Sha256: 86ab3816b83545997eae9343c31875278eec5e3ddbcdd69ee6d70b22f66494fa

Contents?: true

Size: 1.14 KB

Versions: 54

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

54 entries across 54 versions & 4 rubygems

Version Path
swiss-activemerchant-1.0.6 lib/active_merchant/billing/gateways/modern_payments.rb
swiss-activemerchant-1.0.5 lib/active_merchant/billing/gateways/modern_payments.rb
swiss-activemerchant-1.0.4 lib/active_merchant/billing/gateways/modern_payments.rb
activemerchant-1.137.0 lib/active_merchant/billing/gateways/modern_payments.rb
swiss-activemerchant-1.0.2 lib/active_merchant/billing/gateways/modern_payments.rb
swiss-activemerchant-1.0.1 lib/active_merchant/billing/gateways/modern_payments.rb
activemerchant-1.133.0 lib/active_merchant/billing/gateways/modern_payments.rb
activemerchant-1.131.0 lib/active_merchant/billing/gateways/modern_payments.rb
activemerchant-1.130.0 lib/active_merchant/billing/gateways/modern_payments.rb
activemerchant-1.129.0 lib/active_merchant/billing/gateways/modern_payments.rb
activemerchant-1.126.0 lib/active_merchant/billing/gateways/modern_payments.rb
activemerchant-1.125.0 lib/active_merchant/billing/gateways/modern_payments.rb
archetype2142_activemerchant-1.124.0 lib/active_merchant/billing/gateways/modern_payments.rb
activemerchant-1.124.0 lib/active_merchant/billing/gateways/modern_payments.rb
activemerchant-1.123.0 lib/active_merchant/billing/gateways/modern_payments.rb
activemerchant-1.121.0 lib/active_merchant/billing/gateways/modern_payments.rb
activemerchant-1.120.0 lib/active_merchant/billing/gateways/modern_payments.rb
activemerchant-1.119.0 lib/active_merchant/billing/gateways/modern_payments.rb
activemerchant-1.118.0 lib/active_merchant/billing/gateways/modern_payments.rb
activemerchant-1.117.0 lib/active_merchant/billing/gateways/modern_payments.rb