当前位置: 首页>>代码示例>>Java>>正文


Java Currency类代码示例

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


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


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