本文整理汇总了Java中io.sphere.sdk.payments.commands.PaymentCreateCommand类的典型用法代码示例。如果您正苦于以下问题:Java PaymentCreateCommand类的具体用法?Java PaymentCreateCommand怎么用?Java PaymentCreateCommand使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PaymentCreateCommand类属于io.sphere.sdk.payments.commands包,在下文中一共展示了PaymentCreateCommand类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addNewPayment
import io.sphere.sdk.payments.commands.PaymentCreateCommand; //导入依赖的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
示例2: createPayment
import io.sphere.sdk.payments.commands.PaymentCreateCommand; //导入依赖的package包/类
private CompletionStage<Payment> createPayment(final PaymentMethodsWithCart paymentMethodsWithCart, final CheckoutPaymentFormData formData) {
final Cart cart = paymentMethodsWithCart.getCart();
final PaymentMethodInfo paymentMethod = findPaymentMethod(paymentMethodsWithCart.getPaymentMethods(), formData);
final PaymentDraft paymentDraft = PaymentDraftBuilder.of(cart.getTotalPrice())
.paymentMethodInfo(paymentMethod)
.customer(Optional.ofNullable(cart.getCustomerId()).map(Customer::referenceOfId).orElse(null))
.build();
return getSphereClient().execute(PaymentCreateCommand.of(paymentDraft));
}
开发者ID:commercetools,项目名称:commercetools-sunrise-java,代码行数:10,代码来源:DefaultCheckoutPaymentControllerAction.java
示例3: withPayment
import io.sphere.sdk.payments.commands.PaymentCreateCommand; //导入依赖的package包/类
private static void withPayment(final BlockingSphereClient client, final PaymentDraft paymentDraft, final Function<Payment, Payment> test) {
final Payment payment = client.executeBlocking(PaymentCreateCommand.of(paymentDraft));
final Payment paymentAfterTest = test.apply(payment);
client.executeBlocking(PaymentDeleteCommand.of(paymentAfterTest));
}
开发者ID:commercetools,项目名称:commercetools-sunrise-java-training,代码行数:6,代码来源:CreditCardFeeControllerComponentIntegrationTest.java