本文整理汇总了Java中org.killbill.billing.tenant.api.Tenant.getId方法的典型用法代码示例。如果您正苦于以下问题:Java Tenant.getId方法的具体用法?Java Tenant.getId怎么用?Java Tenant.getId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.killbill.billing.tenant.api.Tenant
的用法示例。
在下文中一共展示了Tenant.getId方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addTaxCodes
import org.killbill.billing.tenant.api.Tenant; //导入方法依赖的package包/类
private void addTaxCodes(final Tenant tenant, final ServletRequest req,
final HttpServletResponse resp) throws IOException {
final List<EasyTaxTaxCode> taxCodes = JSON_MAPPER.readValue(getRequestData(req),
TAX_CODE_LIST_MAPPING_TYPE);
if (taxCodes == null) {
return;
}
DateTime now = clock.getUTCNow();
UUID tenantId = tenant.getId();
for (EasyTaxTaxCode code : taxCodes) {
code.setKbTenantId(tenantId);
code.setCreatedDate(now);
}
try {
dao.saveTaxCodes(taxCodes);
} catch (final SQLException e) {
buildErrorResponse(e, resp);
return;
}
buildOKResponse(null, resp);
}
示例2: getEventTypesPerAccount
import org.killbill.billing.tenant.api.Tenant; //导入方法依赖的package包/类
@GET
@Path("/accounts/:kbAccountId")
public Result getEventTypesPerAccount(@Named("kbAccountId") final UUID kbAccountId, @Local @Named("killbill_tenant") final Tenant tenant,
Optional<ExtBusEventType> eventType) {
final UUID kbTenantId = tenant.getId();
if (!eventType.isPresent())
{
return EmailNotificationService.getEventTypesPerAccount(this.dao, kbAccountId, kbTenantId);
}
else
{
return EmailNotificationService.getEventTypePerAccount(this.dao, kbAccountId, kbTenantId, eventType.get());
}
}
示例3: checkPermission
import org.killbill.billing.tenant.api.Tenant; //导入方法依赖的package包/类
private int checkPermission(Tenant tenant, Set<Permission> required, HttpServletRequest req) {
if (required.isEmpty()) {
return 0;
}
String authHeader = req.getHeader("Authorization");
if (authHeader == null) {
return 401;
}
final String[] authHeaderComponents = authHeader.split(" ");
if (authHeaderComponents.length < 2) {
return 403;
}
try {
final String credentials = new String(
Base64.getDecoder().decode(authHeaderComponents[1]), "UTF-8").trim();
final String[] credentialComponents = credentials.split(":", 2);
if (credentialComponents.length < 2) {
return 403;
}
securityApi.login(credentialComponents[0], credentialComponents[1]);
TenantContext context = new EasyTaxTenantContext(tenant.getId(), null);
Set<Permission> granted = securityApi.getCurrentUserPermissions(context);
if (granted == null) {
return 403;
}
if (granted.containsAll(required)) {
return 0;
}
} catch (Exception e) {
// ignore and deny
log.info("Permission check failed for Authorization header {}: {}", authHeader,
e.getMessage());
}
return 403;
}
示例4: getEventTypes
import org.killbill.billing.tenant.api.Tenant; //导入方法依赖的package包/类
@GET
@Path("/accounts")
public Result getEventTypes(@Named("kbAccountId") List<UUID> kbAccountId, @Local @Named("killbill_tenant") final Tenant tenant) {
final UUID kbTenantId = tenant.getId();
return EmailNotificationService.getEventTypes(this.dao, kbAccountId, kbTenantId);
}
示例5: doUpdateEventTypePerAccount
import org.killbill.billing.tenant.api.Tenant; //导入方法依赖的package包/类
@POST
@Path("/accounts/:kbAccountId")
public Result doUpdateEventTypePerAccount(@Named("kbAccountId") final UUID kbAccountId, @Local @Named("killbill_tenant") final Tenant tenant,
@Body List<ExtBusEventType> eventTypes){
final UUID kbTenantId = tenant.getId();
return EmailNotificationService.doUpdateEventTypePerAccount(this.dao, kbAccountId, kbTenantId, eventTypes, this.clock.getClock().getUTCNow());
}
示例6: listInvoiceTaxCodes
import org.killbill.billing.tenant.api.Tenant; //导入方法依赖的package包/类
public List<TaxCodesGETRsc> listInvoiceTaxCodes(@Nonnull UUID invoiceId, Tenant tenant) {
TenantContext tenantContext = new PluginTenantContext(tenant.getId());
List<InvoiceItem> items = invoiceService.findAllInvoiceItemsByInvoice(invoiceId, tenantContext);
List<TaxCodesGETRsc> taxCodes = newArrayList();
for (InvoiceItem item : items) {
TaxCodesGETRsc rsc = fetchTaxCodesOfInvoiceItem(invoiceId, item.getId(), tenantContext);
if (rsc != null) {
taxCodes.add(rsc);
}
}
return taxCodes;
}
示例7: getTaxCodesOfInvoiceItem
import org.killbill.billing.tenant.api.Tenant; //导入方法依赖的package包/类
public TaxCodesGETRsc getTaxCodesOfInvoiceItem(@Nonnull UUID invoiceItemId, Tenant tenant) {
TenantContext tenantContext = new PluginTenantContext(tenant.getId());
Invoice invoice = invoiceService.findInvoiceByInvoiceItem(invoiceItemId, tenantContext);
if (invoice == null) {
logService.log(LOG_DEBUG,
"No invoice found for invoice item [" + invoiceItemId + "] in tenant [" + tenant.getApiKey() + "]");
return null;
}
return fetchTaxCodesOfInvoiceItem(invoice.getId(), invoiceItemId, tenantContext);
}
示例8: createCallContext
import org.killbill.billing.tenant.api.Tenant; //导入方法依赖的package包/类
private CallContext createCallContext(final HttpServletRequest req, final HttpServletResponse resp) throws IOException {
final String createdBy = Objects.firstNonNull(req.getHeader(HDR_CREATED_BY), req.getRemoteAddr());
final String reason = req.getHeader(HDR_REASON);
final String comment = Objects.firstNonNull(req.getHeader(HDR_COMMENT), req.getRequestURI());
// Set by the TenantFilter
final Tenant tenant = (Tenant) req.getAttribute("killbill_tenant");
UUID tenantId = null;
if (tenant != null) {
tenantId = tenant.getId();
}
return new BitcoinCallContext(tenantId, reason, comment);
}
示例9: createCallContext
import org.killbill.billing.tenant.api.Tenant; //导入方法依赖的package包/类
protected CallContext createCallContext(final HttpServletRequest req, final HttpServletResponse resp) throws IOException {
final String createdBy = MoreObjects.firstNonNull(req.getHeader(HDR_CREATED_BY), req.getRemoteAddr());
final String reason = req.getHeader(HDR_REASON);
final String comment = MoreObjects.firstNonNull(req.getHeader(HDR_COMMENT), req.getRequestURI());
// Set by the TenantFilter
final Tenant tenant = (Tenant) req.getAttribute("killbill_tenant");
UUID tenantId = null;
if (tenant != null) {
tenantId = tenant.getId();
}
return new AnalyticsApiCallContext(createdBy, reason, comment, tenantId);
}
示例10: createContext
import org.killbill.billing.tenant.api.Tenant; //导入方法依赖的package包/类
private CallContext createContext(final String createdBy, final String reason, final String comment, final ServletRequest request)
throws IllegalArgumentException {
try {
Preconditions.checkNotNull(createdBy, String.format("Header %s needs to be set", HDR_CREATED_BY));
final Tenant tenant = getTenantFromRequest(request);
return new MeterCallContext(tenant == null ? null : tenant.getId(), createdBy, CallOrigin.EXTERNAL, UserType.CUSTOMER, reason,
comment, UUID.randomUUID(), clock.getUTCNow());
} catch (NullPointerException e) {
throw new IllegalArgumentException(e.getMessage());
}
}
示例11: saveTaxCodesOfInvoiceItem
import org.killbill.billing.tenant.api.Tenant; //导入方法依赖的package包/类
public boolean saveTaxCodesOfInvoiceItem(@Nonnull UUID invoiceItemId, TaxCodesPUTRsc taxCodes, Tenant tenant) {
TenantContext tenantContext = new PluginTenantContext(tenant.getId());
return customFieldService.saveInvoiceItemField(joinTaxCodes(taxCodes.taxCodes), TAX_CODES_FIELD_NAME,
invoiceItemId, tenantContext);
}
示例12: getAccountTaxCountry
import org.killbill.billing.tenant.api.Tenant; //导入方法依赖的package包/类
/**
* Returns a JSON resource for any tax country that could be attached to the
* given account.
*
* @param accountId
* An account the tax country of which should be returned. Must
* not be {@code null}.
* @param tenant
* The tenant on which to operate.
* @return The {@linkplain TaxCountryRsc tax country resource} of the given
* account, or {@code null} if none exists.
*/
// TODO: return a TaxCountryRsc
public Object getAccountTaxCountry(@Nonnull UUID accountId, Tenant tenant) {
TenantContext tenantContext = new PluginTenantContext(tenant.getId());
CustomField field = customFieldService.findFieldByNameAndAccountAndTenant(
TAX_COUNTRY_CUSTOM_FIELD_NAME, accountId, tenantContext);
if (field == null) {
return null;
}
return toTaxCountryJsonOrNull(accountId, field.getFieldValue());
}
示例13: getAccountVatin
import org.killbill.billing.tenant.api.Tenant; //导入方法依赖的package包/类
/**
* Returns a JSON resource for any VAT Identification Number that could be
* attached to the given account.
*
* @param accountId
* An account the VAT Identification Number of which should be
* returned. Must not be {@code null}.
* @param tenant
* The tenant on which to operate.
* @return The {@linkplain VATINRsc VAT Identification Number resource} of
* the given account, or {@code null} if none exists.
*/
// TODO: return a VATINRsc
public Object getAccountVatin(@Nonnull UUID accountId, @Nonnull Tenant tenant) {
TenantContext tenantContext = new PluginTenantContext(tenant.getId());
CustomField field = customFieldService.findFieldByNameAndAccountAndTenant(VATIN_CUSTOM_FIELD_NAME,
accountId, tenantContext);
if (field == null) {
return null;
}
return toVATINJsonOrNull(accountId, field.getFieldValue());
}
示例14: saveAccountTaxCountry
import org.killbill.billing.tenant.api.Tenant; //导入方法依赖的package包/类
/**
* Persists a new tax country value for a given account.
*
* @param accountId
* An account the tax country of which should be modified. Must
* not be {@code null}.
* @param taxCountryRsc
* A new tax country resource to persist. Must not be
* {@code null}.
* @param tenant
* The tenant on which to operate.
* @return {@code true} if the tax country is properly saved, or
* {@code false} otherwise.
* @throws NullPointerException
* When {@code vatinRsc} is {@code null}.
*/
public boolean saveAccountTaxCountry(@Nonnull UUID accountId, @Nonnull TaxCountryRsc taxCountryRsc, Tenant tenant) {
TenantContext tenantContext = new PluginTenantContext(tenant.getId());
String newValue = taxCountryRsc.taxCountry.getCode();
return customFieldService.saveAccountField(newValue, TAX_COUNTRY_CUSTOM_FIELD_NAME, accountId, tenantContext);
}
示例15: saveAccountVatin
import org.killbill.billing.tenant.api.Tenant; //导入方法依赖的package包/类
/**
* Persists a new VAT Identification Number value for a given account.
*
* @param accountId
* An account the VAT Identification Number of which should be
* modified. Must not be {@code null}.
* @param vatinRsc
* A new VAT Identification Number resource to persist. Must not
* be {@code null}.
* @param tenant
* The tenant on which to operate.
* @return {@code true} if the VAT Identification Number is properly saved,
* or {@code false} otherwise.
* @throws NullPointerException
* When {@code vatinRsc} is {@code null}.
*/
public boolean saveAccountVatin(@Nonnull UUID accountId, @Nonnull VATINRsc vatinRsc, Tenant tenant) {
TenantContext tenantContext = new PluginTenantContext(tenant.getId());
String newValue = vatinRsc.vatin.getNumber();
return customFieldService.saveAccountField(newValue, VATIN_CUSTOM_FIELD_NAME, accountId, tenantContext);
}