本文整理汇总了Java中org.killbill.billing.account.api.Account类的典型用法代码示例。如果您正苦于以下问题:Java Account类的具体用法?Java Account怎么用?Java Account使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Account类属于org.killbill.billing.account.api包,在下文中一共展示了Account类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: sendEmailForUpComingInvoice
import org.killbill.billing.account.api.Account; //导入依赖的package包/类
private void sendEmailForUpComingInvoice(final Account account, final ExtBusEvent killbillEvent, final TenantContext context) throws IOException, InvoiceApiException, EmailException, TenantApiException, EmailNotificationException {
Preconditions.checkArgument(killbillEvent.getEventType() == ExtBusEventType.INVOICE_NOTIFICATION, String.format("Unexpected event %s", killbillEvent.getEventType()));
final String dryRunTimePropValue = configProperties.getString(INVOICE_DRY_RUN_TIME_PROPERTY);
Preconditions.checkArgument(dryRunTimePropValue != null, String.format("Cannot find property %s", INVOICE_DRY_RUN_TIME_PROPERTY));
final TimeSpan span = new TimeSpan(dryRunTimePropValue);
final DateTime now = clock.getClock().getUTCNow();
final DateTime targetDateTime = now.plus(span.getMillis());
final PluginCallContext callContext = new PluginCallContext(EmailNotificationActivator.PLUGIN_NAME, now, context.getTenantId());
final Invoice invoice = osgiKillbillAPI.getInvoiceUserApi().triggerInvoiceGeneration(account.getId(), new LocalDate(targetDateTime, account.getTimeZone()), NULL_DRY_RUN_ARGUMENTS, callContext);
if (invoice != null) {
final EmailContent emailContent = templateRenderer.generateEmailForUpComingInvoice(account, invoice, context);
sendEmail(account, emailContent, context);
}
}
开发者ID:killbill,项目名称:killbill-email-notifications-plugin,代码行数:20,代码来源:EmailNotificationListener.java
示例2: buildInvoiceItems
import org.killbill.billing.account.api.Account; //导入依赖的package包/类
private List<InvoiceItem> buildInvoiceItems(final Account account, final Invoice newInvoice,
final Invoice invoice, final Map<UUID, InvoiceItem> taxableItems,
@Nullable final Map<UUID, Collection<InvoiceItem>> adjustmentItems,
@Nullable final String originalInvoiceReferenceCode, final boolean dryRun,
final String taxZone, final Map<String, String> planToProductCache,
final UUID kbTenantId, final Map<UUID, Iterable<InvoiceItem>> kbInvoiceItems,
final LocalDate utcToday) throws SQLException {
final List<InvoiceItem> newTaxItems = new ArrayList<>();
for (final InvoiceItem taxableItem : taxableItems.values()) {
final Collection<InvoiceItem> adjustmentsForTaxableItem = adjustmentItems == null ? null
: adjustmentItems.get(taxableItem.getId());
final BigDecimal netItemAmount = adjustmentsForTaxableItem == null
? taxableItem.getAmount()
: sum(adjustmentsForTaxableItem);
newTaxItems.addAll(taxInvoiceItemsForInvoiceItem(account, newInvoice, taxableItem,
taxZone, netItemAmount, utcToday, kbTenantId, planToProductCache));
}
return newTaxItems;
}
开发者ID:SolarNetwork,项目名称:killbill-easytax-plugin,代码行数:21,代码来源:EasyTaxTaxCalculator.java
示例3: createInvoiceItem
import org.killbill.billing.account.api.Account; //导入依赖的package包/类
public static InvoiceItem createInvoiceItem(Account account, Invoice invoice,
InvoiceItemType type, String planName, DateTime createdDate, LocalDate startDate,
LocalDate endDate, BigDecimal amount, Currency currency) {
UUID id = UUID.randomUUID();
UUID accountId = account.getId();
UUID invoiceId = invoice.getId();
InvoiceItem item = Mockito.mock(InvoiceItem.class,
Mockito.withSettings().defaultAnswer(RETURNS_SMART_NULLS.get()));
when(item.getId()).thenReturn(id);
when(item.getAccountId()).thenReturn(accountId);
when(item.getCreatedDate()).thenReturn(createdDate);
when(item.getCurrency()).thenReturn(currency);
when(item.getAmount()).thenReturn(amount);
when(item.getInvoiceId()).thenReturn(invoiceId);
when(item.getInvoiceItemType()).thenReturn(type);
when(item.getPlanName()).thenReturn(planName);
when(item.getStartDate()).thenReturn(startDate);
when(item.getEndDate()).thenReturn(endDate);
return item;
}
开发者ID:SolarNetwork,项目名称:killbill-easytax-plugin,代码行数:21,代码来源:EasyTaxTestUtils.java
示例4: defaultAccountCustomField
import org.killbill.billing.account.api.Account; //导入依赖的package包/类
@Test(groups = "fast")
public void defaultAccountCustomField() {
// given
Account account = EasyTaxTestUtils.createAccount("NZ",
DateTimeZone.forID("Pacific/Auckland"));
CustomFieldUserApi fieldApi = Mockito.mock(CustomFieldUserApi.class);
when(killbillApi.getCustomFieldUserApi()).thenReturn(fieldApi);
ArgumentCaptor<TenantContext> contextCaptor = ArgumentCaptor.forClass(TenantContext.class);
CustomField customField = createCustomField(
AccountCustomFieldTaxZoneResolver.TAX_ZONE_CUSTOM_FIIELD, TEST_TAX_ZONE);
when(fieldApi.getCustomFieldsForObject(eq(account.getId()), eq(ObjectType.ACCOUNT),
contextCaptor.capture())).thenReturn(Collections.singletonList(customField));
// when
AccountCustomFieldTaxZoneResolver resolver = createResolver(new Properties());
String taxZone = resolver.taxZoneForInvoice(tenantId, account, null,
Collections.emptyList());
// then
assertEquals(contextCaptor.getValue().getTenantId(), tenantId, "TenantContext tenant ID");
assertEquals(taxZone, TEST_TAX_ZONE, "Tax zone resolved from account custom field");
}
开发者ID:SolarNetwork,项目名称:killbill-easytax-plugin,代码行数:23,代码来源:AccountCustomFieldTaxZoneResolverTests.java
示例5: defaultFallbackToAccountCountry
import org.killbill.billing.account.api.Account; //导入依赖的package包/类
@Test(groups = "fast")
public void defaultFallbackToAccountCountry() {
// given
Account account = EasyTaxTestUtils.createAccount("NZ",
DateTimeZone.forID("Pacific/Auckland"));
CustomFieldUserApi fieldApi = Mockito.mock(CustomFieldUserApi.class);
when(killbillApi.getCustomFieldUserApi()).thenReturn(fieldApi);
ArgumentCaptor<TenantContext> contextCaptor = ArgumentCaptor.forClass(TenantContext.class);
when(fieldApi.getCustomFieldsForObject(eq(account.getId()), eq(ObjectType.ACCOUNT),
contextCaptor.capture())).thenReturn(Collections.emptyList());
// when
AccountCustomFieldTaxZoneResolver resolver = createResolver(new Properties());
String taxZone = resolver.taxZoneForInvoice(tenantId, account, null,
Collections.emptyList());
// then
assertEquals(contextCaptor.getValue().getTenantId(), tenantId, "TenantContext tenant ID");
assertEquals(taxZone, account.getCountry(),
"Fallback to account country when no custom field present");
}
开发者ID:SolarNetwork,项目名称:killbill-easytax-plugin,代码行数:22,代码来源:AccountCustomFieldTaxZoneResolverTests.java
示例6: shouldSupportNullListOfCustomFields
import org.killbill.billing.account.api.Account; //导入依赖的package包/类
@Test(groups = "fast")
public void shouldSupportNullListOfCustomFields() throws Exception {
// Given
Account accountWithNullCustomFields = createAccount(FR);
UUID accountId = accountWithNullCustomFields.getId();
when(accountUserApi.getAccountById(accountId, context)).thenReturn(accountWithNullCustomFields);
Invoice invoice = new InvoiceBuilder(accountWithNullCustomFields)//
.withItem(new InvoiceItemBuilder().withType(RECURRING).withAmount(SIX)).build();
when(invoiceUserApi.getInvoicesByAccount(accountId, context))//
.thenReturn(asList(invoice));
when(customFieldUserApi.getCustomFieldsForAccountType(accountId, INVOICE_ITEM, context))//
.thenReturn(null);
// When
List<InvoiceItem> items = plugin.getAdditionalInvoiceItems(invoice, properties, context);
// Then
assertEquals(items.size(), 0);
}
开发者ID:bgandon,项目名称:killbill-simple-tax-plugin,代码行数:22,代码来源:TestSimpleTaxPlugin.java
示例7: shouldAllowEmptyListOfCustomFields
import org.killbill.billing.account.api.Account; //导入依赖的package包/类
@Test(groups = "fast")
public void shouldAllowEmptyListOfCustomFields() throws Exception {
// Given
Account accountNoCustomFields = createAccount(FR);
UUID accountId = accountNoCustomFields.getId();
when(accountUserApi.getAccountById(accountId, context)).thenReturn(accountNoCustomFields);
Invoice invoice = new InvoiceBuilder(accountNoCustomFields)//
.withItem(new InvoiceItemBuilder().withType(RECURRING).withAmount(SIX)).build();
when(invoiceUserApi.getInvoicesByAccount(accountId, context))//
.thenReturn(asList(invoice));
when(customFieldUserApi.getCustomFieldsForAccountType(accountId, INVOICE_ITEM, context))//
.thenReturn(ImmutableList.<CustomField> of());
// When
List<InvoiceItem> items = plugin.getAdditionalInvoiceItems(invoice, properties, context);
// Then
assertEquals(items.size(), 0);
}
开发者ID:bgandon,项目名称:killbill-simple-tax-plugin,代码行数:22,代码来源:TestSimpleTaxPlugin.java
示例8: shouldAllowNonTaxRelatedCustomFields
import org.killbill.billing.account.api.Account; //导入依赖的package包/类
@Test(groups = "fast")
public void shouldAllowNonTaxRelatedCustomFields() throws Exception {
// Given
Account accountNonTaxFields = createAccount(FR);
UUID accountId = accountNonTaxFields.getId();
when(accountUserApi.getAccountById(accountId, context)).thenReturn(accountNonTaxFields);
Promise<InvoiceItem> item = holder();
Invoice invoice = new InvoiceBuilder(accountNonTaxFields)//
.withItem(new InvoiceItemBuilder().withType(RECURRING).withAmount(SIX).thenSaveTo(item)).build();
when(invoiceUserApi.getInvoicesByAccount(accountId, context))//
.thenReturn(asList(invoice));
when(customFieldUserApi.getCustomFieldsForAccountType(accountId, INVOICE_ITEM, context))//
.thenReturn(asList(new CustomFieldBuilder()//
.withObjectType(INVOICE_ITEM).withObjectId(item.get().getId())//
.withFieldName("no-tax-field-name").withFieldValue(VAT_20_0).build()));
// When
List<InvoiceItem> items = plugin.getAdditionalInvoiceItems(invoice, properties, context);
// Then
assertEquals(items.size(), 0);
}
开发者ID:bgandon,项目名称:killbill-simple-tax-plugin,代码行数:25,代码来源:TestSimpleTaxPlugin.java
示例9: toCustomerLocale
import org.killbill.billing.account.api.Account; //导入依赖的package包/类
/**
* This function determines the customer locale that will be used in the communication with Adyen.
* <p>
* The following heuristic is used to determine it:
* 1. if there is a local provided in the plugin properties this will be used
* 2. if there the account has a locale, that will be used
* 3. if there should be no account or an account without locale, an empty optional will be returned
*
* @param propertyLocaleString the locale that has been sent in the plugin properties
* @param account the Kill Bill account
* @return the locale as an Optional
*/
@VisibleForTesting
static Optional<Locale> toCustomerLocale(final String propertyLocaleString, final Account account) {
final String candidateString;
if (propertyLocaleString != null) {
candidateString = propertyLocaleString;
} else if (account != null && account.getLocale() != null) {
candidateString = account.getLocale();
} else {
return Optional.absent();
}
Locale candidateLocale = Locale.forLanguageTag(candidateString);
if (candidateLocale.toString().isEmpty()) {
candidateLocale = Locale.forLanguageTag(candidateString.replace("_", "-"));
if (candidateLocale.toString().isEmpty()) {
candidateLocale = new Locale(candidateString);
}
}
return Optional.of(candidateLocale);
}
开发者ID:killbill,项目名称:killbill-adyen-plugin,代码行数:33,代码来源:UserDataMappingService.java
示例10: createChargeback
import org.killbill.billing.account.api.Account; //导入依赖的package包/类
private PaymentTransaction createChargeback(final Account account, final UUID kbPaymentId, final NotificationItem notification, final CallContext context) {
final BigDecimal amount = notification.getAmount();
final Currency currency = Currency.valueOf(notification.getCurrency());
// We cannot use the merchant reference here, because it's the one associated with the auth.
// We cannot use the PSP reference either as it may be the one from the capture.
final String paymentTransactionExternalKey = null;
try {
final Payment chargeback = osgiKillbillAPI.getPaymentApi().createChargeback(account,
kbPaymentId,
amount,
currency,
paymentTransactionExternalKey,
context);
return filterForLastTransaction(chargeback);
} catch (final PaymentApiException e) {
// Have Adyen retry
throw new RuntimeException("Failed to record chargeback", e);
}
}
开发者ID:killbill,项目名称:killbill-adyen-plugin,代码行数:21,代码来源:KillbillAdyenNotificationHandler.java
示例11: testAuthorizeWithIncorrectValues
import org.killbill.billing.account.api.Account; //导入依赖的package包/类
/**
* Sanity check that a refused purchase (wrong cc data) still results in an error.
*/
@Test(groups = "slow")
public void testAuthorizeWithIncorrectValues() throws Exception {
final String expectedGatewayError = "CVC Declined";
final Account account = defaultAccount();
final OSGIKillbillAPI killbillAPI = TestUtils.buildOSGIKillbillAPI(account);
final Payment payment = killBillPayment(account, killbillAPI);
final AdyenCallContext callContext = newCallContext();
final AdyenPaymentPluginApi pluginApi = AdyenPluginMockBuilder.newPlugin()
.withAccount(account)
.withOSGIKillbillAPI(killbillAPI)
.withDatabaseAccess(dao)
.build();
final PaymentTransactionInfoPlugin result = authorizeCall(account, payment, callContext, pluginApi, invalidCreditCardData(AdyenPaymentPluginApi.PROPERTY_CC_VERIFICATION_VALUE, String.valueOf("1234")));
assertEquals(result.getStatus(), PaymentPluginStatus.ERROR);
assertEquals(result.getGatewayError(), expectedGatewayError);
assertNull(result.getGatewayErrorCode());
final List<PaymentTransactionInfoPlugin> results = pluginApi.getPaymentInfo(account.getId(), payment.getId(), ImmutableList.<PluginProperty>of(), callContext);
assertEquals(results.size(), 1);
assertEquals(results.get(0).getStatus(), PaymentPluginStatus.ERROR);
assertEquals(results.get(0).getGatewayError(), expectedGatewayError);
assertNull(results.get(0).getGatewayErrorCode());
}
开发者ID:killbill,项目名称:killbill-adyen-plugin,代码行数:29,代码来源:TestAdyenPaymentPluginHttpErrors.java
示例12: testAuthorizeWithInvalidValues
import org.killbill.billing.account.api.Account; //导入依赖的package包/类
@Test(groups = "slow", enabled=false)
public void testAuthorizeWithInvalidValues() throws Exception {
final String expectedGatewayError = "validation Expiry month should be between 1 and 12 inclusive Card";
final String expectedGatewayErrorCode = "o.a.cxf.binding.soap.SoapFault";
final Account account = defaultAccount();
final OSGIKillbillAPI killbillAPI = TestUtils.buildOSGIKillbillAPI(account);
final Payment payment = killBillPayment(account, killbillAPI);
final AdyenCallContext callContext = newCallContext();
final AdyenPaymentPluginApi pluginApi = AdyenPluginMockBuilder.newPlugin()
.withAccount(account)
.withOSGIKillbillAPI(killbillAPI)
.withDatabaseAccess(dao)
.build();
final PaymentTransactionInfoPlugin result = authorizeCall(account, payment, callContext, pluginApi, invalidCreditCardData(AdyenPaymentPluginApi.PROPERTY_CC_EXPIRATION_MONTH, String.valueOf("123")));
assertEquals(result.getStatus(), PaymentPluginStatus.CANCELED);
assertEquals(result.getGatewayError(), expectedGatewayError);
assertEquals(result.getGatewayErrorCode(), expectedGatewayErrorCode);
final List<PaymentTransactionInfoPlugin> results = pluginApi.getPaymentInfo(account.getId(), payment.getId(), ImmutableList.<PluginProperty>of(), callContext);
assertEquals(results.size(), 1);
assertEquals(results.get(0).getStatus(), PaymentPluginStatus.CANCELED);
assertEquals(results.get(0).getGatewayError(), expectedGatewayError);
assertEquals(results.get(0).getGatewayErrorCode(), expectedGatewayErrorCode);
}
开发者ID:killbill,项目名称:killbill-adyen-plugin,代码行数:27,代码来源:TestAdyenPaymentPluginHttpErrors.java
示例13: createBusinessSubscriptionTransitions
import org.killbill.billing.account.api.Account; //导入依赖的package包/类
public Collection<BusinessSubscriptionTransitionModelDao> createBusinessSubscriptionTransitions(final BusinessContextFactory businessContextFactory) throws AnalyticsRefreshException {
final Account account = businessContextFactory.getAccount();
final Long accountRecordId = businessContextFactory.getAccountRecordId();
final Long tenantRecordId = businessContextFactory.getTenantRecordId();
final ReportGroup reportGroup = businessContextFactory.getReportGroup();
final CurrencyConverter currencyConverter = businessContextFactory.getCurrencyConverter();
final Iterable<SubscriptionBundle> bundles = businessContextFactory.getAccountBundles();
final Collection<BusinessSubscriptionTransitionModelDao> bsts = new LinkedList<BusinessSubscriptionTransitionModelDao>();
for (final SubscriptionBundle bundle : bundles) {
bsts.addAll(buildTransitionsForBundle(businessContextFactory, account, bundle, currencyConverter, accountRecordId, tenantRecordId, reportGroup));
}
return bsts;
}
开发者ID:killbill,项目名称:killbill-analytics-plugin,代码行数:17,代码来源:BusinessSubscriptionTransitionFactory.java
示例14: getBusinessSubscriptionFromTransition
import org.killbill.billing.account.api.Account; //导入依赖的package包/类
private BusinessSubscription getBusinessSubscriptionFromTransition(final Account account,
final SubscriptionEvent subscriptionTransition,
final String serviceName,
final CurrencyConverter currencyConverter) {
return new BusinessSubscription(subscriptionTransition.getNextPlan(),
subscriptionTransition.getNextPhase(),
subscriptionTransition.getNextPriceList(),
account.getCurrency(),
subscriptionTransition.getEffectiveDate(),
// We don't record the blockedBilling/blockedEntitlement values
// as they are implicitly reflected in the subscription transition event name
// Note: we don't have information on blocked changes though
serviceName,
subscriptionTransition.getServiceStateName(),
currencyConverter);
}
开发者ID:killbill,项目名称:killbill-analytics-plugin,代码行数:17,代码来源:BusinessSubscriptionTransitionFactory.java
示例15: BusinessAccountTagModelDao
import org.killbill.billing.account.api.Account; //导入依赖的package包/类
public BusinessAccountTagModelDao(final Account account,
final Long accountRecordId,
final Tag tag,
final Long tagRecordId,
final TagDefinition tagDefinition,
@Nullable final AuditLog creationAuditLog,
final Long tenantRecordId,
@Nullable final ReportGroup reportGroup) {
super(account,
accountRecordId,
tag,
tagRecordId,
tagDefinition,
creationAuditLog,
tenantRecordId,
reportGroup);
}
开发者ID:killbill,项目名称:killbill-analytics-plugin,代码行数:18,代码来源:BusinessAccountTagModelDao.java
示例16: BusinessInvoiceTagModelDao
import org.killbill.billing.account.api.Account; //导入依赖的package包/类
public BusinessInvoiceTagModelDao(final Account account,
final Long accountRecordId,
final Tag tag,
final Long tagRecordId,
final TagDefinition tagDefinition,
@Nullable final AuditLog creationAuditLog,
final Long tenantRecordId,
@Nullable final ReportGroup reportGroup) {
super(account,
accountRecordId,
tag,
tagRecordId,
tagDefinition,
creationAuditLog,
tenantRecordId,
reportGroup);
this.invoiceId = tag.getObjectId();
}
开发者ID:killbill,项目名称:killbill-analytics-plugin,代码行数:19,代码来源:BusinessInvoiceTagModelDao.java
示例17: BusinessInvoicePaymentFieldModelDao
import org.killbill.billing.account.api.Account; //导入依赖的package包/类
public BusinessInvoicePaymentFieldModelDao(final Account account,
final Long accountRecordId,
final CustomField customField,
final Long customFieldRecordId,
@Nullable final AuditLog creationAuditLog,
final Long tenantRecordId,
@Nullable final ReportGroup reportGroup) {
super(account,
accountRecordId,
customField,
customFieldRecordId,
creationAuditLog,
tenantRecordId,
reportGroup);
this.invoicePaymentId = customField.getObjectId();
}
开发者ID:killbill,项目名称:killbill-analytics-plugin,代码行数:17,代码来源:BusinessInvoicePaymentFieldModelDao.java
示例18: BusinessPaymentFieldModelDao
import org.killbill.billing.account.api.Account; //导入依赖的package包/类
public BusinessPaymentFieldModelDao(final Account account,
final Long accountRecordId,
final CustomField customField,
final Long customFieldRecordId,
@Nullable final AuditLog creationAuditLog,
final Long tenantRecordId,
@Nullable final ReportGroup reportGroup) {
super(account,
accountRecordId,
customField,
customFieldRecordId,
creationAuditLog,
tenantRecordId,
reportGroup);
this.paymentId = customField.getObjectId();
}
开发者ID:killbill,项目名称:killbill-analytics-plugin,代码行数:17,代码来源:BusinessPaymentFieldModelDao.java
示例19: BusinessFieldModelDao
import org.killbill.billing.account.api.Account; //导入依赖的package包/类
public BusinessFieldModelDao(final Account account,
final Long accountRecordId,
final CustomField customField,
final Long customFieldRecordId,
@Nullable final AuditLog creationAuditLog,
final Long tenantRecordId,
@Nullable final ReportGroup reportGroup) {
this(customFieldRecordId,
customField.getFieldName(),
customField.getFieldValue(),
customField.getCreatedDate(),
creationAuditLog != null ? creationAuditLog.getUserName() : null,
creationAuditLog != null ? creationAuditLog.getReasonCode() : null,
creationAuditLog != null ? creationAuditLog.getComment() : null,
account.getId(),
account.getName(),
account.getExternalKey(),
accountRecordId,
tenantRecordId,
reportGroup);
}
开发者ID:killbill,项目名称:killbill-analytics-plugin,代码行数:22,代码来源:BusinessFieldModelDao.java
示例20: BusinessInvoicePaymentTagModelDao
import org.killbill.billing.account.api.Account; //导入依赖的package包/类
public BusinessInvoicePaymentTagModelDao(final Account account,
final Long accountRecordId,
final Tag tag,
final Long tagRecordId,
final TagDefinition tagDefinition,
@Nullable final AuditLog creationAuditLog,
final Long tenantRecordId,
@Nullable final ReportGroup reportGroup) {
super(account,
accountRecordId,
tag,
tagRecordId,
tagDefinition,
creationAuditLog,
tenantRecordId,
reportGroup);
this.invoicePaymentId = tag.getObjectId();
}
开发者ID:killbill,项目名称:killbill-analytics-plugin,代码行数:19,代码来源:BusinessInvoicePaymentTagModelDao.java
注:本文中的org.killbill.billing.account.api.Account类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论