diff --git a/pom.xml b/pom.xml index 7019568..0058f54 100644 --- a/pom.xml +++ b/pom.xml @@ -173,12 +173,12 @@ org.apache.commons commons-collections4 - 4.3 + 4.4 com.google.guava guava - 29.0-jre + 31.1-jre io.micrometer diff --git a/src/main/java/dev/vality/hooker/service/MessageService.java b/src/main/java/dev/vality/hooker/service/MessageService.java index 3c853df..0fd1536 100644 --- a/src/main/java/dev/vality/hooker/service/MessageService.java +++ b/src/main/java/dev/vality/hooker/service/MessageService.java @@ -30,7 +30,7 @@ public class MessageService { Long hookId = w.getHookId(); Long parentEventId = messageDao.getParentId(hookId, sourceId, id); WebhookMessage webhookMessage = webhookMessageBuilder.build(w, event, sourceId, parentEventId); - log.info("Try to send webhook to kafka: {}", webhookMessage); + log.info("Try to send webhook to kafka: {}, parentId {}", webhookMessage, parentEventId); webhookKafkaProducerService.send(webhookMessage); log.info("Webhook to kafka was sent: sourceId={}", webhookMessage.getSourceId()); }); diff --git a/src/test/java/dev/vality/hooker/converter/PaymentConverterTest.java b/src/test/java/dev/vality/hooker/converter/PaymentConverterTest.java index a9fcf15..891dd8f 100644 --- a/src/test/java/dev/vality/hooker/converter/PaymentConverterTest.java +++ b/src/test/java/dev/vality/hooker/converter/PaymentConverterTest.java @@ -9,6 +9,7 @@ import dev.vality.swag_webhook_events.model.CustomerPayer; import dev.vality.swag_webhook_events.model.Payment; import dev.vality.swag_webhook_events.model.PaymentResourcePayer; import dev.vality.swag_webhook_events.model.RecurrentPayer; +import org.junit.jupiter.api.RepeatedTest; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; @@ -31,16 +32,19 @@ public class PaymentConverterTest { @Autowired private PaymentConverter converter; - @Test + @RepeatedTest(7) public void testConvert() throws IOException { MockTBaseProcessor mockTBaseProcessor = new MockTBaseProcessor(MockMode.RANDOM, 15, 1); InvoicePayment source = mockTBaseProcessor .process(new InvoicePayment(), new TBaseHandler<>(InvoicePayment.class)); source.setCreatedAt("2016-03-22T06:12:27Z"); + PaymentTool paymentTool = PaymentTool + .bank_card(mockTBaseProcessor.process(new BankCard(), new TBaseHandler<>(BankCard.class))); if (source.getPayer().isSetPaymentResource()) { source.getPayer().getPaymentResource().getResource() - .setPaymentTool(PaymentTool - .bank_card(mockTBaseProcessor.process(new BankCard(), new TBaseHandler<>(BankCard.class)))); + .setPaymentTool(paymentTool); + } else if (source.getPayer().isSetCustomer()) { + source.getPayer().getCustomer().setPaymentTool(paymentTool); } source.setStatus(InvoicePaymentStatus.pending(new InvoicePaymentPending())); Payment target = converter