@Override public BillingEventSet getBillingEventsForAccountAndUpdateAccountBCD( final UUID accountId, final InternalCallContext context) { final List<SubscriptionBaseBundle> bundles = subscriptionApi.getBundlesForAccount(accountId, context); final DefaultBillingEventSet result = new DefaultBillingEventSet(); try { final Account account = accountApi.getAccountById(accountId, context); // Check to see if billing is off for the account final List<Tag> accountTags = tagApi.getTags(accountId, ObjectType.ACCOUNT, context); final boolean found_AUTO_INVOICING_OFF = is_AUTO_INVOICING_OFF(accountTags); if (found_AUTO_INVOICING_OFF) { result.setAccountAutoInvoiceIsOff(true); return result; // billing is off, we are done } addBillingEventsForBundles(bundles, account, context, result); } catch (AccountApiException e) { log.warn("Failed while getting BillingEvent", e); } // Pretty-print the events, before and after the blocking calculator does its magic final StringBuilder logStringBuilder = new StringBuilder("Computed billing events for accountId ").append(accountId); eventsToString(logStringBuilder, result, "\nBilling Events Raw"); blockCalculator.insertBlockingEvents(result, context); eventsToString(logStringBuilder, result, "\nBilling Events After Blocking"); log.info(logStringBuilder.toString()); return result; }