activemerchant 1.86.0 → 1.87.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG +22 -0
- data/lib/active_merchant/billing/avs_result.rb +0 -1
- data/lib/active_merchant/billing/check.rb +1 -1
- data/lib/active_merchant/billing/compatibility.rb +3 -3
- data/lib/active_merchant/billing/credit_card.rb +1 -1
- data/lib/active_merchant/billing/credit_card_formatting.rb +3 -3
- data/lib/active_merchant/billing/credit_card_methods.rb +6 -4
- data/lib/active_merchant/billing/gateway.rb +9 -9
- data/lib/active_merchant/billing/gateways/adyen.rb +48 -7
- data/lib/active_merchant/billing/gateways/allied_wallet.rb +1 -1
- data/lib/active_merchant/billing/gateways/authorize_net.rb +8 -8
- data/lib/active_merchant/billing/gateways/authorize_net_arb.rb +1 -1
- data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +15 -15
- data/lib/active_merchant/billing/gateways/axcessms.rb +2 -2
- data/lib/active_merchant/billing/gateways/balanced.rb +11 -11
- data/lib/active_merchant/billing/gateways/bank_frick.rb +1 -1
- data/lib/active_merchant/billing/gateways/barclaycard_smartpay.rb +5 -5
- data/lib/active_merchant/billing/gateways/beanstream.rb +3 -2
- data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +5 -5
- data/lib/active_merchant/billing/gateways/blue_pay.rb +5 -5
- data/lib/active_merchant/billing/gateways/blue_snap.rb +5 -5
- data/lib/active_merchant/billing/gateways/bogus.rb +3 -3
- data/lib/active_merchant/billing/gateways/borgun.rb +5 -6
- data/lib/active_merchant/billing/gateways/braintree_blue.rb +18 -12
- data/lib/active_merchant/billing/gateways/bridge_pay.rb +1 -1
- data/lib/active_merchant/billing/gateways/cams.rb +12 -12
- data/lib/active_merchant/billing/gateways/card_stream.rb +9 -9
- data/lib/active_merchant/billing/gateways/cardknox.rb +4 -4
- data/lib/active_merchant/billing/gateways/cardprocess.rb +1 -1
- data/lib/active_merchant/billing/gateways/cashnet.rb +2 -2
- data/lib/active_merchant/billing/gateways/cc5.rb +2 -2
- data/lib/active_merchant/billing/gateways/cenpos.rb +2 -2
- data/lib/active_merchant/billing/gateways/checkout.rb +1 -1
- data/lib/active_merchant/billing/gateways/clearhaus.rb +12 -12
- data/lib/active_merchant/billing/gateways/commercegate.rb +3 -3
- data/lib/active_merchant/billing/gateways/creditcall.rb +2 -2
- data/lib/active_merchant/billing/gateways/credorax.rb +13 -3
- data/lib/active_merchant/billing/gateways/ct_payment.rb +6 -6
- data/lib/active_merchant/billing/gateways/culqi.rb +1 -1
- data/lib/active_merchant/billing/gateways/cyber_source.rb +8 -8
- data/lib/active_merchant/billing/gateways/data_cash.rb +2 -2
- data/lib/active_merchant/billing/gateways/dibs.rb +2 -2
- data/lib/active_merchant/billing/gateways/digitzs.rb +5 -5
- data/lib/active_merchant/billing/gateways/ebanx.rb +1 -1
- data/lib/active_merchant/billing/gateways/efsnet.rb +4 -4
- data/lib/active_merchant/billing/gateways/elavon.rb +3 -3
- data/lib/active_merchant/billing/gateways/element.rb +4 -4
- data/lib/active_merchant/billing/gateways/epay.rb +1 -1
- data/lib/active_merchant/billing/gateways/eway.rb +2 -2
- data/lib/active_merchant/billing/gateways/eway_managed.rb +5 -5
- data/lib/active_merchant/billing/gateways/eway_rapid.rb +1 -1
- data/lib/active_merchant/billing/gateways/exact.rb +1 -1
- data/lib/active_merchant/billing/gateways/federated_canada.rb +1 -1
- data/lib/active_merchant/billing/gateways/first_giving.rb +1 -1
- data/lib/active_merchant/billing/gateways/firstdata_e4.rb +7 -7
- data/lib/active_merchant/billing/gateways/flo2cash.rb +2 -2
- data/lib/active_merchant/billing/gateways/forte.rb +11 -7
- data/lib/active_merchant/billing/gateways/garanti.rb +5 -5
- data/lib/active_merchant/billing/gateways/global_collect.rb +2 -3
- data/lib/active_merchant/billing/gateways/hdfc.rb +2 -2
- data/lib/active_merchant/billing/gateways/hps.rb +3 -3
- data/lib/active_merchant/billing/gateways/inspire.rb +7 -7
- data/lib/active_merchant/billing/gateways/iridium.rb +14 -14
- data/lib/active_merchant/billing/gateways/itransact.rb +4 -4
- data/lib/active_merchant/billing/gateways/iveri.rb +3 -3
- data/lib/active_merchant/billing/gateways/jetpay.rb +2 -2
- data/lib/active_merchant/billing/gateways/jetpay_v2.rb +2 -2
- data/lib/active_merchant/billing/gateways/latitude19.rb +1 -1
- data/lib/active_merchant/billing/gateways/linkpoint.rb +3 -3
- data/lib/active_merchant/billing/gateways/litle.rb +2 -2
- data/lib/active_merchant/billing/gateways/maxipago.rb +1 -1
- data/lib/active_merchant/billing/gateways/mercado_pago.rb +7 -13
- data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +3 -3
- data/lib/active_merchant/billing/gateways/merchant_one.rb +4 -4
- data/lib/active_merchant/billing/gateways/merchant_partners.rb +1 -1
- data/lib/active_merchant/billing/gateways/merchant_warrior.rb +3 -3
- data/lib/active_merchant/billing/gateways/mercury.rb +2 -2
- data/lib/active_merchant/billing/gateways/metrics_global.rb +2 -2
- data/lib/active_merchant/billing/gateways/micropayment.rb +1 -1
- data/lib/active_merchant/billing/gateways/migs.rb +4 -6
- data/lib/active_merchant/billing/gateways/modern_payments_cim.rb +2 -2
- data/lib/active_merchant/billing/gateways/moneris.rb +85 -56
- data/lib/active_merchant/billing/gateways/moneris_us.rb +9 -9
- data/lib/active_merchant/billing/gateways/money_movers.rb +1 -1
- data/lib/active_merchant/billing/gateways/mundipagg.rb +1 -1
- data/lib/active_merchant/billing/gateways/nab_transact.rb +1 -1
- data/lib/active_merchant/billing/gateways/net_registry.rb +2 -2
- data/lib/active_merchant/billing/gateways/netaxept.rb +6 -6
- data/lib/active_merchant/billing/gateways/netbanx.rb +36 -36
- data/lib/active_merchant/billing/gateways/netbilling.rb +2 -2
- data/lib/active_merchant/billing/gateways/netpay.rb +1 -1
- data/lib/active_merchant/billing/gateways/nmi.rb +2 -2
- data/lib/active_merchant/billing/gateways/ogone.rb +7 -7
- data/lib/active_merchant/billing/gateways/omise.rb +6 -6
- data/lib/active_merchant/billing/gateways/opp.rb +1 -1
- data/lib/active_merchant/billing/gateways/optimal_payment.rb +5 -0
- data/lib/active_merchant/billing/gateways/orbital.rb +9 -7
- data/lib/active_merchant/billing/gateways/pac_net_raven.rb +6 -6
- data/lib/active_merchant/billing/gateways/pagarme.rb +1 -1
- data/lib/active_merchant/billing/gateways/pay_conex.rb +1 -1
- data/lib/active_merchant/billing/gateways/pay_gate_xml.rb +8 -5
- data/lib/active_merchant/billing/gateways/pay_hub.rb +2 -2
- data/lib/active_merchant/billing/gateways/pay_junction.rb +2 -2
- data/lib/active_merchant/billing/gateways/pay_junction_v2.rb +2 -2
- data/lib/active_merchant/billing/gateways/pay_secure.rb +3 -3
- data/lib/active_merchant/billing/gateways/paybox_direct.rb +8 -8
- data/lib/active_merchant/billing/gateways/payeezy.rb +1 -1
- data/lib/active_merchant/billing/gateways/payex.rb +8 -8
- data/lib/active_merchant/billing/gateways/payflow.rb +13 -13
- data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +4 -4
- data/lib/active_merchant/billing/gateways/payflow_express.rb +1 -1
- data/lib/active_merchant/billing/gateways/payment_express.rb +10 -10
- data/lib/active_merchant/billing/gateways/paymentez.rb +3 -0
- data/lib/active_merchant/billing/gateways/paymill.rb +4 -4
- data/lib/active_merchant/billing/gateways/payscout.rb +1 -1
- data/lib/active_merchant/billing/gateways/paystation.rb +1 -1
- data/lib/active_merchant/billing/gateways/payu_in.rb +3 -3
- data/lib/active_merchant/billing/gateways/payu_latam.rb +1 -1
- data/lib/active_merchant/billing/gateways/payway.rb +2 -2
- data/lib/active_merchant/billing/gateways/plugnpay.rb +2 -2
- data/lib/active_merchant/billing/gateways/pro_pay.rb +2 -2
- data/lib/active_merchant/billing/gateways/psigate.rb +1 -1
- data/lib/active_merchant/billing/gateways/psl_card.rb +3 -3
- data/lib/active_merchant/billing/gateways/qbms.rb +1 -1
- data/lib/active_merchant/billing/gateways/quantum.rb +7 -7
- data/lib/active_merchant/billing/gateways/quickbooks.rb +6 -6
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb +1 -1
- data/lib/active_merchant/billing/gateways/qvalent.rb +2 -2
- data/lib/active_merchant/billing/gateways/realex.rb +33 -13
- data/lib/active_merchant/billing/gateways/redsys.rb +2 -2
- data/lib/active_merchant/billing/gateways/safe_charge.rb +2 -2
- data/lib/active_merchant/billing/gateways/sage.rb +6 -6
- data/lib/active_merchant/billing/gateways/sage_pay.rb +7 -7
- data/lib/active_merchant/billing/gateways/secure_net.rb +1 -1
- data/lib/active_merchant/billing/gateways/secure_pay.rb +2 -2
- data/lib/active_merchant/billing/gateways/secure_pay_au.rb +1 -1
- data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +1 -1
- data/lib/active_merchant/billing/gateways/skip_jack.rb +5 -6
- data/lib/active_merchant/billing/gateways/smart_ps.rb +7 -7
- data/lib/active_merchant/billing/gateways/so_easy_pay.rb +1 -1
- data/lib/active_merchant/billing/gateways/stripe.rb +5 -5
- data/lib/active_merchant/billing/gateways/swipe_checkout.rb +2 -2
- data/lib/active_merchant/billing/gateways/telr.rb +1 -1
- data/lib/active_merchant/billing/gateways/trans_first_transaction_express.rb +2 -2
- data/lib/active_merchant/billing/gateways/transact_pro.rb +5 -5
- data/lib/active_merchant/billing/gateways/transax.rb +1 -1
- data/lib/active_merchant/billing/gateways/trust_commerce.rb +7 -7
- data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +17 -16
- data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +2 -2
- data/lib/active_merchant/billing/gateways/vanco.rb +2 -2
- data/lib/active_merchant/billing/gateways/verifi.rb +1 -1
- data/lib/active_merchant/billing/gateways/viaklix.rb +4 -4
- data/lib/active_merchant/billing/gateways/visanet_peru.rb +4 -4
- data/lib/active_merchant/billing/gateways/wirecard.rb +2 -2
- data/lib/active_merchant/billing/gateways/worldpay.rb +24 -13
- data/lib/active_merchant/billing/gateways/worldpay_online_payments.rb +2 -2
- data/lib/active_merchant/billing/response.rb +7 -7
- data/lib/active_merchant/country.rb +4 -4
- data/lib/active_merchant/network_connection_retries.rb +7 -9
- data/lib/active_merchant/version.rb +1 -1
- data/lib/support/gateway_support.rb +3 -3
- data/lib/support/ssl_verify.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 6c6735efd6b43a6792c15f372218c58388a7481e907f221b8ca401dcee3c9fc2
|
4
|
+
data.tar.gz: eaecbc6f7dfcae07746717eb79208ec5911f80bd15d73ed859fab38164f08d63
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5c37662376465c08da0eafa7ca7a801efb37316b254ac81c234b52c6e780b204763b2c0fdef035a38a6a28e6b5377e2d384e621770719a7497f8e27a008518ca
|
7
|
+
data.tar.gz: 4d8ff4e910d7b93c9f21476be94acdcf25123db575c39614303a5b10ee7c5bf50b050ea1b7c1cb4e6a158c909f76bd82b83327904b8fd7b73f1093ad138e6d19
|
data/CHANGELOG
CHANGED
@@ -1,6 +1,28 @@
|
|
1
1
|
= ActiveMerchant CHANGELOG
|
2
2
|
|
3
3
|
== HEAD
|
4
|
+
* Barclaycard Smartpay: Improves Error Handling [deedeelavinder] #3026
|
5
|
+
* Braintree: Fix passing phone-only billing address [curiousepic] #3025
|
6
|
+
* Litle: Capitalize check account type [curiousepic] #3028
|
7
|
+
* Braintree: Account for nil billing address fields [curiousepic] #3029
|
8
|
+
* Realex: Add verify [kheang] #3030
|
9
|
+
* Braintree: Actually account for nil address fields [curiousepic] #3032
|
10
|
+
* Mercado Pago: do not infer card type [bpollack] #3038
|
11
|
+
* Credorax: allow sending submerchant ID (h3 parameter) [bpollack] #3040
|
12
|
+
* Worldpay: Pass stored credential option fields [curiousepic] #3041
|
13
|
+
* Make behavior of nil CC numbers more consistent [guaguasi] #3010
|
14
|
+
* Moneris: Adds Credential on File logic [deedeelavinder] #3042
|
15
|
+
* Adyen: Return AVS and CVC Result [nfarve] #3044
|
16
|
+
* Paymentez: Supports phone field, does not send if empty [molbrown] #3043
|
17
|
+
* Braintree: Account for nil address with existing customer [curiousepic] #3047
|
18
|
+
* Optimal Payment: Add verify capabilities #3052
|
19
|
+
* Moneris: Allows cof_enabled gateway to process non-cof transactions [deedeelavinder] #3051
|
20
|
+
* Cenpos: update supported countries [bpollack] #3055
|
21
|
+
* CyberSource: update supported countries [bpollack] #3055
|
22
|
+
* MiGS: update supported countries [bpollack] #3055
|
23
|
+
* Clearhaus: update submission data format [bpollack] #3053
|
24
|
+
* Forte: Allow void on capture #3059
|
25
|
+
|
4
26
|
== Version 1.86.0 (October 26, 2018)
|
5
27
|
* UsaEpayTransaction: Support UMcheckformat option for echecks [dtykocki] #3002
|
6
28
|
* Global Collect: handle internal server errors [molbrown] #3005
|
@@ -59,7 +59,7 @@ module ActiveMerchant #:nodoc:
|
|
59
59
|
# (3(d1 + d4 + d7) + 7(d2 + d5 + d8) + 1(d3 + d6 + d9))mod 10 = 0
|
60
60
|
# See http://en.wikipedia.org/wiki/Routing_transit_number#Internal_checksums
|
61
61
|
def valid_routing_number?
|
62
|
-
digits = routing_number.to_s.split('').map(&:to_i).select{|d| (0..9).
|
62
|
+
digits = routing_number.to_s.split('').map(&:to_i).select { |d| (0..9).cover?(d) }
|
63
63
|
case digits.size
|
64
64
|
when 9
|
65
65
|
checksum = ((3 * (digits[0] + digits[3] + digits[6])) +
|
@@ -61,7 +61,7 @@ module ActiveMerchant
|
|
61
61
|
|
62
62
|
class Errors < Hash
|
63
63
|
def initialize
|
64
|
-
super(){|h, k| h[k] = []}
|
64
|
+
super() { |h, k| h[k] = [] }
|
65
65
|
end
|
66
66
|
|
67
67
|
alias count size
|
@@ -75,7 +75,7 @@ module ActiveMerchant
|
|
75
75
|
end
|
76
76
|
|
77
77
|
def empty?
|
78
|
-
all?{|k, v| v&.empty?}
|
78
|
+
all? { |k, v| v&.empty? }
|
79
79
|
end
|
80
80
|
|
81
81
|
def on(field)
|
@@ -91,7 +91,7 @@ module ActiveMerchant
|
|
91
91
|
end
|
92
92
|
|
93
93
|
def each_full
|
94
|
-
full_messages.each{|msg| yield msg}
|
94
|
+
full_messages.each { |msg| yield msg }
|
95
95
|
end
|
96
96
|
|
97
97
|
def full_messages
|
@@ -13,9 +13,9 @@ module ActiveMerchant #:nodoc:
|
|
13
13
|
return '' if number.blank?
|
14
14
|
|
15
15
|
case option
|
16
|
-
|
17
|
-
|
18
|
-
|
16
|
+
when :two_digits then sprintf('%.2i', number.to_i)[-2..-1]
|
17
|
+
when :four_digits then sprintf('%.4i', number.to_i)[-4..-1]
|
18
|
+
else number
|
19
19
|
end
|
20
20
|
end
|
21
21
|
end
|
@@ -10,7 +10,7 @@ module ActiveMerchant #:nodoc:
|
|
10
10
|
'diners_club' => ->(num) { num =~ /^3(0[0-5]|[68]\d)\d{11}$/ },
|
11
11
|
'jcb' => ->(num) { num =~ /^35(28|29|[3-8]\d)\d{12}$/ },
|
12
12
|
'dankort' => ->(num) { num =~ /^5019\d{12}$/ },
|
13
|
-
'maestro' => ->(num) { (12..19).
|
13
|
+
'maestro' => ->(num) { (12..19).cover?(num&.size) && in_bin_range?(num.slice(0, 6), MAESTRO_RANGES) },
|
14
14
|
'forbrugsforeningen' => ->(num) { num =~ /^600722\d{10}$/ },
|
15
15
|
'sodexo' => ->(num) { num =~ /^(606071|603389|606070|606069|606068|600818)\d{8}$/ },
|
16
16
|
'vr' => ->(num) { num =~ /^(627416|637036)\d{8}$/ },
|
@@ -86,7 +86,7 @@ module ActiveMerchant #:nodoc:
|
|
86
86
|
end
|
87
87
|
|
88
88
|
def valid_expiry_year?(year)
|
89
|
-
(Time.now.year..Time.now.year + 20).
|
89
|
+
(Time.now.year..Time.now.year + 20).cover?(year.to_i)
|
90
90
|
end
|
91
91
|
|
92
92
|
def valid_start_year?(year)
|
@@ -160,7 +160,7 @@ module ActiveMerchant #:nodoc:
|
|
160
160
|
end
|
161
161
|
|
162
162
|
def electron?(number)
|
163
|
-
return false unless [16, 19].include?(number
|
163
|
+
return false unless [16, 19].include?(number&.length)
|
164
164
|
|
165
165
|
# don't recalculate for each range
|
166
166
|
bank_identification_number = first_digits(number).to_i
|
@@ -176,7 +176,7 @@ module ActiveMerchant #:nodoc:
|
|
176
176
|
end
|
177
177
|
|
178
178
|
def first_digits(number)
|
179
|
-
number
|
179
|
+
number&.slice(0, 6) || ''
|
180
180
|
end
|
181
181
|
|
182
182
|
def last_digits(number)
|
@@ -201,10 +201,12 @@ module ActiveMerchant #:nodoc:
|
|
201
201
|
private
|
202
202
|
|
203
203
|
def valid_card_number_length?(number) #:nodoc:
|
204
|
+
return false if number.nil?
|
204
205
|
number.length >= 12
|
205
206
|
end
|
206
207
|
|
207
208
|
def valid_card_number_characters?(number) #:nodoc:
|
209
|
+
return false if number.nil?
|
208
210
|
!number.match(/\D/)
|
209
211
|
end
|
210
212
|
|
@@ -204,11 +204,11 @@ module ActiveMerchant #:nodoc:
|
|
204
204
|
|
205
205
|
def normalize(field)
|
206
206
|
case field
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
207
|
+
when 'true' then true
|
208
|
+
when 'false' then false
|
209
|
+
when '' then nil
|
210
|
+
when 'null' then nil
|
211
|
+
else field
|
212
212
|
end
|
213
213
|
end
|
214
214
|
|
@@ -241,10 +241,10 @@ module ActiveMerchant #:nodoc:
|
|
241
241
|
def amount(money)
|
242
242
|
return nil if money.nil?
|
243
243
|
cents = if money.respond_to?(:cents)
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
244
|
+
ActiveMerchant.deprecated 'Support for Money objects is deprecated and will be removed from a future release of ActiveMerchant. Please use an Integer value in cents'
|
245
|
+
money.cents
|
246
|
+
else
|
247
|
+
money
|
248
248
|
end
|
249
249
|
|
250
250
|
if money.is_a?(String)
|
@@ -7,7 +7,7 @@ module ActiveMerchant #:nodoc:
|
|
7
7
|
self.test_url = 'https://pal-test.adyen.com/pal/servlet/Payment/v18'
|
8
8
|
self.live_url = 'https://pal-live.adyen.com/pal/servlet/Payment/v18'
|
9
9
|
|
10
|
-
self.supported_countries = ['AT','AU','BE','BG','BR','CH','CY','CZ','DE','DK','EE','ES','FI','FR','GB','GI','GR','HK','HU','IE','IS','IT','LI','LT','LU','LV','MC','MT','MX','NL','NO','PL','PT','RO','SE','SG','SK','SI','US']
|
10
|
+
self.supported_countries = ['AT', 'AU', 'BE', 'BG', 'BR', 'CH', 'CY', 'CZ', 'DE', 'DK', 'EE', 'ES', 'FI', 'FR', 'GB', 'GI', 'GR', 'HK', 'HU', 'IE', 'IS', 'IT', 'LI', 'LT', 'LU', 'LV', 'MC', 'MT', 'MX', 'NL', 'NO', 'PL', 'PT', 'RO', 'SE', 'SG', 'SK', 'SI', 'US']
|
11
11
|
self.default_currency = 'USD'
|
12
12
|
self.supported_cardtypes = [:visa, :master, :american_express, :diners_club, :jcb, :dankort, :maestro, :discover]
|
13
13
|
|
@@ -34,8 +34,8 @@ module ActiveMerchant #:nodoc:
|
|
34
34
|
|
35
35
|
def purchase(money, payment, options={})
|
36
36
|
MultiResponse.run do |r|
|
37
|
-
r.process{authorize(money, payment, options)}
|
38
|
-
r.process{capture(money, r.authorization, options)}
|
37
|
+
r.process { authorize(money, payment, options) }
|
38
|
+
r.process { capture(money, r.authorization, options) }
|
39
39
|
end
|
40
40
|
end
|
41
41
|
|
@@ -103,6 +103,38 @@ module ActiveMerchant #:nodoc:
|
|
103
103
|
|
104
104
|
private
|
105
105
|
|
106
|
+
AVS_MAPPING = {
|
107
|
+
'0' => 'R', # Unknown
|
108
|
+
'1' => 'A', # Address matches, postal code doesn't
|
109
|
+
'2' => 'N', # Neither postal code nor address match
|
110
|
+
'3' => 'R', # AVS unavailable
|
111
|
+
'4' => 'E', # AVS not supported for this card type
|
112
|
+
'5' => 'U', # No AVS data provided
|
113
|
+
'6' => 'Z', # Postal code matches, address doesn't match
|
114
|
+
'7' => 'D', # Both postal code and address match
|
115
|
+
'8' => 'U', # Address not checked, postal code unknown
|
116
|
+
'9' => 'B', # Address matches, postal code unknown
|
117
|
+
'10' => 'N', # Address doesn't match, postal code unknown
|
118
|
+
'11' => 'U', # Postal code not checked, address unknown
|
119
|
+
'12' => 'B', # Address matches, postal code not checked
|
120
|
+
'13' => 'U', # Address doesn't match, postal code not checked
|
121
|
+
'14' => 'P', # Postal code matches, address unknown
|
122
|
+
'15' => 'P', # Postal code matches, address not checked
|
123
|
+
'16' => 'N', # Postal code doesn't match, address unknown
|
124
|
+
'17' => 'U', # Postal code doesn't match, address not checked
|
125
|
+
'18' => 'I' # Neither postal code nor address were checked
|
126
|
+
}
|
127
|
+
|
128
|
+
CVC_MAPPING = {
|
129
|
+
'0' => 'P', # Unknown
|
130
|
+
'1' => 'M', # Matches
|
131
|
+
'2' => 'N', # Does not match
|
132
|
+
'3' => 'P', # Not checked
|
133
|
+
'4' => 'S', # No CVC/CVV provided, but was required
|
134
|
+
'5' => 'U', # Issuer not certifed by CVC/CVV
|
135
|
+
'6' => 'P' # No CVC/CVV provided
|
136
|
+
}
|
137
|
+
|
106
138
|
NETWORK_TOKENIZATION_CARD_SOURCE = {
|
107
139
|
'apple_pay' => 'applepay',
|
108
140
|
'android_pay' => 'androidpay',
|
@@ -184,7 +216,7 @@ module ActiveMerchant #:nodoc:
|
|
184
216
|
cvc: credit_card.verification_value
|
185
217
|
}
|
186
218
|
|
187
|
-
card.delete_if{|k,v| v.blank? }
|
219
|
+
card.delete_if { |k, v| v.blank? }
|
188
220
|
card[:holderName] ||= 'Not Provided' if credit_card.is_a?(NetworkTokenizationCreditCard)
|
189
221
|
requires!(card, :expiryMonth, :expiryYear, :holderName, :number)
|
190
222
|
post[:card] = card
|
@@ -233,13 +265,12 @@ module ActiveMerchant #:nodoc:
|
|
233
265
|
|
234
266
|
def commit(action, parameters)
|
235
267
|
begin
|
236
|
-
raw_response = ssl_post("#{url}/#{action
|
268
|
+
raw_response = ssl_post("#{url}/#{action}", post_data(action, parameters), request_headers)
|
237
269
|
response = parse(raw_response)
|
238
270
|
rescue ResponseError => e
|
239
271
|
raw_response = e.response.body
|
240
272
|
response = parse(raw_response)
|
241
273
|
end
|
242
|
-
|
243
274
|
success = success_from(action, response)
|
244
275
|
Response.new(
|
245
276
|
success,
|
@@ -247,10 +278,20 @@ module ActiveMerchant #:nodoc:
|
|
247
278
|
response,
|
248
279
|
authorization: authorization_from(action, parameters, response),
|
249
280
|
test: test?,
|
250
|
-
error_code: success ? nil : error_code_from(response)
|
281
|
+
error_code: success ? nil : error_code_from(response),
|
282
|
+
avs_result: AVSResult.new(:code => avs_code_from(response)),
|
283
|
+
cvv_result: CVVResult.new(cvv_result_from(response))
|
251
284
|
)
|
252
285
|
end
|
253
286
|
|
287
|
+
def avs_code_from(response)
|
288
|
+
AVS_MAPPING[response['additionalData']['avsResult'][0..1].strip] if response.dig('additionalData', 'avsResult')
|
289
|
+
end
|
290
|
+
|
291
|
+
def cvv_result_from(response)
|
292
|
+
CVC_MAPPING[response['additionalData']['cvcResult'][0]] if response.dig('additionalData', 'cvcResult')
|
293
|
+
end
|
294
|
+
|
254
295
|
def url
|
255
296
|
if test?
|
256
297
|
test_url
|
@@ -182,7 +182,7 @@ module ActiveMerchant #:nodoc:
|
|
182
182
|
|
183
183
|
def parse_element(response, node)
|
184
184
|
if node.has_elements?
|
185
|
-
node.elements.each{|element| parse_element(response, element) }
|
185
|
+
node.elements.each { |element| parse_element(response, element) }
|
186
186
|
else
|
187
187
|
response[node.name.underscore.to_sym] = node.text
|
188
188
|
end
|
@@ -133,9 +133,9 @@ module ActiveMerchant
|
|
133
133
|
|
134
134
|
def refund(amount, authorization, options={})
|
135
135
|
response = if auth_was_for_cim?(authorization)
|
136
|
-
|
137
|
-
|
138
|
-
|
136
|
+
cim_refund(amount, authorization, options)
|
137
|
+
else
|
138
|
+
normal_refund(amount, authorization, options)
|
139
139
|
end
|
140
140
|
|
141
141
|
return response if response.success?
|
@@ -199,7 +199,7 @@ module ActiveMerchant
|
|
199
199
|
end
|
200
200
|
|
201
201
|
def verify_credentials
|
202
|
-
response = commit(:verify_credentials) {
|
202
|
+
response = commit(:verify_credentials) {}
|
203
203
|
response.success?
|
204
204
|
end
|
205
205
|
|
@@ -394,7 +394,7 @@ module ActiveMerchant
|
|
394
394
|
end
|
395
395
|
|
396
396
|
def camel_case_lower(key)
|
397
|
-
String(key).split('_').inject([]){ |buffer,e| buffer.push(buffer.empty? ? e : e.capitalize) }.join
|
397
|
+
String(key).split('_').inject([]) { |buffer, e| buffer.push(buffer.empty? ? e : e.capitalize) }.join
|
398
398
|
end
|
399
399
|
|
400
400
|
def add_settings(xml, source, options)
|
@@ -594,9 +594,9 @@ module ActiveMerchant
|
|
594
594
|
|
595
595
|
xml.send(root_node) do
|
596
596
|
first_name, last_name = if address[:name]
|
597
|
-
|
598
|
-
|
599
|
-
|
597
|
+
split_names(address[:name])
|
598
|
+
else
|
599
|
+
[address[:first_name], address[:last_name]]
|
600
600
|
end
|
601
601
|
full_address = "#{address[:address1]} #{address[:address2]}".strip
|
602
602
|
|
@@ -407,7 +407,7 @@ module ActiveMerchant #:nodoc:
|
|
407
407
|
|
408
408
|
def recurring_parse_element(response, node)
|
409
409
|
if node.has_elements?
|
410
|
-
node.elements.each{|e| recurring_parse_element(response, e) }
|
410
|
+
node.elements.each { |e| recurring_parse_element(response, e) }
|
411
411
|
else
|
412
412
|
response[node.name.underscore.to_sym] = node.text
|
413
413
|
end
|
@@ -379,18 +379,18 @@ module ActiveMerchant #:nodoc:
|
|
379
379
|
requires!(options, :transaction)
|
380
380
|
requires!(options[:transaction], :type)
|
381
381
|
case options[:transaction][:type]
|
382
|
-
|
382
|
+
when :void
|
383
383
|
requires!(options[:transaction], :trans_id)
|
384
|
-
|
384
|
+
when :refund
|
385
385
|
requires!(options[:transaction], :trans_id) &&
|
386
386
|
(
|
387
387
|
(options[:transaction][:customer_profile_id] && options[:transaction][:customer_payment_profile_id]) ||
|
388
388
|
options[:transaction][:credit_card_number_masked] ||
|
389
389
|
(options[:transaction][:bank_routing_number_masked] && options[:transaction][:bank_account_number_masked])
|
390
390
|
)
|
391
|
-
|
391
|
+
when :prior_auth_capture
|
392
392
|
requires!(options[:transaction], :amount, :trans_id)
|
393
|
-
|
393
|
+
else
|
394
394
|
requires!(options[:transaction], :amount, :customer_profile_id, :customer_payment_profile_id)
|
395
395
|
end
|
396
396
|
request = build_request(:create_customer_profile_transaction, options)
|
@@ -614,7 +614,7 @@ module ActiveMerchant #:nodoc:
|
|
614
614
|
|
615
615
|
def build_create_customer_profile_transaction_request(xml, options)
|
616
616
|
options[:extra_options] ||= {}
|
617
|
-
options[:extra_options]
|
617
|
+
options[:extra_options]['x_delim_char'] = @options[:delimiter] if @options[:delimiter]
|
618
618
|
|
619
619
|
add_transaction(xml, options[:transaction])
|
620
620
|
xml.tag!('extraOptions') do
|
@@ -665,12 +665,12 @@ module ActiveMerchant #:nodoc:
|
|
665
665
|
xml.tag!(CIM_TRANSACTION_TYPES[transaction[:type]]) do
|
666
666
|
# The amount to be billed to the customer
|
667
667
|
case transaction[:type]
|
668
|
-
|
669
|
-
tag_unless_blank(xml,'customerProfileId', transaction[:customer_profile_id])
|
670
|
-
tag_unless_blank(xml,'customerPaymentProfileId', transaction[:customer_payment_profile_id])
|
671
|
-
tag_unless_blank(xml,'customerShippingAddressId', transaction[:customer_shipping_address_id])
|
668
|
+
when :void
|
669
|
+
tag_unless_blank(xml, 'customerProfileId', transaction[:customer_profile_id])
|
670
|
+
tag_unless_blank(xml, 'customerPaymentProfileId', transaction[:customer_payment_profile_id])
|
671
|
+
tag_unless_blank(xml, 'customerShippingAddressId', transaction[:customer_shipping_address_id])
|
672
672
|
xml.tag!('transId', transaction[:trans_id])
|
673
|
-
|
673
|
+
when :refund
|
674
674
|
xml.tag!('amount', transaction[:amount])
|
675
675
|
tag_unless_blank(xml, 'customerProfileId', transaction[:customer_profile_id])
|
676
676
|
tag_unless_blank(xml, 'customerPaymentProfileId', transaction[:customer_payment_profile_id])
|
@@ -683,11 +683,11 @@ module ActiveMerchant #:nodoc:
|
|
683
683
|
add_tax(xml, transaction[:tax]) if transaction[:tax]
|
684
684
|
add_duty(xml, transaction[:duty]) if transaction[:duty]
|
685
685
|
add_shipping(xml, transaction[:shipping]) if transaction[:shipping]
|
686
|
-
|
686
|
+
when :prior_auth_capture
|
687
687
|
xml.tag!('amount', transaction[:amount])
|
688
688
|
add_order(xml, transaction[:order]) if transaction[:order].present?
|
689
689
|
xml.tag!('transId', transaction[:trans_id])
|
690
|
-
|
690
|
+
else
|
691
691
|
xml.tag!('amount', transaction[:amount])
|
692
692
|
xml.tag!('customerProfileId', transaction[:customer_profile_id])
|
693
693
|
xml.tag!('customerPaymentProfileId', transaction[:customer_payment_profile_id])
|
@@ -698,7 +698,7 @@ module ActiveMerchant #:nodoc:
|
|
698
698
|
if [:auth_capture, :auth_only, :capture_only].include?(transaction[:type])
|
699
699
|
xml.tag!('recurringBilling', transaction[:recurring_billing]) if transaction.has_key?(:recurring_billing)
|
700
700
|
end
|
701
|
-
unless [:void
|
701
|
+
unless [:void, :refund, :prior_auth_capture].include?(transaction[:type])
|
702
702
|
tag_unless_blank(xml, 'cardCode', transaction[:card_code])
|
703
703
|
end
|
704
704
|
end
|
@@ -878,7 +878,7 @@ module ActiveMerchant #:nodoc:
|
|
878
878
|
end
|
879
879
|
|
880
880
|
def format_extra_options(options)
|
881
|
-
options&.map{ |k, v| "#{k}=#{v}" }&.join('&')
|
881
|
+
options&.map { |k, v| "#{k}=#{v}" }&.join('&')
|
882
882
|
end
|
883
883
|
|
884
884
|
def parse_direct_response(params)
|
@@ -952,7 +952,7 @@ module ActiveMerchant #:nodoc:
|
|
952
952
|
def parse_element(node)
|
953
953
|
if node.has_elements?
|
954
954
|
response = {}
|
955
|
-
node.elements.each{ |e|
|
955
|
+
node.elements.each { |e|
|
956
956
|
key = e.name.underscore
|
957
957
|
value = parse_element(e)
|
958
958
|
if response.has_key?(key)
|
@@ -94,11 +94,11 @@ module ActiveMerchant #:nodoc:
|
|
94
94
|
|
95
95
|
def parse_element(response, node)
|
96
96
|
if node.has_attributes?
|
97
|
-
node.attributes.each{|name, value| response["#{node.name}_#{name}".underscore.to_sym] = value }
|
97
|
+
node.attributes.each { |name, value| response["#{node.name}_#{name}".underscore.to_sym] = value }
|
98
98
|
end
|
99
99
|
|
100
100
|
if node.has_elements?
|
101
|
-
node.elements.each{|element| parse_element(response, element) }
|
101
|
+
node.elements.each { |element| parse_element(response, element) }
|
102
102
|
else
|
103
103
|
response[node.name.underscore.to_sym] = node.text
|
104
104
|
end
|