Sha256: a5e31bb471c8b6921de2453e72a8d68966f3bb7d313cf6af40c83488cbd52385

Contents?: true

Size: 1.35 KB

Versions: 3

Compression:

Stored size: 1.35 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(order)
      raise NotImplementedError, "Must be implemented in SaferpayPaymentPage or SaferpayTransaction"
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
solidus_six_saferpay-0.5.0 app/models/spree/payment_method/saferpay_payment_method.rb
solidus_six_saferpay-0.4.0 app/models/spree/payment_method/saferpay_payment_method.rb
solidus_six_saferpay-0.3.0 app/models/spree/payment_method/saferpay_payment_method.rb