• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Currency类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.killbill.billing.catalog.api.Currency的典型用法代码示例。如果您正苦于以下问题:Java Currency类的具体用法?Java Currency怎么用?Java Currency使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Currency类属于org.killbill.billing.catalog.api包,在下文中一共展示了Currency类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: createInvoiceItem

import org.killbill.billing.catalog.api.Currency; //导入依赖的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


示例2: testPaymentRefund

import org.killbill.billing.catalog.api.Currency; //导入依赖的package包/类
@Test(groups = "fast")
public void testPaymentRefund() throws Exception {
    final AccountData account = createAccount();
    final PaymentTransaction paymentTransaction = createPaymentTransaction(new BigDecimal("937.070000000"), Currency.USD);

    final TenantContext tenantContext = createTenantContext();
    final EmailContent email = renderer.generateEmailForPaymentRefund(account, paymentTransaction, tenantContext);

    final String expectedBody = "*** Your payment has been refunded ***\n" +
            "\n" +
            "We have processed a refund in the amount of $937.07.\n" +
            "\n" +
            "This refund will appear on your next credit card statement in approximately 3-5 business days.\n" +
            "\n" +
            "If you have any questions about your account, please reply to this email or contact MERCHANT_NAME Support at: (888) 555-1234";

    // System.err.println(email.getBody());
    Assert.assertEquals(email.getSubject(), "MERCHANT_NAME: Refund Receipt");
    Assert.assertEquals(email.getBody(), expectedBody);
}
 
开发者ID:killbill,项目名称:killbill-email-notifications-plugin,代码行数:21,代码来源:TestTemplateRenderer.java


示例3: AdyenPaymentTransactionInfoPlugin

import org.killbill.billing.catalog.api.Currency; //导入依赖的package包/类
public AdyenPaymentTransactionInfoPlugin(final UUID kbPaymentId,
                                         final UUID kbTransactionPaymentPaymentId,
                                         final TransactionType transactionType,
                                         final BigDecimal amount,
                                         final Currency currency,
                                         final DateTime utcNow,
                                         final PurchaseResult purchaseResult) {
    super(kbPaymentId,
          kbTransactionPaymentPaymentId,
          transactionType,
          amount,
          currency,
          getPaymentPluginStatus(purchaseResult.getAdyenCallErrorStatus(), purchaseResult.getResult()),
          getGatewayError(purchaseResult),
          truncate(getGatewayErrorCode(purchaseResult)),
          purchaseResult.getPspReference(),
          purchaseResult.getAuthCode(),
          utcNow,
          utcNow,
          extractPluginProperties(purchaseResult));
    adyenResponseRecord = Optional.absent();
}
 
开发者ID:killbill,项目名称:killbill-adyen-plugin,代码行数:23,代码来源:AdyenPaymentTransactionInfoPlugin.java


示例4: authorizePayment

import org.killbill.billing.catalog.api.Currency; //导入依赖的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.catalog.api.Currency; //导入依赖的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.catalog.api.Currency; //导入依赖的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: refundPayment

import org.killbill.billing.catalog.api.Currency; //导入依赖的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


示例8: getPaymentTransactionInfoPluginForHPP

import org.killbill.billing.catalog.api.Currency; //导入依赖的package包/类
private PaymentTransactionInfoPlugin getPaymentTransactionInfoPluginForHPP(final TransactionType transactionType, final UUID kbAccountId, final UUID kbPaymentId, final UUID kbTransactionId, final BigDecimal amount, final Currency currency, final Iterable<PluginProperty> properties, final TenantContext context) throws PaymentPluginApiException {
    final AdyenPaymentServiceProviderHostedPaymentPagePort hostedPaymentPagePort = adyenHppConfigurationHandler.getConfigurable(context.getTenantId());
    final Map<String, String> requestParameterMap = Maps.transformValues(PluginProperties.toStringMap(properties), new Function<String, String>() {
        @Override
        public String apply(final String input) {
            // Adyen will encode parameters like merchantSig
            return decode(input);
        }
    });
    final HppCompletedResult hppCompletedResult = hostedPaymentPagePort.parseAndVerifyRequestIntegrity(requestParameterMap);
    final PurchaseResult purchaseResult = new PurchaseResult(hppCompletedResult);

    final DateTime utcNow = clock.getUTCNow();
    try {
        final AdyenResponsesRecord adyenResponsesRecord = dao.addResponse(kbAccountId, kbPaymentId, kbTransactionId, transactionType, amount, currency, purchaseResult, utcNow, context.getTenantId());
        return buildPaymentTransactionInfoPlugin(adyenResponsesRecord);
    } catch (final SQLException e) {
        throw new PaymentPluginApiException("HPP payment came through, but we encountered a database error", e);
    }
}
 
开发者ID:killbill,项目名称:killbill-adyen-plugin,代码行数:21,代码来源:AdyenPaymentPluginApi.java


示例9: buildPaymentData

import org.killbill.billing.catalog.api.Currency; //导入依赖的package包/类
private PaymentData buildPaymentData(final String merchantAccount, final String countryCode, final AccountData account, final UUID kbPaymentId, final UUID kbTransactionId, final AdyenPaymentMethodsRecord paymentMethodsRecord, final BigDecimal amount, final Currency currency, final Iterable<PluginProperty> properties, final TenantContext context) throws PaymentPluginApiException {
    final Payment payment;
    try {
        payment = killbillAPI.getPaymentApi().getPayment(kbPaymentId, false, false, properties, context);
    } catch (final PaymentApiException e) {
        throw new PaymentPluginApiException(String.format("Unable to retrieve kbPaymentId='%s'", kbPaymentId), e);
    }

    final PaymentTransaction paymentTransaction = Iterables.<PaymentTransaction>find(payment.getTransactions(),
                                                                                     new Predicate<PaymentTransaction>() {
                                                                                         @Override
                                                                                         public boolean apply(final PaymentTransaction input) {
                                                                                             return kbTransactionId.equals(input.getId());
                                                                                         }
                                                                                     });

    final PaymentInfo paymentInfo = buildPaymentInfo(merchantAccount, countryCode, account, paymentMethodsRecord, properties, context);

    return new PaymentData<PaymentInfo>(amount, currency, paymentTransaction.getExternalKey(), paymentInfo);
}
 
开发者ID:killbill,项目名称:killbill-adyen-plugin,代码行数:21,代码来源:AdyenPaymentPluginApi.java


示例10: createChargeback

import org.killbill.billing.catalog.api.Currency; //导入依赖的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: testBoleto

import org.killbill.billing.catalog.api.Currency; //导入依赖的package包/类
@Test(groups = "slow", enabled = false)
public void testBoleto() throws Exception {
    final PaymentInfo boleto = new PaymentInfo();
    boleto.setCountry("BR");
    boleto.setSelectedBrand("boletobancario_santander");

    final PaymentData<PaymentInfo> paymentData = new PaymentData<PaymentInfo>(new BigDecimal("1"), Currency.BRL, UUID.randomUUID().toString(), boleto);
    final UserData userData = new UserData();
    userData.setFirstName("José");
    userData.setLastName("Silva");
    final SplitSettlementData splitSettlementData = null;

    final PurchaseResult authorizeResult = adyenPaymentServiceProviderPort.authorise(merchantAccount, paymentData, userData, splitSettlementData);
    Assert.assertNotNull(authorizeResult.getPspReference());
    Assert.assertEquals(authorizeResult.getResultCode(), "Received");
    Assert.assertNull(authorizeResult.getAuthCode());
    Assert.assertNull(authorizeResult.getReason());
    Assert.assertNotNull(authorizeResult.getAdditionalData().get("boletobancario.barCodeReference"));
    Assert.assertNotNull(authorizeResult.getAdditionalData().get("boletobancario.data"));
    Assert.assertNotNull(authorizeResult.getAdditionalData().get("boletobancario.dueDate"));
    Assert.assertNotNull(authorizeResult.getAdditionalData().get("boletobancario.url"));
    Assert.assertNotNull(authorizeResult.getAdditionalData().get("boletobancario.expirationDate"));
}
 
开发者ID:killbill,项目名称:killbill-adyen-plugin,代码行数:24,代码来源:TestRemoteAdyenPaymentServiceProviderPort.java


示例12: testPaymentRequestBuilderWithEmptyFields

import org.killbill.billing.catalog.api.Currency; //导入依赖的package包/类
@Test(groups = "fast")
public void testPaymentRequestBuilderWithEmptyFields() {
    final String merchantAccount = UUID.randomUUID().toString();
    final String paymentTransactionExternalKey = UUID.randomUUID().toString();
    final PaymentData paymentData = new PaymentData<Card>(new BigDecimal("20"), Currency.EUR, paymentTransactionExternalKey, new Card());
    final UserData userData = new UserData();
    final SplitSettlementData splitSettlementData = null;
    final PaymentInfoConverterService paymentInfoConverterManagement = new PaymentInfoConverterService();

    final PaymentRequestBuilder builder = new PaymentRequestBuilder(merchantAccount, paymentData, userData, splitSettlementData, paymentInfoConverterManagement);
    final PaymentRequest paymentRequest = builder.build();

    Assert.assertEquals(paymentRequest.getMerchantAccount(), merchantAccount);
    Assert.assertEquals(paymentRequest.getAmount().getValue(), (Long) 2000L);
    Assert.assertEquals(paymentRequest.getAmount().getCurrency(), "EUR");
    Assert.assertEquals(paymentRequest.getReference(), paymentTransactionExternalKey);
}
 
开发者ID:killbill,项目名称:killbill-adyen-plugin,代码行数:18,代码来源:TestPaymentRequestBuilder.java


示例13: testPaymentRequestBuilderWithEmptyFields

import org.killbill.billing.catalog.api.Currency; //导入依赖的package包/类
@Test(groups = "fast")
public void testPaymentRequestBuilderWithEmptyFields() {
    final String merchantAccount = UUID.randomUUID().toString();
    final String paymentTransactionExternalKey = UUID.randomUUID().toString();
    final PaymentData paymentData = new PaymentData<Card>(new BigDecimal("20"), Currency.EUR, paymentTransactionExternalKey, new Card());
    final UserData userData = new UserData();
    final SplitSettlementData splitSettlementData = null;

    final PaymentRequest3DBuilder builder = new PaymentRequest3DBuilder(merchantAccount, paymentData, userData, splitSettlementData);
    final PaymentRequest3D paymentRequest = builder.build();

    Assert.assertEquals(paymentRequest.getMerchantAccount(), merchantAccount);
    Assert.assertEquals(paymentRequest.getAmount().getValue(), (Long) 2000L);
    Assert.assertEquals(paymentRequest.getAmount().getCurrency(), "EUR");
    Assert.assertEquals(paymentRequest.getReference(), paymentTransactionExternalKey);
}
 
开发者ID:killbill,项目名称:killbill-adyen-plugin,代码行数:17,代码来源:TestPaymentRequest3DBuilder.java


示例14: verifyModificationRequestBuilder

import org.killbill.billing.catalog.api.Currency; //导入依赖的package包/类
private ModificationRequest verifyModificationRequestBuilder(final SplitSettlementData splitSettlementData) {
    final String merchantAccount = UUID.randomUUID().toString();
    final String paymentTransactionExternalKey = UUID.randomUUID().toString();
    final PaymentData paymentData = new PaymentData<Card>(new BigDecimal("20"), Currency.EUR, paymentTransactionExternalKey, new Card());
    final String originalReference = UUID.randomUUID().toString();

    final ModificationRequestBuilder builder = new ModificationRequestBuilder(merchantAccount, paymentData, originalReference, splitSettlementData);
    final ModificationRequest modificationRequest = builder.build();

    Assert.assertEquals(modificationRequest.getMerchantAccount(), merchantAccount);
    Assert.assertEquals(modificationRequest.getModificationAmount().getValue(), (Long) 2000L);
    Assert.assertEquals(modificationRequest.getOriginalReference(), originalReference);
    Assert.assertEquals(modificationRequest.getReference(), paymentTransactionExternalKey);

    return modificationRequest;
}
 
开发者ID:killbill,项目名称:killbill-adyen-plugin,代码行数:17,代码来源:TestModificationRequestBuilder.java


示例15: testBuilderLocaleGB

import org.killbill.billing.catalog.api.Currency; //导入依赖的package包/类
@Test(groups = "slow")
public void testBuilderLocaleGB() throws Exception {
    final String merchantAccount = MERCHANT_ACCOUNT;
    final String paymentTransactionExternalKey = MERCHANT_REFERENCE;

    final WebPaymentFrontend paymentInfo = new WebPaymentFrontend();
    paymentInfo.setCountry("GB");
    paymentInfo.setBrandCode("paypal");

    final PaymentData<WebPaymentFrontend> paymentData = new PaymentData<WebPaymentFrontend>(
            new BigDecimal("1"), Currency.GBP, paymentTransactionExternalKey, paymentInfo);

    final UserData userData = new UserData();
    userData.setShopperLocale(Locale.UK);

    final Signer signer = buildSignerMock();
    final Map<String, String> params = new HPPRequestBuilder(merchantAccount, paymentData, userData, null, new AdyenConfigProperties(new Properties()), signer).build();
    Assert.assertEquals(params.get("countryCode"), "GB");
    Assert.assertEquals(params.get("currencyCode"), "GBP");
    Assert.assertEquals(params.get("shopperLocale"), "en_GB");
}
 
开发者ID:killbill,项目名称:killbill-adyen-plugin,代码行数:22,代码来源:TestHPPRequestBuilder.java


示例16: testConstructorWithoutNulls

import org.killbill.billing.catalog.api.Currency; //导入依赖的package包/类
@Test(groups = "fast")
public void testConstructorWithoutNulls() throws Exception {
    final LocalDate startDate = new LocalDate(2019, 7, 4);
    final BusinessSubscription businessSubscription = new BusinessSubscription(plan,
                                                                               phase,
                                                                               priceList,
                                                                               Currency.GBP,
                                                                               startDate,
                                                                               serviceName,
                                                                               stateName,
                                                                               currencyConverter);
    Assert.assertEquals(businessSubscription.getProductName(), plan.getProduct().getName());
    Assert.assertEquals(businessSubscription.getProductType(), plan.getProduct().getCatalogName());
    Assert.assertEquals(businessSubscription.getProductCategory(), plan.getProduct().getCategory().toString());
    Assert.assertEquals(businessSubscription.getSlug(), phase.getName());
    Assert.assertEquals(businessSubscription.getPhase(), phase.getPhaseType().toString());
    Assert.assertEquals(businessSubscription.getBillingPeriod(), phase.getRecurring().getBillingPeriod().toString());
    Assert.assertEquals(businessSubscription.getPrice(), phase.getRecurring().getRecurringPrice().getPrice(Currency.GBP));
    Assert.assertEquals(businessSubscription.getPriceList(), priceList.getName());
    Assert.assertEquals(businessSubscription.getCurrency(), Currency.GBP.toString());
    Assert.assertEquals(businessSubscription.getService(), serviceName);
    Assert.assertEquals(businessSubscription.getState(), stateName);
    //Assert.assertEquals(businessSubscription.getBusinessActive(), /* TODO */);
    Assert.assertEquals(businessSubscription.getStartDate(), startDate);
    Assert.assertNull(businessSubscription.getEndDate());
}
 
开发者ID:killbill,项目名称:killbill-analytics-plugin,代码行数:27,代码来源:TestBusinessSubscription.java


示例17: setupDefaultInvoice

import org.killbill.billing.catalog.api.Currency; //导入依赖的package包/类
private List<InvoiceItem> setupDefaultInvoice(DateTime invoiceCreatedDate,
        DateTime invoiceItemCreatedDate, LocalDate invoiceDate, LocalDate startDate,
        LocalDate endDate) {
    account = EasyTaxTestUtils.createAccount("NZ", DateTimeZone.forID("Pacific/Auckland"));
    List<InvoiceItem> items = new ArrayList<>();
    invoice = EasyTaxTestUtils.createInvoice(invoiceCreatedDate, invoiceDate, items);
    InvoiceItem usage = EasyTaxTestUtils.createInvoiceItem(account, invoice,
            InvoiceItemType.USAGE, TEST_USAGE_PLAN_NAME, invoiceItemCreatedDate, startDate,
            endDate, TEST_USAGE_COST, Currency.NZD);
    items.add(usage);
    return items;
}
 
开发者ID:SolarNetwork,项目名称:killbill-easytax-plugin,代码行数:13,代码来源:SimpleTaxDateResolverTests.java


示例18: testSuccessfulPaymentGBP

import org.killbill.billing.catalog.api.Currency; //导入依赖的package包/类
@Test(groups = "fast")
public void testSuccessfulPaymentGBP() throws Exception {

    final AccountData account = createAccount(Currency.GBP, "en_GB");
    final List<InvoiceItem> items = new ArrayList<InvoiceItem>();
    items.add(createInvoiceItem(InvoiceItemType.RECURRING, new LocalDate("2015-04-06"), new BigDecimal("123.45"), account.getCurrency(), "chocolate-monthly"));
    items.add(createInvoiceItem(InvoiceItemType.TAX, new LocalDate("2015-04-06"), new BigDecimal("7.55"), account.getCurrency(), "chocolate-monthly"));
    final Invoice invoice = createInvoice(234, new LocalDate("2015-04-06"), new BigDecimal("131.00"), BigDecimal.ZERO, account.getCurrency(), items);

    final TenantContext tenantContext = createTenantContext();
    final EmailContent email = renderer.generateEmailForSuccessfulPayment(account, invoice, tenantContext);

    final String expectedBody = "This email confirms your recent payment.\n" +
            "\n" +
            "Here are the details of your payment:\n" +
            "\n" +
            "Invoice #: 234\n" +
            "Payment Date: 2015-04-06\n" +
            "\n" +
            "2015-04-06 chocolate-monthly : £123.45\n" +
            "2015-04-06 chocolate-monthly : £7.55\n" +
            "\n" +
            "Paid:  £131.00\n" +
            "Total: £0.00\n" +
            "\n" +
            "Billed To::\n" +
            "SauvonsLaTerre\n" +
            "Sylvie Dupond\n" +
            "1234 Trumpet street\n" +
            "San Francisco, CA 94110\n" +
            "USA\n" +
            "\n" +
            "If you have any questions about your account, please reply to this email or contact MERCHANT_NAME Support at: (888) 555-1234";

    //System.err.println(email.getBody());
    Assert.assertEquals(email.getSubject(), "MERCHANT_NAME: Payment Confirmation");
    Assert.assertEquals(email.getBody(), expectedBody);
}
 
开发者ID:killbill,项目名称:killbill-email-notifications-plugin,代码行数:39,代码来源:TestTemplateRenderer.java


示例19: BitcoinPaymentInfoPlugin

import org.killbill.billing.catalog.api.Currency; //导入依赖的package包/类
public BitcoinPaymentInfoPlugin(UUID kbPaymentId, BigDecimal amount, Currency currency, DateTime now, String contractId) {
    this.kbPaymentId = kbPaymentId;
    this.amount = amount;
    this.currency = currency;
    this.now = now;
    this.contractId = contractId;
}
 
开发者ID:killbill,项目名称:killbill-bitcoin-plugin,代码行数:8,代码来源:BitcoinPaymentInfoPlugin.java


示例20: getMaxPaymentAmount

import org.killbill.billing.catalog.api.Currency; //导入依赖的package包/类
private long getMaxPaymentAmount(@Nullable final Plan plan) throws CatalogApiException {
    if (plan == null) {
        return 0;
    }

    BigDecimal maxPaymentAmount = BigDecimal.ZERO;
    for (PlanPhase ph : plan.getAllPhases()) {
        BigDecimal phaseAmount = ph.getRecurringPrice() != null ? ph.getRecurringPrice().getPrice(Currency.BTC) : BigDecimal.ZERO;
        if (maxPaymentAmount.compareTo(phaseAmount) < 0) {
            maxPaymentAmount = phaseAmount;
        }
    }
    return maxPaymentAmount.longValue() * BTC_TO_SATOSHIS;
}
 
开发者ID:killbill,项目名称:killbill-bitcoin-plugin,代码行数:15,代码来源:PaymentRequestServlet.java



注:本文中的org.killbill.billing.catalog.api.Currency类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java DecoderException类代码示例发布时间:2022-05-23
下一篇:
Java DefaultOutputPort类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap