johnreitano-activemerchant 1.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG +508 -0
- data/CONTRIBUTORS +134 -0
- data/MIT-LICENSE +20 -0
- data/README.rdoc +136 -0
- data/gem-public_cert.pem +20 -0
- data/lib/active_merchant/billing/avs_result.rb +98 -0
- data/lib/active_merchant/billing/base.rb +57 -0
- data/lib/active_merchant/billing/check.rb +68 -0
- data/lib/active_merchant/billing/credit_card.rb +159 -0
- data/lib/active_merchant/billing/credit_card_formatting.rb +21 -0
- data/lib/active_merchant/billing/credit_card_methods.rb +125 -0
- data/lib/active_merchant/billing/cvv_result.rb +38 -0
- data/lib/active_merchant/billing/expiry_date.rb +34 -0
- data/lib/active_merchant/billing/gateway.rb +163 -0
- data/lib/active_merchant/billing/gateways/authorize_net.rb +654 -0
- data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +736 -0
- data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +244 -0
- data/lib/active_merchant/billing/gateways/beanstream.rb +102 -0
- data/lib/active_merchant/billing/gateways/beanstream_interac.rb +54 -0
- data/lib/active_merchant/billing/gateways/bogus.rb +98 -0
- data/lib/active_merchant/billing/gateways/braintree.rb +17 -0
- data/lib/active_merchant/billing/gateways/card_stream.rb +230 -0
- data/lib/active_merchant/billing/gateways/cyber_source.rb +594 -0
- data/lib/active_merchant/billing/gateways/data_cash.rb +593 -0
- data/lib/active_merchant/billing/gateways/efsnet.rb +229 -0
- data/lib/active_merchant/billing/gateways/elavon.rb +134 -0
- data/lib/active_merchant/billing/gateways/eway.rb +277 -0
- data/lib/active_merchant/billing/gateways/exact.rb +222 -0
- data/lib/active_merchant/billing/gateways/first_pay.rb +172 -0
- data/lib/active_merchant/billing/gateways/instapay.rb +164 -0
- data/lib/active_merchant/billing/gateways/jetpay.rb +270 -0
- data/lib/active_merchant/billing/gateways/linkpoint.rb +449 -0
- data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +154 -0
- data/lib/active_merchant/billing/gateways/merchant_ware.rb +283 -0
- data/lib/active_merchant/billing/gateways/modern_payments.rb +36 -0
- data/lib/active_merchant/billing/gateways/modern_payments_cim.rb +220 -0
- data/lib/active_merchant/billing/gateways/moneris.rb +205 -0
- data/lib/active_merchant/billing/gateways/net_registry.rb +189 -0
- data/lib/active_merchant/billing/gateways/netbilling.rb +168 -0
- data/lib/active_merchant/billing/gateways/ogone.rb +279 -0
- data/lib/active_merchant/billing/gateways/pay_junction.rb +392 -0
- data/lib/active_merchant/billing/gateways/pay_secure.rb +120 -0
- data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +207 -0
- data/lib/active_merchant/billing/gateways/payflow/payflow_express_response.rb +39 -0
- data/lib/active_merchant/billing/gateways/payflow/payflow_response.rb +13 -0
- data/lib/active_merchant/billing/gateways/payflow.rb +236 -0
- data/lib/active_merchant/billing/gateways/payflow_express.rb +138 -0
- data/lib/active_merchant/billing/gateways/payflow_express_uk.rb +15 -0
- data/lib/active_merchant/billing/gateways/payflow_uk.rb +21 -0
- data/lib/active_merchant/billing/gateways/payment_express.rb +230 -0
- data/lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb +326 -0
- data/lib/active_merchant/billing/gateways/paypal/paypal_express_response.rb +38 -0
- data/lib/active_merchant/billing/gateways/paypal.rb +121 -0
- data/lib/active_merchant/billing/gateways/paypal_ca.rb +13 -0
- data/lib/active_merchant/billing/gateways/paypal_express.rb +130 -0
- data/lib/active_merchant/billing/gateways/paypal_express_common.rb +20 -0
- data/lib/active_merchant/billing/gateways/plugnpay.rb +292 -0
- data/lib/active_merchant/billing/gateways/psigate.rb +214 -0
- data/lib/active_merchant/billing/gateways/psl_card.rb +304 -0
- data/lib/active_merchant/billing/gateways/quickpay.rb +213 -0
- data/lib/active_merchant/billing/gateways/realex.rb +200 -0
- data/lib/active_merchant/billing/gateways/sage/sage_bankcard.rb +88 -0
- data/lib/active_merchant/billing/gateways/sage/sage_core.rb +116 -0
- data/lib/active_merchant/billing/gateways/sage/sage_virtual_check.rb +97 -0
- data/lib/active_merchant/billing/gateways/sage.rb +146 -0
- data/lib/active_merchant/billing/gateways/sage_pay.rb +309 -0
- data/lib/active_merchant/billing/gateways/sallie_mae.rb +144 -0
- data/lib/active_merchant/billing/gateways/secure_pay.rb +31 -0
- data/lib/active_merchant/billing/gateways/secure_pay_au.rb +157 -0
- data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +113 -0
- data/lib/active_merchant/billing/gateways/skip_jack.rb +453 -0
- data/lib/active_merchant/billing/gateways/smart_ps.rb +265 -0
- data/lib/active_merchant/billing/gateways/trans_first.rb +127 -0
- data/lib/active_merchant/billing/gateways/transax.rb +25 -0
- data/lib/active_merchant/billing/gateways/trust_commerce.rb +418 -0
- data/lib/active_merchant/billing/gateways/usa_epay.rb +194 -0
- data/lib/active_merchant/billing/gateways/verifi.rb +228 -0
- data/lib/active_merchant/billing/gateways/viaklix.rb +189 -0
- data/lib/active_merchant/billing/gateways/wirecard.rb +318 -0
- data/lib/active_merchant/billing/gateways.rb +18 -0
- data/lib/active_merchant/billing/integrations/action_view_helper.rb +79 -0
- data/lib/active_merchant/billing/integrations/bogus/helper.rb +17 -0
- data/lib/active_merchant/billing/integrations/bogus/notification.rb +11 -0
- data/lib/active_merchant/billing/integrations/bogus/return.rb +10 -0
- data/lib/active_merchant/billing/integrations/bogus.rb +23 -0
- data/lib/active_merchant/billing/integrations/chronopay/helper.rb +120 -0
- data/lib/active_merchant/billing/integrations/chronopay/notification.rb +158 -0
- data/lib/active_merchant/billing/integrations/chronopay/return.rb +10 -0
- data/lib/active_merchant/billing/integrations/chronopay.rb +23 -0
- data/lib/active_merchant/billing/integrations/gestpay/common.rb +42 -0
- data/lib/active_merchant/billing/integrations/gestpay/helper.rb +70 -0
- data/lib/active_merchant/billing/integrations/gestpay/notification.rb +85 -0
- data/lib/active_merchant/billing/integrations/gestpay/return.rb +10 -0
- data/lib/active_merchant/billing/integrations/gestpay.rb +25 -0
- data/lib/active_merchant/billing/integrations/helper.rb +93 -0
- data/lib/active_merchant/billing/integrations/hi_trust/helper.rb +58 -0
- data/lib/active_merchant/billing/integrations/hi_trust/notification.rb +59 -0
- data/lib/active_merchant/billing/integrations/hi_trust/return.rb +67 -0
- data/lib/active_merchant/billing/integrations/hi_trust.rb +27 -0
- data/lib/active_merchant/billing/integrations/nochex/helper.rb +68 -0
- data/lib/active_merchant/billing/integrations/nochex/notification.rb +94 -0
- data/lib/active_merchant/billing/integrations/nochex/return.rb +10 -0
- data/lib/active_merchant/billing/integrations/nochex.rb +88 -0
- data/lib/active_merchant/billing/integrations/notification.rb +62 -0
- data/lib/active_merchant/billing/integrations/paypal/helper.rb +119 -0
- data/lib/active_merchant/billing/integrations/paypal/notification.rb +154 -0
- data/lib/active_merchant/billing/integrations/paypal/return.rb +10 -0
- data/lib/active_merchant/billing/integrations/paypal.rb +39 -0
- data/lib/active_merchant/billing/integrations/quickpay/helper.rb +72 -0
- data/lib/active_merchant/billing/integrations/quickpay/notification.rb +74 -0
- data/lib/active_merchant/billing/integrations/quickpay.rb +17 -0
- data/lib/active_merchant/billing/integrations/return.rb +35 -0
- data/lib/active_merchant/billing/integrations/two_checkout/helper.rb +59 -0
- data/lib/active_merchant/billing/integrations/two_checkout/notification.rb +114 -0
- data/lib/active_merchant/billing/integrations/two_checkout/return.rb +17 -0
- data/lib/active_merchant/billing/integrations/two_checkout.rb +23 -0
- data/lib/active_merchant/billing/integrations.rb +29 -0
- data/lib/active_merchant/billing/response.rb +32 -0
- data/lib/active_merchant/billing.rb +9 -0
- data/lib/active_merchant/lib/connection.rb +170 -0
- data/lib/active_merchant/lib/country.rb +319 -0
- data/lib/active_merchant/lib/error.rb +4 -0
- data/lib/active_merchant/lib/post_data.rb +22 -0
- data/lib/active_merchant/lib/posts_data.rb +47 -0
- data/lib/active_merchant/lib/requires_parameters.rb +16 -0
- data/lib/active_merchant/lib/utils.rb +18 -0
- data/lib/active_merchant/lib/validateable.rb +76 -0
- data/lib/active_merchant.rb +46 -0
- data/lib/certs/cacert.pem +7815 -0
- data/lib/support/gateway_support.rb +58 -0
- metadata +218 -0
@@ -0,0 +1,38 @@
|
|
1
|
+
module ActiveMerchant
|
2
|
+
module Billing
|
3
|
+
# Result of the Card Verification Value check
|
4
|
+
# http://www.bbbonline.org/eExport/doc/MerchantGuide_cvv2.pdf
|
5
|
+
# Check additional codes from cybersource website
|
6
|
+
class CVVResult
|
7
|
+
|
8
|
+
MESSAGES = {
|
9
|
+
'D' => 'Suspicious transaction',
|
10
|
+
'I' => 'Failed data validation check',
|
11
|
+
'M' => 'Match',
|
12
|
+
'N' => 'No Match',
|
13
|
+
'P' => 'Not Processed',
|
14
|
+
'S' => 'Should have been present',
|
15
|
+
'U' => 'Issuer unable to process request',
|
16
|
+
'X' => 'Card does not support verification'
|
17
|
+
}
|
18
|
+
|
19
|
+
def self.messages
|
20
|
+
MESSAGES
|
21
|
+
end
|
22
|
+
|
23
|
+
attr_reader :code, :message
|
24
|
+
|
25
|
+
def initialize(code)
|
26
|
+
@code = code.upcase unless code.blank?
|
27
|
+
@message = MESSAGES[@code]
|
28
|
+
end
|
29
|
+
|
30
|
+
def to_hash
|
31
|
+
{
|
32
|
+
'code' => code,
|
33
|
+
'message' => message
|
34
|
+
}
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'date'
|
2
|
+
|
3
|
+
module ActiveMerchant
|
4
|
+
module Billing
|
5
|
+
class CreditCard
|
6
|
+
class ExpiryDate #:nodoc:
|
7
|
+
attr_reader :month, :year
|
8
|
+
def initialize(month, year)
|
9
|
+
@month = month.to_i
|
10
|
+
@year = year.to_i
|
11
|
+
end
|
12
|
+
|
13
|
+
def expired? #:nodoc:
|
14
|
+
Time.now.utc > expiration
|
15
|
+
end
|
16
|
+
|
17
|
+
def expiration #:nodoc:
|
18
|
+
begin
|
19
|
+
Time.utc(year, month, month_days, 23, 59, 59)
|
20
|
+
rescue ArgumentError
|
21
|
+
Time.at(0).utc
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
private
|
26
|
+
def month_days
|
27
|
+
mdays = [nil,31,28,31,30,31,30,31,31,30,31,30,31]
|
28
|
+
mdays[2] = 29 if Date.leap?(year)
|
29
|
+
mdays[month]
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,163 @@
|
|
1
|
+
require 'net/http'
|
2
|
+
require 'net/https'
|
3
|
+
require 'active_merchant/billing/response'
|
4
|
+
|
5
|
+
module ActiveMerchant #:nodoc:
|
6
|
+
module Billing #:nodoc:
|
7
|
+
#
|
8
|
+
# == Description
|
9
|
+
# The Gateway class is the base class for all ActiveMerchant gateway implementations.
|
10
|
+
#
|
11
|
+
# The standard list of gateway functions that most concrete gateway subclasses implement is:
|
12
|
+
#
|
13
|
+
# * <tt>purchase(money, creditcard, options = {})</tt>
|
14
|
+
# * <tt>authorize(money, creditcard, options = {})</tt>
|
15
|
+
# * <tt>capture(money, authorization, options = {})</tt>
|
16
|
+
# * <tt>void(identification, options = {})</tt>
|
17
|
+
# * <tt>credit(money, identification, options = {})</tt>
|
18
|
+
#
|
19
|
+
# Some gateways include features for recurring billing
|
20
|
+
#
|
21
|
+
# * <tt>recurring(money, creditcard, options = {})</tt>
|
22
|
+
#
|
23
|
+
# Some gateways also support features for storing credit cards:
|
24
|
+
#
|
25
|
+
# * <tt>store(creditcard, options = {})</tt>
|
26
|
+
# * <tt>unstore(identification, options = {})</tt>
|
27
|
+
#
|
28
|
+
# === Gateway Options
|
29
|
+
# The options hash consists of the following options:
|
30
|
+
#
|
31
|
+
# * <tt>:order_id</tt> - The order number
|
32
|
+
# * <tt>:ip</tt> - The IP address of the customer making the purchase
|
33
|
+
# * <tt>:customer</tt> - The name, customer number, or other information that identifies the customer
|
34
|
+
# * <tt>:invoice</tt> - The invoice number
|
35
|
+
# * <tt>:merchant</tt> - The name or description of the merchant offering the product
|
36
|
+
# * <tt>:description</tt> - A description of the transaction
|
37
|
+
# * <tt>:email</tt> - The email address of the customer
|
38
|
+
# * <tt>:currency</tt> - The currency of the transaction. Only important when you are using a currency that is not the default with a gateway that supports multiple currencies.
|
39
|
+
# * <tt>:billing_address</tt> - A hash containing the billing address of the customer.
|
40
|
+
# * <tt>:shipping_address</tt> - A hash containing the shipping address of the customer.
|
41
|
+
#
|
42
|
+
# The <tt>:billing_address</tt>, and <tt>:shipping_address</tt> hashes can have the following keys:
|
43
|
+
#
|
44
|
+
# * <tt>:name</tt> - The full name of the customer.
|
45
|
+
# * <tt>:company</tt> - The company name of the customer.
|
46
|
+
# * <tt>:address1</tt> - The primary street address of the customer.
|
47
|
+
# * <tt>:address2</tt> - Additional line of address information.
|
48
|
+
# * <tt>:city</tt> - The city of the customer.
|
49
|
+
# * <tt>:state</tt> - The state of the customer. The 2 digit code for US and Canadian addresses. The full name of the state or province for foreign addresses.
|
50
|
+
# * <tt>:country</tt> - The [ISO 3166-1-alpha-2 code](http://www.iso.org/iso/country_codes/iso_3166_code_lists/english_country_names_and_code_elements.htm) for the customer.
|
51
|
+
# * <tt>:zip</tt> - The zip or postal code of the customer.
|
52
|
+
# * <tt>:phone</tt> - The phone number of the customer.
|
53
|
+
#
|
54
|
+
# == Implmenting new gateways
|
55
|
+
#
|
56
|
+
# See the {ActiveMerchant Guide to Contributing}[http://code.google.com/p/activemerchant/wiki/Contributing]
|
57
|
+
#
|
58
|
+
class Gateway
|
59
|
+
include PostsData
|
60
|
+
include RequiresParameters
|
61
|
+
include CreditCardFormatting
|
62
|
+
include Utils
|
63
|
+
|
64
|
+
DEBIT_CARDS = [ :switch, :solo ]
|
65
|
+
|
66
|
+
cattr_reader :implementations
|
67
|
+
@@implementations = []
|
68
|
+
|
69
|
+
def self.inherited(subclass)
|
70
|
+
super
|
71
|
+
@@implementations << subclass
|
72
|
+
end
|
73
|
+
|
74
|
+
# The format of the amounts used by the gateway
|
75
|
+
# :dollars => '12.50'
|
76
|
+
# :cents => '1250'
|
77
|
+
class_inheritable_accessor :money_format
|
78
|
+
self.money_format = :dollars
|
79
|
+
|
80
|
+
# The default currency for the transactions if no currency is provided
|
81
|
+
class_inheritable_accessor :default_currency
|
82
|
+
|
83
|
+
# The countries of merchants the gateway supports
|
84
|
+
class_inheritable_accessor :supported_countries
|
85
|
+
self.supported_countries = []
|
86
|
+
|
87
|
+
# The supported card types for the gateway
|
88
|
+
class_inheritable_accessor :supported_cardtypes
|
89
|
+
self.supported_cardtypes = []
|
90
|
+
|
91
|
+
class_inheritable_accessor :homepage_url
|
92
|
+
class_inheritable_accessor :display_name
|
93
|
+
|
94
|
+
# The application making the calls to the gateway
|
95
|
+
# Useful for things like the PayPal build notation (BN) id fields
|
96
|
+
superclass_delegating_accessor :application_id
|
97
|
+
self.application_id = 'ActiveMerchant'
|
98
|
+
|
99
|
+
attr_reader :options
|
100
|
+
|
101
|
+
# Use this method to check if your gateway of interest supports a credit card of some type
|
102
|
+
def self.supports?(card_type)
|
103
|
+
supported_cardtypes.include?(card_type.to_sym)
|
104
|
+
end
|
105
|
+
|
106
|
+
def self.card_brand(source)
|
107
|
+
result = source.respond_to?(:brand) ? source.brand : source.type
|
108
|
+
result.to_s.downcase
|
109
|
+
end
|
110
|
+
|
111
|
+
def card_brand(source)
|
112
|
+
self.class.card_brand(source)
|
113
|
+
end
|
114
|
+
|
115
|
+
# Initialize a new gateway.
|
116
|
+
#
|
117
|
+
# See the documentation for the gateway you will be using to make sure there are no other
|
118
|
+
# required options.
|
119
|
+
def initialize(options = {})
|
120
|
+
end
|
121
|
+
|
122
|
+
# Are we running in test mode?
|
123
|
+
def test?
|
124
|
+
Base.gateway_mode == :test
|
125
|
+
end
|
126
|
+
|
127
|
+
private # :nodoc: all
|
128
|
+
|
129
|
+
def name
|
130
|
+
self.class.name.scan(/\:\:(\w+)Gateway/).flatten.first
|
131
|
+
end
|
132
|
+
|
133
|
+
def amount(money)
|
134
|
+
return nil if money.nil?
|
135
|
+
cents = if money.respond_to?(:cents)
|
136
|
+
warn "Support for Money objects is deprecated and will be removed from a future release of ActiveMerchant. Please use an Integer value in cents"
|
137
|
+
money.cents
|
138
|
+
else
|
139
|
+
money
|
140
|
+
end
|
141
|
+
|
142
|
+
if money.is_a?(String) or cents.to_i < 0
|
143
|
+
raise ArgumentError, 'money amount must be a positive Integer in cents.'
|
144
|
+
end
|
145
|
+
|
146
|
+
if self.money_format == :cents
|
147
|
+
cents.to_s
|
148
|
+
else
|
149
|
+
sprintf("%.2f", cents.to_f / 100)
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
153
|
+
def currency(money)
|
154
|
+
money.respond_to?(:currency) ? money.currency : self.default_currency
|
155
|
+
end
|
156
|
+
|
157
|
+
def requires_start_date_or_issue_number?(credit_card)
|
158
|
+
return false if card_brand(credit_card).blank?
|
159
|
+
DEBIT_CARDS.include?(card_brand(credit_card).to_sym)
|
160
|
+
end
|
161
|
+
end
|
162
|
+
end
|
163
|
+
end
|