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


Java AddPayment类代码示例

本文整理汇总了Java中io.sphere.sdk.carts.commands.updateactions.AddPayment的典型用法代码示例。如果您正苦于以下问题:Java AddPayment类的具体用法?Java AddPayment怎么用?Java AddPayment使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


AddPayment类属于io.sphere.sdk.carts.commands.updateactions包,在下文中一共展示了AddPayment类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: checkPaymentsAreAdded

import io.sphere.sdk.carts.commands.updateactions.AddPayment; //导入依赖的package包/类
@Test
public void checkPaymentsAreAdded() throws Exception {
    final PaymentDraft paymentDraft = PaymentDraftBuilder.of(MoneyImpl.ofCents(540, CURRENCY)).build();
    withPayment(sphereClient, paymentDraft, payment -> {
        final CartDraft cartDraft = CartDraft.of(CURRENCY);
        withCart(sphereClient, cartDraft, cart -> {
            assertThat(cart.getPaymentInfo()).isNull();
            final Cart cartWithPayment = sphereClient.executeBlocking(CartUpdateCommand.of(cart, AddPayment.of(payment)));
            assertThat(cartWithPayment.getPaymentInfo()).isNotNull();
            assertThat(cartWithPayment.getPaymentInfo().getPayments().get(0).getId()).isEqualTo(payment.getId());
            return cartWithPayment;
        });
        return payment;
    });
}
 
开发者ID:commercetools,项目名称:commercetools-sunrise-java-training,代码行数:16,代码来源:CreditCardFeeControllerComponentIntegrationTest.java

示例2: addNewPayment

import io.sphere.sdk.carts.commands.updateactions.AddPayment; //导入依赖的package包/类
/**
 * Method to To add a new payment to the Cart
 *
 * @param cpd contains the data for the new payment
 * @return the newly created Payment object
 */
protected CompletionStage<Payment> addNewPayment(final CreatePaymentData cpd) {
    final Command<Payment> createPaymentCommand = PaymentCreateCommand.of(createPaymentDraft(cpd).build());
    return cpd.getSphereClient().execute(createPaymentCommand)
            .thenCompose(p -> cpd.getSphereClient().execute(CartUpdateCommand.of(cpd.getCart(), AddPayment.of(p)))
                    .thenApplyAsync(c -> p));
}
 
开发者ID:commercetools,项目名称:commercetools-payment-integration-java,代码行数:13,代码来源:CreatePaymentMethodBase.java

示例3: buildRequest

import io.sphere.sdk.carts.commands.updateactions.AddPayment; //导入依赖的package包/类
protected CartUpdateCommand buildRequest(final PaymentMethodsWithCart paymentMethodsWithCart, final CheckoutPaymentFormData formData, final Payment payment) {
    return CartUpdateCommand.of(paymentMethodsWithCart.getCart(), AddPayment.of(payment));
}
 
开发者ID:commercetools,项目名称:commercetools-sunrise-java,代码行数:4,代码来源:DefaultCheckoutPaymentControllerAction.java


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