當前位置: 首頁>>代碼示例>>Java>>正文


Java PaymentCreateCommand類代碼示例

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


注:本文中的io.sphere.sdk.payments.commands.PaymentCreateCommand類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。