Sha256: ec2ff03456737ef3ea5923d0b44095fe2add272d43bea8f890f1180b4e135c02

Contents?: true

Size: 745 Bytes

Versions: 2

Compression:

Stored size: 745 Bytes

Contents

# frozen_string_literal: true

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

2 entries across 2 versions & 1 rubygems

Version Path
solidus_culqi-0.1.1 lib/solidus_culqi/gateway.rb
solidus_culqi-0.1.0 lib/solidus_culqi/gateway.rb