Sha256: d87b93f0d2be62aa61e65aa26694cb03299d1174db3545480e34f52b6a7ebc07

Contents?: true

Size: 1.34 KB

Versions: 10

Compression:

Stored size: 1.34 KB

Contents

module Spree
  class PaymentMethod::SaferpayPaymentMethod < PaymentMethod::CreditCard
    include RouteAccess

    AVAILABLE_PAYMENT_METHODS = %w(ALIPAY AMEX BANCONTACT BONUS DINERS DIRECTDEBIT EPRZELEWY EPS GIROPAY IDEAL INVOICE JCB MAESTRO MASTERCARD MYONE PAYPAL PAYDIREKT POSTCARD POSTFINANCE SAFERPAYTEST SOFORT TWINT UNIONPAY VISA VPAY)

    delegate :try_void, to: :gateway

    preference :as_iframe, :boolean, default: true

    preference :require_liability_shift, :boolean, default: true

    # Configure all available Payment Methods for the Saferpay API as
    # preferences
    AVAILABLE_PAYMENT_METHODS.each do |six_payment_method|
      preference "payment_method_#{six_payment_method.downcase}", :boolean, default: false
    end

    def enabled_payment_methods
      AVAILABLE_PAYMENT_METHODS.select do |six_payment_method|
        public_send("preferred_payment_method_#{six_payment_method.downcase}")
      end
    end

    def payment_source_class
      Spree::SixSaferpayPayment
    end

    def profiles_supported?
      false
    end

    # We want to automatically capture the payment when the order is completed
    def auto_capture
      true
    end

    def partial_name
      'saferpay_payment'
    end

    def init_path
      raise NotImplementedError, "Must be implemented in SaferpayPaymentPage or SaferpayTransaction"
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
solidus_six_saferpay-0.1.8.1 app/models/spree/payment_method/saferpay_payment_method.rb
solidus_six_saferpay-0.2.0 app/models/spree/payment_method/saferpay_payment_method.rb
solidus_six_saferpay-0.1.8 app/models/spree/payment_method/saferpay_payment_method.rb
solidus_six_saferpay-0.1.7 app/models/spree/payment_method/saferpay_payment_method.rb
solidus_six_saferpay-0.1.5 app/models/spree/payment_method/saferpay_payment_method.rb
solidus_six_saferpay-0.1.4 app/models/spree/payment_method/saferpay_payment_method.rb
solidus_six_saferpay-0.1.3 app/models/spree/payment_method/saferpay_payment_method.rb
solidus_six_saferpay-0.1.2 app/models/spree/payment_method/saferpay_payment_method.rb
solidus_six_saferpay-0.1.1 app/models/spree/payment_method/saferpay_payment_method.rb
solidus_six_saferpay-0.1.0 app/models/spree/payment_method/saferpay_payment_method.rb