Sha256: dd94c579ace0605ccc8f7368d6f426c41b77575ab76365f6be2497a62ed887fb

Contents?: true

Size: 1.43 KB

Versions: 1

Compression:

Stored size: 1.43 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 = :multi_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)
        end  
        
        def self.return(query_string, options = {})
          Return.new(query_string)
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
activemerchant-1.22.0 lib/active_merchant/billing/integrations/two_checkout.rb