Package mocking

Class StripeServiceMock

  • All Implemented Interfaces:
    StripeService

    @Service
    public class StripeServiceMock
    extends java.lang.Object
    implements StripeService
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.math.BigDecimal calculateServiceFee​(java.math.BigDecimal amount)
      Calculates service fee for given amount.
      java.util.Map<java.lang.String,​java.lang.Object> calculateTaxRate​(java.lang.String amount, java.lang.String countryIsoCode)
      This method returns data as object.
      com.stripe.model.PaymentIntent cancelIntent​(java.lang.String paymentIntentId)
      This method cancel created payment intent in Stripe
      java.lang.String cancelSubscriptionAfterActivePeriod​(java.lang.String sellerId)
      This method cancels a stripe subscription after expired stripe contract period.
      java.lang.String cancelSubscriptionImmediately​(java.lang.String sellerId)
      This method cancels a stripe subscription immediately.
      boolean changePaymentMethod​(java.lang.String paymentIntentId, java.lang.String paymentMethodId)
      Changes the payment method for the given payment intent.
      java.lang.String chargeCreditCard​(java.util.LinkedHashMap<java.lang.String,​java.lang.Object> chargeRequestAsMap)
      This method creates a charge for payment.
      PaymentStatus chargeIntent​(java.lang.String paymentIntentId)
      Charges payment intent.
      java.lang.String chargeSepa​(java.util.LinkedHashMap<java.lang.String,​java.lang.Object> chargeRequestAsMap)
      This method creates a stripe charge entity.
      void chargeTariffCreditCard​(java.util.LinkedHashMap<java.lang.String,​java.lang.Object> chargeRequestAsMap)
      This method creates a charge tariff for payment.
      void chargeTariffSepa​(java.util.LinkedHashMap<java.lang.String,​java.lang.Object> chargeRequestAsMap)
      This method creates a stripe charge tariff.
      java.lang.String createIntent​(java.lang.String orderId, java.lang.String stripeConnectId, java.lang.String paymentMethodId, java.lang.Long bruttoAmount, java.lang.Long nettoAmount)
      Creates payment intent for current seller by payment method and amount.
      java.util.Map<java.lang.String,​java.lang.Object> createPaymentMethod​(java.util.LinkedHashMap<java.lang.String,​java.lang.Object> paymentMethod)
      Creates payment method and - if needed - customer for Stripe.
      java.util.Map<java.lang.String,​java.lang.String> getAmountByTariff​(java.lang.String tariff)
      This method returns data as map.
      java.util.Map<java.lang.String,​java.lang.Object> getContractEndDate​(java.lang.String createdDate, java.lang.String pattern)
      This method does return time.
      java.util.Map<java.lang.String,​java.lang.Object> getContractEndDateFromTimestamp​(java.lang.String created, java.lang.String pattern)
      This method does return time.
      java.lang.String getCurrency()
      This method returns currency name
      java.util.List<com.stripe.model.Invoice> getInvoices()
      This method returns data as list.
      java.util.Map<java.lang.String,​java.lang.Object> getPaymentMethod​(java.lang.String paymentMethodId)
      This method returns data as map.
      java.util.List<com.stripe.model.PaymentMethod> getPaymentMethods​(java.lang.String type)
      This method returns data as list.
      java.util.List<com.stripe.model.Product> getProducts()
      This method returns data as list.
      java.math.BigDecimal getServiceFee()
      Service fee coefficient.
      java.util.Map<java.lang.String,​java.lang.Object> getSubscription()
      This method returns data as object.
      boolean isStripeKeysDefined()
      This method does return boolean result.
      boolean isTariffEquals​(java.lang.String tariff)
      This method does return boolean result.
      java.lang.String obtain3DSecureLink​(java.lang.String paymentIntentId)
      Obtains link for payment intent authorization.
      java.util.Map<java.lang.String,​com.stripe.model.TaxRate> obtainAllTaxRates()
      Obtains all tax rates from Stripe api.
      com.stripe.model.Payout payoutToVendor​(Seller vendor, long amount)
      Moves funds from stripe account to bank/card.
      void removePaymentMethod​(java.lang.String paymentMethodId)
      This method returns data as object.
      java.lang.String transferToVendor​(Order order, long amount)
      Attempts to execute a Transfer from the service to given order seller's Account.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • StripeServiceMock

        public StripeServiceMock()
    • Method Detail

      • isStripeKeysDefined

        public boolean isStripeKeysDefined()
        Description copied from interface: StripeService
        This method does return boolean result.
        Specified by:
        isStripeKeysDefined in interface StripeService
        Returns:
        value as boolean
      • getServiceFee

        public java.math.BigDecimal getServiceFee()
        Description copied from interface: StripeService
        Service fee coefficient.
        Specified by:
        getServiceFee in interface StripeService
        Returns:
        coefficient
      • calculateServiceFee

        public java.math.BigDecimal calculateServiceFee​(java.math.BigDecimal amount)
        Description copied from interface: StripeService
        Calculates service fee for given amount.
        Specified by:
        calculateServiceFee in interface StripeService
        Parameters:
        amount - amount
        Returns:
        service fee
      • getCurrency

        public java.lang.String getCurrency()
        Description copied from interface: StripeService
        This method returns currency name
        Specified by:
        getCurrency in interface StripeService
        Returns:
        value as string
      • cancelIntent

        public com.stripe.model.PaymentIntent cancelIntent​(java.lang.String paymentIntentId)
        Description copied from interface: StripeService
        This method cancel created payment intent in Stripe
        Specified by:
        cancelIntent in interface StripeService
        Parameters:
        paymentIntentId - identification from payment intent in Stripe
        Returns:
        stripe payment intent entity
      • createIntent

        public java.lang.String createIntent​(java.lang.String orderId,
                                             java.lang.String stripeConnectId,
                                             java.lang.String paymentMethodId,
                                             java.lang.Long bruttoAmount,
                                             java.lang.Long nettoAmount)
        Description copied from interface: StripeService
        Creates payment intent for current seller by payment method and amount.
        Specified by:
        createIntent in interface StripeService
        Parameters:
        orderId - id of the order for metadata
        stripeConnectId - id of the stripe connect account for vendor
        paymentMethodId - payment method ID.
        bruttoAmount - amount with tax in the smallest currency unit, e.g. for 100$ expected value would be 10000 (that means to be cents).
        nettoAmount - net amount in the smallest currency unit, e.g. for 100$ expected value would be 10000 (that means to be cents).
        Returns:
        created intent ID
      • changePaymentMethod

        public boolean changePaymentMethod​(java.lang.String paymentIntentId,
                                           java.lang.String paymentMethodId)
        Description copied from interface: StripeService
        Changes the payment method for the given payment intent.
        Specified by:
        changePaymentMethod in interface StripeService
        Parameters:
        paymentIntentId - id of intent
        paymentMethodId - id of a new using in the intent payment method
        Returns:
        true if successful
      • obtain3DSecureLink

        public java.lang.String obtain3DSecureLink​(java.lang.String paymentIntentId)
        Description copied from interface: StripeService
        Obtains link for payment intent authorization.
        Specified by:
        obtain3DSecureLink in interface StripeService
        Parameters:
        paymentIntentId - intent id
        Returns:
        link
      • payoutToVendor

        public com.stripe.model.Payout payoutToVendor​(Seller vendor,
                                                      long amount)
        Description copied from interface: StripeService
        Moves funds from stripe account to bank/card.
        Specified by:
        payoutToVendor in interface StripeService
        Parameters:
        vendor - seller
        amount - amount
        Returns:
        stripe payout
      • chargeSepa

        public java.lang.String chargeSepa​(java.util.LinkedHashMap<java.lang.String,​java.lang.Object> chargeRequestAsMap)
                                    throws com.stripe.exception.StripeException
        Description copied from interface: StripeService
        This method creates a stripe charge entity.
        Specified by:
        chargeSepa in interface StripeService
        Parameters:
        chargeRequestAsMap - map-representation of database entity
        Returns:
        optional value to externally interaction
        Throws:
        com.stripe.exception.StripeException - in create charge
      • chargeCreditCard

        public java.lang.String chargeCreditCard​(java.util.LinkedHashMap<java.lang.String,​java.lang.Object> chargeRequestAsMap)
                                          throws com.stripe.exception.StripeException
        Description copied from interface: StripeService
        This method creates a charge for payment.
        Specified by:
        chargeCreditCard in interface StripeService
        Parameters:
        chargeRequestAsMap - map-representation of charge request
        Returns:
        value as text
        Throws:
        com.stripe.exception.StripeException - in create token and customer
      • chargeTariffSepa

        public void chargeTariffSepa​(java.util.LinkedHashMap<java.lang.String,​java.lang.Object> chargeRequestAsMap)
                              throws com.stripe.exception.StripeException
        Description copied from interface: StripeService
        This method creates a stripe charge tariff.
        Specified by:
        chargeTariffSepa in interface StripeService
        Parameters:
        chargeRequestAsMap - map-representation of database entity
        Throws:
        com.stripe.exception.StripeException - in create charge tariff
      • chargeTariffCreditCard

        public void chargeTariffCreditCard​(java.util.LinkedHashMap<java.lang.String,​java.lang.Object> chargeRequestAsMap)
                                    throws com.stripe.exception.StripeException
        Description copied from interface: StripeService
        This method creates a charge tariff for payment.
        Specified by:
        chargeTariffCreditCard in interface StripeService
        Parameters:
        chargeRequestAsMap - map-representation of charge request
        Throws:
        com.stripe.exception.StripeException - in create token, customer and update subscription
      • getAmountByTariff

        public java.util.Map<java.lang.String,​java.lang.String> getAmountByTariff​(java.lang.String tariff)
        Description copied from interface: StripeService
        This method returns data as map.
        Specified by:
        getAmountByTariff in interface StripeService
        Parameters:
        tariff - field for filter and return data
        Returns:
        data as map
      • getInvoices

        public java.util.List<com.stripe.model.Invoice> getInvoices()
        Description copied from interface: StripeService
        This method returns data as list.
        Specified by:
        getInvoices in interface StripeService
        Returns:
        data as list
      • getProducts

        public java.util.List<com.stripe.model.Product> getProducts()
        Description copied from interface: StripeService
        This method returns data as list.
        Specified by:
        getProducts in interface StripeService
        Returns:
        data as list
      • createPaymentMethod

        public java.util.Map<java.lang.String,​java.lang.Object> createPaymentMethod​(java.util.LinkedHashMap<java.lang.String,​java.lang.Object> paymentMethod)
        Description copied from interface: StripeService
        Creates payment method and - if needed - customer for Stripe.
        Specified by:
        createPaymentMethod in interface StripeService
        Parameters:
        paymentMethod - data
        Returns:
        map as object
      • removePaymentMethod

        public void removePaymentMethod​(java.lang.String paymentMethodId)
        Description copied from interface: StripeService
        This method returns data as object.
        Specified by:
        removePaymentMethod in interface StripeService
        Parameters:
        paymentMethodId - field for filter and return data
      • getPaymentMethods

        public java.util.List<com.stripe.model.PaymentMethod> getPaymentMethods​(java.lang.String type)
        Description copied from interface: StripeService
        This method returns data as list.
        Specified by:
        getPaymentMethods in interface StripeService
        Parameters:
        type - field for filter and return data
        Returns:
        data as list
      • getPaymentMethod

        public java.util.Map<java.lang.String,​java.lang.Object> getPaymentMethod​(java.lang.String paymentMethodId)
        Description copied from interface: StripeService
        This method returns data as map.
        Specified by:
        getPaymentMethod in interface StripeService
        Parameters:
        paymentMethodId - field for filter and return data
        Returns:
        data as map
      • getSubscription

        public java.util.Map<java.lang.String,​java.lang.Object> getSubscription()
        Description copied from interface: StripeService
        This method returns data as object.
        Specified by:
        getSubscription in interface StripeService
        Returns:
        map as object
      • calculateTaxRate

        public java.util.Map<java.lang.String,​java.lang.Object> calculateTaxRate​(java.lang.String amount,
                                                                                       java.lang.String countryIsoCode)
        Description copied from interface: StripeService
        This method returns data as object.
        Specified by:
        calculateTaxRate in interface StripeService
        Parameters:
        amount - from this amount will be calculated a tax value
        countryIsoCode - field for filter and return data
        Returns:
        map as object
      • obtainAllTaxRates

        public java.util.Map<java.lang.String,​com.stripe.model.TaxRate> obtainAllTaxRates()
        Description copied from interface: StripeService
        Obtains all tax rates from Stripe api.
        Specified by:
        obtainAllTaxRates in interface StripeService
        Returns:
        map of country iso codes to tax rate
      • cancelSubscriptionAfterActivePeriod

        public java.lang.String cancelSubscriptionAfterActivePeriod​(java.lang.String sellerId)
        Description copied from interface: StripeService
        This method cancels a stripe subscription after expired stripe contract period.
        Specified by:
        cancelSubscriptionAfterActivePeriod in interface StripeService
        Parameters:
        sellerId - identification bean which will be find database entity
        Returns:
        value as text
      • cancelSubscriptionImmediately

        public java.lang.String cancelSubscriptionImmediately​(java.lang.String sellerId)
        Description copied from interface: StripeService
        This method cancels a stripe subscription immediately.
        Specified by:
        cancelSubscriptionImmediately in interface StripeService
        Parameters:
        sellerId - identification bean which will be find database entity
        Returns:
        value as text
      • getContractEndDate

        public java.util.Map<java.lang.String,​java.lang.Object> getContractEndDate​(java.lang.String createdDate,
                                                                                         java.lang.String pattern)
        Description copied from interface: StripeService
        This method does return time.
        Specified by:
        getContractEndDate in interface StripeService
        Parameters:
        createdDate - from which can extracted time
        pattern - pattern for formatting a date
        Returns:
        data as map
      • getContractEndDateFromTimestamp

        public java.util.Map<java.lang.String,​java.lang.Object> getContractEndDateFromTimestamp​(java.lang.String created,
                                                                                                      java.lang.String pattern)
        Description copied from interface: StripeService
        This method does return time.
        Specified by:
        getContractEndDateFromTimestamp in interface StripeService
        Parameters:
        created - from which can extracted time
        pattern - pattern for formatting a date
        Returns:
        data as map
      • isTariffEquals

        public boolean isTariffEquals​(java.lang.String tariff)
        Description copied from interface: StripeService
        This method does return boolean result.
        Specified by:
        isTariffEquals in interface StripeService
        Parameters:
        tariff - value to check
        Returns:
        value as boolean
      • transferToVendor

        public java.lang.String transferToVendor​(Order order,
                                                 long amount)
        Description copied from interface: StripeService
        Attempts to execute a Transfer from the service to given order seller's Account.
        Specified by:
        transferToVendor in interface StripeService
        Parameters:
        order - order
        amount - amount
        Returns:
        ID of created Transfer