@Override public void onSubscriptionBaseTransition(final EffectiveSubscriptionInternalEvent event) { log.info(String.format("Got event SubscriptionBaseTransition token = %s, type = %s, remaining = %d ", event.getUserToken(), event.getTransitionType(), event.getRemainingEventsForUserOperation())); }
public void processSubscription(final EffectiveSubscriptionInternalEvent transition, final InternalCallContext context) throws InvoiceApiException { final UUID subscriptionId = transition.getSubscriptionId(); final DateTime targetDate = transition.getEffectiveTransitionTime(); processSubscription(subscriptionId, targetDate, context); }
switch (event.getBusEventType()) { case ACCOUNT_CREATE: AccountCreationInternalEvent realEventACR = (AccountCreationInternalEvent) event; objectType = ObjectType.ACCOUNT; objectId = realEventACR.getId(); eventBusType = ExtBusEventType.ACCOUNT_CREATION; break; AccountChangeInternalEvent realEventACH = (AccountChangeInternalEvent) event; objectType = ObjectType.ACCOUNT; objectId = realEventACH.getAccountId(); eventBusType = ExtBusEventType.ACCOUNT_CHANGE; break; SubscriptionInternalEvent realEventST = (SubscriptionInternalEvent) event; objectType = ObjectType.SUBSCRIPTION; objectId = realEventST.getSubscriptionId(); if (realEventST.getTransitionType() == SubscriptionBaseTransitionType.CREATE || realEventST.getTransitionType() == SubscriptionBaseTransitionType.RE_CREATE || realEventST.getTransitionType() == SubscriptionBaseTransitionType.TRANSFER || realEventST.getTransitionType() == SubscriptionBaseTransitionType.MIGRATE_ENTITLEMENT) { eventBusType = ExtBusEventType.SUBSCRIPTION_CREATION; } else if (realEventST.getTransitionType() == SubscriptionBaseTransitionType.CANCEL) { eventBusType = ExtBusEventType.SUBSCRIPTION_CANCEL; } else if (realEventST.getTransitionType() == SubscriptionBaseTransitionType.PHASE) { eventBusType = ExtBusEventType.SUBSCRIPTION_PHASE; } else if (realEventST.getTransitionType() == SubscriptionBaseTransitionType.CHANGE) { eventBusType = ExtBusEventType.SUBSCRIPTION_CHANGE; } else if (realEventST.getTransitionType() == SubscriptionBaseTransitionType.UNCANCEL) {
@Subscribe public void process_AUTO_PAY_OFF_removal(final ControlTagDeletionInternalEvent event) { if (event.getTagDefinition().getName().equals(ControlTagType.AUTO_PAY_OFF.toString()) && event.getObjectType() == ObjectType.ACCOUNT) { final UUID accountId = event.getObjectId(); processUnpaid_AUTO_PAY_OFF_payments(accountId, event.getSearchKey1(), event.getSearchKey2(), event.getUserToken()); } }
@Subscribe public void handle_OVERDUE_ENFORCEMENT_OFF_Removal(final ControlTagDeletionInternalEvent event) { if (event.getTagDefinition().getName().equals(ControlTagType.OVERDUE_ENFORCEMENT_OFF.toString()) && event.getObjectType() == ObjectType.ACCOUNT) { insertBusEventIntoNotificationQueue(event.getObjectId(), event, OverdueAsyncBusNotificationAction.REFRESH); } }
@Subscribe public void handleEntitlementTransition(final EffectiveEntitlementInternalEvent event) { try { final InternalCallContext context = internalCallContextFactory.createInternalCallContext(event.getSearchKey2(), event.getSearchKey1(), "SubscriptionBaseTransition", CallOrigin.INTERNAL, UserType.SYSTEM, event.getUserToken()); dispatcher.processAccount(event.getAccountId(), event.getEffectiveTransitionTime(), false, context); } catch (InvoiceApiException e) { log.error(e.getMessage()); } }
@Subscribe public void handleRepairSubscriptionEvent(final RepairSubscriptionInternalEvent event) { try { final InternalCallContext context = internalCallContextFactory.createInternalCallContext(event.getSearchKey2(), event.getSearchKey1(), "RepairBundle", CallOrigin.INTERNAL, UserType.SYSTEM, event.getUserToken()); dispatcher.processAccount(event.getAccountId(), event.getEffectiveDate(), false, context); } catch (InvoiceApiException e) { log.error(e.getMessage()); } }
@Subscribe public void handleAllInternalKillbillEvents(final BusInternalEvent event) { final InternalCallContext internalContext = internalCallContextFactory.createInternalCallContext(event.getSearchKey2(), event.getSearchKey1(), "BeatrixListener", CallOrigin.INTERNAL, UserType.SYSTEM, event.getUserToken()); try { final BusEvent externalEvent = computeExtBusEventEntryFromBusInternalEvent(event, internalContext); if (externalEvent != null) { externalBus.post(externalEvent); } } catch (EventBusException e) { log.warn("Failed to dispatch external bus events", e); } }
private void verifyTagEvent(final UUID tagId, final UUID objectId, final ObjectType objectType, final UUID tagDefinitionId, final String tagDefinitionName, final String tagDefinitionDescription, final TagDefinition tagDefinition, final UUID userToken, final TagInternalEvent event) { Assert.assertEquals(event.getTagId(), tagId); Assert.assertEquals(event.getObjectId(), objectId); Assert.assertEquals(event.getObjectType(), objectType); Assert.assertEquals(event.getTagDefinition(), tagDefinition); Assert.assertEquals(event.getTagDefinition().getId(), tagDefinitionId); Assert.assertEquals(event.getTagDefinition().getName(), tagDefinitionName); Assert.assertEquals(event.getTagDefinition().getDescription(), tagDefinitionDescription); Assert.assertEquals(event, event); Assert.assertTrue(event.equals(event)); } }
@Override public void onInvoiceCreation(final InvoiceCreationInternalEvent event) { log.info(String.format("Got event InvoiceCreationNotification token = %s ", event.getUserToken())); if (event.getAmountOwed().compareTo(BigDecimal.ZERO) <= 0) { notifyForCompletion(); } }
private void postEvent(final BusInternalEvent event, final UUID accountId, final InternalCallContext context) { try { eventBus.post(event); } catch (EventBusException e) { log.error(String.format("Failed to post event %s for account %s", event.getBusEventType(), accountId), e); } }
@Subscribe public void handle_OVERDUE_ENFORCEMENT_OFF_Insert(final ControlTagCreationInternalEvent event) { if (event.getTagDefinition().getName().equals(ControlTagType.OVERDUE_ENFORCEMENT_OFF.toString()) && event.getObjectType() == ObjectType.ACCOUNT) { insertBusEventIntoNotificationQueue(event.getObjectId(), event, OverdueAsyncBusNotificationAction.CLEAR); } }
private void verifyTagDefinitionEvent(final UUID tagDefinitionId, final String tagDefinitionName, final String tagDefinitionDescription, final TagDefinition tagDefinition, final UUID userToken, final TagDefinitionInternalEvent event) { Assert.assertEquals(event.getTagDefinitionId(), tagDefinitionId); Assert.assertEquals(event.getTagDefinition(), tagDefinition); Assert.assertEquals(event.getTagDefinition().getId(), tagDefinitionId); Assert.assertEquals(event.getTagDefinition().getName(), tagDefinitionName); Assert.assertEquals(event.getTagDefinition().getDescription(), tagDefinitionDescription); Assert.assertEquals(event, event); Assert.assertTrue(event.equals(event)); }
@Override public void onPaymentInfo(final PaymentInfoInternalEvent event) { log.info(String.format("Got event PaymentInfo token = %s ", event.getUserToken())); notifyForCompletion(); }
@Override public void onPaymentError(final PaymentErrorInternalEvent event) { log.info(String.format("Got event PaymentError token = %s ", event.getUserToken())); notifyForCompletion(); }
@Subscribe public void handleInvoiceAdjustmentEvent(final InvoiceAdjustmentInternalEvent event) { log.debug("Received InvoiceAdjustment event {}", event); insertBusEventIntoNotificationQueue(event.getAccountId(), event, OverdueAsyncBusNotificationAction.REFRESH); }
@Override public void onPaymentPluginError(final PaymentPluginErrorInternalEvent event) { log.info(String.format("Got event PaymentPluginError token = %s ", event.getUserToken())); notifyForCompletion(); } }
@Override public void onEmptyInvoice(final NullInvoiceInternalEvent event) { log.info(String.format("Got event EmptyInvoiceNotification token = %s ", event.getUserToken())); notifyForCompletion(); }
@Subscribe public void handlePaymentInfoEvent(final PaymentInfoInternalEvent event) { log.debug("Received PaymentInfo event {}", event); insertBusEventIntoNotificationQueue(event.getAccountId(), event, OverdueAsyncBusNotificationAction.REFRESH); }
@Subscribe public void handlePaymentErrorEvent(final PaymentErrorInternalEvent event) { log.debug("Received PaymentError event {}", event); insertBusEventIntoNotificationQueue(event.getAccountId(), event, OverdueAsyncBusNotificationAction.REFRESH); }