Class PaymentProviderServiceImpl

    • Constructor Detail

      • PaymentProviderServiceImpl

        public PaymentProviderServiceImpl()
    • Method Detail

      • isActive

        public boolean isActive()
        Description copied from interface: PaymentProviderService
        Checks if the payment provider is active.
        Specified by:
        isActive in interface PaymentProviderService
        Returns:
        true if the payment provider is active, false otherwise.
      • payoutToVendor

        public java.lang.String payoutToVendor​(Order order,
                                               Seller vendor)
                                        throws com.stripe.exception.StripeException
        Description copied from interface: PaymentProviderService
        Pays out an amount to a vendor.
        Specified by:
        payoutToVendor in interface PaymentProviderService
        Parameters:
        order - the order to be payout
        vendor - the vendor to be paid
        Returns:
        the status of the payout
        Throws:
        com.stripe.exception.StripeException - if the payout fails
      • createPayment

        public java.lang.String createPayment​(Order order,
                                              Seller buyer,
                                              Seller vendor)
        Description copied from interface: PaymentProviderService
        Creates a payment for the specified order with the given netto amount and tax.
        Specified by:
        createPayment in interface PaymentProviderService
        Parameters:
        order - the order to be paid
        buyer - the buyer who will pay
        vendor - the vendor to be paid
        Returns:
        A string representing the created payment.
      • cancelPayment

        public java.lang.String cancelPayment​(java.lang.String paymentId)
        Description copied from interface: PaymentProviderService
        Cancels a payment.
        Specified by:
        cancelPayment in interface PaymentProviderService
        Parameters:
        paymentId - the payment id to cancel
        Returns:
        the cancellation result
      • getPaymentMethod

        public java.lang.String getPaymentMethod​(Seller buyer,
                                                 java.util.LinkedHashMap<java.lang.String,​java.lang.Object> paymentMethod)
        Description copied from interface: PaymentProviderService
        Creates payment method and - if needed - customer for Stripe.
        Specified by:
        getPaymentMethod in interface PaymentProviderService
        Parameters:
        buyer - the buyer for whom the payment method will be created
        paymentMethod - the map representation of payment method
        Returns:
        map as object
      • changePaymentMethod

        public boolean changePaymentMethod​(java.lang.String paymentId,
                                           java.lang.String paymentMethodId)
        Description copied from interface: PaymentProviderService
        Changes the payment method for a payment.
        Specified by:
        changePaymentMethod in interface PaymentProviderService
        Parameters:
        paymentId - the payment id to change the payment method for
        paymentMethodId - the new payment method id
        Returns:
        true if the payment method is successfully changed, false otherwise
      • get3DSecureLink

        public java.lang.String get3DSecureLink​(java.lang.String paymentId)
        Description copied from interface: PaymentProviderService
        Gets the 3D Secure link for a payment.
        Specified by:
        get3DSecureLink in interface PaymentProviderService
        Parameters:
        paymentId - the payment id to get the 3D Secure link for
        Returns:
        the 3D Secure link
      • calculateTotalPrice

        public java.util.Map<java.lang.String,​java.lang.Object> calculateTotalPrice​(java.lang.String orderId)
        Description copied from interface: PaymentProviderService
        Sums prices of commerce items.
        Specified by:
        calculateTotalPrice in interface PaymentProviderService
        Parameters:
        orderId - order identifier
        Returns:
        items total amount as map-property
      • calculateTaxAmountPrice

        public java.util.Map<java.lang.String,​java.lang.Object> calculateTaxAmountPrice​(java.lang.String orderId)
        Description copied from interface: PaymentProviderService
        Calculates tax amount for order.
        Specified by:
        calculateTaxAmountPrice in interface PaymentProviderService
        Parameters:
        orderId - order identifier
        Returns:
        tax amount as map-property
      • calculateItemsTotalBruttoAmount

        public java.util.Map<java.lang.String,​java.lang.Object> calculateItemsTotalBruttoAmount​(java.lang.String orderId)
        Description copied from interface: PaymentProviderService
        Calculates total gross amount for order.
        Specified by:
        calculateItemsTotalBruttoAmount in interface PaymentProviderService
        Parameters:
        orderId - order identifier
        Returns:
        order gross amount as map-property
      • calculateServiceFeeBruttoAmount

        public java.util.Map<java.lang.String,​java.lang.Object> calculateServiceFeeBruttoAmount​(java.lang.String orderId)
        Description copied from interface: PaymentProviderService
        Calculates service fee for order.
        Specified by:
        calculateServiceFeeBruttoAmount in interface PaymentProviderService
        Parameters:
        orderId - order identifier
        Returns:
        service fee amount as map-property
      • calculatePayoutAmount

        public java.util.Map<java.lang.String,​java.lang.Object> calculatePayoutAmount​(java.lang.String orderId)
        Description copied from interface: PaymentProviderService
        Calculates payout amount for order.
        Specified by:
        calculatePayoutAmount in interface PaymentProviderService
        Parameters:
        orderId - order identifier
        Returns:
        payout amount as map-property
      • calculateTax

        public Order.Tax calculateTax​(Seller buyer,
                                      Seller seller)
        Description copied from interface: PaymentProviderService
        Calculates the tax for an order based on the buyer, seller, and tax rates.
        Specified by:
        calculateTax in interface PaymentProviderService
        Parameters:
        buyer - the user who is buying the order
        seller - the user who is selling the order
        Returns:
        the tax amount for the order