Class DefaultPayPalOrderService

    • Method Detail

      • createPayPalOrder

        public com.paypal.orders.Order createPayPalOrder​(@NonNull
                                                         @NonNull com.broadleafcommerce.paymentgateway.domain.PaymentRequest paymentRequest,
                                                         boolean performCheckoutOnReturn,
                                                         boolean capture)
        Description copied from interface: PayPalOrderService
        Creates a PayPal Order.
        Specified by:
        createPayPalOrder in interface PayPalOrderService
        Parameters:
        paymentRequest - The gateway PaymentRequest containing the information necessary to construct the order
        performCheckoutOnReturn - Indicates if we should start checkout after the user has authorized the order
        Returns:
        The new Order
      • updatePayPalOrderForFulfillment

        public void updatePayPalOrderForFulfillment​(@NonNull
                                                    @NonNull com.broadleafcommerce.paymentgateway.domain.PaymentRequest paymentRequest)
        Description copied from interface: PayPalOrderService
        Updates the PayPal Order to be in sync with the Broadleaf order. This method should be used when fulfillment or pricing information changes after Order creation. For creating an order use #createPayPalOrder(PaymentRequest, boolean)
        Specified by:
        updatePayPalOrderForFulfillment in interface PayPalOrderService
        Parameters:
        paymentRequest - The gateway PaymentRequest
      • updateOrderCustomId

        public void updateOrderCustomId​(@NonNull
                                        @NonNull String orderId,
                                        @NonNull
                                        @NonNull String customId,
                                        @NonNull
                                        @NonNull com.broadleafcommerce.paymentgateway.domain.PaymentRequest paymentRequest)
        Description copied from interface: PayPalOrderService
        Updates the PayPal Order to include the provided custom ID value.
        Specified by:
        updateOrderCustomId in interface PayPalOrderService
        Parameters:
        orderId - the primary identifier of the PayPal Order
        customId - the value that is to be stored on the PayPal Order object
        paymentRequest - The originating PaymentRequest
      • getIntent

        public String getIntent​(boolean performCheckoutOnReturn,
                                boolean capture)
      • constructPayer

        protected com.paypal.orders.Payer constructPayer​(@NonNull
                                                         @NonNull com.broadleafcommerce.paymentgateway.domain.PaymentRequest paymentRequest)
      • getPayerEmail

        @Nullable
        protected String getPayerEmail​(@NonNull
                                       @NonNull com.broadleafcommerce.paymentgateway.domain.PaymentRequest paymentRequest)
      • constructPayee

        @Nullable
        protected com.paypal.orders.Payee constructPayee​(@NonNull
                                                         @NonNull com.broadleafcommerce.paymentgateway.domain.PaymentRequest paymentRequest)
        Constructions a Payee to place on the PurchaseUnitRequest when creating an order. This is used only for PayPal's marketplace offering.
        Parameters:
        paymentRequest - The gateway PaymentRequest with the payment info.
        Returns:
        a Payee to place on the PurchaseUnitRequest or null if no MessageConstants.PAYEE_MERCHANT_ID on PaymentRequest.getAdditionalFields()
      • constructItems

        protected List<com.paypal.orders.Item> constructItems​(@NonNull
                                                              @NonNull com.broadleafcommerce.paymentgateway.domain.PaymentRequest paymentRequest)
      • constructShippingDetail

        @Nullable
        protected com.paypal.orders.ShippingDetail constructShippingDetail​(@NonNull
                                                                           @NonNull com.broadleafcommerce.paymentgateway.domain.PaymentRequest paymentRequest)
      • convertToMoney

        protected Optional<com.paypal.orders.Money> convertToMoney​(@Nullable
                                                                   javax.money.MonetaryAmount amount)
      • getStateCode

        @Nullable
        protected String getStateCode​(@NonNull
                                      @NonNull com.broadleafcommerce.paymentgateway.domain.Address<com.broadleafcommerce.paymentgateway.domain.PaymentRequest> address)
        PayPal supports only the State code with a short form, e.g. "AL" instead of "US-AL".
      • createOrder

        protected com.paypal.orders.Order createOrder​(@NonNull
                                                      @NonNull com.paypal.orders.OrderRequest orderRequest,
                                                      @NonNull
                                                      @NonNull com.broadleafcommerce.paymentgateway.domain.PaymentRequest paymentRequest)
      • updateOrder

        protected void updateOrder​(String orderId,
                                   List<com.paypal.orders.Patch> patches,
                                   @NonNull
                                   @NonNull com.broadleafcommerce.paymentgateway.domain.PaymentRequest paymentRequest)
      • constructAmountWithBreakdown

        protected com.paypal.orders.AmountWithBreakdown constructAmountWithBreakdown​(@NonNull
                                                                                     @NonNull com.broadleafcommerce.paymentgateway.domain.PaymentRequest paymentRequest)