Search in sources :

Example 1 with DefaultInvoiceCreationEvent

use of org.killbill.billing.invoice.api.user.DefaultInvoiceCreationEvent in project killbill by killbill.

the class DefaultInvoiceDao method notifyBusOfInvoiceCreation.

private void notifyBusOfInvoiceCreation(final EntitySqlDaoWrapperFactory entitySqlDaoWrapperFactory, final InvoiceModelDao invoice, final InternalCallContext context) {
    try {
        final BigDecimal balance = InvoiceModelDaoHelper.getBalance(invoice);
        final DefaultInvoiceCreationEvent event = new DefaultInvoiceCreationEvent(invoice.getId(), invoice.getAccountId(), balance, invoice.getCurrency(), context.getAccountRecordId(), context.getTenantRecordId(), context.getUserToken());
        eventBus.postFromTransaction(event, entitySqlDaoWrapperFactory.getHandle().getConnection());
    } catch (final EventBusException e) {
        log.error(String.format("Failed to post invoice creation event %s for account %s", invoice.getAccountId()), e);
    }
}
Also used : EventBusException(org.killbill.bus.api.PersistentBus.EventBusException) BigDecimal(java.math.BigDecimal) DefaultInvoiceCreationEvent(org.killbill.billing.invoice.api.user.DefaultInvoiceCreationEvent)

Aggregations

BigDecimal (java.math.BigDecimal)1 DefaultInvoiceCreationEvent (org.killbill.billing.invoice.api.user.DefaultInvoiceCreationEvent)1 EventBusException (org.killbill.bus.api.PersistentBus.EventBusException)1