Logging parent Id (#25)

* Fix parent Id

* Fix test

* logging parent_id

Co-authored-by: Inal Arsanukaev <aiz@empayre.com>
This commit is contained in:
Inal Arsanukaev 2022-08-23 18:43:10 +03:00 committed by GitHub
parent cc9a3d69a3
commit 500f734626
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 6 deletions

View File

@ -173,12 +173,12 @@
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-collections4</artifactId>
<version>4.3</version>
<version>4.4</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>29.0-jre</version>
<version>31.1-jre</version>
</dependency>
<dependency>
<groupId>io.micrometer</groupId>

View File

@ -30,7 +30,7 @@ public class MessageService<T extends Message> {
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());
});

View File

@ -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