activemerchant 1.105.0 → 1.107.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +99 -1
- data/README.md +2 -2
- data/lib/active_merchant/billing/credit_card_methods.rb +12 -3
- data/lib/active_merchant/billing/gateway.rb +22 -22
- data/lib/active_merchant/billing/gateways/adyen.rb +18 -7
- data/lib/active_merchant/billing/gateways/allied_wallet.rb +2 -2
- data/lib/active_merchant/billing/gateways/authorize_net.rb +19 -19
- data/lib/active_merchant/billing/gateways/authorize_net_arb.rb +11 -11
- data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +35 -35
- data/lib/active_merchant/billing/gateways/axcessms.rb +3 -3
- data/lib/active_merchant/billing/gateways/bambora_apac.rb +1 -1
- data/lib/active_merchant/billing/gateways/bank_frick.rb +1 -1
- data/lib/active_merchant/billing/gateways/banwire.rb +2 -2
- data/lib/active_merchant/billing/gateways/barclaycard_smartpay.rb +5 -5
- data/lib/active_merchant/billing/gateways/be2bill.rb +4 -4
- data/lib/active_merchant/billing/gateways/beanstream.rb +1 -1
- data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +27 -27
- data/lib/active_merchant/billing/gateways/beanstream_interac.rb +1 -1
- data/lib/active_merchant/billing/gateways/blue_pay.rb +8 -8
- data/lib/active_merchant/billing/gateways/blue_snap.rb +5 -2
- data/lib/active_merchant/billing/gateways/bogus.rb +20 -20
- data/lib/active_merchant/billing/gateways/borgun.rb +17 -6
- data/lib/active_merchant/billing/gateways/bpoint.rb +1 -1
- data/lib/active_merchant/billing/gateways/braintree_blue.rb +81 -77
- data/lib/active_merchant/billing/gateways/bridge_pay.rb +3 -3
- data/lib/active_merchant/billing/gateways/card_connect.rb +1 -1
- data/lib/active_merchant/billing/gateways/card_stream.rb +19 -19
- data/lib/active_merchant/billing/gateways/cc5.rb +7 -7
- data/lib/active_merchant/billing/gateways/cecabank.rb +3 -3
- data/lib/active_merchant/billing/gateways/cenpos.rb +3 -3
- data/lib/active_merchant/billing/gateways/checkout_v2.rb +20 -9
- data/lib/active_merchant/billing/gateways/clearhaus.rb +1 -1
- data/lib/active_merchant/billing/gateways/commercegate.rb +2 -2
- data/lib/active_merchant/billing/gateways/conekta.rb +1 -1
- data/lib/active_merchant/billing/gateways/creditcall.rb +4 -4
- data/lib/active_merchant/billing/gateways/ct_payment.rb +1 -1
- data/lib/active_merchant/billing/gateways/culqi.rb +2 -2
- data/lib/active_merchant/billing/gateways/cyber_source.rb +154 -91
- data/lib/active_merchant/billing/gateways/d_local.rb +4 -2
- data/lib/active_merchant/billing/gateways/data_cash.rb +33 -33
- data/lib/active_merchant/billing/gateways/decidir.rb +7 -2
- data/lib/active_merchant/billing/gateways/ebanx.rb +14 -2
- data/lib/active_merchant/billing/gateways/efsnet.rb +23 -23
- data/lib/active_merchant/billing/gateways/elavon.rb +70 -18
- data/lib/active_merchant/billing/gateways/element.rb +12 -4
- data/lib/active_merchant/billing/gateways/epay.rb +40 -40
- data/lib/active_merchant/billing/gateways/evo_ca.rb +11 -11
- data/lib/active_merchant/billing/gateways/eway.rb +3 -3
- data/lib/active_merchant/billing/gateways/eway_managed.rb +40 -40
- data/lib/active_merchant/billing/gateways/eway_rapid.rb +7 -7
- data/lib/active_merchant/billing/gateways/exact.rb +11 -11
- data/lib/active_merchant/billing/gateways/fat_zebra.rb +3 -2
- data/lib/active_merchant/billing/gateways/federated_canada.rb +5 -5
- data/lib/active_merchant/billing/gateways/firstdata_e4.rb +21 -21
- data/lib/active_merchant/billing/gateways/firstdata_e4_v27.rb +20 -20
- data/lib/active_merchant/billing/gateways/flo2cash.rb +4 -4
- data/lib/active_merchant/billing/gateways/forte.rb +8 -7
- data/lib/active_merchant/billing/gateways/garanti.rb +8 -8
- data/lib/active_merchant/billing/gateways/global_collect.rb +30 -24
- data/lib/active_merchant/billing/gateways/hdfc.rb +3 -3
- data/lib/active_merchant/billing/gateways/hps.rb +5 -3
- data/lib/active_merchant/billing/gateways/iats_payments.rb +32 -15
- data/lib/active_merchant/billing/gateways/inspire.rb +7 -7
- data/lib/active_merchant/billing/gateways/instapay.rb +3 -3
- data/lib/active_merchant/billing/gateways/ipp.rb +1 -1
- data/lib/active_merchant/billing/gateways/iridium.rb +12 -10
- data/lib/active_merchant/billing/gateways/itransact.rb +7 -7
- data/lib/active_merchant/billing/gateways/iveri.rb +6 -3
- data/lib/active_merchant/billing/gateways/ixopay.rb +22 -0
- data/lib/active_merchant/billing/gateways/jetpay.rb +4 -4
- data/lib/active_merchant/billing/gateways/jetpay_v2.rb +5 -5
- data/lib/active_merchant/billing/gateways/kushki.rb +34 -5
- data/lib/active_merchant/billing/gateways/latitude19.rb +2 -2
- data/lib/active_merchant/billing/gateways/linkpoint.rb +62 -62
- data/lib/active_merchant/billing/gateways/litle.rb +8 -3
- data/lib/active_merchant/billing/gateways/mastercard.rb +2 -2
- data/lib/active_merchant/billing/gateways/mercado_pago.rb +1 -0
- data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +5 -5
- data/lib/active_merchant/billing/gateways/merchant_one.rb +2 -2
- data/lib/active_merchant/billing/gateways/merchant_partners.rb +4 -4
- data/lib/active_merchant/billing/gateways/merchant_ware.rb +12 -12
- data/lib/active_merchant/billing/gateways/merchant_ware_version_four.rb +11 -11
- data/lib/active_merchant/billing/gateways/merchant_warrior.rb +12 -2
- data/lib/active_merchant/billing/gateways/mercury.rb +9 -9
- data/lib/active_merchant/billing/gateways/metrics_global.rb +15 -15
- data/lib/active_merchant/billing/gateways/migs.rb +13 -13
- data/lib/active_merchant/billing/gateways/modern_payments_cim.rb +7 -7
- data/lib/active_merchant/billing/gateways/monei.rb +19 -19
- data/lib/active_merchant/billing/gateways/moneris.rb +10 -10
- data/lib/active_merchant/billing/gateways/money_movers.rb +5 -5
- data/lib/active_merchant/billing/gateways/mundipagg.rb +1 -1
- data/lib/active_merchant/billing/gateways/nab_transact.rb +15 -15
- data/lib/active_merchant/billing/gateways/ncr_secure_pay.rb +1 -1
- data/lib/active_merchant/billing/gateways/net_registry.rb +6 -6
- data/lib/active_merchant/billing/gateways/netaxept.rb +4 -4
- data/lib/active_merchant/billing/gateways/netbanx.rb +14 -14
- data/lib/active_merchant/billing/gateways/netbilling.rb +12 -12
- data/lib/active_merchant/billing/gateways/netpay.rb +2 -2
- data/lib/active_merchant/billing/gateways/network_merchants.rb +5 -5
- data/lib/active_merchant/billing/gateways/ogone.rb +7 -7
- data/lib/active_merchant/billing/gateways/openpay.rb +2 -2
- data/lib/active_merchant/billing/gateways/opp.rb +13 -7
- data/lib/active_merchant/billing/gateways/optimal_payment.rb +13 -9
- data/lib/active_merchant/billing/gateways/orbital.rb +54 -12
- data/lib/active_merchant/billing/gateways/pac_net_raven.rb +7 -7
- data/lib/active_merchant/billing/gateways/pay_conex.rb +2 -2
- data/lib/active_merchant/billing/gateways/pay_gate_xml.rb +16 -16
- data/lib/active_merchant/billing/gateways/pay_junction.rb +16 -16
- data/lib/active_merchant/billing/gateways/pay_junction_v2.rb +18 -2
- data/lib/active_merchant/billing/gateways/pay_secure.rb +6 -6
- data/lib/active_merchant/billing/gateways/paybox_direct.rb +36 -36
- data/lib/active_merchant/billing/gateways/payflow.rb +7 -7
- data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +12 -12
- data/lib/active_merchant/billing/gateways/payflow_express.rb +4 -4
- data/lib/active_merchant/billing/gateways/payment_express.rb +9 -9
- data/lib/active_merchant/billing/gateways/paymill.rb +3 -3
- data/lib/active_merchant/billing/gateways/paypal.rb +1 -1
- data/lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb +5 -5
- data/lib/active_merchant/billing/gateways/paypal_express_common.rb +1 -1
- data/lib/active_merchant/billing/gateways/payscout.rb +5 -5
- data/lib/active_merchant/billing/gateways/paystation.rb +2 -2
- data/lib/active_merchant/billing/gateways/payu_latam.rb +3 -3
- data/lib/active_merchant/billing/gateways/payway.rb +12 -12
- data/lib/active_merchant/billing/gateways/pin.rb +16 -16
- data/lib/active_merchant/billing/gateways/plugnpay.rb +10 -10
- data/lib/active_merchant/billing/gateways/psigate.rb +26 -26
- data/lib/active_merchant/billing/gateways/psl_card.rb +4 -4
- data/lib/active_merchant/billing/gateways/qbms.rb +23 -23
- data/lib/active_merchant/billing/gateways/quantum.rb +4 -4
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_common.rb +95 -95
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb +9 -9
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_v4to7.rb +2 -2
- data/lib/active_merchant/billing/gateways/qvalent.rb +1 -1
- data/lib/active_merchant/billing/gateways/realex.rb +17 -10
- data/lib/active_merchant/billing/gateways/redsys.rb +24 -16
- data/lib/active_merchant/billing/gateways/safe_charge.rb +1 -1
- data/lib/active_merchant/billing/gateways/sage.rb +10 -10
- data/lib/active_merchant/billing/gateways/sage_pay.rb +35 -35
- data/lib/active_merchant/billing/gateways/sallie_mae.rb +2 -2
- data/lib/active_merchant/billing/gateways/secure_net.rb +9 -9
- data/lib/active_merchant/billing/gateways/secure_pay.rb +13 -13
- data/lib/active_merchant/billing/gateways/secure_pay_au.rb +16 -16
- data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +2 -2
- data/lib/active_merchant/billing/gateways/skip_jack.rb +8 -8
- data/lib/active_merchant/billing/gateways/smart_ps.rb +16 -16
- data/lib/active_merchant/billing/gateways/so_easy_pay.rb +6 -6
- data/lib/active_merchant/billing/gateways/spreedly_core.rb +4 -4
- data/lib/active_merchant/billing/gateways/stripe.rb +15 -10
- data/lib/active_merchant/billing/gateways/stripe_payment_intents.rb +50 -9
- data/lib/active_merchant/billing/gateways/swipe_checkout.rb +2 -2
- data/lib/active_merchant/billing/gateways/trans_first.rb +4 -4
- data/lib/active_merchant/billing/gateways/trust_commerce.rb +19 -19
- data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +110 -110
- data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +29 -29
- data/lib/active_merchant/billing/gateways/verifi.rb +10 -10
- data/lib/active_merchant/billing/gateways/viaklix.rb +6 -6
- data/lib/active_merchant/billing/gateways/visanet_peru.rb +6 -6
- data/lib/active_merchant/billing/gateways/webpay.rb +2 -2
- data/lib/active_merchant/billing/gateways/wirecard.rb +6 -6
- data/lib/active_merchant/billing/gateways/worldpay.rb +22 -20
- data/lib/active_merchant/billing/gateways/worldpay_online_payments.rb +32 -32
- data/lib/active_merchant/billing/gateways/worldpay_us.rb +2 -2
- data/lib/active_merchant/billing/network_tokenization_credit_card.rb +1 -1
- data/lib/active_merchant/connection.rb +1 -1
- data/lib/active_merchant/network_connection_retries.rb +3 -3
- data/lib/active_merchant/post_data.rb +1 -1
- data/lib/active_merchant/version.rb +1 -1
- data/lib/certs/cacert.pem +75 -0
- data/lib/support/ssl_verify.rb +2 -2
- data/lib/support/ssl_version.rb +2 -2
- metadata +4 -4
- data/lib/active_merchant/billing/gateways/moneris_us.rb +0 -352
@@ -79,6 +79,7 @@ module ActiveMerchant #:nodoc:
|
|
79
79
|
post = {}
|
80
80
|
|
81
81
|
add_creditcard(post, creditcard)
|
82
|
+
post[:is_billing] = true if options[:recurring]
|
82
83
|
|
83
84
|
commit(:post, 'credit_cards', post)
|
84
85
|
end
|
@@ -159,8 +160,8 @@ module ActiveMerchant #:nodoc:
|
|
159
160
|
success,
|
160
161
|
message_from(response),
|
161
162
|
response,
|
162
|
-
:
|
163
|
-
:
|
163
|
+
test: response['test'],
|
164
|
+
authorization: authorization_from(response, success, uri)
|
164
165
|
)
|
165
166
|
end
|
166
167
|
|
@@ -54,7 +54,7 @@ module ActiveMerchant #:nodoc:
|
|
54
54
|
end
|
55
55
|
|
56
56
|
def refund(money, authorization, options = {})
|
57
|
-
commit('refund', money, options.merge(:
|
57
|
+
commit('refund', money, options.merge(transactionid: authorization))
|
58
58
|
end
|
59
59
|
|
60
60
|
def credit(money, authorization, options = {})
|
@@ -122,10 +122,10 @@ module ActiveMerchant #:nodoc:
|
|
122
122
|
message = message_from(response)
|
123
123
|
|
124
124
|
Response.new(success?(response), message, response,
|
125
|
-
:
|
126
|
-
:
|
127
|
-
:
|
128
|
-
:
|
125
|
+
test: test?,
|
126
|
+
authorization: response['transactionid'],
|
127
|
+
avs_result: {code: response['avsresponse']},
|
128
|
+
cvv_result: response['cvvresponse']
|
129
129
|
)
|
130
130
|
end
|
131
131
|
|
@@ -25,14 +25,14 @@ module ActiveMerchant #:nodoc:
|
|
25
25
|
SENSITIVE_FIELDS = [:verification_str2, :expiry_date, :card_number]
|
26
26
|
|
27
27
|
BRANDS = {
|
28
|
-
:
|
29
|
-
:
|
30
|
-
:
|
31
|
-
:
|
32
|
-
:
|
28
|
+
visa: 'Visa',
|
29
|
+
master: 'Mastercard',
|
30
|
+
american_express: 'American Express',
|
31
|
+
jcb: 'JCB',
|
32
|
+
discover: 'Discover'
|
33
33
|
}
|
34
34
|
|
35
|
-
E4_BRANDS = BRANDS.merge({:
|
35
|
+
E4_BRANDS = BRANDS.merge({mastercard: 'Mastercard'})
|
36
36
|
|
37
37
|
DEFAULT_ECI = '07'
|
38
38
|
|
@@ -262,7 +262,7 @@ module ActiveMerchant #:nodoc:
|
|
262
262
|
address = options[:billing_address] || options[:address]
|
263
263
|
if address
|
264
264
|
address_values = []
|
265
|
-
[:address1, :zip, :city, :state, :country].each { |part| address_values << address[part].to_s }
|
265
|
+
[:address1, :zip, :city, :state, :country].each { |part| address_values << address[part].to_s.tr("\r\n", ' ').strip }
|
266
266
|
xml.tag! 'VerificationStr1', address_values.join('|')
|
267
267
|
end
|
268
268
|
|
@@ -298,11 +298,11 @@ module ActiveMerchant #:nodoc:
|
|
298
298
|
def add_credit_card_token(xml, store_authorization, options)
|
299
299
|
params = store_authorization.split(';')
|
300
300
|
credit_card = CreditCard.new(
|
301
|
-
:
|
302
|
-
:
|
303
|
-
:
|
304
|
-
:
|
305
|
-
:
|
301
|
+
brand: params[1],
|
302
|
+
first_name: params[2],
|
303
|
+
last_name: params[3],
|
304
|
+
month: params[4],
|
305
|
+
year: params[5])
|
306
306
|
|
307
307
|
xml.tag! 'TransarmorToken', params[0]
|
308
308
|
xml.tag! 'Expiry_Date', expdate(credit_card)
|
@@ -354,11 +354,11 @@ module ActiveMerchant #:nodoc:
|
|
354
354
|
end
|
355
355
|
|
356
356
|
Response.new(successful?(response), message_from(response), response,
|
357
|
-
:
|
358
|
-
:
|
359
|
-
:
|
360
|
-
:
|
361
|
-
:
|
357
|
+
test: test?,
|
358
|
+
authorization: successful?(response) ? response_authorization(action, response, credit_card) : '',
|
359
|
+
avs_result: {code: response[:avs]},
|
360
|
+
cvv_result: response[:cvv2],
|
361
|
+
error_code: standard_error_code(response)
|
362
362
|
)
|
363
363
|
end
|
364
364
|
|
@@ -420,10 +420,10 @@ module ActiveMerchant #:nodoc:
|
|
420
420
|
|
421
421
|
def parse_error(error)
|
422
422
|
{
|
423
|
-
:
|
424
|
-
:
|
425
|
-
:
|
426
|
-
:
|
423
|
+
transaction_approved: 'false',
|
424
|
+
error_number: error.code,
|
425
|
+
error_description: error.body,
|
426
|
+
ecommerce_error_code: error.body.gsub(/[^\d]/, '')
|
427
427
|
}
|
428
428
|
end
|
429
429
|
|
@@ -19,11 +19,11 @@ module ActiveMerchant #:nodoc:
|
|
19
19
|
SENSITIVE_FIELDS = [:cvdcode, :expiry_date, :card_number]
|
20
20
|
|
21
21
|
BRANDS = {
|
22
|
-
:
|
23
|
-
:
|
24
|
-
:
|
25
|
-
:
|
26
|
-
:
|
22
|
+
visa: 'Visa',
|
23
|
+
master: 'Mastercard',
|
24
|
+
american_express: 'American Express',
|
25
|
+
jcb: 'JCB',
|
26
|
+
discover: 'Discover'
|
27
27
|
}
|
28
28
|
|
29
29
|
DEFAULT_ECI = '07'
|
@@ -265,11 +265,11 @@ module ActiveMerchant #:nodoc:
|
|
265
265
|
def add_credit_card_token(xml, store_authorization, options)
|
266
266
|
params = store_authorization.split(';')
|
267
267
|
credit_card = CreditCard.new(
|
268
|
-
:
|
269
|
-
:
|
270
|
-
:
|
271
|
-
:
|
272
|
-
:
|
268
|
+
brand: params[1],
|
269
|
+
first_name: params[2],
|
270
|
+
last_name: params[3],
|
271
|
+
month: params[4],
|
272
|
+
year: params[5])
|
273
273
|
|
274
274
|
xml.tag! 'TransarmorToken', params[0]
|
275
275
|
xml.tag! 'Expiry_Date', expdate(credit_card)
|
@@ -319,7 +319,7 @@ module ActiveMerchant #:nodoc:
|
|
319
319
|
xml.tag! 'StoredCredentials' do
|
320
320
|
xml.tag! 'Indicator', stored_credential_indicator(xml, card, options)
|
321
321
|
if initiator = options.dig(:stored_credential, :initiator)
|
322
|
-
xml.tag! initiator == 'merchant' ? 'M' : 'C'
|
322
|
+
xml.tag! 'Initiation', initiator == 'merchant' ? 'M' : 'C'
|
323
323
|
end
|
324
324
|
if reason_type = options.dig(:stored_credential, :reason_type)
|
325
325
|
xml.tag! 'Schedule', reason_type == 'unscheduled' ? 'U' : 'S'
|
@@ -361,11 +361,11 @@ module ActiveMerchant #:nodoc:
|
|
361
361
|
end
|
362
362
|
|
363
363
|
Response.new(successful?(response), message_from(response), response,
|
364
|
-
:
|
365
|
-
:
|
366
|
-
:
|
367
|
-
:
|
368
|
-
:
|
364
|
+
test: test?,
|
365
|
+
authorization: successful?(response) ? response_authorization(action, response, credit_card) : '',
|
366
|
+
avs_result: {code: response[:avs]},
|
367
|
+
cvv_result: response[:cvv2],
|
368
|
+
error_code: standard_error_code(response)
|
369
369
|
)
|
370
370
|
end
|
371
371
|
|
@@ -444,10 +444,10 @@ module ActiveMerchant #:nodoc:
|
|
444
444
|
|
445
445
|
def parse_error(error)
|
446
446
|
{
|
447
|
-
:
|
448
|
-
:
|
449
|
-
:
|
450
|
-
:
|
447
|
+
transaction_approved: 'false',
|
448
|
+
error_number: error.code,
|
449
|
+
error_description: error.body,
|
450
|
+
ecommerce_error_code: error.body.gsub(/[^\d]/, '')
|
451
451
|
}
|
452
452
|
end
|
453
453
|
|
@@ -119,9 +119,9 @@ module ActiveMerchant #:nodoc:
|
|
119
119
|
succeeded,
|
120
120
|
message_from(succeeded, raw),
|
121
121
|
raw,
|
122
|
-
:
|
123
|
-
:
|
124
|
-
:
|
122
|
+
authorization: authorization_from(action, raw[:transaction_id], post[:OriginalTransactionId]),
|
123
|
+
error_code: error_code_from(succeeded, raw),
|
124
|
+
test: test?
|
125
125
|
)
|
126
126
|
end
|
127
127
|
|
@@ -133,7 +133,7 @@ module ActiveMerchant #:nodoc:
|
|
133
133
|
end
|
134
134
|
|
135
135
|
def build_request(action, post)
|
136
|
-
xml = Builder::XmlMarkup.new :
|
136
|
+
xml = Builder::XmlMarkup.new indent: 2
|
137
137
|
post.each do |field, value|
|
138
138
|
xml.tag!(field, value)
|
139
139
|
end
|
@@ -24,7 +24,7 @@ module ActiveMerchant #:nodoc:
|
|
24
24
|
post = {}
|
25
25
|
add_amount(post, money, options)
|
26
26
|
add_invoice(post, options)
|
27
|
-
add_payment_method(post, payment_method)
|
27
|
+
add_payment_method(post, payment_method, options)
|
28
28
|
add_billing_address(post, payment_method, options)
|
29
29
|
add_shipping_address(post, options)
|
30
30
|
post[:action] = 'sale'
|
@@ -36,7 +36,7 @@ module ActiveMerchant #:nodoc:
|
|
36
36
|
post = {}
|
37
37
|
add_amount(post, money, options)
|
38
38
|
add_invoice(post, options)
|
39
|
-
add_payment_method(post, payment_method)
|
39
|
+
add_payment_method(post, payment_method, options)
|
40
40
|
add_billing_address(post, payment_method, options)
|
41
41
|
add_shipping_address(post, options)
|
42
42
|
post[:action] = 'authorize'
|
@@ -57,7 +57,7 @@ module ActiveMerchant #:nodoc:
|
|
57
57
|
post = {}
|
58
58
|
add_amount(post, money, options)
|
59
59
|
add_invoice(post, options)
|
60
|
-
add_payment_method(post, payment_method)
|
60
|
+
add_payment_method(post, payment_method, options)
|
61
61
|
add_billing_address(post, payment_method, options)
|
62
62
|
post[:action] = 'disburse'
|
63
63
|
|
@@ -151,21 +151,22 @@ module ActiveMerchant #:nodoc:
|
|
151
151
|
post[:shipping_address][:physical_address][:locality] = address[:city] if address[:city]
|
152
152
|
end
|
153
153
|
|
154
|
-
def add_payment_method(post, payment_method)
|
154
|
+
def add_payment_method(post, payment_method, options)
|
155
155
|
if payment_method.respond_to?(:brand)
|
156
156
|
add_credit_card(post, payment_method)
|
157
157
|
else
|
158
|
-
add_echeck(post, payment_method)
|
158
|
+
add_echeck(post, payment_method, options)
|
159
159
|
end
|
160
160
|
end
|
161
161
|
|
162
|
-
def add_echeck(post, payment)
|
162
|
+
def add_echeck(post, payment, options)
|
163
163
|
post[:echeck] = {}
|
164
164
|
post[:echeck][:account_holder] = payment.name
|
165
165
|
post[:echeck][:account_number] = payment.account_number
|
166
166
|
post[:echeck][:routing_number] = payment.routing_number
|
167
167
|
post[:echeck][:account_type] = payment.account_type
|
168
168
|
post[:echeck][:check_number] = payment.number
|
169
|
+
post[:echeck][:sec_code] = options[:sec_code] || "WEB"
|
169
170
|
end
|
170
171
|
|
171
172
|
def add_credit_card(post, payment)
|
@@ -259,7 +260,7 @@ module ActiveMerchant #:nodoc:
|
|
259
260
|
end
|
260
261
|
|
261
262
|
def transaction_id_from(authorization)
|
262
|
-
transaction_id, _, original_auth_transaction_id, _= split_authorization(authorization)
|
263
|
+
transaction_id, _, original_auth_transaction_id, _ = split_authorization(authorization)
|
263
264
|
original_auth_transaction_id.present? ? original_auth_transaction_id : transaction_id
|
264
265
|
end
|
265
266
|
end
|
@@ -36,17 +36,17 @@ module ActiveMerchant #:nodoc:
|
|
36
36
|
end
|
37
37
|
|
38
38
|
def purchase(money, credit_card, options = {})
|
39
|
-
options = options.merge(:
|
39
|
+
options = options.merge(gvp_order_type: 'sales')
|
40
40
|
commit(money, build_sale_request(money, credit_card, options))
|
41
41
|
end
|
42
42
|
|
43
43
|
def authorize(money, credit_card, options = {})
|
44
|
-
options = options.merge(:
|
44
|
+
options = options.merge(gvp_order_type: 'preauth')
|
45
45
|
commit(money, build_authorize_request(money, credit_card, options))
|
46
46
|
end
|
47
47
|
|
48
48
|
def capture(money, ref_id, options = {})
|
49
|
-
options = options.merge(:
|
49
|
+
options = options.merge(gvp_order_type: 'postauth')
|
50
50
|
commit(money, build_capture_request(money, ref_id, options))
|
51
51
|
end
|
52
52
|
|
@@ -66,8 +66,8 @@ module ActiveMerchant #:nodoc:
|
|
66
66
|
card_number = credit_card.respond_to?(:number) ? credit_card.number : ''
|
67
67
|
hash_data = generate_hash_data(format_order_id(options[:order_id]), @options[:terminal_id], card_number, amount(money), security_data)
|
68
68
|
|
69
|
-
xml = Builder::XmlMarkup.new(:
|
70
|
-
xml.instruct! :xml, :
|
69
|
+
xml = Builder::XmlMarkup.new(indent: 2)
|
70
|
+
xml.instruct! :xml, version: '1.0', encoding: 'UTF-8'
|
71
71
|
|
72
72
|
xml.tag! 'GVPSRequest' do
|
73
73
|
xml.tag! 'Mode', test? ? 'TEST' : 'PROD'
|
@@ -115,7 +115,7 @@ module ActiveMerchant #:nodoc:
|
|
115
115
|
end
|
116
116
|
|
117
117
|
def build_capture_request(money, ref_id, options)
|
118
|
-
options = options.merge(:
|
118
|
+
options = options.merge(order_id: ref_id)
|
119
119
|
build_xml_request(money, ref_id, options) do |xml|
|
120
120
|
add_customer_data(xml, options)
|
121
121
|
add_order_data(xml, options)
|
@@ -222,8 +222,8 @@ module ActiveMerchant #:nodoc:
|
|
222
222
|
Response.new(success,
|
223
223
|
success ? 'Approved' : "Declined (Reason: #{response[:reason_code]} - #{response[:error_msg]} - #{response[:sys_err_msg]})",
|
224
224
|
response,
|
225
|
-
:
|
226
|
-
:
|
225
|
+
test: test?,
|
226
|
+
authorization: response[:order_id])
|
227
227
|
end
|
228
228
|
|
229
229
|
def parse(body)
|
@@ -7,10 +7,10 @@ module ActiveMerchant #:nodoc:
|
|
7
7
|
self.test_url = 'https://eu.sandbox.api-ingenico.com'
|
8
8
|
self.live_url = 'https://api.globalcollect.com'
|
9
9
|
|
10
|
-
self.supported_countries = [
|
10
|
+
self.supported_countries = %w[AD AE AG AI AL AM AO AR AS AT AU AW AX AZ BA BB BD BE BF BG BH BI BJ BL BM BN BO BQ BR BS BT BW BY BZ CA CC CD CF CH CI CK CL CM CN CO CR CU CV CW CX CY CZ DE DJ DK DM DO DZ EC EE EG ER ES ET FI FJ FK FM FO FR GA GB GD GE GF GH GI GL GM GN GP GQ GR GS GT GU GW GY HK HN HR HT HU ID IE IL IM IN IS IT JM JO JP KE KG KH KI KM KN KR KW KY KZ LA LB LC LI LK LR LS LT LU LV MA MC MD ME MF MG MH MK MM MN MO MP MQ MR MS MT MU MV MW MX MY MZ NA NC NE NG NI NL NO NP NR NU NZ OM PA PE PF PG PH PL PN PS PT PW QA RE RO RS RU RW SA SB SC SE SG SH SI SJ SK SL SM SN SR ST SV SZ TC TD TG TH TJ TL TM TN TO TR TT TV TW TZ UA UG US UY UZ VC VE VG VI VN WF WS ZA ZM ZW]
|
11
11
|
self.default_currency = 'USD'
|
12
12
|
self.money_format = :cents
|
13
|
-
self.supported_cardtypes = [
|
13
|
+
self.supported_cardtypes = %i[visa master american_express discover naranja cabal]
|
14
14
|
|
15
15
|
def initialize(options={})
|
16
16
|
requires!(options, :merchant_id, :api_key_id, :secret_api_key)
|
@@ -20,7 +20,7 @@ module ActiveMerchant #:nodoc:
|
|
20
20
|
def purchase(money, payment, options={})
|
21
21
|
MultiResponse.run do |r|
|
22
22
|
r.process { authorize(money, payment, options) }
|
23
|
-
r.process { capture(money, r.authorization, options) }
|
23
|
+
r.process { capture(money, r.authorization, options) } if should_request_capture?(r, options[:requires_approval])
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
@@ -32,7 +32,6 @@ module ActiveMerchant #:nodoc:
|
|
32
32
|
add_address(post, payment, options)
|
33
33
|
add_creator_info(post, options)
|
34
34
|
add_fraud_fields(post, options)
|
35
|
-
|
36
35
|
commit(:authorize, post)
|
37
36
|
end
|
38
37
|
|
@@ -161,6 +160,8 @@ module ActiveMerchant #:nodoc:
|
|
161
160
|
'skipFraudService' => 'true',
|
162
161
|
'authorizationMode' => pre_authorization
|
163
162
|
}
|
163
|
+
post['cardPaymentMethodSpecificInput']['requiresApproval'] = options[:requires_approval] unless options[:requires_approval].nil?
|
164
|
+
|
164
165
|
post['cardPaymentMethodSpecificInput']['card'] = {
|
165
166
|
'cvv' => payment.verification_value,
|
166
167
|
'cardNumber' => payment.number,
|
@@ -283,7 +284,7 @@ module ActiveMerchant #:nodoc:
|
|
283
284
|
|
284
285
|
def headers(action, post, authorization = nil)
|
285
286
|
{
|
286
|
-
'Content-Type'
|
287
|
+
'Content-Type' => content_type,
|
287
288
|
'Authorization' => auth_digest(action, post, authorization),
|
288
289
|
'Date' => date
|
289
290
|
}
|
@@ -314,18 +315,16 @@ POST
|
|
314
315
|
end
|
315
316
|
|
316
317
|
def message_from(succeeded, response)
|
317
|
-
if succeeded
|
318
|
-
|
318
|
+
return 'Succeeded' if succeeded
|
319
|
+
|
320
|
+
if errors = response['errors']
|
321
|
+
errors.first.try(:[], 'message')
|
322
|
+
elsif response['error_message']
|
323
|
+
response['error_message']
|
324
|
+
elsif response['status']
|
325
|
+
'Status: ' + response['status']
|
319
326
|
else
|
320
|
-
|
321
|
-
errors.first.try(:[], 'message')
|
322
|
-
elsif response['error_message']
|
323
|
-
response['error_message']
|
324
|
-
elsif response['status']
|
325
|
-
'Status: ' + response['status']
|
326
|
-
else
|
327
|
-
'No message available'
|
328
|
-
end
|
327
|
+
'No message available'
|
329
328
|
end
|
330
329
|
end
|
331
330
|
|
@@ -340,14 +339,14 @@ POST
|
|
340
339
|
end
|
341
340
|
|
342
341
|
def error_code_from(succeeded, response)
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
342
|
+
return if succeeded
|
343
|
+
|
344
|
+
if errors = response['errors']
|
345
|
+
errors.first.try(:[], 'code')
|
346
|
+
elsif status = response.try(:[], 'statusOutput').try(:[], 'statusCode')
|
347
|
+
status.to_s
|
348
|
+
else
|
349
|
+
'No error code available'
|
351
350
|
end
|
352
351
|
end
|
353
352
|
|
@@ -355,6 +354,13 @@ POST
|
|
355
354
|
Hash.new { |h, k| h[k] = Hash.new(&h.default_proc) }
|
356
355
|
end
|
357
356
|
|
357
|
+
# Capture hasn't already been requested,
|
358
|
+
# and
|
359
|
+
# `requires_approval` is not false
|
360
|
+
def should_request_capture?(response, requires_approval)
|
361
|
+
!capture_requested?(response) && requires_approval != false
|
362
|
+
end
|
363
|
+
|
358
364
|
def capture_requested?(response)
|
359
365
|
response.params.try(:[], 'payment').try(:[], 'status') == 'CAPTURE_REQUESTED'
|
360
366
|
end
|
@@ -149,13 +149,13 @@ EOA
|
|
149
149
|
succeeded,
|
150
150
|
message_from(succeeded, raw),
|
151
151
|
raw,
|
152
|
-
:
|
153
|
-
:
|
152
|
+
authorization: authorization_from(post, raw),
|
153
|
+
test: test?
|
154
154
|
)
|
155
155
|
end
|
156
156
|
|
157
157
|
def build_request(post)
|
158
|
-
xml = Builder::XmlMarkup.new :
|
158
|
+
xml = Builder::XmlMarkup.new indent: 2
|
159
159
|
xml.instruct!
|
160
160
|
post.each do |field, value|
|
161
161
|
xml.tag!(field, value)
|