Sha256: 37936e50e3dc43475590e2ae22b5a8c5f6b5869ea938137a8e48810a8111aeab

Contents?: true

Size: 1.58 KB

Versions: 10

Compression:

Stored size: 1.58 KB

Contents

module ActiveMerchant
  module Billing
    module Integrations
      module Citrus
        autoload :Helper, File.dirname(__FILE__) + '/citrus/helper.rb'
        autoload :Notification, File.dirname(__FILE__) + '/citrus/notification.rb'
        autoload :Return, File.dirname(__FILE__) + '/citrus/return.rb'

        mattr_accessor :sandbox_url
        mattr_accessor :staging_url
        mattr_accessor :production_url

        self.sandbox_url = 'https://sandbox.citruspay.com/'
        self.staging_url = 'https://stg.citruspay.com/'
        self.production_url = 'https://www.citruspay.com/'

        def self.credential_based_url(options)
          pmt_url = options[:credential3]

          case ActiveMerchant::Billing::Base.integration_mode
          when :production
            self.production_url + pmt_url
          when :test
            self.sandbox_url    + pmt_url
          when :staging
          	self.staging_url    + pmt_url
          else
            raise StandardError, "Integration mode set to an invalid value: #{mode}"
          end
        end

        def self.helper(order, account, options = {})
          Helper.new(order, account, options)
        end

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

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

        def self.checksum(secret_key, payload_items )
          digest = OpenSSL::Digest::Digest.new('sha1')
		      OpenSSL::HMAC.hexdigest(digest, secret_key, payload_items)
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
activemerchant-1.42.4 lib/active_merchant/billing/integrations/citrus.rb
activemerchant-1.42.3 lib/active_merchant/billing/integrations/citrus.rb
activemerchant-1.42.2 lib/active_merchant/billing/integrations/citrus.rb
activemerchant-1.42.1 lib/active_merchant/billing/integrations/citrus.rb
activemerchant-1.42.0 lib/active_merchant/billing/integrations/citrus.rb
activemerchant-1.41.0 lib/active_merchant/billing/integrations/citrus.rb
activemerchant-1.40.0 lib/active_merchant/billing/integrations/citrus.rb
activemerchant-1.39.2 lib/active_merchant/billing/integrations/citrus.rb
activemerchant-1.39.1 lib/active_merchant/billing/integrations/citrus.rb
activemerchant-1.39.0 lib/active_merchant/billing/integrations/citrus.rb