Up damsel (#54)

This commit is contained in:
struga 2024-03-19 18:51:30 +07:00 committed by GitHub
parent ccbcf02a00
commit 94992dbb2c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 20 additions and 3 deletions

View File

@ -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: " +

View File

@ -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);
}