Sha256: 5f1e6bae752e7902363105a4942cdfa521bbfae797815f6e497e3dbfb1f0ba4a

Contents?: true

Size: 1.17 KB

Versions: 125

Compression:

Stored size: 1.17 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
      
      def initialize(options = {})
        requires!(options, :login, :password)
        @options = options
        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

125 entries across 125 versions & 32 rubygems

Version Path
activemerchant-1.9.4 lib/active_merchant/billing/gateways/modern_payments.rb
activemerchant-1.9.3 lib/active_merchant/billing/gateways/modern_payments.rb
activemerchant-1.9.2 lib/active_merchant/billing/gateways/modern_payments.rb
n8_activemerchant-1.9.3 lib/active_merchant/billing/gateways/modern_payments.rb
maedana-activemerchant-1.9.1.1 lib/active_merchant/billing/gateways/modern_payments.rb
activemerchant-1.9.1 lib/active_merchant/billing/gateways/modern_payments.rb
johnreitano-activemerchant-1.5.11 lib/active_merchant/billing/gateways/modern_payments.rb
tomriley-active_merchant-1.4.2.11 lib/active_merchant/billing/gateways/modern_payments.rb
tomriley-active_merchant-1.4.2.10 lib/active_merchant/billing/gateways/modern_payments.rb
activemerchant-1.9.0 lib/active_merchant/billing/gateways/modern_payments.rb
activemerchant-1.8.0 lib/active_merchant/billing/gateways/modern_payments.rb
smulube-activemerchant-1.7.1.5 lib/active_merchant/billing/gateways/modern_payments.rb
smulube-activemerchant-1.7.1.4 lib/active_merchant/billing/gateways/modern_payments.rb
johnreitano-activemerchant-1.5.10 lib/active_merchant/billing/gateways/modern_payments.rb
activemerchant-1.7.3 lib/active_merchant/billing/gateways/modern_payments.rb
johnreitano-activemerchant-1.5.9 lib/active_merchant/billing/gateways/modern_payments.rb
smulube-activemerchant-1.7.1.3 lib/active_merchant/billing/gateways/modern_payments.rb
glebm-activemerchant-1.7.2.1 lib/active_merchant/billing/gateways/modern_payments.rb
activemerchant-1.7.2 lib/active_merchant/billing/gateways/modern_payments.rb
projectdx_activemerchant-1.7.1.20100817.3 lib/active_merchant/billing/gateways/modern_payments.rb