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.util.Map<java.lang.String,​java.lang.Object> calculateTaxRate​(java.lang.String amount, java.lang.String countryIsoCode)
      This method returns data as object.
      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.
      java.lang.String chargeCreditCard​(java.util.LinkedHashMap<java.lang.String,​java.lang.Object> chargeRequestAsMap)
      This method creates a charge for payment.
      boolean 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.
      com.stripe.model.Account createAccount​(java.lang.String sellerId)
      Creates new custom account for Stripe Connect.
      java.lang.String createIntent​(java.lang.String paymentMethodId, java.math.BigDecimal amount)
      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 tax in percents.
      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.util.Map<java.lang.String,​com.stripe.model.TaxRate> obtainAllTaxRates()
      Obtains all tax rates from Stripe api.
      boolean payoutToSeller​(java.math.BigDecimal amount, java.lang.String sellerId)  
      void removePaymentMethod​(java.lang.String paymentMethodId)
      This method returns data as object.
      • 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 tax in percents.
        Specified by:
        getServiceFee in interface StripeService
        Returns:
        value of tax
      • 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
      • createIntent

        public java.lang.String createIntent​(java.lang.String paymentMethodId,
                                             java.math.BigDecimal amount)
        Description copied from interface: StripeService
        Creates payment intent for current seller by payment method and amount.
        Specified by:
        createIntent in interface StripeService
        Parameters:
        paymentMethodId - payment method ID.
        amount - amount.
        Returns:
        created intent ID
      • chargeIntent

        public boolean chargeIntent​(java.lang.String paymentIntentId)
        Description copied from interface: StripeService
        Charges payment intent.
        Specified by:
        chargeIntent in interface StripeService
        Parameters:
        paymentIntentId - id
        Returns:
        true if successful
      • 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
      • payoutToSeller

        public boolean payoutToSeller​(java.math.BigDecimal amount,
                                      java.lang.String sellerId)
        Specified by:
        payoutToSeller in interface StripeService
        Parameters:
        amount - amount
        sellerId - seller ID
        Returns:
        true if successful
      • createAccount

        public com.stripe.model.Account createAccount​(java.lang.String sellerId)
        Description copied from interface: StripeService
        Creates new custom account for Stripe Connect.
        Specified by:
        createAccount in interface StripeService
        Parameters:
        sellerId - ID of seller to payout
        Returns:
        created Account