activemerchant 1.114.0 → 1.120.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +183 -0
- data/README.md +4 -2
- data/lib/active_merchant.rb +1 -1
- data/lib/active_merchant/billing/avs_result.rb +1 -1
- data/lib/active_merchant/billing/check.rb +10 -0
- data/lib/active_merchant/billing/compatibility.rb +3 -3
- data/lib/active_merchant/billing/credit_card.rb +3 -0
- data/lib/active_merchant/billing/credit_card_methods.rb +80 -15
- data/lib/active_merchant/billing/gateways/adyen.rb +44 -20
- data/lib/active_merchant/billing/gateways/allied_wallet.rb +7 -7
- data/lib/active_merchant/billing/gateways/authorize_net.rb +50 -12
- data/lib/active_merchant/billing/gateways/authorize_net_arb.rb +3 -4
- data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +5 -1
- data/lib/active_merchant/billing/gateways/axcessms.rb +8 -9
- data/lib/active_merchant/billing/gateways/balanced.rb +4 -3
- data/lib/active_merchant/billing/gateways/bambora_apac.rb +7 -7
- data/lib/active_merchant/billing/gateways/bank_frick.rb +7 -7
- data/lib/active_merchant/billing/gateways/banwire.rb +1 -1
- data/lib/active_merchant/billing/gateways/barclaycard_smartpay.rb +6 -4
- data/lib/active_merchant/billing/gateways/beanstream.rb +3 -3
- data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +4 -5
- data/lib/active_merchant/billing/gateways/blue_pay.rb +2 -3
- data/lib/active_merchant/billing/gateways/blue_snap.rb +22 -18
- data/lib/active_merchant/billing/gateways/bogus.rb +19 -19
- data/lib/active_merchant/billing/gateways/borgun.rb +11 -11
- data/lib/active_merchant/billing/gateways/bpoint.rb +8 -8
- data/lib/active_merchant/billing/gateways/braintree.rb +1 -1
- data/lib/active_merchant/billing/gateways/braintree_blue.rb +60 -17
- data/lib/active_merchant/billing/gateways/bridge_pay.rb +7 -7
- data/lib/active_merchant/billing/gateways/cams.rb +8 -8
- data/lib/active_merchant/billing/gateways/card_connect.rb +1 -1
- data/lib/active_merchant/billing/gateways/card_save.rb +1 -1
- data/lib/active_merchant/billing/gateways/card_stream.rb +2 -2
- data/lib/active_merchant/billing/gateways/cardknox.rb +7 -7
- data/lib/active_merchant/billing/gateways/cardprocess.rb +1 -1
- data/lib/active_merchant/billing/gateways/cashnet.rb +7 -2
- data/lib/active_merchant/billing/gateways/cecabank.rb +5 -5
- data/lib/active_merchant/billing/gateways/cenpos.rb +10 -10
- data/lib/active_merchant/billing/gateways/checkout.rb +2 -2
- data/lib/active_merchant/billing/gateways/checkout_v2.rb +38 -20
- data/lib/active_merchant/billing/gateways/clearhaus.rb +7 -7
- data/lib/active_merchant/billing/gateways/commercegate.rb +1 -1
- data/lib/active_merchant/billing/gateways/conekta.rb +2 -2
- data/lib/active_merchant/billing/gateways/creditcall.rb +10 -10
- data/lib/active_merchant/billing/gateways/credorax.rb +39 -23
- data/lib/active_merchant/billing/gateways/ct_payment.rb +10 -10
- data/lib/active_merchant/billing/gateways/culqi.rb +9 -9
- data/lib/active_merchant/billing/gateways/cyber_source.rb +81 -39
- data/lib/active_merchant/billing/gateways/d_local.rb +12 -12
- data/lib/active_merchant/billing/gateways/data_cash.rb +2 -3
- data/lib/active_merchant/billing/gateways/decidir.rb +31 -10
- data/lib/active_merchant/billing/gateways/dibs.rb +8 -8
- data/lib/active_merchant/billing/gateways/digitzs.rb +5 -5
- data/lib/active_merchant/billing/gateways/ebanx.rb +9 -9
- data/lib/active_merchant/billing/gateways/efsnet.rb +2 -3
- data/lib/active_merchant/billing/gateways/elavon.rb +296 -225
- data/lib/active_merchant/billing/gateways/element.rb +8 -8
- data/lib/active_merchant/billing/gateways/evo_ca.rb +5 -6
- data/lib/active_merchant/billing/gateways/eway.rb +3 -4
- data/lib/active_merchant/billing/gateways/eway_managed.rb +6 -7
- data/lib/active_merchant/billing/gateways/eway_rapid.rb +19 -6
- data/lib/active_merchant/billing/gateways/exact.rb +8 -9
- data/lib/active_merchant/billing/gateways/ezic.rb +7 -7
- data/lib/active_merchant/billing/gateways/fat_zebra.rb +4 -4
- data/lib/active_merchant/billing/gateways/federated_canada.rb +2 -3
- data/lib/active_merchant/billing/gateways/first_giving.rb +1 -1
- data/lib/active_merchant/billing/gateways/first_pay.rb +6 -6
- data/lib/active_merchant/billing/gateways/firstdata_e4.rb +7 -7
- data/lib/active_merchant/billing/gateways/firstdata_e4_v27.rb +21 -10
- data/lib/active_merchant/billing/gateways/flo2cash.rb +8 -8
- data/lib/active_merchant/billing/gateways/flo2cash_simple.rb +1 -1
- data/lib/active_merchant/billing/gateways/forte.rb +26 -8
- data/lib/active_merchant/billing/gateways/global_collect.rb +35 -16
- data/lib/active_merchant/billing/gateways/global_transport.rb +7 -7
- data/lib/active_merchant/billing/gateways/hdfc.rb +9 -9
- data/lib/active_merchant/billing/gateways/hps.rb +72 -9
- data/lib/active_merchant/billing/gateways/iats_payments.rb +9 -4
- data/lib/active_merchant/billing/gateways/in_context_paypal_express.rb +1 -1
- data/lib/active_merchant/billing/gateways/inspire.rb +3 -4
- data/lib/active_merchant/billing/gateways/instapay.rb +1 -2
- data/lib/active_merchant/billing/gateways/ipp.rb +5 -5
- data/lib/active_merchant/billing/gateways/iridium.rb +14 -15
- data/lib/active_merchant/billing/gateways/iveri.rb +7 -7
- data/lib/active_merchant/billing/gateways/ixopay.rb +7 -7
- data/lib/active_merchant/billing/gateways/jetpay.rb +1 -2
- data/lib/active_merchant/billing/gateways/jetpay_v2.rb +4 -5
- data/lib/active_merchant/billing/gateways/kushki.rb +6 -6
- data/lib/active_merchant/billing/gateways/latitude19.rb +14 -14
- data/lib/active_merchant/billing/gateways/linkpoint.rb +4 -5
- data/lib/active_merchant/billing/gateways/litle.rb +32 -16
- data/lib/active_merchant/billing/gateways/mastercard.rb +10 -10
- data/lib/active_merchant/billing/gateways/mercado_pago.rb +9 -9
- data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +1 -2
- data/lib/active_merchant/billing/gateways/merchant_one.rb +1 -1
- data/lib/active_merchant/billing/gateways/merchant_partners.rb +10 -10
- data/lib/active_merchant/billing/gateways/merchant_ware.rb +5 -7
- data/lib/active_merchant/billing/gateways/merchant_ware_version_four.rb +4 -6
- data/lib/active_merchant/billing/gateways/mercury.rb +4 -4
- data/lib/active_merchant/billing/gateways/metrics_global.rb +4 -5
- data/lib/active_merchant/billing/gateways/micropayment.rb +8 -8
- data/lib/active_merchant/billing/gateways/migs.rb +3 -4
- data/lib/active_merchant/billing/gateways/modern_payments_cim.rb +2 -4
- data/lib/active_merchant/billing/gateways/monei.rb +7 -7
- data/lib/active_merchant/billing/gateways/moneris.rb +4 -3
- data/lib/active_merchant/billing/gateways/money_movers.rb +2 -3
- data/lib/active_merchant/billing/gateways/mundipagg.rb +37 -10
- data/lib/active_merchant/billing/gateways/nab_transact.rb +2 -4
- data/lib/active_merchant/billing/gateways/ncr_secure_pay.rb +7 -7
- data/lib/active_merchant/billing/gateways/net_registry.rb +1 -2
- data/lib/active_merchant/billing/gateways/netaxept.rb +6 -6
- data/lib/active_merchant/billing/gateways/netbanx.rb +45 -10
- data/lib/active_merchant/billing/gateways/netbilling.rb +4 -5
- data/lib/active_merchant/billing/gateways/network_merchants.rb +2 -3
- data/lib/active_merchant/billing/gateways/nmi.rb +21 -7
- data/lib/active_merchant/billing/gateways/ogone.rb +3 -3
- data/lib/active_merchant/billing/gateways/omise.rb +13 -13
- data/lib/active_merchant/billing/gateways/openpay.rb +3 -4
- data/lib/active_merchant/billing/gateways/opp.rb +9 -9
- data/lib/active_merchant/billing/gateways/optimal_payment.rb +2 -3
- data/lib/active_merchant/billing/gateways/orbital.rb +225 -105
- data/lib/active_merchant/billing/gateways/pac_net_raven.rb +3 -4
- data/lib/active_merchant/billing/gateways/pagarme.rb +8 -8
- data/lib/active_merchant/billing/gateways/pago_facil.rb +2 -2
- data/lib/active_merchant/billing/gateways/pay_conex.rb +8 -8
- data/lib/active_merchant/billing/gateways/pay_gate_xml.rb +6 -7
- data/lib/active_merchant/billing/gateways/pay_hub.rb +7 -8
- data/lib/active_merchant/billing/gateways/pay_junction.rb +2 -3
- data/lib/active_merchant/billing/gateways/pay_junction_v2.rb +9 -9
- data/lib/active_merchant/billing/gateways/pay_secure.rb +2 -3
- data/lib/active_merchant/billing/gateways/paybox_direct.rb +23 -1
- data/lib/active_merchant/billing/gateways/payeezy.rb +62 -20
- data/lib/active_merchant/billing/gateways/payex.rb +6 -7
- data/lib/active_merchant/billing/gateways/payflow.rb +1 -1
- data/lib/active_merchant/billing/gateways/payment_express.rb +11 -7
- data/lib/active_merchant/billing/gateways/paymentez.rb +26 -6
- data/lib/active_merchant/billing/gateways/paymill.rb +7 -7
- data/lib/active_merchant/billing/gateways/paypal.rb +10 -2
- data/lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb +1 -0
- data/lib/active_merchant/billing/gateways/paypal_express.rb +1 -1
- data/lib/active_merchant/billing/gateways/paypal_express_common.rb +1 -1
- data/lib/active_merchant/billing/gateways/payscout.rb +1 -2
- data/lib/active_merchant/billing/gateways/paystation.rb +3 -4
- data/lib/active_merchant/billing/gateways/payu_in.rb +3 -3
- data/lib/active_merchant/billing/gateways/payu_latam.rb +17 -10
- data/lib/active_merchant/billing/gateways/payway.rb +8 -9
- data/lib/active_merchant/billing/gateways/payway_dot_com.rb +253 -0
- data/lib/active_merchant/billing/gateways/pin.rb +11 -0
- data/lib/active_merchant/billing/gateways/plugnpay.rb +1 -2
- data/lib/active_merchant/billing/gateways/pro_pay.rb +8 -8
- data/lib/active_merchant/billing/gateways/psigate.rb +2 -3
- data/lib/active_merchant/billing/gateways/psl_card.rb +1 -2
- data/lib/active_merchant/billing/gateways/qbms.rb +1 -2
- data/lib/active_merchant/billing/gateways/quantum.rb +1 -2
- data/lib/active_merchant/billing/gateways/quickbooks.rb +1 -1
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb +3 -4
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_v4to7.rb +1 -2
- data/lib/active_merchant/billing/gateways/qvalent.rb +31 -17
- data/lib/active_merchant/billing/gateways/realex.rb +1 -1
- data/lib/active_merchant/billing/gateways/redsys.rb +105 -9
- data/lib/active_merchant/billing/gateways/s5.rb +7 -7
- data/lib/active_merchant/billing/gateways/safe_charge.rb +51 -18
- data/lib/active_merchant/billing/gateways/sage.rb +3 -5
- data/lib/active_merchant/billing/gateways/sage_pay.rb +2 -3
- data/lib/active_merchant/billing/gateways/sallie_mae.rb +1 -2
- data/lib/active_merchant/billing/gateways/secure_net.rb +1 -2
- data/lib/active_merchant/billing/gateways/secure_pay.rb +3 -4
- data/lib/active_merchant/billing/gateways/secure_pay_au.rb +2 -4
- data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +1 -2
- data/lib/active_merchant/billing/gateways/securion_pay.rb +5 -6
- data/lib/active_merchant/billing/gateways/skip_jack.rb +2 -3
- data/lib/active_merchant/billing/gateways/smart_ps.rb +5 -6
- data/lib/active_merchant/billing/gateways/so_easy_pay.rb +7 -7
- data/lib/active_merchant/billing/gateways/spreedly_core.rb +6 -6
- data/lib/active_merchant/billing/gateways/stripe.rb +18 -18
- data/lib/active_merchant/billing/gateways/stripe_payment_intents.rb +91 -25
- data/lib/active_merchant/billing/gateways/swipe_checkout.rb +3 -4
- data/lib/active_merchant/billing/gateways/telr.rb +8 -8
- data/lib/active_merchant/billing/gateways/trans_first.rb +2 -2
- data/lib/active_merchant/billing/gateways/trans_first_transaction_express.rb +12 -12
- data/lib/active_merchant/billing/gateways/transact_pro.rb +9 -9
- data/lib/active_merchant/billing/gateways/trust_commerce.rb +1 -2
- data/lib/active_merchant/billing/gateways/usa_epay.rb +1 -1
- data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +32 -32
- data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +3 -4
- data/lib/active_merchant/billing/gateways/vanco.rb +3 -3
- data/lib/active_merchant/billing/gateways/verifi.rb +1 -2
- data/lib/active_merchant/billing/gateways/viaklix.rb +1 -2
- data/lib/active_merchant/billing/gateways/visanet_peru.rb +10 -10
- data/lib/active_merchant/billing/gateways/vpos.rb +172 -0
- data/lib/active_merchant/billing/gateways/webpay.rb +2 -2
- data/lib/active_merchant/billing/gateways/wepay.rb +3 -2
- data/lib/active_merchant/billing/gateways/wirecard.rb +1 -2
- data/lib/active_merchant/billing/gateways/worldpay.rb +43 -22
- data/lib/active_merchant/billing/gateways/worldpay_online_payments.rb +14 -16
- data/lib/active_merchant/billing/gateways/worldpay_us.rb +7 -7
- data/lib/active_merchant/billing/response.rb +3 -2
- data/lib/active_merchant/country.rb +1 -1
- data/lib/active_merchant/network_connection_retries.rb +2 -2
- data/lib/active_merchant/post_data.rb +1 -1
- data/lib/active_merchant/posts_data.rb +1 -1
- data/lib/active_merchant/version.rb +1 -1
- data/lib/certs/cacert.pem +1582 -2431
- data/lib/support/ssl_verify.rb +2 -2
- data/lib/support/ssl_version.rb +2 -2
- metadata +5 -3
@@ -147,8 +147,7 @@ module ActiveMerchant #:nodoc:
|
|
147
147
|
authorization: response[:credit_card_trans_id],
|
148
148
|
fraud_review: fraud_review?(response),
|
149
149
|
avs_result: { code: avs_result(response) },
|
150
|
-
cvv_result: cvv_result(response)
|
151
|
-
)
|
150
|
+
cvv_result: cvv_result(response))
|
152
151
|
end
|
153
152
|
|
154
153
|
def success?(response)
|
@@ -219,8 +219,7 @@ module ActiveMerchant #:nodoc:
|
|
219
219
|
test: test?,
|
220
220
|
authorization: authorization,
|
221
221
|
avs_result: { code: response[:AVSResponseCode] },
|
222
|
-
cvv_result: response[:CVV2ResponseCode]
|
223
|
-
)
|
222
|
+
cvv_result: response[:CVV2ResponseCode])
|
224
223
|
end
|
225
224
|
|
226
225
|
# Parse the SOAP response
|
@@ -260,7 +260,7 @@ module ActiveMerchant #:nodoc:
|
|
260
260
|
hmac_signature = OpenSSL::HMAC.digest(OpenSSL::Digest.new('sha1'), oauth_signing_key, oauth_signature_base_string)
|
261
261
|
|
262
262
|
# append signature to required OAuth parameters
|
263
|
-
oauth_parameters[:oauth_signature] = CGI.escape(Base64.encode64(hmac_signature).chomp.
|
263
|
+
oauth_parameters[:oauth_signature] = CGI.escape(Base64.encode64(hmac_signature).chomp.delete("\n"))
|
264
264
|
|
265
265
|
# prepare Authorization header string
|
266
266
|
oauth_parameters = Hash[oauth_parameters.sort_by { |k, _| k }]
|
@@ -68,7 +68,7 @@ module ActiveMerchant
|
|
68
68
|
commit(synchronized_path("/payments/#{identification}/refund"), post)
|
69
69
|
end
|
70
70
|
|
71
|
-
def verify(credit_card, options={})
|
71
|
+
def verify(credit_card, options = {})
|
72
72
|
MultiResponse.run(:use_first_response) do |r|
|
73
73
|
r.process { authorize(100, credit_card, options) }
|
74
74
|
r.process(:ignore_result) { void(r.authorization, options) }
|
@@ -155,8 +155,7 @@ module ActiveMerchant
|
|
155
155
|
|
156
156
|
Response.new(success, message_from(success, response), response,
|
157
157
|
test: test?,
|
158
|
-
authorization: authorization_from(response)
|
159
|
-
)
|
158
|
+
authorization: authorization_from(response))
|
160
159
|
end
|
161
160
|
|
162
161
|
def authorization_from(response)
|
@@ -264,7 +263,7 @@ module ActiveMerchant
|
|
264
263
|
end
|
265
264
|
|
266
265
|
def format_order_id(order_id)
|
267
|
-
truncate(order_id.to_s.
|
266
|
+
truncate(order_id.to_s.delete('#'), 20)
|
268
267
|
end
|
269
268
|
|
270
269
|
def headers
|
@@ -166,8 +166,7 @@ module ActiveMerchant #:nodoc:
|
|
166
166
|
|
167
167
|
Response.new(successful?(response), message_from(response), response,
|
168
168
|
test: test?,
|
169
|
-
authorization: response[:transaction]
|
170
|
-
)
|
169
|
+
authorization: response[:transaction])
|
171
170
|
end
|
172
171
|
|
173
172
|
def successful?(response)
|
@@ -16,12 +16,12 @@ module ActiveMerchant #:nodoc:
|
|
16
16
|
'S' => 'D'
|
17
17
|
}
|
18
18
|
|
19
|
-
def initialize(options={})
|
20
|
-
requires!(options, :username, :password, :merchant, :pem
|
19
|
+
def initialize(options = {})
|
20
|
+
requires!(options, :username, :password, :merchant, :pem)
|
21
21
|
super
|
22
22
|
end
|
23
23
|
|
24
|
-
def purchase(amount, payment_method, options={})
|
24
|
+
def purchase(amount, payment_method, options = {})
|
25
25
|
post = {}
|
26
26
|
add_invoice(post, amount, options)
|
27
27
|
add_order_number(post, options)
|
@@ -30,11 +30,12 @@ module ActiveMerchant #:nodoc:
|
|
30
30
|
add_stored_credential_data(post, payment_method, options)
|
31
31
|
add_customer_data(post, options)
|
32
32
|
add_soft_descriptors(post, options)
|
33
|
+
add_customer_reference(post, options)
|
33
34
|
|
34
35
|
commit('capture', post)
|
35
36
|
end
|
36
37
|
|
37
|
-
def authorize(amount, payment_method, options={})
|
38
|
+
def authorize(amount, payment_method, options = {})
|
38
39
|
post = {}
|
39
40
|
add_invoice(post, amount, options)
|
40
41
|
add_order_number(post, options)
|
@@ -43,48 +44,53 @@ module ActiveMerchant #:nodoc:
|
|
43
44
|
add_stored_credential_data(post, payment_method, options)
|
44
45
|
add_customer_data(post, options)
|
45
46
|
add_soft_descriptors(post, options)
|
47
|
+
add_customer_reference(post, options)
|
46
48
|
|
47
49
|
commit('preauth', post)
|
48
50
|
end
|
49
51
|
|
50
|
-
def capture(amount, authorization, options={})
|
52
|
+
def capture(amount, authorization, options = {})
|
51
53
|
post = {}
|
52
54
|
add_invoice(post, amount, options)
|
53
55
|
add_reference(post, authorization, options)
|
54
56
|
add_customer_data(post, options)
|
55
57
|
add_soft_descriptors(post, options)
|
58
|
+
add_customer_reference(post, options)
|
56
59
|
|
57
60
|
commit('captureWithoutAuth', post)
|
58
61
|
end
|
59
62
|
|
60
|
-
def refund(amount, authorization, options={})
|
63
|
+
def refund(amount, authorization, options = {})
|
61
64
|
post = {}
|
62
65
|
add_invoice(post, amount, options)
|
63
66
|
add_reference(post, authorization, options)
|
64
67
|
add_customer_data(post, options)
|
65
68
|
add_soft_descriptors(post, options)
|
66
69
|
post['order.ECI'] = options[:eci] || 'SSL'
|
70
|
+
add_customer_reference(post, options)
|
67
71
|
|
68
72
|
commit('refund', post)
|
69
73
|
end
|
70
74
|
|
71
75
|
# Credit requires the merchant account to be enabled for "Adhoc Refunds"
|
72
|
-
def credit(amount, payment_method, options={})
|
76
|
+
def credit(amount, payment_method, options = {})
|
73
77
|
post = {}
|
74
78
|
add_invoice(post, amount, options)
|
75
79
|
add_order_number(post, options)
|
76
80
|
add_payment_method(post, payment_method)
|
77
81
|
add_customer_data(post, options)
|
78
82
|
add_soft_descriptors(post, options)
|
83
|
+
add_customer_reference(post, options)
|
79
84
|
|
80
85
|
commit('refund', post)
|
81
86
|
end
|
82
87
|
|
83
|
-
def void(authorization, options={})
|
88
|
+
def void(authorization, options = {})
|
84
89
|
post = {}
|
85
90
|
add_reference(post, authorization, options)
|
86
91
|
add_customer_data(post, options)
|
87
92
|
add_soft_descriptors(post, options)
|
93
|
+
add_customer_reference(post, options)
|
88
94
|
|
89
95
|
commit('reversal', post)
|
90
96
|
end
|
@@ -92,7 +98,7 @@ module ActiveMerchant #:nodoc:
|
|
92
98
|
def store(payment_method, options = {})
|
93
99
|
post = {}
|
94
100
|
add_payment_method(post, payment_method)
|
95
|
-
add_card_reference(post)
|
101
|
+
add_card_reference(post, options)
|
96
102
|
|
97
103
|
commit('registerAccount', post)
|
98
104
|
end
|
@@ -110,7 +116,7 @@ module ActiveMerchant #:nodoc:
|
|
110
116
|
|
111
117
|
private
|
112
118
|
|
113
|
-
CURRENCY_CODES = Hash.new { |
|
119
|
+
CURRENCY_CODES = Hash.new { |_h, k| raise ArgumentError.new("Unsupported currency: #{k}") }
|
114
120
|
CURRENCY_CODES['AUD'] = 'AUD'
|
115
121
|
CURRENCY_CODES['INR'] = 'INR'
|
116
122
|
|
@@ -149,12 +155,16 @@ module ActiveMerchant #:nodoc:
|
|
149
155
|
return unless payment_method.brand == 'visa'
|
150
156
|
|
151
157
|
stored_credential = options[:stored_credential]
|
152
|
-
if stored_credential[:
|
153
|
-
|
154
|
-
|
158
|
+
if stored_credential[:reason_type] == 'unscheduled'
|
159
|
+
if stored_credential[:initiator] == 'merchant'
|
160
|
+
post['card.storedCredentialUsage'] = 'UNSCHEDULED_MIT'
|
161
|
+
elsif stored_credential[:initiator] == 'customer'
|
162
|
+
post['card.storedCredentialUsage'] = 'UNSCHEDULED_CIT'
|
163
|
+
end
|
164
|
+
elsif stored_credential[:reason_type] == 'recurring'
|
155
165
|
post['card.storedCredentialUsage'] = 'RECURRING'
|
156
|
-
elsif stored_credential[:reason_type] == '
|
157
|
-
post['card.storedCredentialUsage'] = '
|
166
|
+
elsif stored_credential[:reason_type] == 'installment'
|
167
|
+
post['card.storedCredentialUsage'] = 'INSTALLMENT'
|
158
168
|
end
|
159
169
|
end
|
160
170
|
|
@@ -181,8 +191,12 @@ module ActiveMerchant #:nodoc:
|
|
181
191
|
post['card.CVN'] = payment_method.verification_value
|
182
192
|
end
|
183
193
|
|
184
|
-
def add_card_reference(post)
|
185
|
-
post['customer.customerReferenceNumber'] = options[:order_id]
|
194
|
+
def add_card_reference(post, options)
|
195
|
+
post['customer.customerReferenceNumber'] = options[:customer_reference_number] || options[:order_id]
|
196
|
+
end
|
197
|
+
|
198
|
+
def add_customer_reference(post, options)
|
199
|
+
post['customer.customerReferenceNumber'] = options[:customer_reference_number] if options[:customer_reference_number]
|
186
200
|
end
|
187
201
|
|
188
202
|
def add_reference(post, authorization, options)
|
@@ -126,6 +126,7 @@ module ActiveMerchant #:nodoc:
|
|
126
126
|
184 => 'Authentication error',
|
127
127
|
190 => 'Refusal with no specific reason',
|
128
128
|
191 => 'Expiry date incorrect',
|
129
|
+
195 => 'Requires SCA authentication',
|
129
130
|
|
130
131
|
201 => 'Card expired',
|
131
132
|
202 => 'Card blocked temporarily or under suspicion of fraud',
|
@@ -170,6 +171,10 @@ module ActiveMerchant #:nodoc:
|
|
170
171
|
9914 => 'KO Confirmation'
|
171
172
|
}
|
172
173
|
|
174
|
+
# Expected values as per documentation
|
175
|
+
THREE_DS_V1 = '1.0.2'
|
176
|
+
THREE_DS_V2 = '2.1.0'
|
177
|
+
|
173
178
|
# Creates a new instance
|
174
179
|
#
|
175
180
|
# Redsys requires a login and secret_key, and optionally also accepts a
|
@@ -197,10 +202,13 @@ module ActiveMerchant #:nodoc:
|
|
197
202
|
add_amount(data, money, options)
|
198
203
|
add_order(data, options[:order_id])
|
199
204
|
add_payment(data, payment)
|
205
|
+
add_external_mpi_fields(data, options)
|
200
206
|
add_threeds(data, options) if options[:execute_threed]
|
207
|
+
add_stored_credential_options(data, options)
|
201
208
|
data[:description] = options[:description]
|
202
209
|
data[:store_in_vault] = options[:store]
|
203
210
|
data[:sca_exemption] = options[:sca_exemption]
|
211
|
+
data[:sca_exemption_direct_payment_enabled] = options[:sca_exemption_direct_payment_enabled]
|
204
212
|
|
205
213
|
commit data, options
|
206
214
|
end
|
@@ -213,10 +221,13 @@ module ActiveMerchant #:nodoc:
|
|
213
221
|
add_amount(data, money, options)
|
214
222
|
add_order(data, options[:order_id])
|
215
223
|
add_payment(data, payment)
|
224
|
+
add_external_mpi_fields(data, options)
|
216
225
|
add_threeds(data, options) if options[:execute_threed]
|
226
|
+
add_stored_credential_options(data, options)
|
217
227
|
data[:description] = options[:description]
|
218
228
|
data[:store_in_vault] = options[:store]
|
219
229
|
data[:sca_exemption] = options[:sca_exemption]
|
230
|
+
data[:sca_exemption_direct_payment_enabled] = options[:sca_exemption_direct_payment_enabled]
|
220
231
|
|
221
232
|
commit data, options
|
222
233
|
end
|
@@ -321,8 +332,48 @@ module ActiveMerchant #:nodoc:
|
|
321
332
|
end
|
322
333
|
end
|
323
334
|
|
335
|
+
def add_external_mpi_fields(data, options)
|
336
|
+
return unless options[:three_d_secure]
|
337
|
+
|
338
|
+
if options[:three_d_secure][:version] == THREE_DS_V2
|
339
|
+
data[:threeDSServerTransID] = options[:three_d_secure][:three_ds_server_trans_id] if options[:three_d_secure][:three_ds_server_trans_id]
|
340
|
+
data[:dsTransID] = options[:three_d_secure][:ds_transaction_id] if options[:three_d_secure][:ds_transaction_id]
|
341
|
+
data[:authenticacionValue] = options[:three_d_secure][:cavv] if options[:three_d_secure][:cavv]
|
342
|
+
data[:protocolVersion] = options[:three_d_secure][:version] if options[:three_d_secure][:version]
|
343
|
+
data[:authenticacionMethod] = options[:authentication_method] if options[:authentication_method]
|
344
|
+
data[:authenticacionType] = options[:authentication_type] if options[:authentication_type]
|
345
|
+
data[:authenticacionFlow] = options[:authentication_flow] if options[:authentication_flow]
|
346
|
+
data[:eci_v2] = options[:three_d_secure][:eci] if options[:three_d_secure][:eci]
|
347
|
+
elsif options[:three_d_secure][:version] == THREE_DS_V1
|
348
|
+
data[:txid] = options[:three_d_secure][:xid] if options[:three_d_secure][:xid]
|
349
|
+
data[:cavv] = options[:three_d_secure][:cavv] if options[:three_d_secure][:cavv]
|
350
|
+
data[:eci_v1] = options[:three_d_secure][:eci] if options[:three_d_secure][:eci]
|
351
|
+
end
|
352
|
+
end
|
353
|
+
|
354
|
+
def add_stored_credential_options(data, options)
|
355
|
+
return unless options[:stored_credential]
|
356
|
+
|
357
|
+
case options[:stored_credential][:initial_transaction]
|
358
|
+
when true
|
359
|
+
data[:DS_MERCHANT_COF_INI] = 'S'
|
360
|
+
when false
|
361
|
+
data[:DS_MERCHANT_COF_INI] = 'N'
|
362
|
+
data[:DS_MERCHANT_COF_TXNID] = options[:stored_credential][:network_transaction_id] if options[:stored_credential][:network_transaction_id]
|
363
|
+
end
|
364
|
+
|
365
|
+
case options[:stored_credential][:reason_type]
|
366
|
+
when 'recurring'
|
367
|
+
data[:DS_MERCHANT_COF_TYPE] = 'R'
|
368
|
+
when 'installment'
|
369
|
+
data[:DS_MERCHANT_COF_TYPE] = 'I'
|
370
|
+
when 'unscheduled'
|
371
|
+
return
|
372
|
+
end
|
373
|
+
end
|
374
|
+
|
324
375
|
def add_threeds(data, options)
|
325
|
-
data[:threeds] = {threeDSInfo: 'CardData'} if options[:execute_threed] == true
|
376
|
+
data[:threeds] = { threeDSInfo: 'CardData' } if options[:execute_threed] == true
|
326
377
|
end
|
327
378
|
|
328
379
|
def determine_3ds_action(threeds_hash)
|
@@ -334,7 +385,7 @@ module ActiveMerchant #:nodoc:
|
|
334
385
|
def commit(data, options = {})
|
335
386
|
if data[:threeds]
|
336
387
|
action = determine_3ds_action(data[:threeds])
|
337
|
-
request = <<-
|
388
|
+
request = <<-REQUEST
|
338
389
|
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://webservice.sis.sermepa.es" xmlns:intf="http://webservice.sis.sermepa.es" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
|
339
390
|
<soapenv:Header/>
|
340
391
|
<soapenv:Body>
|
@@ -345,14 +396,15 @@ module ActiveMerchant #:nodoc:
|
|
345
396
|
</intf:#{action}>
|
346
397
|
</soapenv:Body>
|
347
398
|
</soapenv:Envelope>
|
348
|
-
|
399
|
+
REQUEST
|
349
400
|
parse(ssl_post(threeds_url, request, headers(action)), action)
|
350
401
|
else
|
351
|
-
|
402
|
+
xmlreq = xml_request_from(data, options)
|
403
|
+
parse(ssl_post(url, "entrada=#{CGI.escape(xmlreq)}", headers), action)
|
352
404
|
end
|
353
405
|
end
|
354
406
|
|
355
|
-
def headers(action=nil)
|
407
|
+
def headers(action = nil)
|
356
408
|
if action
|
357
409
|
{
|
358
410
|
'Content-Type' => 'text/xml',
|
@@ -418,7 +470,14 @@ module ActiveMerchant #:nodoc:
|
|
418
470
|
xml.target!
|
419
471
|
end
|
420
472
|
|
473
|
+
# Template Method to allow AM API clients to override decision to escape, based on their own criteria.
|
474
|
+
def escape_special_chars?(data, options = {})
|
475
|
+
data[:threeds]
|
476
|
+
end
|
477
|
+
|
421
478
|
def build_merchant_data(xml, data, options = {})
|
479
|
+
# See https://sis-t.redsys.es:25443/sis/services/SerClsWSEntradaV2/wsdl/SerClsWSEntradaV2.wsdl
|
480
|
+
# (which results from calling #threeds_url + '?WSDL', https://sis-t.redsys.es:25443/sis/services/SerClsWSEntradaV2?WSDL)
|
422
481
|
xml.DATOSENTRADA do
|
423
482
|
# Basic elements
|
424
483
|
xml.DS_Version 0.1
|
@@ -426,7 +485,7 @@ module ActiveMerchant #:nodoc:
|
|
426
485
|
xml.DS_MERCHANT_AMOUNT data[:amount]
|
427
486
|
xml.DS_MERCHANT_ORDER data[:order_id]
|
428
487
|
xml.DS_MERCHANT_TRANSACTIONTYPE data[:action]
|
429
|
-
if data[:description] && data
|
488
|
+
if data[:description] && escape_special_chars?(data, options)
|
430
489
|
xml.DS_MERCHANT_PRODUCTDESCRIPTION CGI.escape(data[:description])
|
431
490
|
else
|
432
491
|
xml.DS_MERCHANT_PRODUCTDESCRIPTION data[:description]
|
@@ -434,11 +493,18 @@ module ActiveMerchant #:nodoc:
|
|
434
493
|
xml.DS_MERCHANT_TERMINAL options[:terminal] || @options[:terminal]
|
435
494
|
xml.DS_MERCHANT_MERCHANTCODE @options[:login]
|
436
495
|
xml.DS_MERCHANT_MERCHANTSIGNATURE build_signature(data) unless sha256_authentication?
|
437
|
-
|
496
|
+
|
497
|
+
action = determine_3ds_action(data[:threeds]) if data[:threeds]
|
498
|
+
if action == 'iniciaPeticion' && data[:sca_exemption]
|
499
|
+
xml.DS_MERCHANT_EXCEP_SCA 'Y'
|
500
|
+
else
|
501
|
+
xml.DS_MERCHANT_EXCEP_SCA data[:sca_exemption] if data[:sca_exemption]
|
502
|
+
xml.DS_MERCHANT_DIRECTPAYMENT data[:sca_exemption_direct_payment_enabled] if data[:sca_exemption_direct_payment_enabled]
|
503
|
+
end
|
438
504
|
|
439
505
|
# Only when card is present
|
440
506
|
if data[:card]
|
441
|
-
if data[:card][:name] && data
|
507
|
+
if data[:card][:name] && escape_special_chars?(data, options)
|
442
508
|
xml.DS_MERCHANT_TITULAR CGI.escape(data[:card][:name])
|
443
509
|
else
|
444
510
|
xml.DS_MERCHANT_TITULAR data[:card][:name]
|
@@ -447,6 +513,9 @@ module ActiveMerchant #:nodoc:
|
|
447
513
|
xml.DS_MERCHANT_EXPIRYDATE data[:card][:date]
|
448
514
|
xml.DS_MERCHANT_CVV2 data[:card][:cvv]
|
449
515
|
xml.DS_MERCHANT_IDENTIFIER 'REQUIRED' if data[:store_in_vault]
|
516
|
+
|
517
|
+
build_merchant_mpi_external(xml, data)
|
518
|
+
|
450
519
|
elsif data[:credit_card_token]
|
451
520
|
xml.DS_MERCHANT_IDENTIFIER data[:credit_card_token]
|
452
521
|
xml.DS_MERCHANT_DIRECTPAYMENT 'true'
|
@@ -457,9 +526,36 @@ module ActiveMerchant #:nodoc:
|
|
457
526
|
xml.DS_MERCHANT_DIRECTPAYMENT 'moto' if options.dig(:moto) && options.dig(:metadata, :manual_entry)
|
458
527
|
|
459
528
|
xml.DS_MERCHANT_EMV3DS data[:threeds].to_json if data[:threeds]
|
529
|
+
|
530
|
+
if options[:stored_credential]
|
531
|
+
xml.DS_MERCHANT_COF_INI data[:DS_MERCHANT_COF_INI]
|
532
|
+
xml.DS_MERCHANT_COF_TYPE data[:DS_MERCHANT_COF_TYPE]
|
533
|
+
xml.DS_MERCHANT_COF_TXNID data[:DS_MERCHANT_COF_TXNID] if data[:DS_MERCHANT_COF_TXNID]
|
534
|
+
end
|
460
535
|
end
|
461
536
|
end
|
462
537
|
|
538
|
+
def build_merchant_mpi_external(xml, data)
|
539
|
+
return unless data[:txid] || data[:threeDSServerTransID]
|
540
|
+
|
541
|
+
ds_merchant_mpi_external = {}
|
542
|
+
ds_merchant_mpi_external[:TXID] = data[:txid] if data[:txid]
|
543
|
+
ds_merchant_mpi_external[:CAVV] = data[:cavv] if data[:cavv]
|
544
|
+
ds_merchant_mpi_external[:ECI] = data[:eci_v1] if data[:eci_v1]
|
545
|
+
|
546
|
+
ds_merchant_mpi_external[:threeDSServerTransID] = data[:threeDSServerTransID] if data[:threeDSServerTransID]
|
547
|
+
ds_merchant_mpi_external[:dsTransID] = data[:dsTransID] if data[:dsTransID]
|
548
|
+
ds_merchant_mpi_external[:authenticacionValue] = data[:authenticacionValue] if data[:authenticacionValue]
|
549
|
+
ds_merchant_mpi_external[:protocolVersion] = data[:protocolVersion] if data[:protocolVersion]
|
550
|
+
ds_merchant_mpi_external[:Eci] = data[:eci_v2] if data[:eci_v2]
|
551
|
+
ds_merchant_mpi_external[:authenticacionMethod] = data[:authenticacionMethod] if data[:authenticacionMethod]
|
552
|
+
ds_merchant_mpi_external[:authenticacionType] = data[:authenticacionType] if data[:authenticacionType]
|
553
|
+
ds_merchant_mpi_external[:authenticacionFlow] = data[:authenticacionFlow] if data[:authenticacionFlow]
|
554
|
+
|
555
|
+
xml.DS_MERCHANT_MPIEXTERNAL ds_merchant_mpi_external.to_json unless ds_merchant_mpi_external.empty?
|
556
|
+
xml.target!
|
557
|
+
end
|
558
|
+
|
463
559
|
def parse(data, action)
|
464
560
|
params = {}
|
465
561
|
success = false
|
@@ -542,7 +638,7 @@ module ActiveMerchant #:nodoc:
|
|
542
638
|
def response_text(code)
|
543
639
|
code = code.to_i
|
544
640
|
code = 0 if code < 100
|
545
|
-
RESPONSE_TEXTS[code] || '
|
641
|
+
RESPONSE_TEXTS[code] || 'Unknown code, please check in manual'
|
546
642
|
end
|
547
643
|
|
548
644
|
def response_text_3ds(xml, params)
|
@@ -22,12 +22,12 @@ module ActiveMerchant #:nodoc:
|
|
22
22
|
'store' => 'CC.RG'
|
23
23
|
}
|
24
24
|
|
25
|
-
def initialize(options={})
|
25
|
+
def initialize(options = {})
|
26
26
|
requires!(options, :sender, :channel, :login, :password)
|
27
27
|
super
|
28
28
|
end
|
29
29
|
|
30
|
-
def purchase(money, payment, options={})
|
30
|
+
def purchase(money, payment, options = {})
|
31
31
|
request = build_xml_request do |xml|
|
32
32
|
add_identification(xml, options)
|
33
33
|
add_payment(xml, money, 'sale', options)
|
@@ -39,7 +39,7 @@ module ActiveMerchant #:nodoc:
|
|
39
39
|
commit(request)
|
40
40
|
end
|
41
41
|
|
42
|
-
def refund(money, authorization, options={})
|
42
|
+
def refund(money, authorization, options = {})
|
43
43
|
request = build_xml_request do |xml|
|
44
44
|
add_identification(xml, options, authorization)
|
45
45
|
add_payment(xml, money, 'refund', options)
|
@@ -48,7 +48,7 @@ module ActiveMerchant #:nodoc:
|
|
48
48
|
commit(request)
|
49
49
|
end
|
50
50
|
|
51
|
-
def authorize(money, payment, options={})
|
51
|
+
def authorize(money, payment, options = {})
|
52
52
|
request = build_xml_request do |xml|
|
53
53
|
add_identification(xml, options)
|
54
54
|
add_payment(xml, money, 'authonly', options)
|
@@ -60,7 +60,7 @@ module ActiveMerchant #:nodoc:
|
|
60
60
|
commit(request)
|
61
61
|
end
|
62
62
|
|
63
|
-
def capture(money, authorization, options={})
|
63
|
+
def capture(money, authorization, options = {})
|
64
64
|
request = build_xml_request do |xml|
|
65
65
|
add_identification(xml, options, authorization)
|
66
66
|
add_payment(xml, money, 'capture', options)
|
@@ -69,7 +69,7 @@ module ActiveMerchant #:nodoc:
|
|
69
69
|
commit(request)
|
70
70
|
end
|
71
71
|
|
72
|
-
def void(authorization, options={})
|
72
|
+
def void(authorization, options = {})
|
73
73
|
request = build_xml_request do |xml|
|
74
74
|
add_identification(xml, options, authorization)
|
75
75
|
add_payment(xml, nil, 'void', options)
|
@@ -89,7 +89,7 @@ module ActiveMerchant #:nodoc:
|
|
89
89
|
commit(request)
|
90
90
|
end
|
91
91
|
|
92
|
-
def verify(credit_card, options={})
|
92
|
+
def verify(credit_card, options = {})
|
93
93
|
MultiResponse.run(:use_first_response) do |r|
|
94
94
|
r.process { authorize(100, credit_card, options) }
|
95
95
|
r.process(:ignore_result) { void(r.authorization, options) }
|