Hello
I am writing a
custom invoice formatter and need the
externalKey of the
account to ask another web service for additional customer data I would like to add to the HTML invoice.
I got the invoice from this call:
org.killbill.billing.invoice.plugin.api.InvoiceFormatterFactory
.createInvoiceFormatter(
final String defaultLocale,
final String catalogBundlePath,
final Invoice invoice,
final Locale locale,
final CurrencyConversionApi currencyConversionApi,
ResourceBundle bundle,
ResourceBundle defaultBundle)From the invoice I got the account id:
org.killbill.billing.invoice.api.Invoice
.getAccountId()And to get the account with the
externalKey I tried to ask the AccountUserApi:
org.killbill.billing.account.api.AccountUserApi
.getAccountById(
UUID accountId,
TenantContext context);My problem is that I cannot find the tenant id. From other plugins, I am used to get some sort of context, like
org.killbill.billing.util.callcontext.TenantContext or
org.killbill.billing.invoice.plugin.api.InvoiceContext. But the
InvoiceFormatterFactory does not provide such.
For now, I use the known tenant api key of our one and only tenant to get the tenant id via
org.killbill.billing.tenant.api.TenantUserApi#getTenantByApiKey. It works like a charm. But we plan to have more than one tenant eventually. So that's not a long term solution.
Does anybody have a trick to obtain the tenant id that isn't too dirty? Perhaps I am just blind ...
Best regards
Florian