Sha256: fac0fad6253b297751b42f8974f8841641c510ddc455aa8aa508c3bdf3669459

Contents?: true

Size: 1.13 KB

Versions: 50

Compression:

Stored size: 1.13 KB

Contents

require File.dirname(__FILE__) + '/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

50 entries across 50 versions & 5 rubygems

Version Path
tanga_activemerchant-1.38.0.5 lib/active_merchant/billing/gateways/modern_payments.rb
tanga_activemerchant-1.38.0.4 lib/active_merchant/billing/gateways/modern_payments.rb
tanga_activemerchant-1.38.0.3 lib/active_merchant/billing/gateways/modern_payments.rb
tanga_activemerchant-1.38.0.2 lib/active_merchant/billing/gateways/modern_payments.rb
solidus_backend-1.0.0.pre vendor/bundle/gems/activemerchant-1.44.1/lib/active_merchant/billing/gateways/modern_payments.rb
tanga_activemerchant-1.38.0.1 lib/active_merchant/billing/gateways/modern_payments.rb
tanga_activemerchant-1.38.0 lib/active_merchant/billing/gateways/modern_payments.rb
tanga_activemerchant-1.37.0 lib/active_merchant/billing/gateways/modern_payments.rb
activemerchant-1.45.0 lib/active_merchant/billing/gateways/modern_payments.rb
aktivemerchant-2.0.0 lib/active_merchant/billing/gateways/modern_payments.rb
activemerchant-1.44.1 lib/active_merchant/billing/gateways/modern_payments.rb
activemerchant-1.44.0 lib/active_merchant/billing/gateways/modern_payments.rb
activemerchant-1.43.3 lib/active_merchant/billing/gateways/modern_payments.rb
activemerchant-1.43.1 lib/active_merchant/billing/gateways/modern_payments.rb
activemerchant-1.43.0 lib/active_merchant/billing/gateways/modern_payments.rb
activemerchant-1.42.9 lib/active_merchant/billing/gateways/modern_payments.rb
activemerchant-1.42.8 lib/active_merchant/billing/gateways/modern_payments.rb
activemerchant-1.42.7 lib/active_merchant/billing/gateways/modern_payments.rb
activemerchant-1.42.6 lib/active_merchant/billing/gateways/modern_payments.rb
activemerchant-1.42.5 lib/active_merchant/billing/gateways/modern_payments.rb