forked from activemerchant/offsite_payments
-
Notifications
You must be signed in to change notification settings - Fork 0
/
offsite_payments.rb
39 lines (32 loc) · 1.08 KB
/
offsite_payments.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
require 'securerandom'
require 'cgi'
require "timeout"
require "socket"
require 'active_utils'
require "offsite_payments/helper"
require "offsite_payments/notification"
require "offsite_payments/return"
require "offsite_payments/integrations"
require "offsite_payments/action_view_helper"
I18n.enforce_available_locales = false
module OffsitePayments
# Return the matching integration module
# You can then get the notification from the module
# * <tt>bogus</tt>: Bogus - Does nothing (for testing)
# * <tt>chronopay</tt>: Chronopay
# * <tt>paypal</tt>: Paypal
#
# chronopay = OffsitePayments.integration('chronopay')
# notification = chronopay.notification(raw_post)
#
def self.integration(name)
Integrations.const_get("#{name.to_s.downcase}".camelize)
end
mattr_accessor :mode
self.mode = :production
# A check to see if we're in test mode
def self.test?
self.mode == :test
end
CURRENCIES_WITHOUT_FRACTIONS = [ 'BIF', 'BYR', 'CLP', 'CVE', 'DJF', 'GNF', 'HUF', 'ISK', 'JPY', 'KMF', 'KRW', 'PYG', 'RWF', 'TWD', 'UGX', 'VND', 'VUV', 'XAF', 'XOF', 'XPF' ]
end