activemerchant 1.133.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 +240 -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 +11 -8
- data/lib/active_merchant/billing/credit_card_formatting.rb +4 -0
- data/lib/active_merchant/billing/credit_card_methods.rb +59 -6
- data/lib/active_merchant/billing/gateway.rb +9 -0
- data/lib/active_merchant/billing/gateways/adyen.rb +162 -43
- 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 +43 -35
- 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/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 +238 -34
- data/lib/active_merchant/billing/gateways/commerce_hub.rb +63 -6
- data/lib/active_merchant/billing/gateways/credorax.rb +3 -5
- data/lib/active_merchant/billing/gateways/cyber_source.rb +185 -47
- 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 +9 -5
- 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 +72 -12
- 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 +8 -3
- 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 +18 -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 +2 -2
- 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 +2 -10
- 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 +36 -16
- 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 +53 -21
- data/lib/active_merchant/billing/gateways/stripe_payment_intents.rb +199 -50
- 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 +3 -3
- 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 +140 -73
- 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
@@ -43,12 +43,7 @@ module ActiveMerchant #:nodoc:
|
|
43
43
|
xml.ssl_transaction_type self.actions[:purchase]
|
44
44
|
xml.ssl_amount amount(money)
|
45
45
|
|
46
|
-
|
47
|
-
add_token(xml, payment_method)
|
48
|
-
else
|
49
|
-
add_creditcard(xml, payment_method)
|
50
|
-
end
|
51
|
-
|
46
|
+
add_payment(xml, payment_method, options)
|
52
47
|
add_invoice(xml, options)
|
53
48
|
add_salestax(xml, options)
|
54
49
|
add_currency(xml, money, options)
|
@@ -56,27 +51,26 @@ module ActiveMerchant #:nodoc:
|
|
56
51
|
add_customer_email(xml, options)
|
57
52
|
add_test_mode(xml, options)
|
58
53
|
add_ip(xml, options)
|
59
|
-
add_auth_purchase_params(xml, options)
|
54
|
+
add_auth_purchase_params(xml, payment_method, options)
|
60
55
|
add_level_3_fields(xml, options) if options[:level_3_data]
|
61
56
|
end
|
62
57
|
commit(request)
|
63
58
|
end
|
64
59
|
|
65
|
-
def authorize(money,
|
60
|
+
def authorize(money, payment_method, options = {})
|
66
61
|
request = build_xml_request do |xml|
|
67
62
|
xml.ssl_vendor_id @options[:ssl_vendor_id] || options[:ssl_vendor_id]
|
68
63
|
xml.ssl_transaction_type self.actions[:authorize]
|
69
64
|
xml.ssl_amount amount(money)
|
70
|
-
|
71
65
|
add_salestax(xml, options)
|
72
66
|
add_invoice(xml, options)
|
73
|
-
|
67
|
+
add_payment(xml, payment_method, options)
|
74
68
|
add_currency(xml, money, options)
|
75
69
|
add_address(xml, options)
|
76
70
|
add_customer_email(xml, options)
|
77
71
|
add_test_mode(xml, options)
|
78
72
|
add_ip(xml, options)
|
79
|
-
add_auth_purchase_params(xml, options)
|
73
|
+
add_auth_purchase_params(xml, payment_method, options)
|
80
74
|
add_level_3_fields(xml, options) if options[:level_3_data]
|
81
75
|
end
|
82
76
|
commit(request)
|
@@ -92,7 +86,7 @@ module ActiveMerchant #:nodoc:
|
|
92
86
|
add_salestax(xml, options)
|
93
87
|
add_approval_code(xml, authorization)
|
94
88
|
add_invoice(xml, options)
|
95
|
-
add_creditcard(xml, options[:credit_card])
|
89
|
+
add_creditcard(xml, options[:credit_card], options)
|
96
90
|
add_currency(xml, money, options)
|
97
91
|
add_address(xml, options)
|
98
92
|
add_customer_email(xml, options)
|
@@ -139,7 +133,7 @@ module ActiveMerchant #:nodoc:
|
|
139
133
|
xml.ssl_transaction_type self.actions[:credit]
|
140
134
|
xml.ssl_amount amount(money)
|
141
135
|
add_invoice(xml, options)
|
142
|
-
add_creditcard(xml, creditcard)
|
136
|
+
add_creditcard(xml, creditcard, options)
|
143
137
|
add_currency(xml, money, options)
|
144
138
|
add_address(xml, options)
|
145
139
|
add_customer_email(xml, options)
|
@@ -152,7 +146,7 @@ module ActiveMerchant #:nodoc:
|
|
152
146
|
request = build_xml_request do |xml|
|
153
147
|
xml.ssl_vendor_id @options[:ssl_vendor_id] || options[:ssl_vendor_id]
|
154
148
|
xml.ssl_transaction_type self.actions[:verify]
|
155
|
-
add_creditcard(xml, credit_card)
|
149
|
+
add_creditcard(xml, credit_card, options)
|
156
150
|
add_address(xml, options)
|
157
151
|
add_test_mode(xml, options)
|
158
152
|
add_ip(xml, options)
|
@@ -165,7 +159,7 @@ module ActiveMerchant #:nodoc:
|
|
165
159
|
xml.ssl_vendor_id @options[:ssl_vendor_id] || options[:ssl_vendor_id]
|
166
160
|
xml.ssl_transaction_type self.actions[:store]
|
167
161
|
xml.ssl_add_token 'Y'
|
168
|
-
add_creditcard(xml, creditcard)
|
162
|
+
add_creditcard(xml, creditcard, options)
|
169
163
|
add_address(xml, options)
|
170
164
|
add_customer_email(xml, options)
|
171
165
|
add_test_mode(xml, options)
|
@@ -178,8 +172,8 @@ module ActiveMerchant #:nodoc:
|
|
178
172
|
request = build_xml_request do |xml|
|
179
173
|
xml.ssl_vendor_id @options[:ssl_vendor_id] || options[:ssl_vendor_id]
|
180
174
|
xml.ssl_transaction_type self.actions[:update]
|
181
|
-
|
182
|
-
add_creditcard(xml, creditcard)
|
175
|
+
xml.ssl_token token
|
176
|
+
add_creditcard(xml, creditcard, options)
|
183
177
|
add_address(xml, options)
|
184
178
|
add_customer_email(xml, options)
|
185
179
|
add_test_mode(xml, options)
|
@@ -200,6 +194,16 @@ module ActiveMerchant #:nodoc:
|
|
200
194
|
|
201
195
|
private
|
202
196
|
|
197
|
+
def add_payment(xml, payment, options)
|
198
|
+
if payment.is_a?(String) || options[:ssl_token]
|
199
|
+
xml.ssl_token options[:ssl_token] || payment
|
200
|
+
elsif payment.is_a?(NetworkTokenizationCreditCard)
|
201
|
+
add_network_token(xml, payment)
|
202
|
+
else
|
203
|
+
add_creditcard(xml, payment, options)
|
204
|
+
end
|
205
|
+
end
|
206
|
+
|
203
207
|
def add_invoice(xml, options)
|
204
208
|
xml.ssl_invoice_number url_encode_truncate((options[:order_id] || options[:invoice]), 25)
|
205
209
|
xml.ssl_description url_encode_truncate(options[:description], 255)
|
@@ -213,11 +217,21 @@ module ActiveMerchant #:nodoc:
|
|
213
217
|
xml.ssl_txn_id authorization.split(';').last
|
214
218
|
end
|
215
219
|
|
216
|
-
def
|
220
|
+
def add_network_token(xml, payment_method)
|
221
|
+
payment = payment_method.payment_data&.gsub('=>', ':')
|
222
|
+
case payment_method.source
|
223
|
+
when :apple_pay
|
224
|
+
xml.ssl_applepay_web url_encode(payment)
|
225
|
+
when :google_pay
|
226
|
+
xml.ssl_google_pay url_encode(payment)
|
227
|
+
end
|
228
|
+
end
|
229
|
+
|
230
|
+
def add_creditcard(xml, creditcard, options)
|
217
231
|
xml.ssl_card_number creditcard.number
|
218
232
|
xml.ssl_exp_date expdate(creditcard)
|
219
233
|
|
220
|
-
add_verification_value(xml, creditcard)
|
234
|
+
add_verification_value(xml, creditcard, options)
|
221
235
|
|
222
236
|
xml.ssl_first_name url_encode_truncate(creditcard.first_name, 20)
|
223
237
|
xml.ssl_last_name url_encode_truncate(creditcard.last_name, 30)
|
@@ -230,12 +244,12 @@ module ActiveMerchant #:nodoc:
|
|
230
244
|
xml.ssl_transaction_currency currency
|
231
245
|
end
|
232
246
|
|
233
|
-
def
|
234
|
-
|
235
|
-
|
247
|
+
def add_verification_value(xml, credit_card, options)
|
248
|
+
return unless credit_card.verification_value?
|
249
|
+
# Don't add cvv if this is a non-initial stored credential transaction
|
250
|
+
return if options[:stored_credential] && !options.dig(:stored_credential, :initial_transaction) && options[:stored_cred_v2]
|
236
251
|
|
237
|
-
|
238
|
-
xml.ssl_cvv2cvc2 creditcard.verification_value
|
252
|
+
xml.ssl_cvv2cvc2 credit_card.verification_value
|
239
253
|
xml.ssl_cvv2cvc2_indicator 1
|
240
254
|
end
|
241
255
|
|
@@ -294,16 +308,20 @@ module ActiveMerchant #:nodoc:
|
|
294
308
|
end
|
295
309
|
|
296
310
|
# add_recurring_token is a field that can be sent in to obtain a token from Elavon for use with their tokenization program
|
297
|
-
def add_auth_purchase_params(xml, options)
|
311
|
+
def add_auth_purchase_params(xml, payment_method, options)
|
298
312
|
xml.ssl_dynamic_dba options[:dba] if options.has_key?(:dba)
|
299
313
|
xml.ssl_merchant_initiated_unscheduled merchant_initiated_unscheduled(options) if merchant_initiated_unscheduled(options)
|
300
314
|
xml.ssl_add_token options[:add_recurring_token] if options.has_key?(:add_recurring_token)
|
301
|
-
xml.ssl_token options[:ssl_token] if options[:ssl_token]
|
302
315
|
xml.ssl_customer_code options[:customer] if options.has_key?(:customer)
|
303
316
|
xml.ssl_customer_number options[:customer_number] if options.has_key?(:customer_number)
|
304
|
-
xml.ssl_entry_mode entry_mode(options) if entry_mode(options)
|
317
|
+
xml.ssl_entry_mode entry_mode(payment_method, options) if entry_mode(payment_method, options)
|
305
318
|
add_custom_fields(xml, options) if options[:custom_fields]
|
306
|
-
|
319
|
+
if options[:stored_cred_v2]
|
320
|
+
add_stored_credential_v2(xml, payment_method, options)
|
321
|
+
add_installment_fields(xml, options)
|
322
|
+
else
|
323
|
+
add_stored_credential(xml, options)
|
324
|
+
end
|
307
325
|
end
|
308
326
|
|
309
327
|
def add_custom_fields(xml, options)
|
@@ -353,6 +371,8 @@ module ActiveMerchant #:nodoc:
|
|
353
371
|
end
|
354
372
|
|
355
373
|
def add_stored_credential(xml, options)
|
374
|
+
return unless options[:stored_credential]
|
375
|
+
|
356
376
|
network_transaction_id = options.dig(:stored_credential, :network_transaction_id)
|
357
377
|
case
|
358
378
|
when network_transaction_id.nil?
|
@@ -368,14 +388,60 @@ module ActiveMerchant #:nodoc:
|
|
368
388
|
end
|
369
389
|
end
|
370
390
|
|
391
|
+
def add_stored_credential_v2(xml, payment_method, options)
|
392
|
+
return unless options[:stored_credential]
|
393
|
+
|
394
|
+
network_transaction_id = options.dig(:stored_credential, :network_transaction_id)
|
395
|
+
xml.ssl_recurring_flag recurring_flag(options) if recurring_flag(options)
|
396
|
+
xml.ssl_par_value options[:par_value] if options[:par_value]
|
397
|
+
xml.ssl_association_token_data options[:association_token_data] if options[:association_token_data]
|
398
|
+
|
399
|
+
unless payment_method.is_a?(String) || options[:ssl_token].present?
|
400
|
+
xml.ssl_approval_code options[:approval_code] if options[:approval_code]
|
401
|
+
if network_transaction_id.to_s.include?('|')
|
402
|
+
oar_data, ps2000_data = network_transaction_id.split('|')
|
403
|
+
xml.ssl_oar_data oar_data unless oar_data.blank?
|
404
|
+
xml.ssl_ps2000_data ps2000_data unless ps2000_data.blank?
|
405
|
+
elsif network_transaction_id.to_s.length > 22
|
406
|
+
xml.ssl_oar_data network_transaction_id
|
407
|
+
elsif network_transaction_id.present?
|
408
|
+
xml.ssl_ps2000_data network_transaction_id
|
409
|
+
end
|
410
|
+
end
|
411
|
+
end
|
412
|
+
|
413
|
+
def recurring_flag(options)
|
414
|
+
return unless reason = options.dig(:stored_credential, :reason_type)
|
415
|
+
return 1 if reason == 'recurring'
|
416
|
+
return 2 if reason == 'installment'
|
417
|
+
end
|
418
|
+
|
371
419
|
def merchant_initiated_unscheduled(options)
|
372
420
|
return options[:merchant_initiated_unscheduled] if options[:merchant_initiated_unscheduled]
|
373
|
-
return 'Y' if options.dig(:stored_credential, :initiator) == 'merchant' &&
|
421
|
+
return 'Y' if options.dig(:stored_credential, :initiator) == 'merchant' && merchant_reason_type(options)
|
422
|
+
end
|
423
|
+
|
424
|
+
def merchant_reason_type(options)
|
425
|
+
if options[:stored_cred_v2]
|
426
|
+
options.dig(:stored_credential, :reason_type) == 'unscheduled'
|
427
|
+
else
|
428
|
+
options.dig(:stored_credential, :reason_type) == 'unscheduled' || options.dig(:stored_credential, :reason_type) == 'recurring'
|
429
|
+
end
|
430
|
+
end
|
431
|
+
|
432
|
+
def add_installment_fields(xml, options)
|
433
|
+
return unless options.dig(:stored_credential, :reason_type) == 'installment'
|
434
|
+
|
435
|
+
xml.ssl_payment_number options[:payment_number]
|
436
|
+
xml.ssl_payment_count options[:installments]
|
374
437
|
end
|
375
438
|
|
376
|
-
def entry_mode(options)
|
439
|
+
def entry_mode(payment_method, options)
|
377
440
|
return options[:entry_mode] if options[:entry_mode]
|
378
|
-
return 12 if options[:stored_credential]
|
441
|
+
return 12 if options[:stored_credential] && options[:stored_cred_v2] != true
|
442
|
+
|
443
|
+
return if payment_method.is_a?(String) || options[:ssl_token]
|
444
|
+
return 12 if options.dig(:stored_credential, :reason_type) == 'unscheduled'
|
379
445
|
end
|
380
446
|
|
381
447
|
def build_xml_request
|
@@ -451,8 +517,8 @@ module ActiveMerchant #:nodoc:
|
|
451
517
|
if value.is_a?(String)
|
452
518
|
encoded = CGI.escape(value)
|
453
519
|
encoded = encoded.tr('+', ' ') # don't encode spaces
|
454
|
-
encoded
|
455
|
-
|
520
|
+
encoded.gsub('%26', '%26amp;') # account for Elavon's weird '&' handling
|
521
|
+
|
456
522
|
else
|
457
523
|
value.to_s
|
458
524
|
end
|
@@ -37,6 +37,7 @@ module ActiveMerchant #:nodoc:
|
|
37
37
|
add_transaction(xml, money, options)
|
38
38
|
add_terminal(xml, options)
|
39
39
|
add_address(xml, options)
|
40
|
+
add_lodging(xml, options)
|
40
41
|
end
|
41
42
|
end
|
42
43
|
|
@@ -51,6 +52,7 @@ module ActiveMerchant #:nodoc:
|
|
51
52
|
add_transaction(xml, money, options)
|
52
53
|
add_terminal(xml, options)
|
53
54
|
add_address(xml, options)
|
55
|
+
add_lodging(xml, options)
|
54
56
|
end
|
55
57
|
end
|
56
58
|
|
@@ -222,16 +224,44 @@ module ActiveMerchant #:nodoc:
|
|
222
224
|
options[:market_code] || 'Default'
|
223
225
|
end
|
224
226
|
|
227
|
+
def add_lodging(xml, options)
|
228
|
+
if lodging = options[:lodging]
|
229
|
+
xml.extendedParameters do
|
230
|
+
xml.ExtendedParameters do
|
231
|
+
xml.Key 'Lodging'
|
232
|
+
xml.Value('xsi:type' => 'Lodging') do
|
233
|
+
xml.LodgingAgreementNumber lodging[:agreement_number] if lodging[:agreement_number]
|
234
|
+
xml.LodgingCheckInDate lodging[:check_in_date] if lodging[:check_in_date]
|
235
|
+
xml.LodgingCheckOutDate lodging[:check_out_date] if lodging[:check_out_date]
|
236
|
+
xml.LodgingRoomAmount lodging[:room_amount] if lodging[:room_amount]
|
237
|
+
xml.LodgingRoomTax lodging[:room_tax] if lodging[:room_tax]
|
238
|
+
xml.LodgingNoShowIndicator lodging[:no_show_indicator] if lodging[:no_show_indicator]
|
239
|
+
xml.LodgingDuration lodging[:duration] if lodging[:duration]
|
240
|
+
xml.LodgingCustomerName lodging[:customer_name] if lodging[:customer_name]
|
241
|
+
xml.LodgingClientCode lodging[:client_code] if lodging[:client_code]
|
242
|
+
xml.LodgingExtraChargesDetail lodging[:extra_charges_detail] if lodging[:extra_charges_detail]
|
243
|
+
xml.LodgingExtraChargesAmounts lodging[:extra_charges_amounts] if lodging[:extra_charges_amounts]
|
244
|
+
xml.LodgingPrestigiousPropertyCode lodging[:prestigious_property_code] if lodging[:prestigious_property_code]
|
245
|
+
xml.LodgingSpecialProgramCode lodging[:special_program_code] if lodging[:special_program_code]
|
246
|
+
xml.LodgingChargeType lodging[:charge_type] if lodging[:charge_type]
|
247
|
+
end
|
248
|
+
end
|
249
|
+
end
|
250
|
+
end
|
251
|
+
end
|
252
|
+
|
225
253
|
def add_terminal(xml, options)
|
226
254
|
xml.terminal do
|
227
255
|
xml.TerminalID options[:terminal_id] || '01'
|
256
|
+
xml.TerminalType options[:terminal_type] if options[:terminal_type]
|
228
257
|
xml.CardPresentCode options[:card_present_code] || 'UseDefault'
|
229
|
-
xml.CardholderPresentCode 'UseDefault'
|
230
|
-
xml.CardInputCode 'UseDefault'
|
231
|
-
xml.CVVPresenceCode 'UseDefault'
|
232
|
-
xml.TerminalCapabilityCode 'UseDefault'
|
233
|
-
xml.TerminalEnvironmentCode 'UseDefault'
|
258
|
+
xml.CardholderPresentCode options[:card_holder_present_code] || 'UseDefault'
|
259
|
+
xml.CardInputCode options[:card_input_code] || 'UseDefault'
|
260
|
+
xml.CVVPresenceCode options[:cvv_presence_code] || 'UseDefault'
|
261
|
+
xml.TerminalCapabilityCode options[:terminal_capability_code] || 'UseDefault'
|
262
|
+
xml.TerminalEnvironmentCode options[:terminal_environment_code] || 'UseDefault'
|
234
263
|
xml.MotoECICode 'NonAuthenticatedSecureECommerceTransaction'
|
264
|
+
xml.PartialApprovedFlag options[:partial_approved_flag] if options[:partial_approved_flag]
|
235
265
|
end
|
236
266
|
end
|
237
267
|
|
@@ -240,7 +270,7 @@ module ActiveMerchant #:nodoc:
|
|
240
270
|
xml.CardNumber payment.number
|
241
271
|
xml.ExpirationMonth format(payment.month, :two_digits)
|
242
272
|
xml.ExpirationYear format(payment.year, :two_digits)
|
243
|
-
xml.CardholderName payment.first_name
|
273
|
+
xml.CardholderName "#{payment.first_name} #{payment.last_name}"
|
244
274
|
xml.CVV payment.verification_value
|
245
275
|
end
|
246
276
|
end
|
@@ -363,7 +393,6 @@ module ActiveMerchant #:nodoc:
|
|
363
393
|
xml['soap'].Envelope('xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
|
364
394
|
'xmlns:xsd' => 'http://www.w3.org/2001/XMLSchema',
|
365
395
|
'xmlns:soap' => 'http://schemas.xmlsoap.org/soap/envelope/') do
|
366
|
-
|
367
396
|
xml['soap'].Body do
|
368
397
|
yield(xml)
|
369
398
|
end
|
@@ -174,17 +174,21 @@ module ActiveMerchant #:nodoc:
|
|
174
174
|
response = send("do_#{action}", params)
|
175
175
|
|
176
176
|
if action == :authorize
|
177
|
-
Response.new
|
177
|
+
Response.new(
|
178
|
+
response['accept'].to_i == 1,
|
178
179
|
response['errortext'],
|
179
180
|
response,
|
180
181
|
test: test?,
|
181
182
|
authorization: response['tid']
|
183
|
+
)
|
182
184
|
else
|
183
|
-
Response.new
|
185
|
+
Response.new(
|
186
|
+
response['result'] == 'true',
|
184
187
|
messages(response['epay'], response['pbs']),
|
185
188
|
response,
|
186
189
|
test: test?,
|
187
190
|
authorization: params[:transaction]
|
191
|
+
)
|
188
192
|
end
|
189
193
|
end
|
190
194
|
|
@@ -279,11 +279,15 @@ module ActiveMerchant #:nodoc:
|
|
279
279
|
response = parse(data)
|
280
280
|
message = message_from(response)
|
281
281
|
|
282
|
-
Response.new(
|
282
|
+
Response.new(
|
283
|
+
success?(response),
|
284
|
+
message,
|
285
|
+
response,
|
283
286
|
test: test?,
|
284
287
|
authorization: response['transactionid'],
|
285
288
|
avs_result: { code: response['avsresponse'] },
|
286
|
-
cvv_result: response['cvvresponse']
|
289
|
+
cvv_result: response['cvvresponse']
|
290
|
+
)
|
287
291
|
end
|
288
292
|
|
289
293
|
def message_from(response)
|
@@ -111,11 +111,13 @@ module ActiveMerchant #:nodoc:
|
|
111
111
|
raw_response = ssl_post(url, post_data(parameters))
|
112
112
|
response = parse(raw_response)
|
113
113
|
|
114
|
-
Response.new(
|
114
|
+
Response.new(
|
115
|
+
success?(response),
|
115
116
|
message_from(response[:ewaytrxnerror]),
|
116
117
|
response,
|
117
118
|
authorization: response[:ewaytrxnnumber],
|
118
|
-
test: test?
|
119
|
+
test: test?
|
120
|
+
)
|
119
121
|
end
|
120
122
|
|
121
123
|
def success?(response)
|
@@ -222,9 +222,13 @@ module ActiveMerchant #:nodoc:
|
|
222
222
|
end
|
223
223
|
response = parse(raw)
|
224
224
|
|
225
|
-
EwayResponse.new(
|
225
|
+
EwayResponse.new(
|
226
|
+
response[:success],
|
227
|
+
response[:message],
|
228
|
+
response,
|
226
229
|
test: test?,
|
227
|
-
authorization: response[:auth_code]
|
230
|
+
authorization: response[:auth_code]
|
231
|
+
)
|
228
232
|
end
|
229
233
|
|
230
234
|
# Where we build the full SOAP 1.2 request using builder
|
@@ -158,11 +158,15 @@ module ActiveMerchant #:nodoc:
|
|
158
158
|
def commit(action, request)
|
159
159
|
response = parse(ssl_post(self.live_url, build_request(action, request), POST_HEADERS))
|
160
160
|
|
161
|
-
Response.new(
|
161
|
+
Response.new(
|
162
|
+
successful?(response),
|
163
|
+
message_from(response),
|
164
|
+
response,
|
162
165
|
test: test?,
|
163
166
|
authorization: authorization_from(response),
|
164
167
|
avs_result: { code: response[:avs] },
|
165
|
-
cvv_result: response[:cvv2]
|
168
|
+
cvv_result: response[:cvv2]
|
169
|
+
)
|
166
170
|
rescue ResponseError => e
|
167
171
|
case e.response.code
|
168
172
|
when '401'
|
@@ -28,6 +28,7 @@ module ActiveMerchant #:nodoc:
|
|
28
28
|
add_order_id(post, options)
|
29
29
|
add_ip(post, options)
|
30
30
|
add_metadata(post, options)
|
31
|
+
add_three_ds(post, options)
|
31
32
|
|
32
33
|
commit(:post, 'purchases', post)
|
33
34
|
end
|
@@ -41,6 +42,7 @@ module ActiveMerchant #:nodoc:
|
|
41
42
|
add_order_id(post, options)
|
42
43
|
add_ip(post, options)
|
43
44
|
add_metadata(post, options)
|
45
|
+
add_three_ds(post, options)
|
44
46
|
|
45
47
|
post[:capture] = false
|
46
48
|
|
@@ -125,16 +127,42 @@ module ActiveMerchant #:nodoc:
|
|
125
127
|
def add_extra_options(post, options)
|
126
128
|
extra = {}
|
127
129
|
extra[:ecm] = '32' if options[:recurring]
|
128
|
-
extra[:cavv] = options[:cavv] || options.dig(:three_d_secure, :cavv) if options[:cavv] || options.dig(:three_d_secure, :cavv)
|
129
|
-
extra[:xid] = options[:xid] || options.dig(:three_d_secure, :xid) if options[:xid] || options.dig(:three_d_secure, :xid)
|
130
|
-
extra[:sli] = options[:sli] || options.dig(:three_d_secure, :eci) if options[:sli] || options.dig(:three_d_secure, :eci)
|
131
130
|
extra[:name] = options[:merchant] if options[:merchant]
|
132
131
|
extra[:location] = options[:merchant_location] if options[:merchant_location]
|
133
132
|
extra[:card_on_file] = options.dig(:extra, :card_on_file) if options.dig(:extra, :card_on_file)
|
134
133
|
extra[:auth_reason] = options.dig(:extra, :auth_reason) if options.dig(:extra, :auth_reason)
|
134
|
+
|
135
|
+
unless options[:three_d_secure].present?
|
136
|
+
extra[:sli] = options[:sli] if options[:sli]
|
137
|
+
extra[:xid] = options[:xid] if options[:xid]
|
138
|
+
extra[:cavv] = options[:cavv] if options[:cavv]
|
139
|
+
end
|
140
|
+
|
135
141
|
post[:extra] = extra if extra.any?
|
136
142
|
end
|
137
143
|
|
144
|
+
def add_three_ds(post, options)
|
145
|
+
return unless three_d_secure = options[:three_d_secure]
|
146
|
+
|
147
|
+
post[:extra] = {
|
148
|
+
sli: three_d_secure[:eci],
|
149
|
+
xid: three_d_secure[:xid],
|
150
|
+
cavv: three_d_secure[:cavv],
|
151
|
+
par: three_d_secure[:authentication_response_status],
|
152
|
+
ver: formatted_enrollment(three_d_secure[:enrolled]),
|
153
|
+
threeds_version: three_d_secure[:version],
|
154
|
+
directory_server_txn_id: three_d_secure[:ds_transaction_id]
|
155
|
+
}.compact
|
156
|
+
end
|
157
|
+
|
158
|
+
def formatted_enrollment(val)
|
159
|
+
case val
|
160
|
+
when 'Y', 'N', 'U' then val
|
161
|
+
when true, 'true' then 'Y'
|
162
|
+
when false, 'false' then 'N'
|
163
|
+
end
|
164
|
+
end
|
165
|
+
|
138
166
|
def add_order_id(post, options)
|
139
167
|
post[:reference] = options[:order_id] || SecureRandom.hex(15)
|
140
168
|
end
|
@@ -121,11 +121,15 @@ module ActiveMerchant #:nodoc:
|
|
121
121
|
response = parse(data)
|
122
122
|
message = message_from(response)
|
123
123
|
|
124
|
-
Response.new(
|
124
|
+
Response.new(
|
125
|
+
success?(response),
|
126
|
+
message,
|
127
|
+
response,
|
125
128
|
test: test?,
|
126
129
|
authorization: response['transactionid'],
|
127
130
|
avs_result: { code: response['avsresponse'] },
|
128
|
-
cvv_result: response['cvvresponse']
|
131
|
+
cvv_result: response['cvvresponse']
|
132
|
+
)
|
129
133
|
end
|
130
134
|
|
131
135
|
def success?(response)
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module FirstPayCommon
|
2
|
+
def self.included(base)
|
3
|
+
base.supported_countries = ['US']
|
4
|
+
base.default_currency = 'USD'
|
5
|
+
base.money_format = :dollars
|
6
|
+
base.supported_cardtypes = %i[visa master american_express discover]
|
7
|
+
|
8
|
+
base.homepage_url = 'http://1stpaygateway.net/'
|
9
|
+
base.display_name = '1stPayGateway.Net'
|
10
|
+
end
|
11
|
+
|
12
|
+
def supports_scrubbing?
|
13
|
+
true
|
14
|
+
end
|
15
|
+
end
|