activemerchant 1.29.1 → 1.30.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 +48 -0
- data/CONTRIBUTORS +19 -0
- data/README.md +43 -41
- data/lib/active_merchant/billing/check.rb +15 -11
- data/lib/active_merchant/billing/credit_card.rb +5 -1
- data/lib/active_merchant/billing/credit_card_formatting.rb +8 -8
- data/lib/active_merchant/billing/gateway.rb +1 -1
- data/lib/active_merchant/billing/gateways/authorize_net.rb +9 -1
- data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +15 -4
- data/lib/active_merchant/billing/gateways/balanced.rb +9 -3
- data/lib/active_merchant/billing/gateways/banwire.rb +15 -1
- data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +6 -2
- data/lib/active_merchant/billing/gateways/beanstream.rb +26 -24
- data/lib/active_merchant/billing/gateways/braintree_blue.rb +5 -2
- data/lib/active_merchant/billing/gateways/cyber_source.rb +55 -22
- data/lib/active_merchant/billing/gateways/eway.rb +114 -171
- data/lib/active_merchant/billing/gateways/eway_managed.rb +52 -22
- data/lib/active_merchant/billing/gateways/firstdata_e4.rb +222 -0
- data/lib/active_merchant/billing/gateways/ideal_rabobank.rb +13 -2
- data/lib/active_merchant/billing/gateways/litle.rb +50 -19
- data/lib/active_merchant/billing/gateways/merchant_ware.rb +44 -9
- data/lib/active_merchant/billing/gateways/merchant_warrior.rb +190 -0
- data/lib/active_merchant/billing/gateways/moneris.rb +3 -5
- data/lib/active_merchant/billing/gateways/moneris_us.rb +1 -1
- data/lib/active_merchant/billing/gateways/nab_transact.rb +20 -3
- data/lib/active_merchant/billing/gateways/netbilling.rb +1 -0
- data/lib/active_merchant/billing/gateways/netpay.rb +223 -0
- data/lib/active_merchant/billing/gateways/optimal_payment.rb +18 -3
- data/lib/active_merchant/billing/gateways/orbital.rb +9 -5
- data/lib/active_merchant/billing/gateways/payment_express.rb +62 -1
- data/lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb +1 -1
- data/lib/active_merchant/billing/gateways/paypal_express.rb +2 -0
- data/lib/active_merchant/billing/gateways/pin.rb +157 -0
- data/lib/active_merchant/billing/gateways/qbms.rb +3 -2
- data/lib/active_merchant/billing/gateways/quickpay.rb +66 -28
- data/lib/active_merchant/billing/gateways/sage_pay.rb +6 -0
- data/lib/active_merchant/billing/gateways/smart_ps.rb +1 -1
- data/lib/active_merchant/billing/gateways/spreedly_core.rb +235 -0
- data/lib/active_merchant/billing/gateways/stripe.rb +1 -0
- data/lib/active_merchant/billing/gateways/wirecard.rb +15 -9
- data/lib/active_merchant/billing/gateways/worldpay.rb +15 -4
- data/lib/active_merchant/billing/integrations/payflow_link/helper.rb +4 -1
- data/lib/active_merchant/billing/integrations/paypal/notification.rb +39 -31
- data/lib/active_merchant/billing/integrations/quickpay/helper.rb +13 -10
- data/lib/active_merchant/billing/integrations/quickpay/notification.rb +14 -14
- data/lib/active_merchant/billing/integrations/sage_pay_form/helper.rb +2 -2
- data/lib/active_merchant/version.rb +1 -1
- data.tar.gz.sig +0 -0
- metadata +109 -49
- metadata.gz.sig +0 -0
|
@@ -6,34 +6,34 @@ module ActiveMerchant #:nodoc:
|
|
|
6
6
|
# It is also named TD Canada Trust Online Mart payment gateway.
|
|
7
7
|
# To learn more about the specification of Beanstream gateway, please read the OM_Direct_Interface_API.pdf,
|
|
8
8
|
# which you can get from your Beanstream account or get from me by email.
|
|
9
|
-
#
|
|
9
|
+
#
|
|
10
10
|
# == Supported transaction types by Beanstream:
|
|
11
11
|
# * +P+ - Purchase
|
|
12
12
|
# * +PA+ - Pre Authorization
|
|
13
13
|
# * +PAC+ - Pre Authorization Completion
|
|
14
|
-
#
|
|
14
|
+
#
|
|
15
15
|
# == Secure Payment Profiles:
|
|
16
16
|
# BeanStream supports payment profiles (vaults). This allows you to store cc information with BeanStream and process subsequent transactions with a customer id.
|
|
17
17
|
# Secure Payment Profiles must be enabled on your account (must be done over the phone).
|
|
18
18
|
# Your API Access Passcode must be set in Administration => account settings => order settings.
|
|
19
19
|
# To learn more about storing credit cards with the Beanstream gateway, please read the BEAN_Payment_Profiles.pdf (I had to phone BeanStream to request it.)
|
|
20
|
-
#
|
|
21
|
-
# == Notes
|
|
20
|
+
#
|
|
21
|
+
# == Notes
|
|
22
22
|
# * Adding of order products information is not implemented.
|
|
23
23
|
# * Ensure that country and province data is provided as a code such as "CA", "US", "QC".
|
|
24
24
|
# * login is the Beanstream merchant ID, username and password should be enabled in your Beanstream account and passed in using the <tt>:user</tt> and <tt>:password</tt> options.
|
|
25
25
|
# * Test your app with your true merchant id and test credit card information provided in the api pdf document.
|
|
26
|
-
# * Beanstream does not allow Payment Profiles to be deleted with their API. The accounts are 'closed', but have to be deleted manually.
|
|
27
|
-
#
|
|
26
|
+
# * Beanstream does not allow Payment Profiles to be deleted with their API. The accounts are 'closed', but have to be deleted manually.
|
|
27
|
+
#
|
|
28
28
|
# Example authorization (Beanstream PA transaction type):
|
|
29
|
-
#
|
|
29
|
+
#
|
|
30
30
|
# twenty = 2000
|
|
31
31
|
# gateway = BeanstreamGateway.new(
|
|
32
32
|
# :login => '100200000',
|
|
33
33
|
# :user => 'xiaobozz',
|
|
34
34
|
# :password => 'password'
|
|
35
35
|
# )
|
|
36
|
-
#
|
|
36
|
+
#
|
|
37
37
|
# credit_card = CreditCard.new(
|
|
38
38
|
# :number => '4030000010001234',
|
|
39
39
|
# :month => 8,
|
|
@@ -63,37 +63,39 @@ module ActiveMerchant #:nodoc:
|
|
|
63
63
|
# )
|
|
64
64
|
class BeanstreamGateway < Gateway
|
|
65
65
|
include BeanstreamCore
|
|
66
|
-
|
|
66
|
+
|
|
67
67
|
def authorize(money, source, options = {})
|
|
68
68
|
post = {}
|
|
69
69
|
add_amount(post, money)
|
|
70
70
|
add_invoice(post, options)
|
|
71
|
-
add_source(post, source)
|
|
71
|
+
add_source(post, source)
|
|
72
72
|
add_address(post, options)
|
|
73
73
|
add_transaction_type(post, :authorization)
|
|
74
|
+
add_customer_ip(post, options)
|
|
74
75
|
commit(post)
|
|
75
76
|
end
|
|
76
|
-
|
|
77
|
+
|
|
77
78
|
def purchase(money, source, options = {})
|
|
78
79
|
post = {}
|
|
79
|
-
add_amount(post, money)
|
|
80
|
+
add_amount(post, money)
|
|
80
81
|
add_invoice(post, options)
|
|
81
82
|
add_source(post, source)
|
|
82
83
|
add_address(post, options)
|
|
83
84
|
add_transaction_type(post, purchase_action(source))
|
|
85
|
+
add_customer_ip(post, options)
|
|
84
86
|
commit(post)
|
|
85
|
-
end
|
|
86
|
-
|
|
87
|
+
end
|
|
88
|
+
|
|
87
89
|
def void(authorization, options = {})
|
|
88
90
|
reference, amount, type = split_auth(authorization)
|
|
89
|
-
|
|
91
|
+
|
|
90
92
|
post = {}
|
|
91
93
|
add_reference(post, reference)
|
|
92
94
|
add_original_amount(post, amount)
|
|
93
95
|
add_transaction_type(post, void_action(type))
|
|
94
96
|
commit(post)
|
|
95
97
|
end
|
|
96
|
-
|
|
98
|
+
|
|
97
99
|
def recurring(money, source, options = {})
|
|
98
100
|
post = {}
|
|
99
101
|
add_amount(post, money)
|
|
@@ -104,7 +106,7 @@ module ActiveMerchant #:nodoc:
|
|
|
104
106
|
add_recurring_type(post, options)
|
|
105
107
|
commit(post)
|
|
106
108
|
end
|
|
107
|
-
|
|
109
|
+
|
|
108
110
|
def update_recurring(amount, source, options = {})
|
|
109
111
|
post = {}
|
|
110
112
|
add_recurring_amount(post, amount)
|
|
@@ -115,7 +117,7 @@ module ActiveMerchant #:nodoc:
|
|
|
115
117
|
add_recurring_service(post, options)
|
|
116
118
|
recurring_commit(post)
|
|
117
119
|
end
|
|
118
|
-
|
|
120
|
+
|
|
119
121
|
def cancel_recurring(options = {})
|
|
120
122
|
post = {}
|
|
121
123
|
add_recurring_operation_type(post, :cancel)
|
|
@@ -126,25 +128,25 @@ module ActiveMerchant #:nodoc:
|
|
|
126
128
|
def interac
|
|
127
129
|
@interac ||= BeanstreamInteracGateway.new(@options)
|
|
128
130
|
end
|
|
129
|
-
|
|
131
|
+
|
|
130
132
|
# To match the other stored-value gateways, like TrustCommerce,
|
|
131
133
|
# store and unstore need to be defined
|
|
132
134
|
def store(credit_card, options = {})
|
|
133
|
-
post = {}
|
|
135
|
+
post = {}
|
|
134
136
|
add_address(post, options)
|
|
135
|
-
add_credit_card(post, credit_card)
|
|
137
|
+
add_credit_card(post, credit_card)
|
|
136
138
|
add_secure_profile_variables(post,options)
|
|
137
139
|
commit(post, true)
|
|
138
140
|
end
|
|
139
|
-
|
|
141
|
+
|
|
140
142
|
#can't actually delete a secure profile with the supplicaed API. This function sets the status of the profile to closed (C).
|
|
141
143
|
#Closed profiles will have to removed manually.
|
|
142
144
|
def delete(vault_id)
|
|
143
145
|
update(vault_id, false, {:status => "C"})
|
|
144
146
|
end
|
|
145
|
-
|
|
147
|
+
|
|
146
148
|
alias_method :unstore, :delete
|
|
147
|
-
|
|
149
|
+
|
|
148
150
|
# Update the values (such as CC expiration) stored at
|
|
149
151
|
# the gateway. The CC number must be supplied in the
|
|
150
152
|
# CreditCard object.
|
|
@@ -68,8 +68,10 @@ module ActiveMerchant #:nodoc:
|
|
|
68
68
|
Braintree::Configuration.custom_user_agent = "ActiveMerchant #{ActiveMerchant::VERSION}"
|
|
69
69
|
|
|
70
70
|
if wiredump_device
|
|
71
|
-
Braintree::Configuration.logger = wiredump_device
|
|
71
|
+
Braintree::Configuration.logger = ((Logger === wiredump_device) ? wiredump_device : Logger.new(wiredump_device))
|
|
72
72
|
Braintree::Configuration.logger.level = Logger::DEBUG
|
|
73
|
+
else
|
|
74
|
+
Braintree::Configuration.logger.level = Logger::WARN
|
|
73
75
|
end
|
|
74
76
|
end
|
|
75
77
|
|
|
@@ -135,7 +137,8 @@ module ActiveMerchant #:nodoc:
|
|
|
135
137
|
{
|
|
136
138
|
:braintree_customer => (customer_hash(result.customer) if result.success?),
|
|
137
139
|
:customer_vault_id => (result.customer.id if result.success?)
|
|
138
|
-
}
|
|
140
|
+
},
|
|
141
|
+
:authorization => (result.customer.id if result.success?)
|
|
139
142
|
)
|
|
140
143
|
end
|
|
141
144
|
end
|
|
@@ -13,6 +13,7 @@ module ActiveMerchant #:nodoc:
|
|
|
13
13
|
# names.
|
|
14
14
|
#
|
|
15
15
|
# Important Notes
|
|
16
|
+
# * For checks you can purchase and store.
|
|
16
17
|
# * AVS and CVV only work against the production server. You will always
|
|
17
18
|
# get back X for AVS and no response for CVV against the test server.
|
|
18
19
|
# * Nexus is the list of states or provinces where you have a physical
|
|
@@ -131,10 +132,10 @@ module ActiveMerchant #:nodoc:
|
|
|
131
132
|
|
|
132
133
|
# Purchase is an auth followed by a capture
|
|
133
134
|
# You must supply an order_id in the options hash
|
|
134
|
-
def purchase(money,
|
|
135
|
+
def purchase(money, payment_method_or_reference, options = {})
|
|
135
136
|
requires!(options, :order_id)
|
|
136
137
|
setup_address_hash(options)
|
|
137
|
-
commit(build_purchase_request(money,
|
|
138
|
+
commit(build_purchase_request(money, payment_method_or_reference, options), options)
|
|
138
139
|
end
|
|
139
140
|
|
|
140
141
|
def void(identification, options = {})
|
|
@@ -154,10 +155,10 @@ module ActiveMerchant #:nodoc:
|
|
|
154
155
|
# Stores a customer subscription/profile with type "on-demand".
|
|
155
156
|
# To charge the card while creating a profile, pass
|
|
156
157
|
# options[:setup_fee] => money
|
|
157
|
-
def store(
|
|
158
|
+
def store(payment_method, options = {})
|
|
158
159
|
requires!(options, :order_id)
|
|
159
160
|
setup_address_hash(options)
|
|
160
|
-
commit(build_create_subscription_request(
|
|
161
|
+
commit(build_create_subscription_request(payment_method, options), options)
|
|
161
162
|
end
|
|
162
163
|
|
|
163
164
|
# Updates a customer subscription/profile
|
|
@@ -222,7 +223,7 @@ module ActiveMerchant #:nodoc:
|
|
|
222
223
|
|
|
223
224
|
def build_auth_request(money, creditcard_or_reference, options)
|
|
224
225
|
xml = Builder::XmlMarkup.new :indent => 2
|
|
225
|
-
|
|
226
|
+
add_payment_method_or_subscription(xml, money, creditcard_or_reference, options)
|
|
226
227
|
add_auth_service(xml)
|
|
227
228
|
add_business_rules_data(xml)
|
|
228
229
|
xml.target!
|
|
@@ -250,11 +251,15 @@ module ActiveMerchant #:nodoc:
|
|
|
250
251
|
xml.target!
|
|
251
252
|
end
|
|
252
253
|
|
|
253
|
-
def build_purchase_request(money,
|
|
254
|
+
def build_purchase_request(money, payment_method_or_reference, options)
|
|
254
255
|
xml = Builder::XmlMarkup.new :indent => 2
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
256
|
+
add_payment_method_or_subscription(xml, money, payment_method_or_reference, options)
|
|
257
|
+
if(payment_method_or_reference.respond_to?(:check?) && payment_method_or_reference.check?)
|
|
258
|
+
add_check_service(xml)
|
|
259
|
+
else
|
|
260
|
+
add_purchase_service(xml, options)
|
|
261
|
+
add_business_rules_data(xml)
|
|
262
|
+
end
|
|
258
263
|
xml.target!
|
|
259
264
|
end
|
|
260
265
|
|
|
@@ -297,16 +302,22 @@ module ActiveMerchant #:nodoc:
|
|
|
297
302
|
xml.target!
|
|
298
303
|
end
|
|
299
304
|
|
|
300
|
-
def build_create_subscription_request(
|
|
305
|
+
def build_create_subscription_request(payment_method, options)
|
|
301
306
|
options[:subscription] = (options[:subscription] || {}).merge(:frequency => "on-demand", :amount => 0, :automatic_renew => false)
|
|
302
307
|
|
|
303
308
|
xml = Builder::XmlMarkup.new :indent => 2
|
|
304
|
-
add_address(xml,
|
|
309
|
+
add_address(xml, payment_method, options[:billing_address], options)
|
|
305
310
|
add_purchase_data(xml, options[:setup_fee] || 0, true, options)
|
|
306
|
-
|
|
307
|
-
|
|
311
|
+
if payment_method.check?
|
|
312
|
+
add_check(xml, payment_method)
|
|
313
|
+
add_check_payment_method(xml)
|
|
314
|
+
add_check_service(xml, options) if options[:setup_fee]
|
|
315
|
+
else
|
|
316
|
+
add_creditcard(xml, payment_method)
|
|
317
|
+
add_creditcard_payment_method(xml)
|
|
318
|
+
add_purchase_service(xml, options) if options[:setup_fee]
|
|
319
|
+
end
|
|
308
320
|
add_subscription(xml, options)
|
|
309
|
-
add_purchase_service(xml, options) if options[:setup_fee]
|
|
310
321
|
add_subscription_create_service(xml, options)
|
|
311
322
|
add_business_rules_data(xml)
|
|
312
323
|
xml.target!
|
|
@@ -372,12 +383,12 @@ module ActiveMerchant #:nodoc:
|
|
|
372
383
|
end
|
|
373
384
|
end
|
|
374
385
|
|
|
375
|
-
def add_address(xml,
|
|
386
|
+
def add_address(xml, payment_method, address, options, shipTo = false)
|
|
376
387
|
requires!(options, :email)
|
|
377
388
|
|
|
378
389
|
xml.tag! shipTo ? 'shipTo' : 'billTo' do
|
|
379
|
-
xml.tag! 'firstName',
|
|
380
|
-
xml.tag! 'lastName',
|
|
390
|
+
xml.tag! 'firstName', payment_method.first_name if payment_method
|
|
391
|
+
xml.tag! 'lastName', payment_method.last_name if payment_method
|
|
381
392
|
xml.tag! 'street1', address[:address1]
|
|
382
393
|
xml.tag! 'street2', address[:address2] unless address[:address2].blank?
|
|
383
394
|
xml.tag! 'city', address[:city]
|
|
@@ -403,6 +414,14 @@ module ActiveMerchant #:nodoc:
|
|
|
403
414
|
end
|
|
404
415
|
end
|
|
405
416
|
|
|
417
|
+
def add_check(xml, check)
|
|
418
|
+
xml.tag! 'check' do
|
|
419
|
+
xml.tag! 'accountNumber', check.account_number
|
|
420
|
+
xml.tag! 'accountType', check.account_type[0]
|
|
421
|
+
xml.tag! 'bankTransitNumber', check.routing_number
|
|
422
|
+
end
|
|
423
|
+
end
|
|
424
|
+
|
|
406
425
|
def add_tax_service(xml)
|
|
407
426
|
xml.tag! 'taxService', {'run' => 'true'} do
|
|
408
427
|
xml.tag!('nexus', @options[:nexus]) unless @options[:nexus].blank?
|
|
@@ -447,6 +466,10 @@ module ActiveMerchant #:nodoc:
|
|
|
447
466
|
end
|
|
448
467
|
end
|
|
449
468
|
|
|
469
|
+
def add_check_service(xml)
|
|
470
|
+
xml.tag! 'ecDebitService', {'run' => 'true'}
|
|
471
|
+
end
|
|
472
|
+
|
|
450
473
|
def add_subscription_create_service(xml, options)
|
|
451
474
|
xml.tag! 'paySubscriptionCreateService', {'run' => 'true'}
|
|
452
475
|
end
|
|
@@ -491,14 +514,24 @@ module ActiveMerchant #:nodoc:
|
|
|
491
514
|
end
|
|
492
515
|
end
|
|
493
516
|
|
|
494
|
-
def
|
|
495
|
-
|
|
517
|
+
def add_check_payment_method(xml)
|
|
518
|
+
xml.tag! 'subscription' do
|
|
519
|
+
xml.tag! 'paymentMethod', "check"
|
|
520
|
+
end
|
|
521
|
+
end
|
|
522
|
+
|
|
523
|
+
def add_payment_method_or_subscription(xml, money, payment_method_or_reference, options)
|
|
524
|
+
if payment_method_or_reference.is_a?(String)
|
|
525
|
+
add_purchase_data(xml, money, true, options)
|
|
526
|
+
add_subscription(xml, options, payment_method_or_reference)
|
|
527
|
+
elsif payment_method_or_reference.check?
|
|
528
|
+
add_address(xml, payment_method_or_reference, options[:billing_address], options)
|
|
496
529
|
add_purchase_data(xml, money, true, options)
|
|
497
|
-
|
|
530
|
+
add_check(xml, payment_method_or_reference)
|
|
498
531
|
else
|
|
499
|
-
add_address(xml,
|
|
532
|
+
add_address(xml, payment_method_or_reference, options[:billing_address], options)
|
|
500
533
|
add_purchase_data(xml, money, true, options)
|
|
501
|
-
add_creditcard(xml,
|
|
534
|
+
add_creditcard(xml, payment_method_or_reference)
|
|
502
535
|
end
|
|
503
536
|
end
|
|
504
537
|
|