Sha256: 7db9be924fad53e515ec91c96323ae2ec598b13a5636bf1d1831f3c8de27b287

Contents?: true

Size: 1.4 KB

Versions: 8

Compression:

Stored size: 1.4 KB

Contents

module ActiveMerchant #:nodoc:
  module Billing #:nodoc:
    module Integrations #:nodoc:
      module TwoCheckout
        autoload 'Helper', File.dirname(__FILE__) + '/two_checkout/helper'
        autoload 'Return', File.dirname(__FILE__) + '/two_checkout/return'
        autoload 'Notification', File.dirname(__FILE__) + '/two_checkout/notification'

        mattr_accessor :payment_routine
        self.payment_routine = :single_page

        def self.service_url
          case self.payment_routine
          when :multi_page
            'https://www.2checkout.com/checkout/purchase'
          when :single_page
            'https://www.2checkout.com/checkout/spurchase'
          else
            raise StandardError, "Integration payment routine set to an invalid value: #{self.payment_routine}"
          end
        end

        def self.service_url=(service_url)
          # Note: do not use this method, it is here for backward compatibility
          # Use the payment_routine method to change service_url
          if service_url =~ /spurchase/
            self.payment_routine = :single_page
          else
            self.payment_routine = :multi_page
          end
        end


        def self.notification(post, options = {})
          Notification.new(post, options)
        end

        def self.return(query_string, options = {})
          Return.new(query_string, options)
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
activemerchant-1.43.3 lib/active_merchant/billing/integrations/two_checkout.rb
activemerchant-1.43.1 lib/active_merchant/billing/integrations/two_checkout.rb
activemerchant-1.43.0 lib/active_merchant/billing/integrations/two_checkout.rb
activemerchant-1.42.9 lib/active_merchant/billing/integrations/two_checkout.rb
activemerchant-1.42.8 lib/active_merchant/billing/integrations/two_checkout.rb
activemerchant-1.42.7 lib/active_merchant/billing/integrations/two_checkout.rb
activemerchant-1.42.6 lib/active_merchant/billing/integrations/two_checkout.rb
activemerchant-1.42.5 lib/active_merchant/billing/integrations/two_checkout.rb