yetanothernguyen-activemerchant 1.16.0 → 1.21.0
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 +95 -0
- data/CONTRIBUTORS +29 -0
- data/lib/active_merchant/billing/credit_card.rb +105 -19
- data/lib/active_merchant/billing/credit_card_methods.rb +5 -1
- data/lib/active_merchant/billing/gateway.rb +1 -1
- data/lib/active_merchant/billing/gateways/authorize_net.rb +24 -2
- data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +104 -18
- data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +110 -4
- data/lib/active_merchant/billing/gateways/beanstream.rb +29 -1
- data/lib/active_merchant/billing/gateways/braintree_blue.rb +9 -4
- data/lib/active_merchant/billing/gateways/braintree_orange.rb +4 -0
- data/lib/active_merchant/billing/gateways/card_save.rb +23 -0
- data/lib/active_merchant/billing/gateways/certo_direct.rb +279 -0
- data/lib/active_merchant/billing/gateways/efsnet.rb +9 -9
- data/lib/active_merchant/billing/gateways/elavon.rb +2 -1
- data/lib/active_merchant/billing/gateways/epay.rb +12 -6
- data/lib/active_merchant/billing/gateways/eway_managed.rb +46 -12
- data/lib/active_merchant/billing/gateways/exact.rb +5 -0
- data/lib/active_merchant/billing/gateways/ideal/ideal_base.rb +3 -3
- data/lib/active_merchant/billing/gateways/ipay88.rb +157 -0
- data/lib/active_merchant/billing/gateways/iridium.rb +3 -3
- data/lib/active_merchant/billing/gateways/itransact.rb +450 -0
- data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +1 -0
- data/lib/active_merchant/billing/gateways/moneris.rb +4 -0
- data/lib/active_merchant/billing/gateways/nab_transact.rb +244 -0
- data/lib/active_merchant/billing/gateways/ogone.rb +94 -56
- data/lib/active_merchant/billing/gateways/optimal_payment.rb +277 -0
- data/lib/active_merchant/billing/gateways/orbital.rb +57 -34
- data/lib/active_merchant/billing/gateways/pay_junction.rb +6 -1
- data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +1 -0
- data/lib/active_merchant/billing/gateways/payflow/payflow_express_response.rb +2 -2
- data/lib/active_merchant/billing/gateways/payflow.rb +10 -2
- data/lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb +8 -5
- data/lib/active_merchant/billing/gateways/paypal_digital_goods.rb +43 -0
- data/lib/active_merchant/billing/gateways/paypal_express.rb +93 -40
- data/lib/active_merchant/billing/gateways/paypal_express_common.rb +8 -3
- data/lib/active_merchant/billing/gateways/qbms.rb +4 -0
- data/lib/active_merchant/billing/gateways/quickpay.rb +97 -22
- data/lib/active_merchant/billing/gateways/realex.rb +5 -1
- data/lib/active_merchant/billing/gateways/samurai.rb +121 -0
- data/lib/active_merchant/billing/gateways/secure_pay_au.rb +136 -49
- data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +1 -1
- data/lib/active_merchant/billing/gateways/skip_jack.rb +7 -2
- data/lib/active_merchant/billing/gateways/stripe.rb +51 -19
- data/lib/active_merchant/billing/gateways/usa_epay.rb +13 -184
- data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +1496 -0
- data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +206 -0
- data/lib/active_merchant/billing/gateways/verifi.rb +2 -2
- data/lib/active_merchant/billing/gateways/viaklix.rb +1 -1
- data/lib/active_merchant/billing/gateways/worldpay.rb +1 -1
- data/lib/active_merchant/billing/integrations/action_view_helper.rb +6 -2
- data/lib/active_merchant/billing/integrations/authorize_net_sim/helper.rb +228 -0
- data/lib/active_merchant/billing/integrations/authorize_net_sim/notification.rb +340 -0
- data/lib/active_merchant/billing/integrations/authorize_net_sim.rb +38 -0
- data/lib/active_merchant/billing/integrations/direc_pay/helper.rb +4 -4
- data/lib/active_merchant/billing/integrations/dwolla/helper.rb +31 -0
- data/lib/active_merchant/billing/integrations/dwolla/notification.rb +55 -0
- data/lib/active_merchant/billing/integrations/dwolla/return.rb +38 -0
- data/lib/active_merchant/billing/integrations/dwolla.rb +30 -0
- data/lib/active_merchant/billing/integrations/helper.rb +19 -2
- data/lib/active_merchant/billing/integrations/ipay88/helper.rb +120 -0
- data/lib/active_merchant/billing/integrations/ipay88/return.rb +121 -0
- data/lib/active_merchant/billing/integrations/ipay88.rb +40 -0
- data/lib/active_merchant/billing/integrations/nochex.rb +1 -1
- data/lib/active_merchant/billing/integrations/payflow_link/helper.rb +100 -0
- data/lib/active_merchant/billing/integrations/payflow_link/notification.rb +78 -0
- data/lib/active_merchant/billing/integrations/payflow_link.rb +21 -0
- data/lib/active_merchant/billing/integrations/sage_pay_form/encryption.rb +4 -4
- data/lib/active_merchant/billing/integrations/sage_pay_form/helper.rb +18 -2
- data/lib/active_merchant/billing/integrations/two_checkout.rb +1 -2
- data/lib/active_merchant/railtie.rb +7 -7
- data/lib/active_merchant/railtie.rb.orig +19 -0
- data/lib/active_merchant/version.rb +1 -1
- data/lib/active_merchant.rb +23 -10
- data/lib/active_merchant.rb.orig +78 -0
- metadata +147 -63
- data/lib/active_merchant/common/connection.rb +0 -177
- data/lib/active_merchant/common/country.rb +0 -328
- data/lib/active_merchant/common/error.rb +0 -26
- data/lib/active_merchant/common/post_data.rb +0 -24
- data/lib/active_merchant/common/posts_data.rb +0 -63
- data/lib/active_merchant/common/requires_parameters.rb +0 -16
- data/lib/active_merchant/common/utils.rb +0 -22
- data/lib/active_merchant/common/validateable.rb +0 -81
- data/lib/active_merchant/common.rb +0 -14
- data/lib/certs/cacert.pem +0 -7815
data/CHANGELOG
CHANGED
@@ -1,5 +1,100 @@
|
|
1
1
|
= ActiveMerchant CHANGELOG
|
2
2
|
|
3
|
+
== Version 1.21.0 (March 7, 2012)
|
4
|
+
|
5
|
+
* Stripe: Add support for passing IP [collision]
|
6
|
+
* Merchant e-Solutions: pass expiration date when purchasing with a stored credit card [chrisyoung]
|
7
|
+
* Braintree: Fix passing custom processor ids to old accounts [maxsilver]
|
8
|
+
* Authorize.net CIM: Add validation mode option to create_customer_profile_request [jwood]
|
9
|
+
* eWay Managed: Include transaction number in response params [jamsi]
|
10
|
+
* Fix various hash ordering issues exposed by Ruby 1.8 [ntalbott]
|
11
|
+
* Authorize.Net CIM: Add WEB echeck type [deathbob]
|
12
|
+
* Move Braintree from the gemspec to the Gemfile [ntalbott]
|
13
|
+
* Add CertoDirect gateway [hron]
|
14
|
+
* Authorize.Net CIM: Add option for setting a custom delimiter [bmorton]
|
15
|
+
* Authorize.Net CIM: Add 3.1 response fields [bmorton]
|
16
|
+
* Authorize.Net CIM: Misc fixes and doc improvements [bmorton]
|
17
|
+
* Authorize.Net CIM: Fix error when order is blank [KeeperPat]
|
18
|
+
* Beanstream: Add recurring payments support [castiglione]
|
19
|
+
* Make ePay password optional [ePay]
|
20
|
+
* Quickpay: skip testmode if transaction provided [brentmc79]
|
21
|
+
* Payflow: add additional fields [thorstadt]
|
22
|
+
* Authorize.Net CIM: Add get_customer_profile_ids [howaboutwe]
|
23
|
+
* PayPal Express: Add support for BrandName and Custom fields [exviva]
|
24
|
+
* Payflow: Handle dates with leading zeros [jcoleman]
|
25
|
+
* Authorize.Net CIM: Add CCV code support & improve tests [tgarnett]
|
26
|
+
* Add Authorize.Net SIM integration [courtland & rdp]
|
27
|
+
* Secure Pay AU: Handle periodic payments [tommeier]
|
28
|
+
* Viaklix: Add discover as a supported card type [waelchatila]
|
29
|
+
* Improvements to testing infrastructure for integrations [jduff]
|
30
|
+
* Add NAB Transact (AU) Gateway [tommeier]
|
31
|
+
|
32
|
+
== Version 1.20.4 (February 22, 2012)
|
33
|
+
|
34
|
+
* Fix json dependency
|
35
|
+
|
36
|
+
== Version 1.20.3 (February 7, 2012)
|
37
|
+
|
38
|
+
* Various fixes to support Ruby 1.9 [wisq]
|
39
|
+
* SkipJack: Fix partial capture [jduff]
|
40
|
+
* Optimal Payments: submit region when outside North America [jduff]
|
41
|
+
* USA ePay: Add void and refund support [duff/ntalbott]
|
42
|
+
* Add first digits to credit card [codyfauser]
|
43
|
+
* Orbital: fixes to authentication and order id [Soleone]
|
44
|
+
* Stripe: fixes to purchase method [duff/ntalbott]
|
45
|
+
|
46
|
+
== Version 1.20.2 (January 16, 2012)
|
47
|
+
|
48
|
+
* Remove authorize/capture support for Stripe [gdb]
|
49
|
+
|
50
|
+
== Version 1.20.1 (December 22, 2011)
|
51
|
+
|
52
|
+
* PayflowExpressUk: Fix parsing street2 from response [odorcicd]
|
53
|
+
* AuthorizeNet: Support tracking id [odorcicd]
|
54
|
+
* SagePay Form: Map billing address to shipping address [jduff]
|
55
|
+
|
56
|
+
== Version 1.20.0 (November 14, 2011)
|
57
|
+
|
58
|
+
* Add support for USA ePay Advanced SOAP interface [matthewcalebsmith/jduff]
|
59
|
+
* Beanstram: fix purchase with Secure Profile [pitr/jduff]
|
60
|
+
* Orbital: various fixes [Soleone]
|
61
|
+
* Add Samuari gateway by Fee Fighters [jkrall/odorcicd]
|
62
|
+
* Lock money gem to 3.7.1 or less since newer versions break in 1.9 [jduff]
|
63
|
+
* Braintree: handle gateway rejected transactions gracefully [braintreeps/jduff]
|
64
|
+
* Ogone: support different signature encryptors, custom currency and eci [ZenCocoon/rymai/jduff]
|
65
|
+
* Payflow Link: use secure token [jduff]
|
66
|
+
* Added refund method to Exact, Pay Junction and Skip Jack gateways [jduff]
|
67
|
+
* Elavon: added test url [kylekeesling/jduff]
|
68
|
+
* Fix redundent errors when credit card is expired [castiglione/jduff]
|
69
|
+
* Two Checkout: update service url [vampirechicken/jduff]
|
70
|
+
|
71
|
+
== Version 1.18.1 (September 23, 2011)
|
72
|
+
|
73
|
+
* Braintree: allow setting merchant_account_id on initialize [jduff]
|
74
|
+
* Realex: only send letters and numbers in shipping code field [Soleone]
|
75
|
+
|
76
|
+
== Version 1.18.0 (September 23, 2011)
|
77
|
+
|
78
|
+
* NoChex: Update the URL that payment requests are posted to [caseywhalen/jduff]
|
79
|
+
* QBMS: fixed test mode check [Soleone]
|
80
|
+
* Realex: encode avs info with shipping address [Soleone]
|
81
|
+
* Add Dwolla offsite gateway [armsteadj1/jduff]
|
82
|
+
* Eway: pass email, customer, description and options to store [moklett/tobi]
|
83
|
+
* New dependency: active_utils gem [odorcicd]
|
84
|
+
* Optimal Payments: fix test mode check [jduff]
|
85
|
+
|
86
|
+
== Version 1.17.0 (August 23, 2011)
|
87
|
+
|
88
|
+
* Add Payflow Link integration [jduff]
|
89
|
+
* Add CardSave gateway [MrJaba/jduff]]
|
90
|
+
* Quickpay: Support protocal version 4 and fraud parameters [anderslemke/jduff]
|
91
|
+
* Authorize.net: Add status_recurring [mm1/jduff]
|
92
|
+
* Paypal Express: Support specifying :items with purchase [sivabudh/jduff]
|
93
|
+
* ePay: Add Sweden and Norway to supported countries [ePay/jduff]
|
94
|
+
* Brainreee: Support passing merchant_account_id parameter [braintreeps/jduff]
|
95
|
+
* Paypal Express: Remove deprecated Address field in favor of ShipToAddress[jduff]
|
96
|
+
* Add Optimal Payments gateway [jamie/jduff]
|
97
|
+
* Documentation improvements [dasch/nhemsley/jstorimer/jduff]
|
3
98
|
* Authorize.Net: Pass through first name, last name, and zip for refunds. [ntalbott]
|
4
99
|
|
5
100
|
== Version 1.16.0 (July 18, 2011)
|
data/CONTRIBUTORS
CHANGED
@@ -243,3 +243,32 @@ Paystation (July, 2011)
|
|
243
243
|
ePaymentPlans offsite gatway (June, 2011)
|
244
244
|
|
245
245
|
* Roberto Miranda (robertomiranda)
|
246
|
+
|
247
|
+
Optimal Payments (August, 2011)
|
248
|
+
|
249
|
+
* Jamie Macey (jamie)
|
250
|
+
|
251
|
+
CardSave (August, 2011)
|
252
|
+
|
253
|
+
* Tom Crinson (MrJaba)
|
254
|
+
|
255
|
+
Dwolla (September, 2011)
|
256
|
+
|
257
|
+
* James Armstead (armsteadj1)
|
258
|
+
|
259
|
+
Samurai (November, 2011)
|
260
|
+
|
261
|
+
* Joshua Krall (jkrall)
|
262
|
+
|
263
|
+
CertoDirect Gateway (February, 2012)
|
264
|
+
|
265
|
+
* Aleksei Gusev (hron)
|
266
|
+
|
267
|
+
Authorize.Net SIM Integration (February, 2012)
|
268
|
+
|
269
|
+
* Roger Pack (rdp)
|
270
|
+
* Nick Rogers (courtland)
|
271
|
+
|
272
|
+
NAB Transact (AU) Gateway (February, 2012)
|
273
|
+
|
274
|
+
* Tom Meier (tommeier)
|
@@ -4,22 +4,34 @@ require 'active_merchant/billing/expiry_date'
|
|
4
4
|
|
5
5
|
module ActiveMerchant #:nodoc:
|
6
6
|
module Billing #:nodoc:
|
7
|
-
#
|
8
|
-
#
|
9
|
-
# but doesn't support the .save method as its not backed by a database.
|
7
|
+
# A +CreditCard+ object represents a physical credit card, and is capable of validating the various
|
8
|
+
# data associated with these.
|
10
9
|
#
|
11
|
-
#
|
12
|
-
#
|
13
|
-
#
|
10
|
+
# At the moment, the following credit card types are supported:
|
11
|
+
#
|
12
|
+
# * Visa
|
13
|
+
# * MasterCard
|
14
|
+
# * Discover
|
15
|
+
# * American Express
|
16
|
+
# * Diner's Club
|
17
|
+
# * JCB
|
18
|
+
# * Switch
|
19
|
+
# * Solo
|
20
|
+
# * Dankort
|
21
|
+
# * Maestro
|
22
|
+
# * Forbrugsforeningen
|
23
|
+
# * Laser
|
24
|
+
#
|
25
|
+
# For testing purposes, use the 'bogus' credit card type. This skips the vast majority of
|
26
|
+
# validations, allowing you to focus on your core concerns until you're ready to be more concerned
|
27
|
+
# with the details of particular credit cards or your gateway.
|
14
28
|
#
|
15
29
|
# == Testing With CreditCard
|
16
30
|
# Often when testing we don't care about the particulars of a given card type. When using the 'test'
|
17
|
-
# mode in your Gateway, there are six different valid card numbers: 1, 2, 3, 'success', 'fail',
|
31
|
+
# mode in your {Gateway}, there are six different valid card numbers: 1, 2, 3, 'success', 'fail',
|
18
32
|
# and 'error'.
|
19
33
|
#
|
20
|
-
|
21
|
-
# For details, see CreditCardMethods#valid_number?
|
22
|
-
#++
|
34
|
+
# For details, see {CreditCardMethods::ClassMethods#valid_number?}
|
23
35
|
#
|
24
36
|
# == Example Usage
|
25
37
|
# cc = CreditCard.new(
|
@@ -38,44 +50,102 @@ module ActiveMerchant #:nodoc:
|
|
38
50
|
include CreditCardMethods
|
39
51
|
include Validateable
|
40
52
|
|
41
|
-
## Attributes
|
42
|
-
|
43
53
|
cattr_accessor :require_verification_value
|
44
54
|
self.require_verification_value = true
|
45
55
|
|
46
|
-
#
|
47
|
-
|
56
|
+
# Returns or sets the credit card number.
|
57
|
+
#
|
58
|
+
# @return [String]
|
59
|
+
attr_accessor :number
|
60
|
+
|
61
|
+
# Returns or sets the expiry month for the card.
|
62
|
+
#
|
63
|
+
# @return [Integer]
|
64
|
+
attr_accessor :month
|
65
|
+
|
66
|
+
# Returns or sets the expiry year for the card.
|
67
|
+
#
|
68
|
+
# @return [Integer]
|
69
|
+
attr_accessor :year
|
70
|
+
|
71
|
+
# Returns or sets the credit card type.
|
72
|
+
#
|
73
|
+
# Valid card types are
|
74
|
+
#
|
75
|
+
# * +'visa'+
|
76
|
+
# * +'master'+
|
77
|
+
# * +'discover'+
|
78
|
+
# * +'american_express'+
|
79
|
+
# * +'diners_club'+
|
80
|
+
# * +'jcb'+
|
81
|
+
# * +'switch'+
|
82
|
+
# * +'solo'+
|
83
|
+
# * +'dankort'+
|
84
|
+
# * +'maestro'+
|
85
|
+
# * +'forbrugsforeningen'+
|
86
|
+
# * +'laser'+
|
87
|
+
#
|
88
|
+
# Or, if you wish to test your implementation, +'bogus'+.
|
89
|
+
#
|
90
|
+
# @return (String) the credit card type
|
91
|
+
attr_accessor :type
|
92
|
+
|
93
|
+
# Returns or sets the first name of the card holder.
|
94
|
+
#
|
95
|
+
# @return [String]
|
96
|
+
attr_accessor :first_name
|
97
|
+
|
98
|
+
# Returns or sets the last name of the card holder.
|
99
|
+
#
|
100
|
+
# @return [String]
|
101
|
+
attr_accessor :last_name
|
48
102
|
|
49
103
|
# Required for Switch / Solo cards
|
50
104
|
attr_accessor :start_month, :start_year, :issue_number
|
51
105
|
|
52
|
-
#
|
53
|
-
#
|
106
|
+
# Returns or sets the card verification value.
|
107
|
+
#
|
108
|
+
# This attribute is optional but recommended. The verification value is
|
109
|
+
# a {card security code}[http://en.wikipedia.org/wiki/Card_security_code]. If provided,
|
110
|
+
# the gateway will attempt to validate the value.
|
111
|
+
#
|
112
|
+
# @return [String] the verification value
|
54
113
|
attr_accessor :verification_value
|
55
114
|
|
56
115
|
alias_method :brand, :type
|
57
|
-
|
116
|
+
|
58
117
|
# Provides proxy access to an expiry date object
|
118
|
+
#
|
119
|
+
# @return [ExpiryDate]
|
59
120
|
def expiry_date
|
60
121
|
ExpiryDate.new(@month, @year)
|
61
122
|
end
|
62
123
|
|
124
|
+
# Returns whether the credit card has expired.
|
125
|
+
#
|
126
|
+
# @return +true+ if the card has expired, +false+ otherwise
|
63
127
|
def expired?
|
64
128
|
expiry_date.expired?
|
65
129
|
end
|
66
130
|
|
131
|
+
# Returns whether either the +first_name+ or the +last_name+ attributes has been set.
|
67
132
|
def name?
|
68
133
|
first_name? || last_name?
|
69
134
|
end
|
70
135
|
|
136
|
+
# Returns whether the +first_name+ attribute has been set.
|
71
137
|
def first_name?
|
72
138
|
@first_name.present?
|
73
139
|
end
|
74
140
|
|
141
|
+
# Returns whether the +last_name+ attribute has been set.
|
75
142
|
def last_name?
|
76
143
|
@last_name.present?
|
77
144
|
end
|
78
145
|
|
146
|
+
# Returns the full name of the card holder.
|
147
|
+
#
|
148
|
+
# @return [String] the full name of the card holder
|
79
149
|
def name
|
80
150
|
[@first_name, @last_name].compact.join(' ')
|
81
151
|
end
|
@@ -90,15 +160,31 @@ module ActiveMerchant #:nodoc:
|
|
90
160
|
!@verification_value.blank?
|
91
161
|
end
|
92
162
|
|
93
|
-
#
|
163
|
+
# Returns a display-friendly version of the card number.
|
164
|
+
#
|
165
|
+
# All but the last 4 numbers are replaced with an "X", and hyphens are
|
166
|
+
# inserted in order to improve legibility.
|
167
|
+
#
|
168
|
+
# @example
|
169
|
+
# credit_card = CreditCard.new(:number => "2132542376824338")
|
170
|
+
# credit_card.display_number # "XXXX-XXXX-XXXX-4338"
|
171
|
+
#
|
172
|
+
# @return [String] a display-friendly version of the card number
|
94
173
|
def display_number
|
95
174
|
self.class.mask(number)
|
96
175
|
end
|
176
|
+
|
177
|
+
def first_digits
|
178
|
+
self.class.first_digits(number)
|
179
|
+
end
|
97
180
|
|
98
181
|
def last_digits
|
99
182
|
self.class.last_digits(number)
|
100
183
|
end
|
101
184
|
|
185
|
+
# Validates the credit card details.
|
186
|
+
#
|
187
|
+
# Any validation errors are added to the {#errors} attribute.
|
102
188
|
def validate
|
103
189
|
validate_essential_attributes
|
104
190
|
|
@@ -154,7 +240,7 @@ module ActiveMerchant #:nodoc:
|
|
154
240
|
else
|
155
241
|
errors.add :month, "is not a valid month" unless valid_month?(@month)
|
156
242
|
errors.add :year, "expired" if expired?
|
157
|
-
errors.add :year, "is not a valid year" unless valid_expiry_year?(@year)
|
243
|
+
errors.add :year, "is not a valid year" unless expired? || valid_expiry_year?(@year)
|
158
244
|
end
|
159
245
|
end
|
160
246
|
|
@@ -14,7 +14,7 @@ module ActiveMerchant #:nodoc:
|
|
14
14
|
'dankort' => /^5019\d{12}$/,
|
15
15
|
'maestro' => /^(5[06-8]|6\d)\d{10,17}$/,
|
16
16
|
'forbrugsforeningen' => /^600722\d{10}$/,
|
17
|
-
'laser' => /^(6304|6706|6771
|
17
|
+
'laser' => /^(6304|6706|6709|6771(?!89))\d{8}(\d{4}|\d{6,7})?$/
|
18
18
|
}
|
19
19
|
|
20
20
|
def self.included(base)
|
@@ -84,6 +84,10 @@ module ActiveMerchant #:nodoc:
|
|
84
84
|
return nil
|
85
85
|
end
|
86
86
|
|
87
|
+
def first_digits(number)
|
88
|
+
number.to_s.slice(0,6)
|
89
|
+
end
|
90
|
+
|
87
91
|
def last_digits(number)
|
88
92
|
number.to_s.length <= 4 ? number : number.to_s.slice(-4..-1)
|
89
93
|
end
|
@@ -53,7 +53,7 @@ module ActiveMerchant #:nodoc:
|
|
53
53
|
#
|
54
54
|
# == Implmenting new gateways
|
55
55
|
#
|
56
|
-
# See the {ActiveMerchant Guide to Contributing}[
|
56
|
+
# See the {ActiveMerchant Guide to Contributing}[https://github.com/Shopify/active_merchant/wiki/Contributing]
|
57
57
|
#
|
58
58
|
class Gateway
|
59
59
|
include PostsData
|
@@ -19,7 +19,7 @@ module ActiveMerchant #:nodoc:
|
|
19
19
|
#
|
20
20
|
# Automated Recurring Billing (ARB) is an optional service for submitting and managing recurring, or subscription-based, transactions.
|
21
21
|
#
|
22
|
-
# To use recurring, update_recurring, and
|
22
|
+
# To use recurring, update_recurring, cancel_recurring and status_recurring ARB must be enabled for your account.
|
23
23
|
#
|
24
24
|
# Information about ARB is available on the {Authorize.Net website}[http://www.authorize.net/solutions/merchantsolutions/merchantservices/automatedrecurringbilling/].
|
25
25
|
# Information about the ARB API is available at the {Authorize.Net Integration Center}[http://developer.authorize.net/]
|
@@ -55,7 +55,8 @@ module ActiveMerchant #:nodoc:
|
|
55
55
|
RECURRING_ACTIONS = {
|
56
56
|
:create => 'ARBCreateSubscription',
|
57
57
|
:update => 'ARBUpdateSubscription',
|
58
|
-
:cancel => 'ARBCancelSubscription'
|
58
|
+
:cancel => 'ARBCancelSubscription',
|
59
|
+
:status => 'ARBGetSubscriptionStatus'
|
59
60
|
}
|
60
61
|
|
61
62
|
# Creates a new AuthorizeNetGateway
|
@@ -242,6 +243,19 @@ module ActiveMerchant #:nodoc:
|
|
242
243
|
recurring_commit(:cancel, request)
|
243
244
|
end
|
244
245
|
|
246
|
+
# Get Subscription Status of a recurring payment.
|
247
|
+
#
|
248
|
+
# This transaction gets the status of an existing Automated Recurring Billing (ARB) subscription. Your account must have ARB enabled.
|
249
|
+
#
|
250
|
+
# ==== Parameters
|
251
|
+
#
|
252
|
+
# * <tt>subscription_id</tt> -- A string containing the +subscription_id+ of the recurring payment already in place
|
253
|
+
# for a given credit card. (REQUIRED)
|
254
|
+
def status_recurring(subscription_id)
|
255
|
+
request = build_recurring_request(:status, :subscription_id => subscription_id)
|
256
|
+
recurring_commit(:status, request)
|
257
|
+
end
|
258
|
+
|
245
259
|
private
|
246
260
|
|
247
261
|
def commit(action, money, parameters)
|
@@ -306,6 +320,7 @@ module ActiveMerchant #:nodoc:
|
|
306
320
|
post[:delim_data] = "TRUE"
|
307
321
|
post[:delim_char] = ","
|
308
322
|
post[:encap_char] = "$"
|
323
|
+
post[:solution_ID] = application_id if application_id.present? && application_id != "ActiveMerchant"
|
309
324
|
|
310
325
|
request = post.merge(parameters).collect { |key, value| "x_#{key}=#{CGI.escape(value.to_s)}" }.join("&")
|
311
326
|
request
|
@@ -455,6 +470,13 @@ module ActiveMerchant #:nodoc:
|
|
455
470
|
xml.target!
|
456
471
|
end
|
457
472
|
|
473
|
+
# Builds body for ARBGetSubscriptionStatusRequest
|
474
|
+
def build_arb_status_subscription_request(xml, options)
|
475
|
+
xml.tag!('subscriptionId', options[:subscription_id])
|
476
|
+
|
477
|
+
xml.target!
|
478
|
+
end
|
479
|
+
|
458
480
|
# Adds subscription information
|
459
481
|
def add_arb_subscription(xml, options)
|
460
482
|
xml.tag!('subscription') do
|