Interface PaymentProviderService

  • All Known Implementing Classes:
    PaymentProviderServiceImpl

    public interface PaymentProviderService
    Represents a service for interacting with payment providers.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      java.util.Map<java.lang.String,​java.lang.Object> calculateItemsTotalBruttoAmount​(java.lang.String orderId)
      Calculates total gross amount for order.
      OrderDTO calculateOrder​(Order order)
      Maps an Order object to an OrderDTO object.
      java.util.Map<java.lang.String,​java.lang.Object> calculatePayoutAmount​(java.lang.String orderId)
      Calculates payout amount for order.
      java.util.Map<java.lang.String,​java.lang.Object> calculateServiceFeeBruttoAmount​(java.lang.String orderId)
      Calculates service fee for order.
      Order.Tax calculateTax​(Seller buyer, Seller seller)
      Calculates the tax for an order based on the buyer, seller, and tax rates.
      java.util.Map<java.lang.String,​java.lang.Object> calculateTaxAmountPrice​(java.lang.String orderId)
      Calculates tax amount for order.
      java.util.Map<java.lang.String,​java.lang.Object> calculateTotalPrice​(java.lang.String orderId)
      Sums prices of commerce items.
      java.lang.String cancelPayment​(java.lang.String paymentId)
      Cancels a payment.
      boolean changePaymentMethod​(java.lang.String paymentId, java.lang.String paymentMethodId)
      Changes the payment method for a payment.
      java.lang.String checkConnectAccountStatus()
      Returns the status of the current seller's account
      java.lang.String createPayment​(Order order, Seller buyer, Seller vendor)
      Creates a payment for the specified order with the given netto amount and tax.
      java.lang.String get3DSecureLink​(java.lang.String paymentId)
      Gets the 3D Secure link for a payment.
      java.lang.String getPaymentMethod​(Seller buyer, java.util.LinkedHashMap<java.lang.String,​java.lang.Object> paymentMethod)
      Creates payment method and - if needed - customer for Stripe.
      boolean isActive()
      Checks if the payment provider is active.
      PaymentStatus pay​(Order order)
      Pays for the given order and returns the payment status.
      java.lang.String payoutToVendor​(Order order, Seller vendor)
      Pays out an amount to a vendor.
    • Method Detail

      • isActive

        boolean isActive()
        Checks if the payment provider is active.
        Returns:
        true if the payment provider is active, false otherwise.
      • pay

        PaymentStatus pay​(Order order)
        Pays for the given order and returns the payment status.
        Parameters:
        order - the order to be paid
        Returns:
        the payment status of the order
      • payoutToVendor

        java.lang.String payoutToVendor​(Order order,
                                        Seller vendor)
                                 throws com.stripe.exception.StripeException
        Pays out an amount to a vendor.
        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

        java.lang.String createPayment​(Order order,
                                       Seller buyer,
                                       Seller vendor)
        Creates a payment for the specified order with the given netto amount and tax.
        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

        java.lang.String cancelPayment​(java.lang.String paymentId)
        Cancels a payment.
        Parameters:
        paymentId - the payment id to cancel
        Returns:
        the cancellation result
      • getPaymentMethod

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

        boolean changePaymentMethod​(java.lang.String paymentId,
                                    java.lang.String paymentMethodId)
        Changes the payment method for a payment.
        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

        java.lang.String get3DSecureLink​(java.lang.String paymentId)
        Gets the 3D Secure link for a payment.
        Parameters:
        paymentId - the payment id to get the 3D Secure link for
        Returns:
        the 3D Secure link
      • checkConnectAccountStatus

        java.lang.String checkConnectAccountStatus()
        Returns the status of the current seller's account
        Returns:
        status
      • calculateTotalPrice

        java.util.Map<java.lang.String,​java.lang.Object> calculateTotalPrice​(java.lang.String orderId)
        Sums prices of commerce items.
        Parameters:
        orderId - order identifier
        Returns:
        items total amount as map-property
      • calculateTaxAmountPrice

        java.util.Map<java.lang.String,​java.lang.Object> calculateTaxAmountPrice​(java.lang.String orderId)
        Calculates tax amount for order.
        Parameters:
        orderId - order identifier
        Returns:
        tax amount as map-property
      • calculateItemsTotalBruttoAmount

        java.util.Map<java.lang.String,​java.lang.Object> calculateItemsTotalBruttoAmount​(java.lang.String orderId)
        Calculates total gross amount for order.
        Parameters:
        orderId - order identifier
        Returns:
        order gross amount as map-property
      • calculateServiceFeeBruttoAmount

        java.util.Map<java.lang.String,​java.lang.Object> calculateServiceFeeBruttoAmount​(java.lang.String orderId)
        Calculates service fee for order.
        Parameters:
        orderId - order identifier
        Returns:
        service fee amount as map-property
      • calculatePayoutAmount

        java.util.Map<java.lang.String,​java.lang.Object> calculatePayoutAmount​(java.lang.String orderId)
        Calculates payout amount for order.
        Parameters:
        orderId - order identifier
        Returns:
        payout amount as map-property
      • calculateOrder

        OrderDTO calculateOrder​(Order order)
        Maps an Order object to an OrderDTO object.
        Parameters:
        order - the Order object to be mapped
        Returns:
        the mapped OrderDTO object
      • calculateTax

        Order.Tax calculateTax​(Seller buyer,
                               Seller seller)
        Calculates the tax for an order based on the buyer, seller, and tax rates.
        Parameters:
        buyer - the user who is buying the order
        seller - the user who is selling the order
        Returns:
        the tax amount for the order