mirror of
https://github.com/valitydev/fraudbusters-mg-connector.git
synced 2024-11-06 09:25:18 +00:00
Add fields
This commit is contained in:
parent
1e9377f6b9
commit
77f7b805f2
2
pom.xml
2
pom.xml
@ -34,7 +34,7 @@
|
||||
<damsel-utils.version>2.1.3</damsel-utils.version>
|
||||
<machinegun-proto.version>1.12-ebae56f</machinegun-proto.version>
|
||||
<geck.version>0.6.7</geck.version>
|
||||
<fraudbusters-proto.version>1.42-7b207a1</fraudbusters-proto.version>
|
||||
<fraudbusters-proto.version>1.47-357fb85</fraudbusters-proto.version>
|
||||
<kafka.streams.version>2.5.0</kafka.streams.version>
|
||||
</properties>
|
||||
|
||||
|
@ -0,0 +1,21 @@
|
||||
package com.rbkmoney.fraudbusters.mg.connector;
|
||||
|
||||
import com.rbkmoney.damsel.domain.Payer;
|
||||
import com.rbkmoney.damsel.fraudbusters.PayerType;
|
||||
|
||||
public class PayerTypeResolver {
|
||||
|
||||
public static PayerType resolve(Payer payer) {
|
||||
if (payer != null) {
|
||||
if (payer.isSetCustomer()) {
|
||||
return PayerType.customer;
|
||||
} else if (payer.isSetRecurrent()) {
|
||||
return PayerType.recurrent;
|
||||
} else if ((payer.isSetPaymentResource())) {
|
||||
return PayerType.payment_resource;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
@ -30,8 +30,6 @@ import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static org.reflections.Reflections.log;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
|
@ -5,6 +5,7 @@ import com.rbkmoney.damsel.fraudbusters.Chargeback;
|
||||
import com.rbkmoney.damsel.fraudbusters.ChargebackCategory;
|
||||
import com.rbkmoney.damsel.fraudbusters.ChargebackStatus;
|
||||
import com.rbkmoney.damsel.payment_processing.*;
|
||||
import com.rbkmoney.fraudbusters.mg.connector.PayerTypeResolver;
|
||||
import com.rbkmoney.fraudbusters.mg.connector.constant.EventType;
|
||||
import com.rbkmoney.fraudbusters.mg.connector.domain.InvoicePaymentWrapper;
|
||||
import com.rbkmoney.fraudbusters.mg.connector.mapper.Mapper;
|
||||
@ -56,6 +57,7 @@ public class ChargebackPaymentMapper implements Mapper<InvoiceChange, MachineEve
|
||||
.setPaymentId(String.join(DELIMITER, invoice.getId(), invoicePayment.getPayment().getId()))
|
||||
.setEventTime(event.getCreatedAt())
|
||||
.setClientInfo(generalInfoInitiator.initClientInfo(payer))
|
||||
.setPayerType(PayerTypeResolver.resolve(payer))
|
||||
.setProviderInfo(generalInfoInitiator.initProviderInfo(invoicePayment));
|
||||
|
||||
invoicePayment.getChargebacks().stream()
|
||||
|
@ -4,6 +4,7 @@ import com.rbkmoney.damsel.domain.Payer;
|
||||
import com.rbkmoney.damsel.fraudbusters.Payment;
|
||||
import com.rbkmoney.damsel.fraudbusters.PaymentStatus;
|
||||
import com.rbkmoney.damsel.payment_processing.*;
|
||||
import com.rbkmoney.fraudbusters.mg.connector.PayerTypeResolver;
|
||||
import com.rbkmoney.fraudbusters.mg.connector.constant.EventType;
|
||||
import com.rbkmoney.fraudbusters.mg.connector.domain.InvoicePaymentWrapper;
|
||||
import com.rbkmoney.fraudbusters.mg.connector.mapper.Mapper;
|
||||
@ -58,6 +59,7 @@ public class PaymentMapper implements Mapper<InvoiceChange, MachineEvent, Paymen
|
||||
.setEventTime(event.getCreatedAt())
|
||||
.setClientInfo(generalInfoInitiator.initClientInfo(payer))
|
||||
.setProviderInfo(generalInfoInitiator.initProviderInfo(invoicePayment))
|
||||
.setPayerType(PayerTypeResolver.resolve(payer))
|
||||
.setError(generalInfoInitiator.initError(invoicePaymentStatusChanged));
|
||||
|
||||
log.debug("InvoicePaymentMapper payment: {}", payment);
|
||||
|
@ -4,6 +4,7 @@ import com.rbkmoney.damsel.domain.Payer;
|
||||
import com.rbkmoney.damsel.fraudbusters.Refund;
|
||||
import com.rbkmoney.damsel.fraudbusters.RefundStatus;
|
||||
import com.rbkmoney.damsel.payment_processing.*;
|
||||
import com.rbkmoney.fraudbusters.mg.connector.PayerTypeResolver;
|
||||
import com.rbkmoney.fraudbusters.mg.connector.constant.EventType;
|
||||
import com.rbkmoney.fraudbusters.mg.connector.domain.InvoicePaymentWrapper;
|
||||
import com.rbkmoney.fraudbusters.mg.connector.mapper.Mapper;
|
||||
@ -56,6 +57,7 @@ public class RefundPaymentMapper implements Mapper<InvoiceChange, MachineEvent,
|
||||
.setEventTime(event.getCreatedAt())
|
||||
.setClientInfo(generalInfoInitiator.initClientInfo(payer))
|
||||
.setProviderInfo(generalInfoInitiator.initProviderInfo(invoicePayment))
|
||||
.setPayerType(PayerTypeResolver.resolve(payer))
|
||||
.setError(generalInfoInitiator.initError(invoicePaymentRefundStatusChanged));
|
||||
|
||||
log.debug("RefundPaymentMapper refund: {}", refund);
|
||||
|
@ -49,7 +49,6 @@ public abstract class KafkaAbstractTest {
|
||||
|
||||
public static class Initializer implements ApplicationContextInitializer<ConfigurableApplicationContext> {
|
||||
|
||||
|
||||
@Override
|
||||
public void initialize(ConfigurableApplicationContext configurableApplicationContext) {
|
||||
TestPropertyValues
|
||||
|
Loading…
Reference in New Issue
Block a user