use of com.google.common.eventbus.Subscribe in project killbill by killbill.
the class InvoiceListener method handleBlockingStateTransition.
@AllowConcurrentEvents
@Subscribe
public void handleBlockingStateTransition(final BlockingTransitionInternalEvent event) {
// We are only interested in blockBilling or unblockBilling transitions.
if (!event.isTransitionedToUnblockedBilling() && !event.isTransitionedToBlockedBilling()) {
return;
}
try {
final InternalCallContext context = internalCallContextFactory.createInternalCallContext(event.getSearchKey2(), event.getSearchKey1(), "SubscriptionBaseTransition", CallOrigin.INTERNAL, UserType.SYSTEM, event.getUserToken());
final UUID accountId = accountApi.getByRecordId(event.getSearchKey1(), context);
dispatcher.processAccountFromNotificationOrBusEvent(accountId, null, null, context);
} catch (InvoiceApiException e) {
log.warn("Unable to process event {}", event, e);
} catch (AccountApiException e) {
log.warn("Unable to process event {}", event, e);
}
}
use of com.google.common.eventbus.Subscribe in project killbill by killbill.
the class InvoiceListener method handleSubscriptionTransition.
@AllowConcurrentEvents
@Subscribe
public void handleSubscriptionTransition(final EffectiveSubscriptionInternalEvent event) {
try {
// Skip events which are marked as not being the last one
if (event.getTransitionType() == SubscriptionBaseTransitionType.UNCANCEL || event.getRemainingEventsForUserOperation() > 0) {
return;
}
final InternalCallContext context = internalCallContextFactory.createInternalCallContext(event.getSearchKey2(), event.getSearchKey1(), "SubscriptionBaseTransition", CallOrigin.INTERNAL, UserType.SYSTEM, event.getUserToken());
dispatcher.processSubscriptionForInvoiceGeneration(event, context);
} catch (InvoiceApiException e) {
log.warn("Unable to process event {}", event, e);
}
}
use of com.google.common.eventbus.Subscribe in project killbill by killbill.
the class InvoiceListener method handleChildrenInvoiceAdjustmentEvent.
@AllowConcurrentEvents
@Subscribe
public void handleChildrenInvoiceAdjustmentEvent(final DefaultInvoiceAdjustmentEvent event) {
try {
final InternalCallContext context = internalCallContextFactory.createInternalCallContext(event.getSearchKey2(), event.getSearchKey1(), "AdjustParentInvoice", CallOrigin.INTERNAL, UserType.SYSTEM, event.getUserToken());
final Account account = accountApi.getAccountById(event.getAccountId(), context);
// catch children invoices and populate the parent summary invoice
if (isChildrenAccountAndPaymentDelegated(account)) {
dispatcher.processParentInvoiceForAdjustments(account, event.getInvoiceId(), context);
}
} catch (InvoiceApiException e) {
log.error(e.getMessage());
} catch (AccountApiException e) {
log.error(e.getMessage());
}
}
use of com.google.common.eventbus.Subscribe in project killbill by killbill.
the class InvoiceTagHandler method process_AUTO_INVOICING_OFF_removal.
@AllowConcurrentEvents
@Subscribe
public void process_AUTO_INVOICING_OFF_removal(final ControlTagDeletionInternalEvent event) {
if (event.getTagDefinition().getName().equals(ControlTagType.AUTO_INVOICING_OFF.toString()) && event.getObjectType() == ObjectType.ACCOUNT) {
final UUID accountId = event.getObjectId();
final InternalCallContext context = internalCallContextFactory.createInternalCallContext(event.getSearchKey2(), event.getSearchKey1(), "InvoiceTagHandler", CallOrigin.INTERNAL, UserType.SYSTEM, event.getUserToken());
processUnpaid_AUTO_INVOICING_OFF_invoices(accountId, context);
}
}
use of com.google.common.eventbus.Subscribe in project killbill by killbill.
the class PaymentTagHandler method process_AUTO_PAY_OFF_removal.
@AllowConcurrentEvents
@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());
}
}
Aggregations