@AllowConcurrentEvents @Subscribe public void handlePaymentErrorEvent(final InvoicePaymentErrorInternalEvent event) { log.debug("Received InvoicePaymentError event {}", event); insertBusEventIntoNotificationQueue(event.getAccountId(), event); }
@Test(groups = "fast") public void testInvoicePaymentError() throws Exception { InvoicePaymentErrorInternalEvent event = mock(InvoicePaymentErrorInternalEvent.class); provideCommonBusEventInfo(event); when(event.getBusEventType()).thenReturn(BusInternalEventType.INVOICE_PAYMENT_ERROR); when(event.getInvoiceId()).thenReturn(OBJECT_ID); provideCommonInvoicePaymentInfo(event); ArgumentCaptor<InvoicePaymentMetadata> metadataCaptor = ArgumentCaptor.forClass(InvoicePaymentMetadata.class); when(objectMapper.writeValueAsString(metadataCaptor.capture())).thenReturn(METADATA); when(internalCallContextFactory.getAccountId( OBJECT_ID, ObjectType.INVOICE, tenantContext) ).thenReturn(ACCOUNT_ID); ArgumentCaptor<BusEvent> eventCaptor = ArgumentCaptor.forClass(BusEvent.class); beatrixListener.handleAllInternalKillbillEvents(event); verify(externalBus).post(eventCaptor.capture()); DefaultBusExternalEvent postedEvent = (DefaultBusExternalEvent)eventCaptor.getValue(); assertEquals(postedEvent.getObjectId(), OBJECT_ID); assertEquals(postedEvent.getObjectType(), ObjectType.INVOICE); assertEquals(postedEvent.getEventType(), ExtBusEventType.INVOICE_PAYMENT_FAILED); assertEquals(postedEvent.getMetaData(), METADATA); assertCommonFieldsWithAccountId(postedEvent); InvoicePaymentMetadata invoicePaymentMetadata = metadataCaptor.getValue(); assertInvoicePaymentMetadataFields(invoicePaymentMetadata); }
@Override public void onInvoicePaymentError(final InvoicePaymentErrorInternalEvent event) { log.info("Got event InvoicePaymentError token='{}'", event.getUserToken()); notifyForCompletion(); } }
@AllowConcurrentEvents @Subscribe public void handlePaymentErrorEvent(final InvoicePaymentErrorInternalEvent event) { log.debug("Received InvoicePaymentError event {}", event); insertBusEventIntoNotificationQueue(event.getAccountId(), event); }