activemerchant 1.130.0 → 1.137.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +268 -0
- data/lib/active_merchant/billing/check.rb +2 -2
- data/lib/active_merchant/billing/compatibility.rb +4 -4
- data/lib/active_merchant/billing/credit_card.rb +13 -8
- data/lib/active_merchant/billing/credit_card_formatting.rb +4 -0
- data/lib/active_merchant/billing/credit_card_methods.rb +64 -7
- data/lib/active_merchant/billing/gateway.rb +9 -0
- data/lib/active_merchant/billing/gateways/adyen.rb +240 -41
- data/lib/active_merchant/billing/gateways/airwallex.rb +26 -12
- data/lib/active_merchant/billing/gateways/alelo.rb +23 -5
- data/lib/active_merchant/billing/gateways/authorize_net.rb +44 -36
- data/lib/active_merchant/billing/gateways/authorize_net_arb.rb +10 -6
- data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +1 -3
- data/lib/active_merchant/billing/gateways/axcessms.rb +6 -2
- data/lib/active_merchant/billing/gateways/banwire.rb +4 -2
- data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +7 -3
- data/lib/active_merchant/billing/gateways/blue_pay.rb +13 -5
- data/lib/active_merchant/billing/gateways/blue_snap.rb +5 -5
- data/lib/active_merchant/billing/gateways/borgun.rb +6 -4
- data/lib/active_merchant/billing/gateways/braintree/token_nonce.rb +65 -20
- data/lib/active_merchant/billing/gateways/braintree_blue.rb +226 -73
- data/lib/active_merchant/billing/gateways/braintree_orange.rb +1 -1
- data/lib/active_merchant/billing/gateways/card_connect.rb +5 -2
- data/lib/active_merchant/billing/gateways/card_stream.rb +4 -6
- data/lib/active_merchant/billing/gateways/cashnet.rb +1 -1
- data/lib/active_merchant/billing/gateways/cecabank/cecabank_common.rb +36 -0
- data/lib/active_merchant/billing/gateways/cecabank/cecabank_json.rb +316 -0
- data/lib/active_merchant/billing/gateways/cecabank/cecabank_xml.rb +220 -0
- data/lib/active_merchant/billing/gateways/cecabank.rb +7 -240
- data/lib/active_merchant/billing/gateways/checkout_v2.rb +252 -41
- data/lib/active_merchant/billing/gateways/commerce_hub.rb +69 -8
- data/lib/active_merchant/billing/gateways/credorax.rb +3 -5
- data/lib/active_merchant/billing/gateways/cyber_source.rb +192 -41
- data/lib/active_merchant/billing/gateways/cyber_source_rest.rb +102 -58
- data/lib/active_merchant/billing/gateways/d_local.rb +26 -15
- data/lib/active_merchant/billing/gateways/data_cash.rb +21 -17
- data/lib/active_merchant/billing/gateways/datatrans.rb +279 -0
- data/lib/active_merchant/billing/gateways/decidir.rb +53 -18
- data/lib/active_merchant/billing/gateways/decidir_plus.rb +4 -1
- data/lib/active_merchant/billing/gateways/deepstack.rb +382 -0
- data/lib/active_merchant/billing/gateways/ebanx.rb +40 -36
- data/lib/active_merchant/billing/gateways/efsnet.rb +6 -2
- data/lib/active_merchant/billing/gateways/elavon.rb +99 -33
- data/lib/active_merchant/billing/gateways/element.rb +36 -7
- data/lib/active_merchant/billing/gateways/epay.rb +6 -2
- data/lib/active_merchant/billing/gateways/evo_ca.rb +6 -2
- data/lib/active_merchant/billing/gateways/eway.rb +4 -2
- data/lib/active_merchant/billing/gateways/eway_managed.rb +6 -2
- data/lib/active_merchant/billing/gateways/exact.rb +6 -2
- data/lib/active_merchant/billing/gateways/fat_zebra.rb +31 -3
- data/lib/active_merchant/billing/gateways/federated_canada.rb +6 -2
- data/lib/active_merchant/billing/gateways/first_pay/first_pay_common.rb +15 -0
- data/lib/active_merchant/billing/gateways/first_pay/first_pay_json.rb +190 -0
- data/lib/active_merchant/billing/gateways/first_pay/first_pay_xml.rb +183 -0
- data/lib/active_merchant/billing/gateways/first_pay.rb +6 -172
- data/lib/active_merchant/billing/gateways/firstdata_e4.rb +6 -2
- data/lib/active_merchant/billing/gateways/firstdata_e4_v27.rb +7 -3
- data/lib/active_merchant/billing/gateways/flex_charge.rb +347 -0
- data/lib/active_merchant/billing/gateways/garanti.rb +4 -2
- data/lib/active_merchant/billing/gateways/global_collect.rb +45 -37
- data/lib/active_merchant/billing/gateways/hi_pay.rb +286 -0
- data/lib/active_merchant/billing/gateways/hps.rb +1 -1
- data/lib/active_merchant/billing/gateways/iats_payments.rb +7 -2
- data/lib/active_merchant/billing/gateways/inspire.rb +6 -4
- data/lib/active_merchant/billing/gateways/instapay.rb +7 -4
- data/lib/active_merchant/billing/gateways/ipg.rb +10 -6
- data/lib/active_merchant/billing/gateways/iridium.rb +15 -5
- data/lib/active_merchant/billing/gateways/itransact.rb +6 -2
- data/lib/active_merchant/billing/gateways/iveri.rb +3 -3
- data/lib/active_merchant/billing/gateways/ixopay.rb +2 -2
- data/lib/active_merchant/billing/gateways/jetpay.rb +4 -2
- data/lib/active_merchant/billing/gateways/jetpay_v2.rb +4 -2
- data/lib/active_merchant/billing/gateways/kushki.rb +73 -13
- data/lib/active_merchant/billing/gateways/linkpoint.rb +6 -2
- data/lib/active_merchant/billing/gateways/litle.rb +33 -50
- data/lib/active_merchant/billing/gateways/mastercard.rb +4 -4
- data/lib/active_merchant/billing/gateways/maxipago.rb +2 -2
- data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +8 -5
- data/lib/active_merchant/billing/gateways/merchant_ware.rb +11 -4
- data/lib/active_merchant/billing/gateways/merchant_ware_version_four.rb +11 -4
- data/lib/active_merchant/billing/gateways/merchant_warrior.rb +19 -3
- data/lib/active_merchant/billing/gateways/mercury.rb +6 -2
- data/lib/active_merchant/billing/gateways/metrics_global.rb +8 -6
- data/lib/active_merchant/billing/gateways/migs/migs_codes.rb +1 -0
- data/lib/active_merchant/billing/gateways/migs.rb +6 -2
- data/lib/active_merchant/billing/gateways/mit.rb +25 -20
- data/lib/active_merchant/billing/gateways/modern_payments_cim.rb +18 -10
- data/lib/active_merchant/billing/gateways/monei.rb +1 -1
- data/lib/active_merchant/billing/gateways/moneris.rb +9 -3
- data/lib/active_merchant/billing/gateways/money_movers.rb +6 -2
- data/lib/active_merchant/billing/gateways/nab_transact.rb +12 -4
- data/lib/active_merchant/billing/gateways/net_registry.rb +6 -2
- data/lib/active_merchant/billing/gateways/netbanx.rb +1 -3
- data/lib/active_merchant/billing/gateways/netbilling.rb +6 -2
- data/lib/active_merchant/billing/gateways/network_merchants.rb +6 -2
- data/lib/active_merchant/billing/gateways/nmi.rb +23 -6
- data/lib/active_merchant/billing/gateways/ogone.rb +6 -2
- data/lib/active_merchant/billing/gateways/openpay.rb +4 -2
- data/lib/active_merchant/billing/gateways/opp.rb +1 -2
- data/lib/active_merchant/billing/gateways/optimal_payment.rb +6 -2
- data/lib/active_merchant/billing/gateways/orbital/orbital_soft_descriptors.rb +1 -3
- data/lib/active_merchant/billing/gateways/orbital.rb +83 -24
- data/lib/active_merchant/billing/gateways/pac_net_raven.rb +7 -4
- data/lib/active_merchant/billing/gateways/pay_gate_xml.rb +6 -2
- data/lib/active_merchant/billing/gateways/pay_hub.rb +4 -2
- data/lib/active_merchant/billing/gateways/pay_junction.rb +6 -2
- data/lib/active_merchant/billing/gateways/pay_secure.rb +6 -2
- data/lib/active_merchant/billing/gateways/pay_trace.rb +31 -18
- data/lib/active_merchant/billing/gateways/payeezy.rb +19 -8
- data/lib/active_merchant/billing/gateways/payex.rb +4 -2
- data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +1 -1
- data/lib/active_merchant/billing/gateways/payflow.rb +1 -3
- data/lib/active_merchant/billing/gateways/payment_express.rb +8 -4
- data/lib/active_merchant/billing/gateways/paymentez.rb +23 -11
- data/lib/active_merchant/billing/gateways/paysafe.rb +12 -11
- data/lib/active_merchant/billing/gateways/payscout.rb +7 -4
- data/lib/active_merchant/billing/gateways/paystation.rb +7 -3
- data/lib/active_merchant/billing/gateways/payway.rb +6 -2
- data/lib/active_merchant/billing/gateways/payway_dot_com.rb +3 -3
- data/lib/active_merchant/billing/gateways/pin.rb +22 -4
- data/lib/active_merchant/billing/gateways/plexo.rb +49 -10
- data/lib/active_merchant/billing/gateways/plugnpay.rb +6 -2
- data/lib/active_merchant/billing/gateways/priority.rb +6 -5
- data/lib/active_merchant/billing/gateways/psigate.rb +6 -2
- data/lib/active_merchant/billing/gateways/psl_card.rb +6 -2
- data/lib/active_merchant/billing/gateways/qbms.rb +6 -2
- data/lib/active_merchant/billing/gateways/quantum.rb +6 -2
- data/lib/active_merchant/billing/gateways/quickbooks.rb +6 -5
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb +7 -4
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_v4to7.rb +6 -2
- data/lib/active_merchant/billing/gateways/rapyd.rb +148 -46
- data/lib/active_merchant/billing/gateways/reach.rb +11 -4
- data/lib/active_merchant/billing/gateways/redsys.rb +3 -11
- data/lib/active_merchant/billing/gateways/redsys_rest.rb +507 -0
- data/lib/active_merchant/billing/gateways/s5.rb +3 -3
- data/lib/active_merchant/billing/gateways/safe_charge.rb +38 -17
- data/lib/active_merchant/billing/gateways/sage.rb +12 -4
- data/lib/active_merchant/billing/gateways/sage_pay.rb +79 -5
- data/lib/active_merchant/billing/gateways/sallie_mae.rb +6 -2
- data/lib/active_merchant/billing/gateways/secure_net.rb +6 -2
- data/lib/active_merchant/billing/gateways/secure_pay.rb +8 -6
- data/lib/active_merchant/billing/gateways/secure_pay_au.rb +12 -4
- data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +6 -2
- data/lib/active_merchant/billing/gateways/securion_pay.rb +24 -10
- data/lib/active_merchant/billing/gateways/shift4.rb +17 -20
- data/lib/active_merchant/billing/gateways/shift4_v2.rb +117 -0
- data/lib/active_merchant/billing/gateways/simetrik.rb +17 -11
- data/lib/active_merchant/billing/gateways/skip_jack.rb +6 -2
- data/lib/active_merchant/billing/gateways/smart_ps.rb +7 -4
- data/lib/active_merchant/billing/gateways/so_easy_pay.rb +4 -2
- data/lib/active_merchant/billing/gateways/spreedly_core.rb +2 -4
- data/lib/active_merchant/billing/gateways/stripe.rb +63 -19
- data/lib/active_merchant/billing/gateways/stripe_payment_intents.rb +280 -88
- data/lib/active_merchant/billing/gateways/sum_up.rb +223 -0
- data/lib/active_merchant/billing/gateways/swipe_checkout.rb +4 -2
- data/lib/active_merchant/billing/gateways/telr.rb +3 -4
- data/lib/active_merchant/billing/gateways/trans_first.rb +1 -2
- data/lib/active_merchant/billing/gateways/trans_first_transaction_express.rb +8 -16
- data/lib/active_merchant/billing/gateways/transact_pro.rb +1 -1
- data/lib/active_merchant/billing/gateways/trust_commerce.rb +6 -2
- data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +9 -8
- data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +6 -2
- data/lib/active_merchant/billing/gateways/vanco.rb +2 -4
- data/lib/active_merchant/billing/gateways/vantiv_express.rb +587 -0
- data/lib/active_merchant/billing/gateways/verifi.rb +6 -2
- data/lib/active_merchant/billing/gateways/viaklix.rb +6 -2
- data/lib/active_merchant/billing/gateways/visanet_peru.rb +2 -2
- data/lib/active_merchant/billing/gateways/vpos.rb +4 -4
- data/lib/active_merchant/billing/gateways/wirecard.rb +7 -3
- data/lib/active_merchant/billing/gateways/wompi.rb +5 -0
- data/lib/active_merchant/billing/gateways/worldpay.rb +147 -93
- data/lib/active_merchant/billing/gateways/worldpay_online_payments.rb +13 -10
- data/lib/active_merchant/billing/gateways/xpay.rb +242 -0
- data/lib/active_merchant/billing/network_tokenization_credit_card.rb +1 -1
- data/lib/active_merchant/billing/response.rb +2 -2
- data/lib/active_merchant/connection.rb +3 -17
- data/lib/active_merchant/country.rb +1 -0
- data/lib/active_merchant/errors.rb +10 -0
- data/lib/active_merchant/version.rb +1 -1
- data/lib/support/gateway_support.rb +2 -2
- data/lib/support/ssl_verify.rb +4 -4
- data/lib/support/ssl_version.rb +6 -6
- metadata +30 -9
@@ -7,6 +7,7 @@ module ActiveMerchant #:nodoc:
|
|
7
7
|
module Billing #:nodoc:
|
8
8
|
class MitGateway < Gateway
|
9
9
|
self.live_url = 'https://wpy.mitec.com.mx/ModuloUtilWS/activeCDP.htm'
|
10
|
+
self.test_url = 'https://scqa.mitec.com.mx/ModuloUtilWS/activeCDP.htm'
|
10
11
|
|
11
12
|
self.supported_countries = ['MX']
|
12
13
|
self.default_currency = 'MXN'
|
@@ -41,7 +42,7 @@ module ActiveMerchant #:nodoc:
|
|
41
42
|
# original message
|
42
43
|
full_data = unpacked[0].bytes.slice(16, unpacked[0].bytes.length)
|
43
44
|
# Creates the engine
|
44
|
-
engine = OpenSSL::Cipher
|
45
|
+
engine = OpenSSL::Cipher.new('aes-128-cbc')
|
45
46
|
# Set engine as decrypt mode
|
46
47
|
engine.decrypt
|
47
48
|
# Converts the key from hex to bytes
|
@@ -54,7 +55,7 @@ module ActiveMerchant #:nodoc:
|
|
54
55
|
|
55
56
|
def encrypt(val, keyinhex)
|
56
57
|
# Creates the engine motor
|
57
|
-
engine = OpenSSL::Cipher
|
58
|
+
engine = OpenSSL::Cipher.new('aes-128-cbc')
|
58
59
|
# Set engine as encrypt mode
|
59
60
|
engine.encrypt
|
60
61
|
# Converts the key from hex to bytes
|
@@ -93,8 +94,7 @@ module ActiveMerchant #:nodoc:
|
|
93
94
|
post_to_json_encrypt = encrypt(post_to_json, @options[:key_session])
|
94
95
|
|
95
96
|
final_post = '<authorization>' + post_to_json_encrypt + '</authorization><dataID>' + @options[:user] + '</dataID>'
|
96
|
-
json_post =
|
97
|
-
json_post[:payload] = final_post
|
97
|
+
json_post = final_post
|
98
98
|
commit('sale', json_post)
|
99
99
|
end
|
100
100
|
|
@@ -114,8 +114,7 @@ module ActiveMerchant #:nodoc:
|
|
114
114
|
post_to_json_encrypt = encrypt(post_to_json, @options[:key_session])
|
115
115
|
|
116
116
|
final_post = '<capture>' + post_to_json_encrypt + '</capture><dataID>' + @options[:user] + '</dataID>'
|
117
|
-
json_post =
|
118
|
-
json_post[:payload] = final_post
|
117
|
+
json_post = final_post
|
119
118
|
commit('capture', json_post)
|
120
119
|
end
|
121
120
|
|
@@ -136,8 +135,7 @@ module ActiveMerchant #:nodoc:
|
|
136
135
|
post_to_json_encrypt = encrypt(post_to_json, @options[:key_session])
|
137
136
|
|
138
137
|
final_post = '<refund>' + post_to_json_encrypt + '</refund><dataID>' + @options[:user] + '</dataID>'
|
139
|
-
json_post =
|
140
|
-
json_post[:payload] = final_post
|
138
|
+
json_post = final_post
|
141
139
|
commit('refund', json_post)
|
142
140
|
end
|
143
141
|
|
@@ -145,10 +143,18 @@ module ActiveMerchant #:nodoc:
|
|
145
143
|
true
|
146
144
|
end
|
147
145
|
|
146
|
+
def extract_mit_responses_from_transcript(transcript)
|
147
|
+
groups = transcript.scan(/reading \d+ bytes(.*?)read \d+ bytes/m)
|
148
|
+
groups.map do |group|
|
149
|
+
group.first.scan(/-> "(.*?)"/).flatten.map(&:strip).join('')
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
148
153
|
def scrub(transcript)
|
149
154
|
ret_transcript = transcript
|
150
155
|
auth_origin = ret_transcript[/<authorization>(.*?)<\/authorization>/, 1]
|
151
156
|
unless auth_origin.nil?
|
157
|
+
auth_origin = auth_origin.gsub('\n', '')
|
152
158
|
auth_decrypted = decrypt(auth_origin, @options[:key_session])
|
153
159
|
auth_json = JSON.parse(auth_decrypted)
|
154
160
|
auth_json['card'] = '[FILTERED]'
|
@@ -162,6 +168,7 @@ module ActiveMerchant #:nodoc:
|
|
162
168
|
|
163
169
|
cap_origin = ret_transcript[/<capture>(.*?)<\/capture>/, 1]
|
164
170
|
unless cap_origin.nil?
|
171
|
+
cap_origin = cap_origin.gsub('\n', '')
|
165
172
|
cap_decrypted = decrypt(cap_origin, @options[:key_session])
|
166
173
|
cap_json = JSON.parse(cap_decrypted)
|
167
174
|
cap_json['apikey'] = '[FILTERED]'
|
@@ -173,6 +180,7 @@ module ActiveMerchant #:nodoc:
|
|
173
180
|
|
174
181
|
ref_origin = ret_transcript[/<refund>(.*?)<\/refund>/, 1]
|
175
182
|
unless ref_origin.nil?
|
183
|
+
ref_origin = ref_origin.gsub('\n', '')
|
176
184
|
ref_decrypted = decrypt(ref_origin, @options[:key_session])
|
177
185
|
ref_json = JSON.parse(ref_decrypted)
|
178
186
|
ref_json['apikey'] = '[FILTERED]'
|
@@ -182,15 +190,10 @@ module ActiveMerchant #:nodoc:
|
|
182
190
|
ret_transcript = ret_transcript.gsub(/<refund>(.*?)<\/refund>/, ref_tagged)
|
183
191
|
end
|
184
192
|
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
resp_origin = res_origin[/#{Regexp.escape('"')}(.*?)#{Regexp.escape('"')}/m, 1]
|
190
|
-
resp_decrypted = decrypt(resp_origin, @options[:key_session])
|
191
|
-
ret_transcript[/#{Regexp.escape('reading ')}(.*?)#{Regexp.escape('read')}/m, 1] = resp_decrypted
|
192
|
-
ret_transcript = ret_transcript.sub('reading ', 'response: ')
|
193
|
-
res_origin = ret_transcript[/#{Regexp.escape('reading ')}(.*?)#{Regexp.escape('read')}/m, 1]
|
193
|
+
groups = extract_mit_responses_from_transcript(transcript)
|
194
|
+
groups.each do |group|
|
195
|
+
group_decrypted = decrypt(group, @options[:key_session])
|
196
|
+
ret_transcript = ret_transcript.gsub('Conn close', "\n" + group_decrypted + "\nConn close")
|
194
197
|
end
|
195
198
|
|
196
199
|
ret_transcript
|
@@ -218,10 +221,12 @@ module ActiveMerchant #:nodoc:
|
|
218
221
|
post[:name_client] = [payment.first_name, payment.last_name].join(' ')
|
219
222
|
end
|
220
223
|
|
224
|
+
def url
|
225
|
+
test? ? test_url : live_url
|
226
|
+
end
|
227
|
+
|
221
228
|
def commit(action, parameters)
|
222
|
-
|
223
|
-
cleaned_str = json_str.gsub('\n', '')
|
224
|
-
raw_response = ssl_post(live_url, cleaned_str, { 'Content-type' => 'application/json' })
|
229
|
+
raw_response = ssl_post(url, parameters, { 'Content-type' => 'text/plain' })
|
225
230
|
response = JSON.parse(decrypt(raw_response, @options[:key_session]))
|
226
231
|
|
227
232
|
Response.new(
|
@@ -111,13 +111,12 @@ module ActiveMerchant #:nodoc:
|
|
111
111
|
end
|
112
112
|
|
113
113
|
def build_request(action, params)
|
114
|
+
envelope_obj = { 'xmlns:xsd' => 'http://www.w3.org/2001/XMLSchema',
|
115
|
+
'xmlns:env' => 'http://schemas.xmlsoap.org/soap/envelope/',
|
116
|
+
'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance' }
|
114
117
|
xml = Builder::XmlMarkup.new indent: 2
|
115
118
|
xml.instruct!
|
116
|
-
xml.tag! 'env:Envelope',
|
117
|
-
{ 'xmlns:xsd' => 'http://www.w3.org/2001/XMLSchema',
|
118
|
-
'xmlns:env' => 'http://schemas.xmlsoap.org/soap/envelope/',
|
119
|
-
'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance' } do
|
120
|
-
|
119
|
+
xml.tag! 'env:Envelope', envelope_obj do
|
121
120
|
xml.tag! 'env:Body' do
|
122
121
|
xml.tag! action, { 'xmlns' => xmlns(action) } do
|
123
122
|
xml.tag! 'clientId', @options[:login]
|
@@ -146,15 +145,24 @@ module ActiveMerchant #:nodoc:
|
|
146
145
|
end
|
147
146
|
|
148
147
|
def commit(action, params)
|
149
|
-
data = ssl_post(
|
150
|
-
|
151
|
-
|
148
|
+
data = ssl_post(
|
149
|
+
url(action),
|
150
|
+
build_request(action, params),
|
151
|
+
{
|
152
|
+
'Content-Type' => 'text/xml; charset=utf-8',
|
153
|
+
'SOAPAction' => "#{xmlns(action)}#{action}"
|
154
|
+
}
|
155
|
+
)
|
152
156
|
|
153
157
|
response = parse(action, data)
|
154
|
-
Response.new(
|
158
|
+
Response.new(
|
159
|
+
successful?(action, response),
|
160
|
+
message_from(action, response),
|
161
|
+
response,
|
155
162
|
test: test?,
|
156
163
|
authorization: authorization_from(action, response),
|
157
|
-
avs_result: { code: response[:avs_code] }
|
164
|
+
avs_result: { code: response[:avs_code] }
|
165
|
+
)
|
158
166
|
end
|
159
167
|
|
160
168
|
def authorization_from(action, response)
|
@@ -337,7 +337,7 @@ module ActiveMerchant #:nodoc:
|
|
337
337
|
endpoint = translate_action_endpoint(action, options)
|
338
338
|
headers = {
|
339
339
|
'Content-Type': 'application/json;charset=UTF-8',
|
340
|
-
|
340
|
+
Authorization: @options[:api_key],
|
341
341
|
'User-Agent': 'MONEI/Shopify/0.1.0'
|
342
342
|
}
|
343
343
|
|
@@ -54,6 +54,7 @@ module ActiveMerchant #:nodoc:
|
|
54
54
|
post[:crypt_type] = options[:crypt_type] || @options[:crypt_type]
|
55
55
|
add_external_mpi_fields(post, options)
|
56
56
|
add_stored_credential(post, options)
|
57
|
+
add_cust_id(post, options)
|
57
58
|
action = if post[:cavv] || options[:three_d_secure]
|
58
59
|
'cavv_preauth'
|
59
60
|
elsif post[:data_key].blank?
|
@@ -78,6 +79,7 @@ module ActiveMerchant #:nodoc:
|
|
78
79
|
post[:crypt_type] = options[:crypt_type] || @options[:crypt_type]
|
79
80
|
add_external_mpi_fields(post, options)
|
80
81
|
add_stored_credential(post, options)
|
82
|
+
add_cust_id(post, options)
|
81
83
|
action = if post[:cavv] || options[:three_d_secure]
|
82
84
|
'cavv_purchase'
|
83
85
|
elsif post[:data_key].blank?
|
@@ -216,7 +218,7 @@ module ActiveMerchant #:nodoc:
|
|
216
218
|
three_d_secure_options = options[:three_d_secure]
|
217
219
|
|
218
220
|
post[:threeds_version] = three_d_secure_options[:version]
|
219
|
-
post[:crypt_type] = three_d_secure_options
|
221
|
+
post[:crypt_type] = three_d_secure_options.dig(:eci)&.to_s&.sub!(/^0/, '')
|
220
222
|
post[:cavv] = three_d_secure_options[:cavv]
|
221
223
|
post[:threeds_server_trans_id] = three_d_secure_options[:three_ds_server_trans_id]
|
222
224
|
post[:ds_trans_id] = three_d_secure_options[:ds_transaction_id]
|
@@ -248,6 +250,10 @@ module ActiveMerchant #:nodoc:
|
|
248
250
|
post[:payment_information] = options[:payment_information] if options[:payment_information]
|
249
251
|
end
|
250
252
|
|
253
|
+
def add_cust_id(post, options)
|
254
|
+
post[:cust_id] = options[:cust_id] if options[:cust_id]
|
255
|
+
end
|
256
|
+
|
251
257
|
def add_stored_credential(post, options)
|
252
258
|
add_cof(post, options)
|
253
259
|
# if any of :issuer_id, :payment_information, or :payment_indicator is not passed,
|
@@ -467,8 +473,8 @@ module ActiveMerchant #:nodoc:
|
|
467
473
|
'indrefund' => %i[order_id cust_id amount pan expdate crypt_type],
|
468
474
|
'completion' => %i[order_id comp_amount txn_number crypt_type],
|
469
475
|
'purchasecorrection' => %i[order_id txn_number crypt_type],
|
470
|
-
'cavv_preauth' => %i[order_id cust_id amount pan expdate cavv crypt_type wallet_indicator],
|
471
|
-
'cavv_purchase' => %i[order_id cust_id amount pan expdate cavv crypt_type wallet_indicator],
|
476
|
+
'cavv_preauth' => %i[order_id cust_id amount pan expdate cavv crypt_type wallet_indicator threeds_version threeds_server_trans_id ds_trans_id],
|
477
|
+
'cavv_purchase' => %i[order_id cust_id amount pan expdate cavv crypt_type wallet_indicator threeds_version threeds_server_trans_id ds_trans_id],
|
472
478
|
'card_verification' => %i[order_id cust_id pan expdate crypt_type avs_info cvd_info cof_info],
|
473
479
|
'transact' => %i[order_id cust_id amount pan expdate crypt_type],
|
474
480
|
'Batchcloseall' => [],
|
@@ -113,11 +113,15 @@ module ActiveMerchant #:nodoc:
|
|
113
113
|
response = parse(data)
|
114
114
|
message = message_from(response)
|
115
115
|
|
116
|
-
Response.new(
|
116
|
+
Response.new(
|
117
|
+
success?(response),
|
118
|
+
message,
|
119
|
+
response,
|
117
120
|
test: test?,
|
118
121
|
authorization: response['transactionid'],
|
119
122
|
avs_result: { code: response['avsresponse'] },
|
120
|
-
cvv_result: response['cvvresponse']
|
123
|
+
cvv_result: response['cvvresponse']
|
124
|
+
)
|
121
125
|
end
|
122
126
|
|
123
127
|
def success?(response)
|
@@ -233,16 +233,24 @@ module ActiveMerchant #:nodoc:
|
|
233
233
|
def commit(action, request)
|
234
234
|
response = parse(ssl_post(test? ? self.test_url : self.live_url, build_request(action, request)))
|
235
235
|
|
236
|
-
Response.new(
|
236
|
+
Response.new(
|
237
|
+
success?(response),
|
238
|
+
message_from(response),
|
239
|
+
response,
|
237
240
|
test: test?,
|
238
|
-
authorization: authorization_from(action, response)
|
241
|
+
authorization: authorization_from(action, response)
|
242
|
+
)
|
239
243
|
end
|
240
244
|
|
241
245
|
def commit_periodic(action, request)
|
242
246
|
response = parse(ssl_post(test? ? self.test_periodic_url : self.live_periodic_url, build_periodic_request(action, request)))
|
243
|
-
Response.new(
|
247
|
+
Response.new(
|
248
|
+
success?(response),
|
249
|
+
message_from(response),
|
250
|
+
response,
|
244
251
|
test: test?,
|
245
|
-
authorization: authorization_from(action, response)
|
252
|
+
authorization: authorization_from(action, response)
|
253
|
+
)
|
246
254
|
end
|
247
255
|
|
248
256
|
def success?(response)
|
@@ -144,8 +144,12 @@ module ActiveMerchant
|
|
144
144
|
# get gateway response
|
145
145
|
response = parse(ssl_post(self.live_url, post_data(action, params)))
|
146
146
|
|
147
|
-
Response.new(
|
148
|
-
|
147
|
+
Response.new(
|
148
|
+
response['status'] == 'approved',
|
149
|
+
message_from(response),
|
150
|
+
response,
|
151
|
+
authorization: authorization_from(response, action)
|
152
|
+
)
|
149
153
|
end
|
150
154
|
|
151
155
|
def post_data(action, params)
|
@@ -233,7 +233,7 @@ module ActiveMerchant #:nodoc:
|
|
233
233
|
end
|
234
234
|
|
235
235
|
def map_3ds(three_d_secure_options)
|
236
|
-
|
236
|
+
{
|
237
237
|
eci: three_d_secure_options[:eci],
|
238
238
|
cavv: three_d_secure_options[:cavv],
|
239
239
|
xid: three_d_secure_options[:xid],
|
@@ -241,8 +241,6 @@ module ActiveMerchant #:nodoc:
|
|
241
241
|
threeDSecureVersion: three_d_secure_options[:version],
|
242
242
|
directoryServerTransactionId: three_d_secure_options[:ds_transaction_id]
|
243
243
|
}
|
244
|
-
|
245
|
-
mapped
|
246
244
|
end
|
247
245
|
|
248
246
|
def parse(body)
|
@@ -193,11 +193,15 @@ module ActiveMerchant #:nodoc:
|
|
193
193
|
def commit(action, parameters)
|
194
194
|
response = parse(ssl_post(self.live_url, post_data(action, parameters)))
|
195
195
|
|
196
|
-
Response.new(
|
196
|
+
Response.new(
|
197
|
+
success?(response),
|
198
|
+
message_from(response),
|
199
|
+
response,
|
197
200
|
test: test_response?(response),
|
198
201
|
authorization: response[:trans_id],
|
199
202
|
avs_result: { code: response[:avs_code] },
|
200
|
-
cvv_result: response[:cvv2_code]
|
203
|
+
cvv_result: response[:cvv2_code]
|
204
|
+
)
|
201
205
|
rescue ActiveMerchant::ResponseError => e
|
202
206
|
raise unless e.response.code =~ /^[67]\d\d$/
|
203
207
|
|
@@ -200,11 +200,15 @@ module ActiveMerchant #:nodoc:
|
|
200
200
|
|
201
201
|
authorization = authorization_from(success, parameters, raw)
|
202
202
|
|
203
|
-
Response.new(
|
203
|
+
Response.new(
|
204
|
+
success,
|
205
|
+
raw['responsetext'],
|
206
|
+
raw,
|
204
207
|
test: test?,
|
205
208
|
authorization: authorization,
|
206
209
|
avs_result: { code: raw['avsresponse'] },
|
207
|
-
cvv_result: raw['cvvresponse']
|
210
|
+
cvv_result: raw['cvvresponse']
|
211
|
+
)
|
208
212
|
end
|
209
213
|
|
210
214
|
def build_request(action, parameters)
|
@@ -8,7 +8,7 @@ module ActiveMerchant #:nodoc:
|
|
8
8
|
self.test_url = self.live_url = 'https://secure.networkmerchants.com/api/transact.php'
|
9
9
|
self.default_currency = 'USD'
|
10
10
|
self.money_format = :dollars
|
11
|
-
self.supported_countries = [
|
11
|
+
self.supported_countries = %w[US CA]
|
12
12
|
self.supported_cardtypes = %i[visa master american_express discover]
|
13
13
|
self.homepage_url = 'http://nmi.com/'
|
14
14
|
self.display_name = 'NMI'
|
@@ -134,6 +134,7 @@ module ActiveMerchant #:nodoc:
|
|
134
134
|
gsub(%r((cvv=)\d+), '\1[FILTERED]').
|
135
135
|
gsub(%r((checkaba=)\d+), '\1[FILTERED]').
|
136
136
|
gsub(%r((checkaccount=)\d+), '\1[FILTERED]').
|
137
|
+
gsub(%r((cavv=)[^&\n]*), '\1[FILTERED]').
|
137
138
|
gsub(%r((cryptogram=)[^&]+(&?)), '\1[FILTERED]\2')
|
138
139
|
end
|
139
140
|
|
@@ -149,6 +150,7 @@ module ActiveMerchant #:nodoc:
|
|
149
150
|
|
150
151
|
def add_invoice(post, money, options)
|
151
152
|
post[:amount] = amount(money)
|
153
|
+
post[:surcharge] = options[:surcharge] if options[:surcharge]
|
152
154
|
post[:orderid] = options[:order_id]
|
153
155
|
post[:orderdescription] = options[:description]
|
154
156
|
post[:currency] = options[:currency] || currency(money)
|
@@ -165,7 +167,7 @@ module ActiveMerchant #:nodoc:
|
|
165
167
|
elsif payment_method.is_a?(NetworkTokenizationCreditCard)
|
166
168
|
post[:ccnumber] = payment_method.number
|
167
169
|
post[:ccexp] = exp_date(payment_method)
|
168
|
-
post
|
170
|
+
add_network_token_fields(post, payment_method)
|
169
171
|
elsif card_brand(payment_method) == 'check'
|
170
172
|
post[:payment] = 'check'
|
171
173
|
post[:firstname] = payment_method.first_name
|
@@ -186,6 +188,17 @@ module ActiveMerchant #:nodoc:
|
|
186
188
|
end
|
187
189
|
end
|
188
190
|
|
191
|
+
def add_network_token_fields(post, payment_method)
|
192
|
+
if payment_method.source == :apple_pay || payment_method.source == :google_pay
|
193
|
+
post[:cavv] = payment_method.payment_cryptogram
|
194
|
+
post[:eci] = payment_method.eci
|
195
|
+
post[:decrypted_applepay_data] = 1
|
196
|
+
post[:decrypted_googlepay_data] = 1
|
197
|
+
else
|
198
|
+
post[:token_cryptogram] = payment_method.payment_cryptogram
|
199
|
+
end
|
200
|
+
end
|
201
|
+
|
189
202
|
def add_stored_credential(post, options)
|
190
203
|
return unless (stored_credential = options[:stored_credential])
|
191
204
|
|
@@ -211,7 +224,8 @@ module ActiveMerchant #:nodoc:
|
|
211
224
|
else
|
212
225
|
post[:stored_credential_indicator] = 'used'
|
213
226
|
# should only send :initial_transaction_id if it is a MIT
|
214
|
-
|
227
|
+
ntid = options[:network_transaction_id] || stored_credential[:network_transaction_id]
|
228
|
+
post[:initial_transaction_id] = ntid if post[:initiated_by] == 'merchant'
|
215
229
|
end
|
216
230
|
end
|
217
231
|
|
@@ -232,6 +246,9 @@ module ActiveMerchant #:nodoc:
|
|
232
246
|
end
|
233
247
|
|
234
248
|
if (shipping_address = options[:shipping_address])
|
249
|
+
first_name, last_name = split_names(shipping_address[:name])
|
250
|
+
post[:shipping_firstname] = first_name if first_name
|
251
|
+
post[:shipping_lastname] = last_name if last_name
|
235
252
|
post[:shipping_company] = shipping_address[:company]
|
236
253
|
post[:shipping_address1] = shipping_address[:address1]
|
237
254
|
post[:shipping_address2] = shipping_address[:address2]
|
@@ -240,6 +257,7 @@ module ActiveMerchant #:nodoc:
|
|
240
257
|
post[:shipping_country] = shipping_address[:country]
|
241
258
|
post[:shipping_zip] = shipping_address[:zip]
|
242
259
|
post[:shipping_phone] = shipping_address[:phone]
|
260
|
+
post[:shipping_email] = options[:shipping_email] if options[:shipping_email]
|
243
261
|
end
|
244
262
|
|
245
263
|
if (descriptor = options[:descriptors])
|
@@ -329,8 +347,7 @@ module ActiveMerchant #:nodoc:
|
|
329
347
|
end
|
330
348
|
|
331
349
|
def headers
|
332
|
-
|
333
|
-
headers
|
350
|
+
{ 'Content-Type' => 'application/x-www-form-urlencoded;charset=UTF-8' }
|
334
351
|
end
|
335
352
|
|
336
353
|
def post_data(action, params)
|
@@ -342,7 +359,7 @@ module ActiveMerchant #:nodoc:
|
|
342
359
|
end
|
343
360
|
|
344
361
|
def parse(body)
|
345
|
-
|
362
|
+
CGI::parse(body).map { |k, v| [k.intern, v.first] }.to_h
|
346
363
|
end
|
347
364
|
|
348
365
|
def success_from(response)
|
@@ -263,7 +263,7 @@ module ActiveMerchant #:nodoc:
|
|
263
263
|
end
|
264
264
|
|
265
265
|
def add_payment_source(post, payment_source, options)
|
266
|
-
add_d3d(post, options) if options[:d3d]
|
266
|
+
add_d3d(post, options) if options[:d3d] || three_d_secure(options)
|
267
267
|
if payment_source.is_a?(String)
|
268
268
|
add_alias(post, payment_source, options[:alias_operation])
|
269
269
|
add_eci(post, options[:eci] || '9')
|
@@ -460,7 +460,7 @@ module ActiveMerchant #:nodoc:
|
|
460
460
|
raise "Unknown signature algorithm #{algorithm}"
|
461
461
|
end
|
462
462
|
|
463
|
-
filtered_params = signed_parameters.
|
463
|
+
filtered_params = signed_parameters.reject { |_k, v| v.nil? || v == '' }
|
464
464
|
sha_encryptor.hexdigest(
|
465
465
|
filtered_params.sort_by { |k, _v| k.upcase }.map { |k, v| "#{k.upcase}=#{v}#{secret}" }.join('')
|
466
466
|
).upcase
|
@@ -494,6 +494,10 @@ module ActiveMerchant #:nodoc:
|
|
494
494
|
end
|
495
495
|
response_hash
|
496
496
|
end
|
497
|
+
|
498
|
+
def three_d_secure(options)
|
499
|
+
options[:three_d_secure] ? options[:three_d_secure][:required] : false
|
500
|
+
end
|
497
501
|
end
|
498
502
|
|
499
503
|
class OgoneResponse < Response
|
@@ -201,11 +201,13 @@ module ActiveMerchant #:nodoc:
|
|
201
201
|
response = http_request(method, resource, parameters, options)
|
202
202
|
success = !error?(response)
|
203
203
|
|
204
|
-
Response.new(
|
204
|
+
Response.new(
|
205
|
+
success,
|
205
206
|
(success ? response['error_code'] : response['description']),
|
206
207
|
response,
|
207
208
|
test: test?,
|
208
|
-
authorization: response['id']
|
209
|
+
authorization: response['id']
|
210
|
+
)
|
209
211
|
end
|
210
212
|
|
211
213
|
def http_request(method, resource, parameters = {}, options = {})
|
@@ -125,8 +125,7 @@ module ActiveMerchant #:nodoc:
|
|
125
125
|
def purchase(money, payment, options = {})
|
126
126
|
# debit
|
127
127
|
options[:registrationId] = payment if payment.is_a?(String)
|
128
|
-
execute_dbpa(options[:risk_workflow] ? 'PA.CP' : 'DB',
|
129
|
-
money, payment, options)
|
128
|
+
execute_dbpa(options[:risk_workflow] ? 'PA.CP' : 'DB', money, payment, options)
|
130
129
|
end
|
131
130
|
|
132
131
|
def authorize(money, payment, options = {})
|
@@ -121,11 +121,15 @@ module ActiveMerchant #:nodoc:
|
|
121
121
|
txnRequest = escape_uri(xml)
|
122
122
|
response = parse(ssl_post(test? ? self.test_url : self.live_url, "txnMode=#{action}&txnRequest=#{txnRequest}"))
|
123
123
|
|
124
|
-
Response.new(
|
124
|
+
Response.new(
|
125
|
+
successful?(response),
|
126
|
+
message_from(response),
|
127
|
+
hash_from_xml(response),
|
125
128
|
test: test?,
|
126
129
|
authorization: authorization_from(response),
|
127
130
|
avs_result: { code: avs_result_from(response) },
|
128
|
-
cvv_result: cvv_result_from(response)
|
131
|
+
cvv_result: cvv_result_from(response)
|
132
|
+
)
|
129
133
|
end
|
130
134
|
|
131
135
|
# The upstream is picky and so we can't use CGI.escape like we want to
|
@@ -33,9 +33,7 @@ module ActiveMerchant #:nodoc:
|
|
33
33
|
errors << [:merchant_phone, 'is required to follow "NNN-NNN-NNNN" or "NNN-AAAAAAA" format'] if !empty?(self.merchant_phone) && !self.merchant_phone.match(PHONE_FORMAT_1) && !self.merchant_phone.match(PHONE_FORMAT_2)
|
34
34
|
|
35
35
|
%i[merchant_email merchant_url].each do |attr|
|
36
|
-
|
37
|
-
errors << [attr, 'is required to be 13 bytes or less'] if self.send(attr).bytesize > 13
|
38
|
-
end
|
36
|
+
errors << [attr, 'is required to be 13 bytes or less'] if !self.send(attr).blank? && (self.send(attr).bytesize > 13)
|
39
37
|
end
|
40
38
|
|
41
39
|
errors_hash(errors)
|