本文整理汇总了Java中org.killbill.billing.util.callcontext.CallContext类的典型用法代码示例。如果您正苦于以下问题:Java CallContext类的具体用法?Java CallContext怎么用?Java CallContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CallContext类属于org.killbill.billing.util.callcontext包,在下文中一共展示了CallContext类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: shouldSaveFieldWhenNoneAlreadyExists
import org.killbill.billing.util.callcontext.CallContext; //导入依赖的package包/类
@Test(groups = "fast")
public void shouldSaveFieldWhenNoneAlreadyExists() throws Exception {
// Given
UUID accountId = randomUUID();
// When
boolean ok = service.saveAccountField("titi", "toto", accountId, defaultTenant);
// Then
assertTrue(ok);
verify(customFieldApi).addCustomFields(addedFields.capture(), any(CallContext.class));
assertNotNull(addedFields.getValue());
assertEquals(addedFields.getValue().size(), 1);
CustomField addedField = addedFields.getValue().get(0);
assertNotNull(addedField);
assertEquals(addedField.getObjectType(), ACCOUNT);
assertEquals(addedField.getObjectId(), accountId);
assertEquals(addedField.getFieldName(), "toto");
assertEquals(addedField.getFieldValue(), "titi");
verifyZeroInteractions(logService);
}
开发者ID:bgandon,项目名称:killbill-simple-tax-plugin,代码行数:24,代码来源:TestCustomFieldService.java
示例2: shouldSurviveNullListOfExistingFields
import org.killbill.billing.util.callcontext.CallContext; //导入依赖的package包/类
@Test(groups = "fast")
public void shouldSurviveNullListOfExistingFields() throws Exception {
// Given
CustomFieldUserApi customFieldApi = mock(CustomFieldUserApi.class);
CustomFieldService service = new CustomFieldService(customFieldApi, logService);
UUID accountId = randomUUID();
when(customFieldApi.getCustomFieldsForObject(accountId, ACCOUNT, defaultTenant))//
.thenReturn(null);
// When
boolean ok = service.saveAccountField("titi", "toto", accountId, defaultTenant);
// Then
assertTrue(ok);
verify(customFieldApi).addCustomFields(addedFields.capture(), any(CallContext.class));
assertEquals(addedFields.getValue().size(), 1);
verifyZeroInteractions(logService);
}
开发者ID:bgandon,项目名称:killbill-simple-tax-plugin,代码行数:21,代码来源:TestCustomFieldService.java
示例3: shouldNotComplainForErrorWhileAddingTaxCodes
import org.killbill.billing.util.callcontext.CallContext; //导入依赖的package包/类
@Test(groups = "fast")
public void shouldNotComplainForErrorWhileAddingTaxCodes() throws Exception {
// Given
CallContext context = mock(CallContext.class);
initCatalogStub();
doThrow(new CustomFieldApiException(UNEXPECTED_ERROR, ""))//
.when(customFieldUserApi).addCustomFields(anyListOf(CustomField.class), eq(context));
withInvoices(invoiceD);
// When
List<InvoiceItem> items = plugin.getAdditionalInvoiceItems(invoiceD, properties, context);
// Then
assertEquals(items.size(), 0);
verifyNoMoreInteractions(logService);
}
开发者ID:bgandon,项目名称:killbill-simple-tax-plugin,代码行数:17,代码来源:TestSimpleTaxPlugin.java
示例4: authorizePayment
import org.killbill.billing.util.callcontext.CallContext; //导入依赖的package包/类
@Override
public PaymentTransactionInfoPlugin authorizePayment(final UUID kbAccountId, final UUID kbPaymentId, final UUID kbTransactionId, final UUID kbPaymentMethodId, final BigDecimal amount, final Currency currency, final Iterable<PluginProperty> properties, final CallContext context) throws PaymentPluginApiException {
final AdyenResponsesRecord adyenResponsesRecord;
try {
adyenResponsesRecord = dao.updateResponse(kbTransactionId, properties, context.getTenantId());
} catch (final SQLException e) {
throw new PaymentPluginApiException("HPP notification came through, but we encountered a database error", e);
}
final boolean isHPPCompletion = adyenResponsesRecord != null && Boolean.valueOf(MoreObjects.firstNonNull(AdyenDao.fromAdditionalData(adyenResponsesRecord.getAdditionalData()).get(PROPERTY_FROM_HPP), false).toString());
if (!isHPPCompletion) {
// We don't have any record for that payment: we want to trigger an actual authorization call (or complete a 3D-S authorization)
return executeInitialTransaction(TransactionType.AUTHORIZE, kbAccountId, kbPaymentId, kbTransactionId, kbPaymentMethodId, amount, currency, properties, context);
} else {
// We already have a record for that payment transaction and we just updated the response row with additional properties
// (the API can be called for instance after the user is redirected back from the HPP to store the PSP reference)
}
return buildPaymentTransactionInfoPlugin(adyenResponsesRecord);
}
开发者ID:killbill,项目名称:killbill-adyen-plugin,代码行数:21,代码来源:AdyenPaymentPluginApi.java
示例5: capturePayment
import org.killbill.billing.util.callcontext.CallContext; //导入依赖的package包/类
@Override
public PaymentTransactionInfoPlugin capturePayment(final UUID kbAccountId, final UUID kbPaymentId, final UUID kbTransactionId, final UUID kbPaymentMethodId, final BigDecimal amount, final Currency currency, final Iterable<PluginProperty> properties, final CallContext context) throws PaymentPluginApiException {
return executeFollowUpTransaction(TransactionType.CAPTURE,
new TransactionExecutor<PaymentModificationResponse>() {
@Override
public PaymentModificationResponse execute(final String merchantAccount, final PaymentData paymentData, final String pspReference, final SplitSettlementData splitSettlementData) {
final AdyenPaymentServiceProviderPort port = adyenConfigurationHandler.getConfigurable(context.getTenantId());
return port.capture(merchantAccount, paymentData, pspReference, splitSettlementData);
}
},
kbAccountId,
kbPaymentId,
kbTransactionId,
kbPaymentMethodId,
amount,
currency,
properties,
context);
}
开发者ID:killbill,项目名称:killbill-adyen-plugin,代码行数:20,代码来源:AdyenPaymentPluginApi.java
示例6: purchasePayment
import org.killbill.billing.util.callcontext.CallContext; //导入依赖的package包/类
@Override
public PaymentTransactionInfoPlugin purchasePayment(final UUID kbAccountId, final UUID kbPaymentId, final UUID kbTransactionId, final UUID kbPaymentMethodId, final BigDecimal amount, final Currency currency, final Iterable<PluginProperty> properties, final CallContext context) throws PaymentPluginApiException {
final AdyenResponsesRecord adyenResponsesRecord;
try {
adyenResponsesRecord = dao.updateResponse(kbTransactionId, properties, context.getTenantId());
} catch (final SQLException e) {
throw new PaymentPluginApiException("HPP notification came through, but we encountered a database error", e);
}
if (adyenResponsesRecord == null) {
// We don't have any record for that payment: we want to trigger an actual purchase (auto-capture) call
final String captureDelayHours = PluginProperties.getValue(PROPERTY_CAPTURE_DELAY_HOURS, "0", properties);
final Iterable<PluginProperty> overriddenProperties = PluginProperties.merge(properties, ImmutableList.<PluginProperty>of(new PluginProperty(PROPERTY_CAPTURE_DELAY_HOURS, captureDelayHours, false)));
return executeInitialTransaction(TransactionType.PURCHASE, kbAccountId, kbPaymentId, kbTransactionId, kbPaymentMethodId, amount, currency, overriddenProperties, context);
} else {
// We already have a record for that payment transaction and we just updated the response row with additional properties
// (the API can be called for instance after the user is redirected back from the HPP to store the PSP reference)
}
return buildPaymentTransactionInfoPlugin(adyenResponsesRecord);
}
开发者ID:killbill,项目名称:killbill-adyen-plugin,代码行数:22,代码来源:AdyenPaymentPluginApi.java
示例7: voidPayment
import org.killbill.billing.util.callcontext.CallContext; //导入依赖的package包/类
@Override
public PaymentTransactionInfoPlugin voidPayment(final UUID kbAccountId, final UUID kbPaymentId, final UUID kbTransactionId, final UUID kbPaymentMethodId, final Iterable<PluginProperty> properties, final CallContext context) throws PaymentPluginApiException {
return executeFollowUpTransaction(TransactionType.VOID,
new TransactionExecutor<PaymentModificationResponse>() {
@Override
public PaymentModificationResponse execute(final String merchantAccount, final PaymentData paymentData, final String pspReference, final SplitSettlementData splitSettlementData) {
final AdyenPaymentServiceProviderPort port = adyenConfigurationHandler.getConfigurable(context.getTenantId());
return port.cancel(merchantAccount, paymentData, pspReference, splitSettlementData);
}
},
kbAccountId,
kbPaymentId,
kbTransactionId,
kbPaymentMethodId,
null,
null,
properties,
context);
}
开发者ID:killbill,项目名称:killbill-adyen-plugin,代码行数:20,代码来源:AdyenPaymentPluginApi.java
示例8: refundPayment
import org.killbill.billing.util.callcontext.CallContext; //导入依赖的package包/类
@Override
public PaymentTransactionInfoPlugin refundPayment(final UUID kbAccountId, final UUID kbPaymentId, final UUID kbTransactionId, final UUID kbPaymentMethodId, final BigDecimal amount, final Currency currency, final Iterable<PluginProperty> properties, final CallContext context) throws PaymentPluginApiException {
return executeFollowUpTransaction(TransactionType.REFUND,
new TransactionExecutor<PaymentModificationResponse>() {
@Override
public PaymentModificationResponse execute(final String merchantAccount, final PaymentData paymentData, final String pspReference, final SplitSettlementData splitSettlementData) {
final AdyenPaymentServiceProviderPort providerPort = adyenConfigurationHandler.getConfigurable(context.getTenantId());
return providerPort.refund(merchantAccount, paymentData, pspReference, splitSettlementData);
}
},
kbAccountId,
kbPaymentId,
kbTransactionId,
kbPaymentMethodId,
amount,
currency,
properties,
context);
}
开发者ID:killbill,项目名称:killbill-adyen-plugin,代码行数:20,代码来源:AdyenPaymentPluginApi.java
示例9: createChargeback
import org.killbill.billing.util.callcontext.CallContext; //导入依赖的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
示例10: updateInTransaction
import org.killbill.billing.util.callcontext.CallContext; //导入依赖的package包/类
/**
* Refresh the records. This does not perform any logic but simply deletes existing records and inserts the current ones.
*
* @param bac current, fully populated, BusinessAccountModelDao record
* @param invoices current, fully populated, mapping of invoice id -> BusinessInvoiceModelDao records
* @param invoiceItems current, fully populated, mapping of invoice id -> BusinessInvoiceItemBaseModelDao records
* @param invoicePayments current, fully populated, mapping of invoice id -> BusinessInvoicePaymentBaseModelDao records
* @param transactional current transaction
* @param context call context
*/
private void updateInTransaction(final BusinessAccountModelDao bac,
final Map<UUID, BusinessInvoiceModelDao> invoices,
final Multimap<UUID, BusinessInvoiceItemBaseModelDao> invoiceItems,
final Multimap<UUID, BusinessPaymentBaseModelDao> invoicePayments,
final BusinessAnalyticsSqlDao transactional,
final CallContext context) {
// Update invoice and invoice items tables
businessInvoiceDao.updateInTransaction(bac, invoices, invoiceItems, transactional, context);
// Update payment tables
businessPaymentDao.updateInTransaction(bac, Iterables.<BusinessPaymentBaseModelDao>concat(invoicePayments.values()), transactional, context);
// Update denormalized invoice and payment details in BAC
businessAccountDao.updateInTransaction(bac, transactional, context);
}
开发者ID:killbill,项目名称:killbill-analytics-plugin,代码行数:26,代码来源:BusinessInvoiceAndPaymentDao.java
示例11: updateInTransaction
import org.killbill.billing.util.callcontext.CallContext; //导入依赖的package包/类
private void updateInTransaction(final BusinessAccountModelDao bac,
final Collection<BusinessBundleModelDao> bbss,
final Collection<BusinessSubscriptionTransitionModelDao> bsts,
final BusinessAnalyticsSqlDao transactional,
final CallContext context) {
// Update the subscription transitions
transactional.deleteByAccountRecordId(BusinessSubscriptionTransitionModelDao.SUBSCRIPTION_TABLE_NAME,
bac.getAccountRecordId(),
bac.getTenantRecordId(),
context);
for (final BusinessSubscriptionTransitionModelDao bst : bsts) {
transactional.create(bst.getTableName(), bst, context);
}
// Update the summary table per bundle
businessBundleDao.updateInTransaction(bbss,
bac.getAccountRecordId(),
bac.getTenantRecordId(),
transactional,
context);
// Update BAC
businessAccountDao.updateInTransaction(bac, transactional, context);
}
开发者ID:killbill,项目名称:killbill-analytics-plugin,代码行数:26,代码来源:BusinessSubscriptionTransitionDao.java
示例12: doPut
import org.killbill.billing.util.callcontext.CallContext; //导入依赖的package包/类
@Override
protected void doPut(final HttpServletRequest req, final HttpServletResponse resp) throws ServletException, IOException {
final CallContext context = createCallContext(req, resp);
final String reportName = (String) req.getAttribute(REPORT_NAME_ATTRIBUTE);
if (reportName == null) {
return;
}
if ((Boolean) req.getAttribute(SHOULD_REFRESH)) {
reportsUserApi.refreshReport(reportName, context);
} else {
final ReportConfigurationJson reportConfigurationJson = jsonMapper.readValue(req.getInputStream(), ReportConfigurationJson.class);
reportsUserApi.updateReport(reportName, reportConfigurationJson, context);
}
}
开发者ID:killbill,项目名称:killbill-analytics-plugin,代码行数:17,代码来源:ReportsServlet.java
示例13: doPut
import org.killbill.billing.util.callcontext.CallContext; //导入依赖的package包/类
@Override
protected void doPut(final HttpServletRequest req, final HttpServletResponse resp) throws ServletException, IOException {
final UUID kbAccountId = (UUID) req.getAttribute(KB_ACCOUNT_ID_ATTRIBUTE);
if (kbAccountId == null) {
return;
}
final CallContext context = createCallContext(req, resp);
try {
analyticsUserApi.rebuildAnalyticsForAccount(kbAccountId, context);
resp.setStatus(HttpServletResponse.SC_NO_CONTENT);
} catch (AnalyticsRefreshException e) {
logService.log(LogService.LOG_ERROR, "Error refreshing account " + kbAccountId, e);
resp.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e.getMessage());
}
}
开发者ID:killbill,项目名称:killbill-analytics-plugin,代码行数:18,代码来源:AnalyticsServlet.java
示例14: getOrAddEventCategory
import org.killbill.billing.util.callcontext.CallContext; //导入依赖的package包/类
@Override
public int getOrAddEventCategory(final String eventCategory, final CallContext context) throws UnableToObtainConnectionException, CallbackFailedException {
final Integer result = delegate.inTransaction(new Transaction<Integer, TimelineSqlDao>() {
@Override
public Integer inTransaction(final TimelineSqlDao transactional, final TransactionStatus status) throws Exception {
return getOrAddWithRetry(new Callable<Integer>() {
@Override
public Integer call() throws Exception {
final MeterInternalTenantContext internalTenantContext = createInternalTenantContext(context);
final MeterInternalCallContext internalCallContext = createInternalCallContext(context);
Integer eventCategoryId = transactional.getCategoryRecordId(eventCategory, internalTenantContext);
if (eventCategoryId == null) {
transactional.addCategory(eventCategory, internalCallContext);
eventCategoryId = transactional.getCategoryRecordId(eventCategory, internalTenantContext);
}
return eventCategoryId;
}
});
}
});
return result;
}
开发者ID:killbill,项目名称:killbill-meter-plugin,代码行数:25,代码来源:DefaultTimelineDao.java
示例15: shouldSaveFieldWhenNoneExistsWithoutCloberingAnyOther
import org.killbill.billing.util.callcontext.CallContext; //导入依赖的package包/类
@Test(groups = "fast")
public void shouldSaveFieldWhenNoneExistsWithoutCloberingAnyOther() throws Exception {
// Given
CustomFieldUserApi customFieldApi = mock(CustomFieldUserApi.class);
CustomFieldService service = new CustomFieldService(customFieldApi, logService);
when(customFieldApi.getCustomFieldsForObject(any(UUID.class), any(ObjectType.class), any(TenantContext.class)))//
.thenReturn(newArrayList(new CustomFieldBuilder()//
.withFieldName("plop")//
.build()));
UUID accountId = randomUUID();
when(customFieldApi.getCustomFieldsForObject(accountId, ACCOUNT, defaultTenant))//
.thenReturn(Lists.<CustomField> newArrayList());
// When
boolean ok = service.saveAccountField("titi", "plop", accountId, defaultTenant);
// Then
assertTrue(ok);
verify(customFieldApi, never()).removeCustomFields(anyListOf(CustomField.class), any(CallContext.class));
verify(customFieldApi, times(1)).addCustomFields(addedFields.capture(), any(CallContext.class));
assertNotNull(addedFields.getValue());
assertEquals(addedFields.getValue().size(), 1);
verifyZeroInteractions(logService);
}
开发者ID:bgandon,项目名称:killbill-simple-tax-plugin,代码行数:29,代码来源:TestCustomFieldService.java
示例16: shouldSurviveExceptionWhenRemovingField
import org.killbill.billing.util.callcontext.CallContext; //导入依赖的package包/类
@Test(groups = "fast")
public void shouldSurviveExceptionWhenRemovingField() throws Exception {
// Given
CustomFieldUserApi customFieldApi = mock(CustomFieldUserApi.class);
OSGIKillbillLogService logService = mock(OSGIKillbillLogService.class);
CustomFieldService service = new CustomFieldService(customFieldApi, logService);
UUID accountId = randomUUID();
when(customFieldApi.getCustomFieldsForObject(accountId, ACCOUNT, defaultTenant))//
.thenReturn(newArrayList(new CustomFieldBuilder()//
.withObjectType(ACCOUNT)//
.withObjectId(accountId)//
.withFieldName("toto")//
.withFieldValue("tata")//
.build()));
doThrow(CustomFieldApiException.class)//
.when(customFieldApi).removeCustomFields(anyListOf(CustomField.class), any(CallContext.class));
// When
boolean ok = service.saveAccountField("titi", "toto", accountId, defaultTenant);
// Then
assertFalse(ok);
verify(logService).log(eq(LOG_ERROR),//
argThat(allOf(containsString("toto"),//
containsString("tata"),//
containsString(accountId.toString()))),//
any(CustomFieldApiException.class));
}
开发者ID:bgandon,项目名称:killbill-simple-tax-plugin,代码行数:31,代码来源:TestCustomFieldService.java
示例17: shouldCreateNoTaxItemFromConfigWhenCatalogIsNotAvailable
import org.killbill.billing.util.callcontext.CallContext; //导入依赖的package包/类
@Test(groups = "fast")
public void shouldCreateNoTaxItemFromConfigWhenCatalogIsNotAvailable() throws Exception {
// Given
CallContext context = mock(CallContext.class);
when(catalogUserApi.getCurrentCatalog(anyString(), eq(context)))//
.thenThrow(new CatalogApiException(__UNKNOWN_ERROR_CODE));
Invoice newInvoice = invoiceF;
withInvoices(invoiceD, newInvoice);
// When
List<InvoiceItem> items = plugin.getAdditionalInvoiceItems(newInvoice, properties, context);
// Then
assertEquals(items.size(), 0);
}
开发者ID:bgandon,项目名称:killbill-simple-tax-plugin,代码行数:16,代码来源:TestSimpleTaxPlugin.java
示例18: shouldComplainForErrorWhilePersistingTaxCodes
import org.killbill.billing.util.callcontext.CallContext; //导入依赖的package包/类
@Test(groups = "fast")
public void shouldComplainForErrorWhilePersistingTaxCodes() throws Exception {
// Given
initCatalogStub();
doThrow(new CustomFieldApiException(UNEXPECTED_ERROR, ""))//
.when(customFieldUserApi).addCustomFields(anyListOf(CustomField.class), any(CallContext.class));
withInvoices(invoiceD);
ExtBusEvent event = mock(ExtBusEvent.class);
when(event.getEventType()).thenReturn(INVOICE_CREATION);
when(event.getObjectType()).thenReturn(INVOICE);
UUID invoiceId = invoiceD.getId();
when(event.getObjectId()).thenReturn(invoiceId);
// When
catchException(plugin).handleKillbillEvent(event);
// Then
Exception exc = caughtException();
assertNotNull(exc);
assertEquals(exc.getClass(), RuntimeException.class);
assertNotNull(exc.getCause());
assertEquals(exc.getCause().getClass(), CustomFieldApiException.class);
verify(logService).log(eq(LOG_DEBUG), anyString());
verify(logService).log(eq(LOG_INFO), anyString());
verify(logService).log(eq(LOG_ERROR),
argThat(allOf(containsStringIgnoringCase("cannot add custom field"), containsString(VAT_20_0))),
any(CustomFieldApiException.class));
verifyNoMoreInteractions(logService);
}
开发者ID:bgandon,项目名称:killbill-simple-tax-plugin,代码行数:33,代码来源:TestSimpleTaxPlugin.java
示例19: shouldCreateMissingTaxItemFromConfiguredTaxCodesForProduct
import org.killbill.billing.util.callcontext.CallContext; //导入依赖的package包/类
@Test(groups = "fast")
public void shouldCreateMissingTaxItemFromConfiguredTaxCodesForProduct() throws Exception {
// Given
CallContext context = mock(CallContext.class);
initCatalogStub();
Invoice newInvoice = invoiceF;
withInvoices(invoiceD, newInvoice);
ExtBusEvent event = mock(ExtBusEvent.class);
when(event.getEventType()).thenReturn(INVOICE_CREATION);
when(event.getObjectType()).thenReturn(INVOICE);
UUID invoiceId = newInvoice.getId();
when(event.getObjectId()).thenReturn(invoiceId);
// When
List<InvoiceItem> items = plugin.getAdditionalInvoiceItems(newInvoice, properties, context);
plugin.handleKillbillEvent(event);
// Then
assertTrue(items.size() >= 1);
InvoiceItem item1 = items.get(0);
assertEquals(item1.getInvoiceId(), invoiceF.getId());
assertEquals(item1.getInvoiceItemType(), TAX);
assertEquals(item1.getLinkedItemId(), taxableF.get().getId());
assertEquals(item1.getAmount(), new BigDecimal("1.00"));
assertEquals(item1.getStartDate(), invoiceF.getInvoiceDate());
assertEquals(items.size(), 1);
verify(customFieldUserApi).addCustomFields(fields.capture(), any(CallContext.class));
assertNotNull(fields.getValue());
assertEquals(fields.getValue().size(), 1);
CustomField customField = fields.getValue().get(0);
assertEquals(customField.getObjectType(), INVOICE_ITEM);
assertEquals(customField.getObjectId(), taxableF.get().getId());
assertEquals(customField.getFieldName(), "taxCodes");
assertEquals(customField.getFieldValue(), VAT_20_0);
}
开发者ID:bgandon,项目名称:killbill-simple-tax-plugin,代码行数:41,代码来源:TestSimpleTaxPlugin.java
示例20: shouldFilterOutTaxCodesOnIrrelevantCountries
import org.killbill.billing.util.callcontext.CallContext; //导入依赖的package包/类
@Test(groups = "fast")
public void shouldFilterOutTaxCodesOnIrrelevantCountries() throws Exception {
// Given
CallContext context = mock(CallContext.class);
initCatalogStub();
Account account = createAccount(US);
when(accountUserApi.getAccountById(eq(account.getId()), eq(context))).thenReturn(account);
Promise<InvoiceItem> taxable = holder();
Invoice newInvoice = new InvoiceBuilder(account)//
.withItem(new InvoiceItemBuilder()//
.withType(RECURRING).withPlanName("planA").withAmount(SIX)//
.withStartDate(lastMonth).withEndDate(today)//
.thenSaveTo(taxable))//
.withItem(new InvoiceItemBuilder()//
.withType(ITEM_ADJ).withLinkedItem(taxable).withAmount(ONE.negate()))//
.build();
withInvoices(newInvoice);
// When
List<InvoiceItem> items = plugin.getAdditionalInvoiceItems(newInvoice, properties, context);
// Then
assertEquals(items.size(), 0);
verify(customFieldUserApi, never()).addCustomFields(anyListOf(CustomField.class), eq(context));
}
开发者ID:bgandon,项目名称:killbill-simple-tax-plugin,代码行数:29,代码来源:TestSimpleTaxPlugin.java
注:本文中的org.killbill.billing.util.callcontext.CallContext类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论