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