From 94992dbb2c4aa426e8c64f56a0d4849f316b9c96 Mon Sep 17 00:00:00 2001 From: struga Date: Tue, 19 Mar 2024 18:51:30 +0700 Subject: [PATCH] Up damsel (#54) --- .../dev/vality/hooker/utils/EventFilterUtils.java | 11 ++++++++++- .../vality/hooker/utils/EventFilterUtilsTest.java | 12 ++++++++++-- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/main/java/dev/vality/hooker/utils/EventFilterUtils.java b/src/main/java/dev/vality/hooker/utils/EventFilterUtils.java index 8efec69..91cf61c 100644 --- a/src/main/java/dev/vality/hooker/utils/EventFilterUtils.java +++ b/src/main/java/dev/vality/hooker/utils/EventFilterUtils.java @@ -1,6 +1,5 @@ package dev.vality.hooker.utils; -import dev.vality.damsel.user_interaction.UserInteraction; import dev.vality.damsel.webhooker.*; import dev.vality.hooker.dao.WebhookAdditionalFilter; import dev.vality.hooker.model.EventType; @@ -112,6 +111,16 @@ public class EventFilterUtils { .invoice_payment_refund_change(InvoicePaymentRefundChange .invoice_payment_refund_status_changed(invoicePaymentRefundStatusChanged)))); break; + case INVOICE_PAYMENT_USER_INTERACTION_CHANGE_REQUESTED: + invoiceEventTypes.add(InvoiceEventType.payment(InvoicePaymentEventType + .user_interaction(new InvoicePaymentUserInteractionChange( + UserInteractionStatus.requested(new UserInteractionStatusRequested()))))); + break; + case INVOICE_PAYMENT_USER_INTERACTION_CHANGE_COMPLETED: + invoiceEventTypes.add(InvoiceEventType.payment(InvoicePaymentEventType + .user_interaction(new InvoicePaymentUserInteractionChange( + UserInteractionStatus.completed(new UserInteractionStatusCompleted()))))); + break; default: throw new UnsupportedOperationException( "Unknown event code " + eventTypeCode + "; must be one of these: " + diff --git a/src/test/java/dev/vality/hooker/utils/EventFilterUtilsTest.java b/src/test/java/dev/vality/hooker/utils/EventFilterUtilsTest.java index ff39843..4e24097 100644 --- a/src/test/java/dev/vality/hooker/utils/EventFilterUtilsTest.java +++ b/src/test/java/dev/vality/hooker/utils/EventFilterUtilsTest.java @@ -15,7 +15,7 @@ import java.util.HashSet; public class EventFilterUtilsTest { @Test public void getEventFilterByCode() throws Exception { - Assert.assertEquals(getEventFilter().getInvoice().getTypes().size(), 6); + Assert.assertEquals(getEventFilter().getInvoice().getTypes().size(), 8); Assert.assertEquals(getCustomerEventFilter().getCustomer().getTypes().size(), 6); } @@ -32,6 +32,14 @@ public class EventFilterUtilsTest { eventTypeCodeSet .add(WebhookAdditionalFilter.builder().eventType(EventType.INVOICE_PAYMENT_REFUND_STATUS_CHANGED) .build()); + eventTypeCodeSet + .add(WebhookAdditionalFilter.builder() + .eventType(EventType.INVOICE_PAYMENT_USER_INTERACTION_CHANGE_REQUESTED) + .build()); + eventTypeCodeSet + .add(WebhookAdditionalFilter.builder() + .eventType(EventType.INVOICE_PAYMENT_USER_INTERACTION_CHANGE_COMPLETED) + .build()); return EventFilterUtils.getEventFilter(eventTypeCodeSet); } @@ -49,7 +57,7 @@ public class EventFilterUtilsTest { @Test public void getWebhookAdditionalFilter() throws Exception { - Assert.assertEquals(EventFilterUtils.getWebhookAdditionalFilter(getEventFilter()).size(), 6); + Assert.assertEquals(EventFilterUtils.getWebhookAdditionalFilter(getEventFilter()).size(), 8); Assert.assertEquals(EventFilterUtils.getWebhookAdditionalFilter(getCustomerEventFilter()).size(), 6); }