Sha256: 9c1292032c3f4772df7d855ba96e92d42622e4a1ab4d581cd29b0a210fc54606

Contents?: true

Size: 714 Bytes

Versions: 1

Compression:

Stored size: 714 Bytes

Contents

module SolidusCulqi
  module Gateway
    def self.parent_class
      if SolidusCulqi::Support.solidus_earlier('2.3.x')
        Spree::Gateway
      else
        Spree::PaymentMethod::CreditCard
      end
    end

    def partial_method(partial_name)
      common_method('method_type', 'partial_name', partial_name)
    end

    def provider_method(provider_class)
      common_method('provider_class', 'gateway_class', provider_class)
    end

    private

    def common_method(old_method, new_method, method_value)
      if SolidusCulqi::Support.solidus_earlier('2.3.x')
        define_method(old_method) { method_value }
      else
        define_method(new_method) { method_value }
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
solidus_culqi-0.0.2 lib/solidus_culqi/gateway.rb