Sha256: 301cf5963a4c7268aee6b8adc76055f93eb6bfcbdcff8057c25a17e23bdf41ea

Contents?: true

Size: 1.14 KB

Versions: 40

Compression:

Stored size: 1.14 KB

Contents

require 'active_merchant/billing/gateways/modern_payments_cim'

module ActiveMerchant #:nodoc:
  module Billing #:nodoc:
    class ModernPaymentsGateway < Gateway
      self.supported_countries = ModernPaymentsCimGateway.supported_countries
      self.supported_cardtypes = ModernPaymentsCimGateway.supported_cardtypes
      self.homepage_url = ModernPaymentsCimGateway.homepage_url
      self.display_name = ModernPaymentsCimGateway.display_name

      self.abstract_class = true

      def initialize(options = {})
        requires!(options, :login, :password)
        super
      end

      def purchase(money, credit_card, options = {})
        customer_response = cim.create_customer(options)
        return customer_response unless customer_response.success?

        customer_id = customer_response.params["create_customer_result"]

        card_response = cim.modify_customer_credit_card(customer_id, credit_card)
        return card_response unless card_response.success?

        cim.authorize_credit_card_payment(customer_id, money)
      end

      private
      def cim
        @cim ||= ModernPaymentsCimGateway.new(@options)
      end
    end
  end
end

Version data entries

40 entries across 40 versions & 3 rubygems

Version Path
activemerchant-1.61.0 lib/active_merchant/billing/gateways/modern_payments.rb
activemerchant-1.60.0 lib/active_merchant/billing/gateways/modern_payments.rb
activemerchant-1.59.0 lib/active_merchant/billing/gateways/modern_payments.rb
activemerchant-1.58.0 lib/active_merchant/billing/gateways/modern_payments.rb
activemerchant-1.57.0 lib/active_merchant/billing/gateways/modern_payments.rb
activemerchant-1.56.0 lib/active_merchant/billing/gateways/modern_payments.rb
activemerchant-1.55.0 lib/active_merchant/billing/gateways/modern_payments.rb
activemerchant-1.54.0 lib/active_merchant/billing/gateways/modern_payments.rb
activemerchant-1.53.0 lib/active_merchant/billing/gateways/modern_payments.rb
start_activemerchant-1.50.0 lib/active_merchant/billing/gateways/modern_payments.rb
solidus_backend-1.0.0.pre3 vendor/bundle/gems/activemerchant-1.48.0/lib/active_merchant/billing/gateways/modern_payments.rb
solidus_backend-1.0.0.pre2 vendor/bundle/gems/activemerchant-1.48.0/lib/active_merchant/billing/gateways/modern_payments.rb
activemerchant-1.52.0 lib/active_merchant/billing/gateways/modern_payments.rb
activemerchant-1.51.0 lib/active_merchant/billing/gateways/modern_payments.rb
solidus_backend-1.0.0.pre vendor/bundle/gems/activemerchant-1.48.0/lib/active_merchant/billing/gateways/modern_payments.rb
activemerchant-1.50.0 lib/active_merchant/billing/gateways/modern_payments.rb
activemerchant-1.49.0 lib/active_merchant/billing/gateways/modern_payments.rb
activemerchant-1.48.0 lib/active_merchant/billing/gateways/modern_payments.rb
activemerchant-1.47.0 lib/active_merchant/billing/gateways/modern_payments.rb
activemerchant-1.46.0 lib/active_merchant/billing/gateways/modern_payments.rb