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
@@ -34,6 +34,7 @@ module ActiveMerchant #:nodoc:
|
|
34
34
|
public_key: public_key
|
35
35
|
}
|
36
36
|
add_invoice(post, money, options)
|
37
|
+
add_tip_in_cents(post, options)
|
37
38
|
add_card(post, payment, options)
|
38
39
|
|
39
40
|
commit('sale', post, '/transactions_sync')
|
@@ -141,6 +142,10 @@ module ActiveMerchant #:nodoc:
|
|
141
142
|
post[:cvc] = cvc if cvc && !cvc.empty?
|
142
143
|
end
|
143
144
|
|
145
|
+
def add_tip_in_cents(post, options)
|
146
|
+
post[:tip_in_cents] = options[:tip_in_cents].to_i if options[:tip_in_cents]
|
147
|
+
end
|
148
|
+
|
144
149
|
def parse(body)
|
145
150
|
JSON.parse(body)
|
146
151
|
end
|
@@ -28,21 +28,6 @@ module ActiveMerchant #:nodoc:
|
|
28
28
|
network_token: 'NETWORKTOKEN'
|
29
29
|
}
|
30
30
|
|
31
|
-
CARD_CODES = {
|
32
|
-
'visa' => 'VISA-SSL',
|
33
|
-
'master' => 'ECMC-SSL',
|
34
|
-
'discover' => 'DISCOVER-SSL',
|
35
|
-
'american_express' => 'AMEX-SSL',
|
36
|
-
'jcb' => 'JCB-SSL',
|
37
|
-
'maestro' => 'MAESTRO-SSL',
|
38
|
-
'diners_club' => 'DINERS-SSL',
|
39
|
-
'elo' => 'ELO-SSL',
|
40
|
-
'naranja' => 'NARANJA-SSL',
|
41
|
-
'cabal' => 'CABAL-SSL',
|
42
|
-
'unionpay' => 'CHINAUNIONPAY-SSL',
|
43
|
-
'unknown' => 'CARD-SSL'
|
44
|
-
}
|
45
|
-
|
46
31
|
AVS_CODE_MAP = {
|
47
32
|
'A' => 'M', # Match
|
48
33
|
'B' => 'P', # Postcode matches, address not verified
|
@@ -53,14 +38,14 @@ module ActiveMerchant #:nodoc:
|
|
53
38
|
'G' => 'C', # Address does not match, postcode not checked
|
54
39
|
'H' => 'I', # Address and postcode not provided
|
55
40
|
'I' => 'C', # Address not checked postcode does not match
|
56
|
-
'J' => 'C'
|
41
|
+
'J' => 'C' # Address and postcode does not match
|
57
42
|
}
|
58
43
|
|
59
44
|
CVC_CODE_MAP = {
|
60
45
|
'A' => 'M', # CVV matches
|
61
46
|
'B' => 'P', # Not provided
|
62
47
|
'C' => 'P', # Not checked
|
63
|
-
'D' => 'N'
|
48
|
+
'D' => 'N' # Does not match
|
64
49
|
}
|
65
50
|
|
66
51
|
def initialize(options = {})
|
@@ -77,7 +62,7 @@ module ActiveMerchant #:nodoc:
|
|
77
62
|
|
78
63
|
def authorize(money, payment_method, options = {})
|
79
64
|
requires!(options, :order_id)
|
80
|
-
payment_details = payment_details(payment_method)
|
65
|
+
payment_details = payment_details(payment_method, options)
|
81
66
|
authorize_request(money, payment_method, payment_details.merge(options))
|
82
67
|
end
|
83
68
|
|
@@ -123,9 +108,11 @@ module ActiveMerchant #:nodoc:
|
|
123
108
|
# and other transactions should be performed on a normal eCom-flagged
|
124
109
|
# merchant ID.
|
125
110
|
def credit(money, payment_method, options = {})
|
126
|
-
payment_details = payment_details(payment_method)
|
111
|
+
payment_details = payment_details(payment_method, options)
|
127
112
|
if options[:fast_fund_credit]
|
128
113
|
fast_fund_credit_request(money, payment_method, payment_details.merge(credit: true, **options))
|
114
|
+
elsif options[:account_funding_transaction]
|
115
|
+
aft_request(money, payment_method, payment_details.merge(**options))
|
129
116
|
else
|
130
117
|
credit_request(money, payment_method, payment_details.merge(credit: true, **options))
|
131
118
|
end
|
@@ -163,11 +150,20 @@ module ActiveMerchant #:nodoc:
|
|
163
150
|
gsub(%r((<cardNumber>)\d+(</cardNumber>)), '\1[FILTERED]\2').
|
164
151
|
gsub(%r((<cvc>)[^<]+(</cvc>)), '\1[FILTERED]\2').
|
165
152
|
gsub(%r((<tokenNumber>)\d+(</tokenNumber>)), '\1[FILTERED]\2').
|
166
|
-
gsub(%r((<cryptogram>)[^<]+(</cryptogram>)), '\1[FILTERED]\2')
|
153
|
+
gsub(%r((<cryptogram>)[^<]+(</cryptogram>)), '\1[FILTERED]\2').
|
154
|
+
gsub(%r((<accountReference accountType="\w+">)\d+(<\/accountReference>)), '\1[FILTERED]\2')
|
167
155
|
end
|
168
156
|
|
169
157
|
private
|
170
158
|
|
159
|
+
def eci_value(payment_method, options)
|
160
|
+
eci = payment_method.respond_to?(:eci) ? format(payment_method.eci, :two_digits) : ''
|
161
|
+
|
162
|
+
return eci unless eci.empty?
|
163
|
+
|
164
|
+
options[:use_default_eci] ? '07' : eci
|
165
|
+
end
|
166
|
+
|
171
167
|
def authorize_request(money, payment_method, options)
|
172
168
|
commit('authorize', build_authorization_request(money, payment_method, options), 'AUTHORISED', 'CAPTURED', options)
|
173
169
|
end
|
@@ -196,6 +192,10 @@ module ActiveMerchant #:nodoc:
|
|
196
192
|
commit('fast_credit', build_fast_fund_credit_request(money, payment_method, options), :ok, 'PUSH_APPROVED', options)
|
197
193
|
end
|
198
194
|
|
195
|
+
def aft_request(money, payment_method, options)
|
196
|
+
commit('funding_transfer_transaction', build_aft_request(money, payment_method, options), :ok, 'AUTHORISED', options)
|
197
|
+
end
|
198
|
+
|
199
199
|
def store_request(credit_card, options)
|
200
200
|
commit('store', build_store_request(credit_card, options), options)
|
201
201
|
end
|
@@ -267,9 +267,8 @@ module ActiveMerchant #:nodoc:
|
|
267
267
|
xml.invoiceReferenceNumber data[:invoice_reference_number] if data.include?(:invoice_reference_number)
|
268
268
|
xml.customerReference data[:customer_reference] if data.include?(:customer_reference)
|
269
269
|
xml.cardAcceptorTaxId data[:card_acceptor_tax_id] if data.include?(:card_acceptor_tax_id)
|
270
|
-
|
271
270
|
{
|
272
|
-
|
271
|
+
tax_amount: 'salesTax',
|
273
272
|
discount_amount: 'discountAmount',
|
274
273
|
shipping_amount: 'shippingAmount',
|
275
274
|
duty_amount: 'dutyAmount'
|
@@ -277,53 +276,37 @@ module ActiveMerchant #:nodoc:
|
|
277
276
|
next unless data.include?(key)
|
278
277
|
|
279
278
|
xml.tag! tag do
|
280
|
-
|
281
|
-
add_amount(xml, data_amount[:amount].to_i, data_amount)
|
279
|
+
add_amount(xml, data[key].to_i, data)
|
282
280
|
end
|
283
281
|
end
|
284
282
|
|
285
|
-
xml.discountName data[:discount_name] if data.include?(:discount_name)
|
286
|
-
xml.discountCode data[:discount_code] if data.include?(:discount_code)
|
287
|
-
|
288
|
-
add_date_element(xml, 'shippingDate', data[:shipping_date]) if data.include?(:shipping_date)
|
289
|
-
|
290
|
-
if data.include?(:shipping_courier)
|
291
|
-
xml.shippingCourier(
|
292
|
-
data[:shipping_courier][:priority],
|
293
|
-
data[:shipping_courier][:tracking_number],
|
294
|
-
data[:shipping_courier][:name]
|
295
|
-
)
|
296
|
-
end
|
297
|
-
|
298
283
|
add_optional_data_level_two_and_three(xml, data)
|
299
284
|
|
300
|
-
|
301
|
-
data[:item].each { |item| add_items_into_level_three_data(xml, item.symbolize_keys) }
|
302
|
-
elsif data.include?(:item)
|
303
|
-
add_items_into_level_three_data(xml, data[:item].symbolize_keys)
|
304
|
-
end
|
285
|
+
data[:line_items].each { |item| add_line_items_into_level_three_data(xml, item.symbolize_keys, data) } if data.include?(:line_items)
|
305
286
|
end
|
306
287
|
|
307
|
-
def
|
288
|
+
def add_line_items_into_level_three_data(xml, item, data)
|
308
289
|
xml.item do
|
309
290
|
xml.description item[:description] if item[:description]
|
310
291
|
xml.productCode item[:product_code] if item[:product_code]
|
311
292
|
xml.commodityCode item[:commodity_code] if item[:commodity_code]
|
312
293
|
xml.quantity item[:quantity] if item[:quantity]
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
294
|
+
xml.unitCost do
|
295
|
+
add_amount(xml, item[:unit_cost], data)
|
296
|
+
end
|
297
|
+
xml.unitOfMeasure item[:unit_of_measure] || 'each'
|
298
|
+
xml.itemTotal do
|
299
|
+
sub_total_amount = item[:quantity].to_i * (item[:unit_cost].to_i - item[:discount_amount].to_i)
|
300
|
+
add_amount(xml, sub_total_amount, data)
|
301
|
+
end
|
302
|
+
xml.itemTotalWithTax do
|
303
|
+
add_amount(xml, item[:total_amount], data)
|
304
|
+
end
|
305
|
+
xml.itemDiscountAmount do
|
306
|
+
add_amount(xml, item[:discount_amount], data)
|
307
|
+
end
|
308
|
+
xml.taxAmount do
|
309
|
+
add_amount(xml, item[:tax_amount], data)
|
327
310
|
end
|
328
311
|
end
|
329
312
|
end
|
@@ -333,7 +316,7 @@ module ActiveMerchant #:nodoc:
|
|
333
316
|
xml.destinationPostalCode data[:destination_postal_code] if data.include?(:destination_postal_code)
|
334
317
|
xml.destinationCountryCode data[:destination_country_code] if data.include?(:destination_country_code)
|
335
318
|
add_date_element(xml, 'orderDate', data[:order_date].symbolize_keys) if data.include?(:order_date)
|
336
|
-
xml.taxExempt data[:
|
319
|
+
xml.taxExempt data[:tax_amount].to_i > 0 ? 'false' : 'true'
|
337
320
|
end
|
338
321
|
|
339
322
|
def order_tag_attributes(options)
|
@@ -424,6 +407,66 @@ module ActiveMerchant #:nodoc:
|
|
424
407
|
end
|
425
408
|
end
|
426
409
|
|
410
|
+
def build_aft_request(money, payment_method, options)
|
411
|
+
build_request do |xml|
|
412
|
+
xml.submit do
|
413
|
+
xml.order order_tag_attributes(options) do
|
414
|
+
xml.description(options[:description].blank? ? 'Account Funding Transaction' : options[:description])
|
415
|
+
add_amount(xml, money, options)
|
416
|
+
add_order_content(xml, options)
|
417
|
+
add_payment_method(xml, money, payment_method, options)
|
418
|
+
add_shopper(xml, options)
|
419
|
+
add_sub_merchant_data(xml, options[:sub_merchant_data]) if options[:sub_merchant_data]
|
420
|
+
add_aft_data(xml, payment_method, options)
|
421
|
+
end
|
422
|
+
end
|
423
|
+
end
|
424
|
+
end
|
425
|
+
|
426
|
+
def add_aft_data(xml, payment_method, options)
|
427
|
+
xml.fundingTransfer 'type' => options[:aft_type], 'category' => 'PULL_FROM_CARD' do
|
428
|
+
xml.paymentPurpose options[:aft_payment_purpose] # Must be included for the recipient for following countries, otherwise optional: Argentina, Bangladesh, Chile, Columbia, Jordan, Mexico, Thailand, UAE, India cross-border
|
429
|
+
xml.fundingParty 'type' => 'sender' do
|
430
|
+
xml.accountReference options[:aft_sender_account_reference], 'accountType' => options[:aft_sender_account_type]
|
431
|
+
xml.fullName do
|
432
|
+
xml.first options.dig(:aft_sender_full_name, :first)
|
433
|
+
xml.middle options.dig(:aft_sender_full_name, :middle)
|
434
|
+
xml.last options.dig(:aft_sender_full_name, :last)
|
435
|
+
end
|
436
|
+
xml.fundingAddress do
|
437
|
+
xml.address1 options.dig(:aft_sender_funding_address, :address1)
|
438
|
+
xml.address2 options.dig(:aft_sender_funding_address, :address2)
|
439
|
+
xml.postalCode options.dig(:aft_sender_funding_address, :postal_code)
|
440
|
+
xml.city options.dig(:aft_sender_funding_address, :city)
|
441
|
+
xml.state options.dig(:aft_sender_funding_address, :state)
|
442
|
+
xml.countryCode options.dig(:aft_sender_funding_address, :country_code)
|
443
|
+
end
|
444
|
+
end
|
445
|
+
xml.fundingParty 'type' => 'recipient' do
|
446
|
+
xml.accountReference options[:aft_recipient_account_reference], 'accountType' => options[:aft_recipient_account_type]
|
447
|
+
xml.fullName do
|
448
|
+
xml.first options.dig(:aft_recipient_full_name, :first)
|
449
|
+
xml.middle options.dig(:aft_recipient_full_name, :middle)
|
450
|
+
xml.last options.dig(:aft_recipient_full_name, :last)
|
451
|
+
end
|
452
|
+
xml.fundingAddress do
|
453
|
+
xml.address1 options.dig(:aft_recipient_funding_address, :address1)
|
454
|
+
xml.address2 options.dig(:aft_recipient_funding_address, :address2)
|
455
|
+
xml.postalCode options.dig(:aft_recipient_funding_address, :postal_code)
|
456
|
+
xml.city options.dig(:aft_recipient_funding_address, :city)
|
457
|
+
xml.state options.dig(:aft_recipient_funding_address, :state)
|
458
|
+
xml.countryCode options.dig(:aft_recipient_funding_address, :country_code)
|
459
|
+
end
|
460
|
+
if options[:aft_recipient_funding_data]
|
461
|
+
xml.fundingData do
|
462
|
+
add_date_element(xml, 'birthDate', options[:aft_recipient_funding_data][:birth_date])
|
463
|
+
xml.telephoneNumber options.dig(:aft_recipient_funding_data, :telephone_number)
|
464
|
+
end
|
465
|
+
end
|
466
|
+
end
|
467
|
+
end
|
468
|
+
end
|
469
|
+
|
427
470
|
def add_payment_details_for_ff_credit(xml, payment_method, options)
|
428
471
|
xml.paymentDetails do
|
429
472
|
xml.tag! 'FF_DISBURSE-SSL' do
|
@@ -458,7 +501,7 @@ module ActiveMerchant #:nodoc:
|
|
458
501
|
end
|
459
502
|
|
460
503
|
def add_additional_3ds_data(xml, options)
|
461
|
-
additional_data = { 'dfReferenceId' => options[:
|
504
|
+
additional_data = { 'dfReferenceId' => options[:df_reference_id] }
|
462
505
|
additional_data['challengeWindowSize'] = options[:browser_size] if options[:browser_size]
|
463
506
|
|
464
507
|
xml.additional3DSData additional_data
|
@@ -569,10 +612,10 @@ module ActiveMerchant #:nodoc:
|
|
569
612
|
end
|
570
613
|
|
571
614
|
def add_amount(xml, money, options)
|
572
|
-
currency = options[:currency] || currency(money)
|
615
|
+
currency = options[:currency] || currency(money.to_i)
|
573
616
|
|
574
617
|
amount_hash = {
|
575
|
-
:value => localized_amount(money, currency),
|
618
|
+
:value => localized_amount(money.to_i, currency),
|
576
619
|
'currencyCode' => currency,
|
577
620
|
'exponent' => currency_exponent(currency)
|
578
621
|
}
|
@@ -587,7 +630,7 @@ module ActiveMerchant #:nodoc:
|
|
587
630
|
when :pay_as_order
|
588
631
|
add_amount_for_pay_as_order(xml, amount, payment_method, options)
|
589
632
|
when :network_token
|
590
|
-
add_network_tokenization_card(xml, payment_method)
|
633
|
+
add_network_tokenization_card(xml, payment_method, options)
|
591
634
|
else
|
592
635
|
add_card_or_token(xml, payment_method, options)
|
593
636
|
end
|
@@ -605,8 +648,9 @@ module ActiveMerchant #:nodoc:
|
|
605
648
|
end
|
606
649
|
end
|
607
650
|
|
608
|
-
def add_network_tokenization_card(xml, payment_method)
|
609
|
-
|
651
|
+
def add_network_tokenization_card(xml, payment_method, options)
|
652
|
+
source = payment_method.respond_to?(:source) ? payment_method.source : options[:wallet_type]
|
653
|
+
token_type = NETWORK_TOKEN_TYPE.fetch(source, 'NETWORKTOKEN')
|
610
654
|
|
611
655
|
xml.paymentDetails do
|
612
656
|
xml.tag! 'EMVCO_TOKEN-SSL', 'type' => token_type do
|
@@ -618,11 +662,12 @@ module ActiveMerchant #:nodoc:
|
|
618
662
|
)
|
619
663
|
end
|
620
664
|
name = card_holder_name(payment_method, options)
|
621
|
-
eci = format(payment_method.eci, :two_digits)
|
622
665
|
xml.cardHolderName name if name.present?
|
623
|
-
xml.cryptogram payment_method.payment_cryptogram
|
624
|
-
|
666
|
+
xml.cryptogram payment_method.payment_cryptogram unless options[:wallet_type] == :google_pay
|
667
|
+
eci = eci_value(payment_method, options)
|
668
|
+
xml.eciIndicator eci if eci.present?
|
625
669
|
end
|
670
|
+
add_stored_credential_options(xml, options)
|
626
671
|
end
|
627
672
|
end
|
628
673
|
|
@@ -646,7 +691,7 @@ module ActiveMerchant #:nodoc:
|
|
646
691
|
end
|
647
692
|
|
648
693
|
def add_card_details(xml, payment_method, options)
|
649
|
-
xml.tag!
|
694
|
+
xml.tag! 'CARD-SSL' do
|
650
695
|
add_card(xml, payment_method, options)
|
651
696
|
end
|
652
697
|
end
|
@@ -699,30 +744,27 @@ module ActiveMerchant #:nodoc:
|
|
699
744
|
end
|
700
745
|
|
701
746
|
def add_stored_credential_using_normalized_fields(xml, options)
|
702
|
-
|
703
|
-
|
704
|
-
|
705
|
-
|
706
|
-
|
707
|
-
|
708
|
-
|
709
|
-
|
710
|
-
|
711
|
-
xml.
|
712
|
-
xml.schemeTransactionIdentifier options[:stored_credential][:network_transaction_id] if options[:stored_credential][:network_transaction_id]
|
713
|
-
end
|
747
|
+
reason = case options[:stored_credential][:reason_type]
|
748
|
+
when 'installment' then 'INSTALMENT'
|
749
|
+
when 'recurring' then 'RECURRING'
|
750
|
+
when 'unscheduled' then 'UNSCHEDULED'
|
751
|
+
end
|
752
|
+
is_initial_transaction = options[:stored_credential][:initial_transaction]
|
753
|
+
stored_credential_params = generate_stored_credential_params(is_initial_transaction, reason)
|
754
|
+
|
755
|
+
xml.storedCredentials stored_credential_params do
|
756
|
+
xml.schemeTransactionIdentifier network_transaction_id(options) if network_transaction_id(options) && !is_initial_transaction
|
714
757
|
end
|
715
758
|
end
|
716
759
|
|
717
760
|
def add_stored_credential_using_gateway_specific_fields(xml, options)
|
718
761
|
return unless options[:stored_credential_usage]
|
719
762
|
|
720
|
-
|
721
|
-
|
722
|
-
|
723
|
-
|
724
|
-
|
725
|
-
xml.storedCredentials 'usage' => options[:stored_credential_usage]
|
763
|
+
is_initial_transaction = options[:stored_credential_usage] == 'FIRST'
|
764
|
+
stored_credential_params = generate_stored_credential_params(is_initial_transaction, options[:stored_credential_initiated_reason])
|
765
|
+
|
766
|
+
xml.storedCredentials stored_credential_params do
|
767
|
+
xml.schemeTransactionIdentifier options[:stored_credential_transaction_id] if options[:stored_credential_transaction_id] && !is_initial_transaction
|
726
768
|
end
|
727
769
|
end
|
728
770
|
|
@@ -847,7 +889,8 @@ module ActiveMerchant #:nodoc:
|
|
847
889
|
|
848
890
|
# ensure cookie included on follow-up '3ds' and 'capture_request' calls, using the cookie saved from the preceding response
|
849
891
|
# cookie should be present in options on the 3ds and capture calls, but also still saved in the instance var in case
|
850
|
-
cookie =
|
892
|
+
cookie = defined?(@cookie) ? @cookie : nil
|
893
|
+
cookie = options[:cookie] || cookie
|
851
894
|
headers['Cookie'] = cookie if cookie
|
852
895
|
|
853
896
|
headers['Idempotency-Key'] = idempotency_key if idempotency_key
|
@@ -992,17 +1035,23 @@ module ActiveMerchant #:nodoc:
|
|
992
1035
|
token_details
|
993
1036
|
end
|
994
1037
|
|
995
|
-
def payment_details(payment_method)
|
1038
|
+
def payment_details(payment_method, options = {})
|
996
1039
|
case payment_method
|
997
1040
|
when String
|
998
1041
|
token_type_and_details(payment_method)
|
999
1042
|
else
|
1000
|
-
type =
|
1043
|
+
type = network_token?(payment_method) || options[:wallet_type] == :google_pay ? :network_token : :credit
|
1001
1044
|
|
1002
1045
|
{ payment_type: type }
|
1003
1046
|
end
|
1004
1047
|
end
|
1005
1048
|
|
1049
|
+
def network_token?(payment_method)
|
1050
|
+
payment_method.respond_to?(:source) &&
|
1051
|
+
payment_method.respond_to?(:payment_cryptogram) &&
|
1052
|
+
payment_method.respond_to?(:eci)
|
1053
|
+
end
|
1054
|
+
|
1006
1055
|
def token_type_and_details(token)
|
1007
1056
|
token_details = token_details_from_authorization(token)
|
1008
1057
|
token_details[:payment_type] = token_details.has_key?(:token_id) ? :token : :pay_as_order
|
@@ -1028,10 +1077,6 @@ module ActiveMerchant #:nodoc:
|
|
1028
1077
|
return 2
|
1029
1078
|
end
|
1030
1079
|
|
1031
|
-
def card_code_for(payment_method)
|
1032
|
-
CARD_CODES[card_brand(payment_method)] || CARD_CODES['unknown']
|
1033
|
-
end
|
1034
|
-
|
1035
1080
|
def eligible_for_0_auth?(payment_method, options = {})
|
1036
1081
|
payment_method.is_a?(CreditCard) && %w(visa master).include?(payment_method.brand) && options[:zero_dollar_auth]
|
1037
1082
|
end
|
@@ -1039,6 +1084,15 @@ module ActiveMerchant #:nodoc:
|
|
1039
1084
|
def card_holder_name(payment_method, options)
|
1040
1085
|
test? && options[:execute_threed] && !options[:three_ds_version]&.start_with?('2') ? '3D' : payment_method.name
|
1041
1086
|
end
|
1087
|
+
|
1088
|
+
def generate_stored_credential_params(is_initial_transaction, reason = nil)
|
1089
|
+
customer_or_merchant = reason == 'RECURRING' && is_initial_transaction ? 'customerInitiatedReason' : 'merchantInitiatedReason'
|
1090
|
+
|
1091
|
+
stored_credential_params = {}
|
1092
|
+
stored_credential_params['usage'] = is_initial_transaction ? 'FIRST' : 'USED'
|
1093
|
+
stored_credential_params[customer_or_merchant] = reason if reason
|
1094
|
+
stored_credential_params
|
1095
|
+
end
|
1042
1096
|
end
|
1043
1097
|
end
|
1044
1098
|
end
|
@@ -34,14 +34,16 @@ module ActiveMerchant #:nodoc:
|
|
34
34
|
if authorization
|
35
35
|
commit(:post, "orders/#{CGI.escape(authorization)}/capture", { 'captureAmount' => money }, options, 'capture')
|
36
36
|
else
|
37
|
-
Response.new(
|
37
|
+
Response.new(
|
38
|
+
false,
|
38
39
|
'FAILED',
|
39
40
|
'FAILED',
|
40
41
|
test: test?,
|
41
42
|
authorization: false,
|
42
43
|
avs_result: {},
|
43
44
|
cvv_result: {},
|
44
|
-
error_code: false
|
45
|
+
error_code: false
|
46
|
+
)
|
45
47
|
end
|
46
48
|
end
|
47
49
|
|
@@ -84,8 +86,7 @@ module ActiveMerchant #:nodoc:
|
|
84
86
|
},
|
85
87
|
'clientKey' => @client_key
|
86
88
|
}
|
87
|
-
|
88
|
-
token_response
|
89
|
+
commit(:post, 'tokens', obj, { 'Authorization' => @service_key }, 'token')
|
89
90
|
end
|
90
91
|
|
91
92
|
def create_post_for_auth_or_purchase(token, money, options)
|
@@ -134,7 +135,10 @@ module ActiveMerchant #:nodoc:
|
|
134
135
|
|
135
136
|
raw_response = ssl_request(method, self.live_url + url, json, headers(options))
|
136
137
|
|
137
|
-
if raw_response
|
138
|
+
if raw_response == ''
|
139
|
+
success = true
|
140
|
+
response = {}
|
141
|
+
else
|
138
142
|
response = parse(raw_response)
|
139
143
|
if type == 'token'
|
140
144
|
success = response.key?('token')
|
@@ -151,9 +155,6 @@ module ActiveMerchant #:nodoc:
|
|
151
155
|
end
|
152
156
|
end
|
153
157
|
end
|
154
|
-
else
|
155
|
-
success = true
|
156
|
-
response = {}
|
157
158
|
end
|
158
159
|
rescue ResponseError => e
|
159
160
|
raw_response = e.response.body
|
@@ -170,14 +171,16 @@ module ActiveMerchant #:nodoc:
|
|
170
171
|
authorization = response['message']
|
171
172
|
end
|
172
173
|
|
173
|
-
Response.new(
|
174
|
+
Response.new(
|
175
|
+
success,
|
174
176
|
success ? 'SUCCESS' : response['message'],
|
175
177
|
response,
|
176
178
|
test: test?,
|
177
179
|
authorization: authorization,
|
178
180
|
avs_result: {},
|
179
181
|
cvv_result: {},
|
180
|
-
error_code: success ? nil : response['customCode']
|
182
|
+
error_code: success ? nil : response['customCode']
|
183
|
+
)
|
181
184
|
end
|
182
185
|
|
183
186
|
def test?
|