本文整理匯總了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