activemerchant 1.105.0 → 1.106.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG +31 -1
- data/README.md +1 -1
- data/lib/active_merchant/billing/credit_card_methods.rb +12 -3
- data/lib/active_merchant/billing/gateway.rb +22 -22
- data/lib/active_merchant/billing/gateways/adyen.rb +17 -6
- data/lib/active_merchant/billing/gateways/allied_wallet.rb +2 -2
- data/lib/active_merchant/billing/gateways/authorize_net.rb +19 -19
- data/lib/active_merchant/billing/gateways/authorize_net_arb.rb +11 -11
- data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +35 -35
- data/lib/active_merchant/billing/gateways/axcessms.rb +3 -3
- data/lib/active_merchant/billing/gateways/bambora_apac.rb +1 -1
- data/lib/active_merchant/billing/gateways/bank_frick.rb +1 -1
- data/lib/active_merchant/billing/gateways/banwire.rb +2 -2
- data/lib/active_merchant/billing/gateways/barclaycard_smartpay.rb +5 -5
- data/lib/active_merchant/billing/gateways/be2bill.rb +4 -4
- data/lib/active_merchant/billing/gateways/beanstream.rb +1 -1
- data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +27 -27
- data/lib/active_merchant/billing/gateways/beanstream_interac.rb +1 -1
- data/lib/active_merchant/billing/gateways/blue_pay.rb +8 -8
- data/lib/active_merchant/billing/gateways/blue_snap.rb +5 -2
- data/lib/active_merchant/billing/gateways/bogus.rb +20 -20
- data/lib/active_merchant/billing/gateways/borgun.rb +2 -2
- data/lib/active_merchant/billing/gateways/bpoint.rb +1 -1
- data/lib/active_merchant/billing/gateways/braintree_blue.rb +74 -74
- data/lib/active_merchant/billing/gateways/bridge_pay.rb +3 -3
- data/lib/active_merchant/billing/gateways/card_connect.rb +1 -1
- data/lib/active_merchant/billing/gateways/card_stream.rb +19 -19
- data/lib/active_merchant/billing/gateways/cc5.rb +7 -7
- data/lib/active_merchant/billing/gateways/cecabank.rb +3 -3
- data/lib/active_merchant/billing/gateways/cenpos.rb +3 -3
- data/lib/active_merchant/billing/gateways/checkout_v2.rb +1 -1
- data/lib/active_merchant/billing/gateways/clearhaus.rb +1 -1
- data/lib/active_merchant/billing/gateways/commercegate.rb +2 -2
- data/lib/active_merchant/billing/gateways/conekta.rb +1 -1
- data/lib/active_merchant/billing/gateways/creditcall.rb +4 -4
- data/lib/active_merchant/billing/gateways/ct_payment.rb +1 -1
- data/lib/active_merchant/billing/gateways/culqi.rb +2 -2
- data/lib/active_merchant/billing/gateways/cyber_source.rb +86 -72
- data/lib/active_merchant/billing/gateways/data_cash.rb +33 -33
- data/lib/active_merchant/billing/gateways/decidir.rb +2 -2
- data/lib/active_merchant/billing/gateways/ebanx.rb +1 -1
- data/lib/active_merchant/billing/gateways/efsnet.rb +23 -23
- data/lib/active_merchant/billing/gateways/elavon.rb +13 -13
- data/lib/active_merchant/billing/gateways/epay.rb +40 -40
- data/lib/active_merchant/billing/gateways/evo_ca.rb +11 -11
- data/lib/active_merchant/billing/gateways/eway.rb +3 -3
- data/lib/active_merchant/billing/gateways/eway_managed.rb +40 -40
- data/lib/active_merchant/billing/gateways/eway_rapid.rb +7 -7
- data/lib/active_merchant/billing/gateways/exact.rb +11 -11
- data/lib/active_merchant/billing/gateways/fat_zebra.rb +3 -2
- data/lib/active_merchant/billing/gateways/federated_canada.rb +5 -5
- data/lib/active_merchant/billing/gateways/firstdata_e4.rb +20 -20
- data/lib/active_merchant/billing/gateways/firstdata_e4_v27.rb +19 -19
- data/lib/active_merchant/billing/gateways/flo2cash.rb +4 -4
- data/lib/active_merchant/billing/gateways/forte.rb +1 -1
- data/lib/active_merchant/billing/gateways/garanti.rb +8 -8
- data/lib/active_merchant/billing/gateways/hdfc.rb +3 -3
- data/lib/active_merchant/billing/gateways/hps.rb +1 -1
- data/lib/active_merchant/billing/gateways/iats_payments.rb +1 -1
- data/lib/active_merchant/billing/gateways/inspire.rb +7 -7
- data/lib/active_merchant/billing/gateways/instapay.rb +3 -3
- data/lib/active_merchant/billing/gateways/ipp.rb +1 -1
- data/lib/active_merchant/billing/gateways/iridium.rb +8 -8
- data/lib/active_merchant/billing/gateways/itransact.rb +7 -7
- data/lib/active_merchant/billing/gateways/iveri.rb +2 -2
- data/lib/active_merchant/billing/gateways/ixopay.rb +21 -0
- data/lib/active_merchant/billing/gateways/jetpay.rb +4 -4
- data/lib/active_merchant/billing/gateways/jetpay_v2.rb +5 -5
- data/lib/active_merchant/billing/gateways/latitude19.rb +2 -2
- data/lib/active_merchant/billing/gateways/linkpoint.rb +62 -62
- data/lib/active_merchant/billing/gateways/litle.rb +2 -2
- data/lib/active_merchant/billing/gateways/mastercard.rb +2 -2
- data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +5 -5
- data/lib/active_merchant/billing/gateways/merchant_one.rb +2 -2
- data/lib/active_merchant/billing/gateways/merchant_partners.rb +4 -4
- data/lib/active_merchant/billing/gateways/merchant_ware.rb +12 -12
- data/lib/active_merchant/billing/gateways/merchant_ware_version_four.rb +11 -11
- data/lib/active_merchant/billing/gateways/merchant_warrior.rb +12 -2
- data/lib/active_merchant/billing/gateways/mercury.rb +9 -9
- data/lib/active_merchant/billing/gateways/metrics_global.rb +15 -15
- data/lib/active_merchant/billing/gateways/migs.rb +13 -13
- data/lib/active_merchant/billing/gateways/modern_payments_cim.rb +7 -7
- data/lib/active_merchant/billing/gateways/monei.rb +19 -19
- data/lib/active_merchant/billing/gateways/moneris.rb +10 -10
- data/lib/active_merchant/billing/gateways/money_movers.rb +5 -5
- data/lib/active_merchant/billing/gateways/mundipagg.rb +1 -1
- data/lib/active_merchant/billing/gateways/nab_transact.rb +15 -15
- data/lib/active_merchant/billing/gateways/ncr_secure_pay.rb +1 -1
- data/lib/active_merchant/billing/gateways/net_registry.rb +6 -6
- data/lib/active_merchant/billing/gateways/netaxept.rb +4 -4
- data/lib/active_merchant/billing/gateways/netbanx.rb +14 -14
- data/lib/active_merchant/billing/gateways/netbilling.rb +12 -12
- data/lib/active_merchant/billing/gateways/netpay.rb +2 -2
- data/lib/active_merchant/billing/gateways/network_merchants.rb +5 -5
- data/lib/active_merchant/billing/gateways/ogone.rb +7 -7
- data/lib/active_merchant/billing/gateways/openpay.rb +2 -2
- data/lib/active_merchant/billing/gateways/opp.rb +1 -1
- data/lib/active_merchant/billing/gateways/optimal_payment.rb +9 -9
- data/lib/active_merchant/billing/gateways/orbital.rb +10 -10
- data/lib/active_merchant/billing/gateways/pac_net_raven.rb +7 -7
- data/lib/active_merchant/billing/gateways/pay_conex.rb +2 -2
- data/lib/active_merchant/billing/gateways/pay_gate_xml.rb +16 -16
- data/lib/active_merchant/billing/gateways/pay_junction.rb +16 -16
- data/lib/active_merchant/billing/gateways/pay_junction_v2.rb +18 -2
- data/lib/active_merchant/billing/gateways/pay_secure.rb +6 -6
- data/lib/active_merchant/billing/gateways/paybox_direct.rb +36 -36
- data/lib/active_merchant/billing/gateways/payflow.rb +7 -7
- data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +12 -12
- data/lib/active_merchant/billing/gateways/payflow_express.rb +4 -4
- data/lib/active_merchant/billing/gateways/payment_express.rb +7 -7
- data/lib/active_merchant/billing/gateways/paymill.rb +3 -3
- data/lib/active_merchant/billing/gateways/paypal.rb +1 -1
- data/lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb +5 -5
- data/lib/active_merchant/billing/gateways/paypal_express_common.rb +1 -1
- data/lib/active_merchant/billing/gateways/payscout.rb +5 -5
- data/lib/active_merchant/billing/gateways/paystation.rb +2 -2
- data/lib/active_merchant/billing/gateways/payu_latam.rb +3 -3
- data/lib/active_merchant/billing/gateways/payway.rb +12 -12
- data/lib/active_merchant/billing/gateways/pin.rb +16 -16
- data/lib/active_merchant/billing/gateways/plugnpay.rb +10 -10
- data/lib/active_merchant/billing/gateways/psigate.rb +26 -26
- data/lib/active_merchant/billing/gateways/psl_card.rb +4 -4
- data/lib/active_merchant/billing/gateways/qbms.rb +23 -23
- data/lib/active_merchant/billing/gateways/quantum.rb +4 -4
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_common.rb +95 -95
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb +9 -9
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_v4to7.rb +2 -2
- data/lib/active_merchant/billing/gateways/qvalent.rb +1 -1
- data/lib/active_merchant/billing/gateways/realex.rb +8 -8
- data/lib/active_merchant/billing/gateways/redsys.rb +24 -16
- data/lib/active_merchant/billing/gateways/safe_charge.rb +1 -1
- data/lib/active_merchant/billing/gateways/sage.rb +10 -10
- data/lib/active_merchant/billing/gateways/sage_pay.rb +35 -35
- data/lib/active_merchant/billing/gateways/sallie_mae.rb +2 -2
- data/lib/active_merchant/billing/gateways/secure_net.rb +9 -9
- data/lib/active_merchant/billing/gateways/secure_pay.rb +13 -13
- data/lib/active_merchant/billing/gateways/secure_pay_au.rb +15 -15
- data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +2 -2
- data/lib/active_merchant/billing/gateways/skip_jack.rb +8 -8
- data/lib/active_merchant/billing/gateways/smart_ps.rb +16 -16
- data/lib/active_merchant/billing/gateways/so_easy_pay.rb +6 -6
- data/lib/active_merchant/billing/gateways/spreedly_core.rb +4 -4
- data/lib/active_merchant/billing/gateways/stripe.rb +8 -8
- data/lib/active_merchant/billing/gateways/stripe_payment_intents.rb +10 -3
- data/lib/active_merchant/billing/gateways/swipe_checkout.rb +2 -2
- data/lib/active_merchant/billing/gateways/trans_first.rb +4 -4
- data/lib/active_merchant/billing/gateways/trust_commerce.rb +19 -19
- data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +110 -110
- data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +29 -29
- data/lib/active_merchant/billing/gateways/verifi.rb +10 -10
- data/lib/active_merchant/billing/gateways/viaklix.rb +6 -6
- data/lib/active_merchant/billing/gateways/visanet_peru.rb +6 -6
- data/lib/active_merchant/billing/gateways/webpay.rb +2 -2
- data/lib/active_merchant/billing/gateways/wirecard.rb +6 -6
- data/lib/active_merchant/billing/gateways/worldpay.rb +15 -15
- data/lib/active_merchant/billing/gateways/worldpay_online_payments.rb +32 -32
- data/lib/active_merchant/billing/gateways/worldpay_us.rb +2 -2
- data/lib/active_merchant/connection.rb +1 -1
- data/lib/active_merchant/network_connection_retries.rb +3 -3
- data/lib/active_merchant/post_data.rb +1 -1
- data/lib/active_merchant/version.rb +1 -1
- data/lib/certs/cacert.pem +75 -0
- data/lib/support/ssl_verify.rb +2 -2
- data/lib/support/ssl_version.rb +2 -2
- metadata +2 -3
- data/lib/active_merchant/billing/gateways/moneris_us.rb +0 -352
|
@@ -72,8 +72,8 @@ module ActiveMerchant #:nodoc:
|
|
|
72
72
|
authorization = response[:unique_id]
|
|
73
73
|
|
|
74
74
|
Response.new(success, message, response,
|
|
75
|
-
:
|
|
76
|
-
:
|
|
75
|
+
authorization: authorization,
|
|
76
|
+
test: (response[:mode] != 'LIVE')
|
|
77
77
|
)
|
|
78
78
|
end
|
|
79
79
|
|
|
@@ -103,7 +103,7 @@ module ActiveMerchant #:nodoc:
|
|
|
103
103
|
end
|
|
104
104
|
|
|
105
105
|
def build_request(payment_code, money, payment, options)
|
|
106
|
-
xml = Builder::XmlMarkup.new :
|
|
106
|
+
xml = Builder::XmlMarkup.new indent: 2
|
|
107
107
|
xml.instruct!
|
|
108
108
|
xml.tag! 'Request', 'version' => API_VERSION do
|
|
109
109
|
xml.tag! 'Header' do
|
|
@@ -132,7 +132,7 @@ module ActiveMerchant #:nodoc:
|
|
|
132
132
|
end
|
|
133
133
|
|
|
134
134
|
def add_credit_card(xml, payment)
|
|
135
|
-
xml.CreditCard :
|
|
135
|
+
xml.CreditCard Registered: 'False' do
|
|
136
136
|
xml.CardNumber payment.number
|
|
137
137
|
xml.ExpM format(payment.month, :two_digits)
|
|
138
138
|
xml.ExpY format(payment.year, :four_digits)
|
|
@@ -166,7 +166,7 @@ module ActiveMerchant #:nodoc:
|
|
|
166
166
|
end
|
|
167
167
|
|
|
168
168
|
def build_xml_request(action, data)
|
|
169
|
-
xml = Builder::XmlMarkup.new :
|
|
169
|
+
xml = Builder::XmlMarkup.new indent: 2
|
|
170
170
|
xml.Request(version: '1.0') do
|
|
171
171
|
xml.Header do
|
|
172
172
|
xml.Security(sender: @options[:sender], type: 'MERCHANT')
|
|
@@ -92,8 +92,8 @@ module ActiveMerchant #:nodoc:
|
|
|
92
92
|
Response.new(success?(response),
|
|
93
93
|
response['message'],
|
|
94
94
|
response,
|
|
95
|
-
:
|
|
96
|
-
:
|
|
95
|
+
test: test?,
|
|
96
|
+
authorization: response['code_auth'])
|
|
97
97
|
end
|
|
98
98
|
|
|
99
99
|
def success?(response)
|
|
@@ -108,7 +108,7 @@ module ActiveMerchant #:nodoc:
|
|
|
108
108
|
def store(creditcard, options = {})
|
|
109
109
|
post = store_request(options)
|
|
110
110
|
post[:card] = credit_card_hash(creditcard)
|
|
111
|
-
post[:recurring] = {:
|
|
111
|
+
post[:recurring] = {contract: 'RECURRING'}
|
|
112
112
|
|
|
113
113
|
commit('store', post)
|
|
114
114
|
end
|
|
@@ -161,20 +161,20 @@ module ActiveMerchant #:nodoc:
|
|
|
161
161
|
message_from(response),
|
|
162
162
|
response,
|
|
163
163
|
test: test?,
|
|
164
|
-
avs_result: AVSResult.new(:
|
|
164
|
+
avs_result: AVSResult.new(code: parse_avs_code(response)),
|
|
165
165
|
authorization: response['recurringDetailReference'] || authorization_from(post, response)
|
|
166
166
|
)
|
|
167
167
|
rescue ResponseError => e
|
|
168
168
|
case e.response.code
|
|
169
169
|
when '401'
|
|
170
|
-
return Response.new(false, 'Invalid credentials', {}, :
|
|
170
|
+
return Response.new(false, 'Invalid credentials', {}, test: test?)
|
|
171
171
|
when '403'
|
|
172
|
-
return Response.new(false, 'Not allowed', {}, :
|
|
172
|
+
return Response.new(false, 'Not allowed', {}, test: test?)
|
|
173
173
|
when '422', '500'
|
|
174
174
|
if e.response.body.split(/\W+/).any? { |word| %w(validation configuration security).include?(word) }
|
|
175
175
|
error_message = e.response.body[/#{Regexp.escape('message=')}(.*?)#{Regexp.escape('&')}/m, 1].tr('+', ' ')
|
|
176
176
|
error_code = e.response.body[/#{Regexp.escape('errorCode=')}(.*?)#{Regexp.escape('&')}/m, 1]
|
|
177
|
-
return Response.new(false, error_code + ': ' + error_message, {}, :
|
|
177
|
+
return Response.new(false, error_code + ': ' + error_message, {}, test: test?)
|
|
178
178
|
end
|
|
179
179
|
end
|
|
180
180
|
raise
|
|
@@ -92,8 +92,8 @@ module ActiveMerchant #:nodoc:
|
|
|
92
92
|
successful?(response),
|
|
93
93
|
message_from(response),
|
|
94
94
|
response,
|
|
95
|
-
:
|
|
96
|
-
:
|
|
95
|
+
authorization: response['TRANSACTIONID'],
|
|
96
|
+
test: test?
|
|
97
97
|
)
|
|
98
98
|
end
|
|
99
99
|
|
|
@@ -111,8 +111,8 @@ module ActiveMerchant #:nodoc:
|
|
|
111
111
|
|
|
112
112
|
def post_data(action, parameters = {})
|
|
113
113
|
{
|
|
114
|
-
:
|
|
115
|
-
:
|
|
114
|
+
method: action,
|
|
115
|
+
params: parameters.merge(HASH: signature(parameters, action))
|
|
116
116
|
}.to_query
|
|
117
117
|
end
|
|
118
118
|
|
|
@@ -175,7 +175,7 @@ module ActiveMerchant #:nodoc:
|
|
|
175
175
|
# can't actually delete a secure profile with the supplicated API. This function sets the status of the profile to closed (C).
|
|
176
176
|
# Closed profiles will have to removed manually.
|
|
177
177
|
def delete(vault_id)
|
|
178
|
-
update(vault_id, false, {:
|
|
178
|
+
update(vault_id, false, {status: 'C'})
|
|
179
179
|
end
|
|
180
180
|
|
|
181
181
|
alias_method :unstore, :delete
|
|
@@ -9,20 +9,20 @@ module ActiveMerchant #:nodoc:
|
|
|
9
9
|
SP_SERVICE_VERSION = '1.1'
|
|
10
10
|
|
|
11
11
|
TRANSACTIONS = {
|
|
12
|
-
:
|
|
13
|
-
:
|
|
14
|
-
:
|
|
15
|
-
:
|
|
16
|
-
:
|
|
17
|
-
:
|
|
18
|
-
:
|
|
19
|
-
:
|
|
20
|
-
:
|
|
12
|
+
authorization: 'PA',
|
|
13
|
+
purchase: 'P',
|
|
14
|
+
capture: 'PAC',
|
|
15
|
+
refund: 'R',
|
|
16
|
+
void: 'VP',
|
|
17
|
+
check_purchase: 'D',
|
|
18
|
+
check_refund: 'C',
|
|
19
|
+
void_purchase: 'VP',
|
|
20
|
+
void_refund: 'VR'
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
PROFILE_OPERATIONS = {
|
|
24
|
-
:
|
|
25
|
-
:
|
|
24
|
+
new: 'N',
|
|
25
|
+
modify: 'M'
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
CVD_CODES = {
|
|
@@ -41,24 +41,24 @@ module ActiveMerchant #:nodoc:
|
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
PERIODS = {
|
|
44
|
-
:
|
|
45
|
-
:
|
|
46
|
-
:
|
|
47
|
-
:
|
|
44
|
+
days: 'D',
|
|
45
|
+
weeks: 'W',
|
|
46
|
+
months: 'M',
|
|
47
|
+
years: 'Y'
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
PERIODICITIES = {
|
|
51
|
-
:
|
|
52
|
-
:
|
|
53
|
-
:
|
|
54
|
-
:
|
|
55
|
-
:
|
|
56
|
-
:
|
|
51
|
+
daily: [:days, 1],
|
|
52
|
+
weekly: [:weeks, 1],
|
|
53
|
+
biweekly: [:weeks, 2],
|
|
54
|
+
monthly: [:months, 1],
|
|
55
|
+
bimonthly: [:months, 2],
|
|
56
|
+
yearly: [:years, 1]
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
RECURRING_OPERATION = {
|
|
60
|
-
:
|
|
61
|
-
:
|
|
60
|
+
update: 'M',
|
|
61
|
+
cancel: 'C'
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
STATES = {
|
|
@@ -414,10 +414,10 @@ module ActiveMerchant #:nodoc:
|
|
|
414
414
|
response = parse(ssl_post((use_profile_api ? SECURE_PROFILE_URL : self.live_url), data))
|
|
415
415
|
response[:customer_vault_id] = response[:customerCode] if response[:customerCode]
|
|
416
416
|
build_response(success?(response), message_from(response), response,
|
|
417
|
-
:
|
|
418
|
-
:
|
|
419
|
-
:
|
|
420
|
-
:
|
|
417
|
+
test: test? || response[:authCode] == 'TEST',
|
|
418
|
+
authorization: authorization_from(response),
|
|
419
|
+
cvv_result: CVD_CODES[response[:cvdId]],
|
|
420
|
+
avs_result: { code: AVS_CODES.include?(response[:avsId]) ? AVS_CODES[response[:avsId]] : response[:avsId] }
|
|
421
421
|
)
|
|
422
422
|
end
|
|
423
423
|
|
|
@@ -18,7 +18,7 @@ module ActiveMerchant #:nodoc:
|
|
|
18
18
|
# post back is for until the response of the confirmation is
|
|
19
19
|
# received, which contains the order number.
|
|
20
20
|
def self.confirm(transaction)
|
|
21
|
-
gateway = new(:
|
|
21
|
+
gateway = new(login: '')
|
|
22
22
|
gateway.confirm(transaction)
|
|
23
23
|
end
|
|
24
24
|
|
|
@@ -18,7 +18,7 @@ module ActiveMerchant #:nodoc:
|
|
|
18
18
|
'TRANS_ID' => :transaction_id,
|
|
19
19
|
'STATUS' => :response_code,
|
|
20
20
|
'AVS' => :avs_result_code,
|
|
21
|
-
'CVV2'=> :card_code,
|
|
21
|
+
'CVV2' => :card_code,
|
|
22
22
|
'AUTH_CODE' => :authorization,
|
|
23
23
|
'MESSAGE' => :message,
|
|
24
24
|
'REBID' => :rebid,
|
|
@@ -29,7 +29,7 @@ module ActiveMerchant #:nodoc:
|
|
|
29
29
|
|
|
30
30
|
REBILL_FIELD_MAP = {
|
|
31
31
|
'REBILL_ID' => :rebill_id,
|
|
32
|
-
'ACCOUNT_ID'=> :account_id,
|
|
32
|
+
'ACCOUNT_ID' => :account_id,
|
|
33
33
|
'USER_ID' => :user_id,
|
|
34
34
|
'TEMPLATE_ID' => :template_id,
|
|
35
35
|
'STATUS' => :status,
|
|
@@ -343,8 +343,8 @@ module ActiveMerchant #:nodoc:
|
|
|
343
343
|
message = parsed[:status]
|
|
344
344
|
|
|
345
345
|
Response.new(success, message, parsed,
|
|
346
|
-
:
|
|
347
|
-
:
|
|
346
|
+
test: test?,
|
|
347
|
+
authorization: parsed[:rebill_id])
|
|
348
348
|
end
|
|
349
349
|
|
|
350
350
|
def parse(body)
|
|
@@ -363,10 +363,10 @@ module ActiveMerchant #:nodoc:
|
|
|
363
363
|
message = message_from(parsed)
|
|
364
364
|
success = parsed[:response_code] == '1'
|
|
365
365
|
Response.new(success, message, parsed,
|
|
366
|
-
:
|
|
367
|
-
:
|
|
368
|
-
:
|
|
369
|
-
:
|
|
366
|
+
test: test?,
|
|
367
|
+
authorization: (parsed[:rebid] && parsed[:rebid] != '' ? parsed[:rebid] : parsed[:transaction_id]),
|
|
368
|
+
avs_result: { code: parsed[:avs_result_code] },
|
|
369
|
+
cvv_result: parsed[:card_code]
|
|
370
370
|
)
|
|
371
371
|
end
|
|
372
372
|
|
|
@@ -9,6 +9,8 @@ module ActiveMerchant
|
|
|
9
9
|
|
|
10
10
|
self.default_currency = 'USD'
|
|
11
11
|
self.supported_cardtypes = [:visa, :master, :american_express, :discover, :jcb, :diners_club, :maestro, :naranja, :cabal]
|
|
12
|
+
self.currencies_without_fractions = %w(BYR CLP ILS JPY KRW VND XOF)
|
|
13
|
+
self.currencies_with_three_decimal_places = %w(BHD JOD KWD OMR TND)
|
|
12
14
|
|
|
13
15
|
self.homepage_url = 'https://home.bluesnap.com/'
|
|
14
16
|
self.display_name = 'BlueSnap'
|
|
@@ -188,8 +190,9 @@ module ActiveMerchant
|
|
|
188
190
|
end
|
|
189
191
|
|
|
190
192
|
def add_amount(doc, money, options)
|
|
191
|
-
|
|
192
|
-
doc.
|
|
193
|
+
currency = options[:currency] || currency(money)
|
|
194
|
+
doc.amount(localized_amount(money, currency))
|
|
195
|
+
doc.currency(currency)
|
|
193
196
|
end
|
|
194
197
|
|
|
195
198
|
def add_personal_info(doc, payment_method, options)
|
|
@@ -47,9 +47,9 @@ module ActiveMerchant #:nodoc:
|
|
|
47
47
|
money = amount(money)
|
|
48
48
|
case normalize(paysource)
|
|
49
49
|
when /1$/
|
|
50
|
-
Response.new(true, SUCCESS_MESSAGE, {:
|
|
50
|
+
Response.new(true, SUCCESS_MESSAGE, {paid_amount: money}, test: true)
|
|
51
51
|
when /2$/
|
|
52
|
-
Response.new(false, FAILURE_MESSAGE, {:
|
|
52
|
+
Response.new(false, FAILURE_MESSAGE, {paid_amount: money, error: FAILURE_MESSAGE }, test: true, error_code: STANDARD_ERROR_CODE[:processing_error])
|
|
53
53
|
else
|
|
54
54
|
raise Error, error_message(paysource)
|
|
55
55
|
end
|
|
@@ -61,9 +61,9 @@ module ActiveMerchant #:nodoc:
|
|
|
61
61
|
when /1$/
|
|
62
62
|
raise Error, REFUND_ERROR_MESSAGE
|
|
63
63
|
when /2$/
|
|
64
|
-
Response.new(false, FAILURE_MESSAGE, {:
|
|
64
|
+
Response.new(false, FAILURE_MESSAGE, {paid_amount: money, error: FAILURE_MESSAGE }, test: true, error_code: STANDARD_ERROR_CODE[:processing_error])
|
|
65
65
|
else
|
|
66
|
-
Response.new(true, SUCCESS_MESSAGE, {:
|
|
66
|
+
Response.new(true, SUCCESS_MESSAGE, {paid_amount: money}, test: true)
|
|
67
67
|
end
|
|
68
68
|
end
|
|
69
69
|
|
|
@@ -73,9 +73,9 @@ module ActiveMerchant #:nodoc:
|
|
|
73
73
|
when /1$/
|
|
74
74
|
raise Error, CAPTURE_ERROR_MESSAGE
|
|
75
75
|
when /2$/
|
|
76
|
-
Response.new(false, FAILURE_MESSAGE, {:
|
|
76
|
+
Response.new(false, FAILURE_MESSAGE, {paid_amount: money, error: FAILURE_MESSAGE }, test: true, error_code: STANDARD_ERROR_CODE[:processing_error])
|
|
77
77
|
else
|
|
78
|
-
Response.new(true, SUCCESS_MESSAGE, {:
|
|
78
|
+
Response.new(true, SUCCESS_MESSAGE, {paid_amount: money}, test: true)
|
|
79
79
|
end
|
|
80
80
|
end
|
|
81
81
|
|
|
@@ -84,18 +84,18 @@ module ActiveMerchant #:nodoc:
|
|
|
84
84
|
when /1$/
|
|
85
85
|
raise Error, VOID_ERROR_MESSAGE
|
|
86
86
|
when /2$/
|
|
87
|
-
Response.new(false, FAILURE_MESSAGE, {:
|
|
87
|
+
Response.new(false, FAILURE_MESSAGE, {authorization: reference, error: FAILURE_MESSAGE }, test: true, error_code: STANDARD_ERROR_CODE[:processing_error])
|
|
88
88
|
else
|
|
89
|
-
Response.new(true, SUCCESS_MESSAGE, {:
|
|
89
|
+
Response.new(true, SUCCESS_MESSAGE, {authorization: reference}, test: true)
|
|
90
90
|
end
|
|
91
91
|
end
|
|
92
92
|
|
|
93
93
|
def store(paysource, options = {})
|
|
94
94
|
case normalize(paysource)
|
|
95
95
|
when /1$/
|
|
96
|
-
Response.new(true, SUCCESS_MESSAGE, {:
|
|
96
|
+
Response.new(true, SUCCESS_MESSAGE, {billingid: '1'}, test: true, authorization: AUTHORIZATION)
|
|
97
97
|
when /2$/
|
|
98
|
-
Response.new(false, FAILURE_MESSAGE, {:
|
|
98
|
+
Response.new(false, FAILURE_MESSAGE, {billingid: nil, error: FAILURE_MESSAGE }, test: true, error_code: STANDARD_ERROR_CODE[:processing_error])
|
|
99
99
|
else
|
|
100
100
|
raise Error, error_message(paysource)
|
|
101
101
|
end
|
|
@@ -104,9 +104,9 @@ module ActiveMerchant #:nodoc:
|
|
|
104
104
|
def unstore(reference, options = {})
|
|
105
105
|
case reference
|
|
106
106
|
when /1$/
|
|
107
|
-
Response.new(true, SUCCESS_MESSAGE, {}, :
|
|
107
|
+
Response.new(true, SUCCESS_MESSAGE, {}, test: true)
|
|
108
108
|
when /2$/
|
|
109
|
-
Response.new(false, FAILURE_MESSAGE, {:
|
|
109
|
+
Response.new(false, FAILURE_MESSAGE, {error: FAILURE_MESSAGE }, test: true, error_code: STANDARD_ERROR_CODE[:processing_error])
|
|
110
110
|
else
|
|
111
111
|
raise Error, UNSTORE_ERROR_MESSAGE
|
|
112
112
|
end
|
|
@@ -118,9 +118,9 @@ module ActiveMerchant #:nodoc:
|
|
|
118
118
|
money = amount(money)
|
|
119
119
|
case money
|
|
120
120
|
when /00$/
|
|
121
|
-
Response.new(true, SUCCESS_MESSAGE, {:
|
|
121
|
+
Response.new(true, SUCCESS_MESSAGE, {authorized_amount: money}, test: true, authorization: AUTHORIZATION, emv_authorization: AUTHORIZATION_EMV_SUCCESS)
|
|
122
122
|
when /05$/
|
|
123
|
-
Response.new(false, FAILURE_MESSAGE, {:
|
|
123
|
+
Response.new(false, FAILURE_MESSAGE, {authorized_amount: money, error: FAILURE_MESSAGE }, test: true, error_code: STANDARD_ERROR_CODE[:processing_error], emv_authorization: AUTHORIZATION_EMV_DECLINE)
|
|
124
124
|
else
|
|
125
125
|
raise Error, error_message(paysource)
|
|
126
126
|
end
|
|
@@ -130,9 +130,9 @@ module ActiveMerchant #:nodoc:
|
|
|
130
130
|
money = amount(money)
|
|
131
131
|
case normalize(paysource)
|
|
132
132
|
when /1$/, AUTHORIZATION
|
|
133
|
-
Response.new(true, SUCCESS_MESSAGE, {:
|
|
133
|
+
Response.new(true, SUCCESS_MESSAGE, {authorized_amount: money}, test: true, authorization: AUTHORIZATION)
|
|
134
134
|
when /2$/
|
|
135
|
-
Response.new(false, FAILURE_MESSAGE, {:
|
|
135
|
+
Response.new(false, FAILURE_MESSAGE, {authorized_amount: money, error: FAILURE_MESSAGE }, test: true, error_code: STANDARD_ERROR_CODE[:processing_error])
|
|
136
136
|
else
|
|
137
137
|
raise Error, error_message(paysource)
|
|
138
138
|
end
|
|
@@ -142,9 +142,9 @@ module ActiveMerchant #:nodoc:
|
|
|
142
142
|
money = amount(money)
|
|
143
143
|
case money
|
|
144
144
|
when /00$/
|
|
145
|
-
Response.new(true, SUCCESS_MESSAGE, {:
|
|
145
|
+
Response.new(true, SUCCESS_MESSAGE, {paid_amount: money}, test: true, authorization: AUTHORIZATION, emv_authorization: AUTHORIZATION_EMV_SUCCESS)
|
|
146
146
|
when /05$/
|
|
147
|
-
Response.new(false, FAILURE_MESSAGE, {:
|
|
147
|
+
Response.new(false, FAILURE_MESSAGE, {paid_amount: money, error: FAILURE_MESSAGE }, test: true, error_code: STANDARD_ERROR_CODE[:processing_error], emv_authorization: AUTHORIZATION_EMV_DECLINE)
|
|
148
148
|
else
|
|
149
149
|
raise Error, error_message(paysource)
|
|
150
150
|
end
|
|
@@ -154,9 +154,9 @@ module ActiveMerchant #:nodoc:
|
|
|
154
154
|
money = amount(money)
|
|
155
155
|
case normalize(paysource)
|
|
156
156
|
when /1$/, AUTHORIZATION
|
|
157
|
-
Response.new(true, SUCCESS_MESSAGE, {:
|
|
157
|
+
Response.new(true, SUCCESS_MESSAGE, {paid_amount: money}, test: true, authorization: AUTHORIZATION)
|
|
158
158
|
when /2$/
|
|
159
|
-
Response.new(false, FAILURE_MESSAGE, {:
|
|
159
|
+
Response.new(false, FAILURE_MESSAGE, {paid_amount: money, error: FAILURE_MESSAGE }, test: true, error_code: STANDARD_ERROR_CODE[:processing_error])
|
|
160
160
|
else
|
|
161
161
|
raise Error, error_message(paysource)
|
|
162
162
|
end
|
|
@@ -182,8 +182,8 @@ module ActiveMerchant #:nodoc:
|
|
|
182
182
|
|
|
183
183
|
def build_request(action, post)
|
|
184
184
|
mode = action == 'void' ? 'cancel' : 'get'
|
|
185
|
-
xml = Builder::XmlMarkup.new :
|
|
186
|
-
xml.instruct!(:xml, :
|
|
185
|
+
xml = Builder::XmlMarkup.new indent: 18
|
|
186
|
+
xml.instruct!(:xml, version: '1.0', encoding: 'utf-8')
|
|
187
187
|
xml.tag!("#{mode}Authorization") do
|
|
188
188
|
post.each do |field, value|
|
|
189
189
|
xml.tag!(field, value)
|
|
@@ -91,7 +91,7 @@ module ActiveMerchant #:nodoc:
|
|
|
91
91
|
private
|
|
92
92
|
|
|
93
93
|
def soap_request
|
|
94
|
-
Nokogiri::XML::Builder.new(:
|
|
94
|
+
Nokogiri::XML::Builder.new(encoding: 'utf-8') do |xml|
|
|
95
95
|
xml.send('soap12:Envelope', soap_envelope_attributes) {
|
|
96
96
|
xml.send('soap12:Body') {
|
|
97
97
|
yield(xml) if block_given?
|
|
@@ -60,12 +60,12 @@ module ActiveMerchant #:nodoc:
|
|
|
60
60
|
end
|
|
61
61
|
|
|
62
62
|
@configuration = Braintree::Configuration.new(
|
|
63
|
-
:
|
|
64
|
-
:
|
|
65
|
-
:
|
|
66
|
-
:
|
|
67
|
-
:
|
|
68
|
-
:
|
|
63
|
+
merchant_id: options[:merchant_id],
|
|
64
|
+
public_key: options[:public_key],
|
|
65
|
+
private_key: options[:private_key],
|
|
66
|
+
environment: (options[:environment] || (test? ? :sandbox : :production)).to_sym,
|
|
67
|
+
custom_user_agent: "ActiveMerchant #{ActiveMerchant::VERSION}",
|
|
68
|
+
logger: options[:logger] || logger
|
|
69
69
|
)
|
|
70
70
|
|
|
71
71
|
@braintree_gateway = Braintree::Gateway.new(@configuration)
|
|
@@ -83,7 +83,7 @@ module ActiveMerchant #:nodoc:
|
|
|
83
83
|
end
|
|
84
84
|
|
|
85
85
|
def purchase(money, credit_card_or_vault_id, options = {})
|
|
86
|
-
authorize(money, credit_card_or_vault_id, options.merge(:
|
|
86
|
+
authorize(money, credit_card_or_vault_id, options.merge(submit_for_settlement: true))
|
|
87
87
|
end
|
|
88
88
|
|
|
89
89
|
def credit(money, credit_card_or_vault_id, options = {})
|
|
@@ -144,26 +144,26 @@ module ActiveMerchant #:nodoc:
|
|
|
144
144
|
|
|
145
145
|
options[:update_existing_token] = braintree_credit_card.token
|
|
146
146
|
credit_card_params = merge_credit_card_options({
|
|
147
|
-
:
|
|
148
|
-
:
|
|
149
|
-
:
|
|
150
|
-
:
|
|
151
|
-
:
|
|
152
|
-
:
|
|
147
|
+
credit_card: {
|
|
148
|
+
cardholder_name: creditcard.name,
|
|
149
|
+
number: creditcard.number,
|
|
150
|
+
cvv: creditcard.verification_value,
|
|
151
|
+
expiration_month: creditcard.month.to_s.rjust(2, '0'),
|
|
152
|
+
expiration_year: creditcard.year.to_s
|
|
153
153
|
}
|
|
154
154
|
}, options)[:credit_card]
|
|
155
155
|
|
|
156
156
|
result = @braintree_gateway.customer.update(vault_id,
|
|
157
|
-
:
|
|
158
|
-
:
|
|
159
|
-
:
|
|
160
|
-
:
|
|
157
|
+
first_name: creditcard.first_name,
|
|
158
|
+
last_name: creditcard.last_name,
|
|
159
|
+
email: scrub_email(options[:email]),
|
|
160
|
+
phone: options[:phone] || (options[:billing_address][:phone] if options[:billing_address] &&
|
|
161
161
|
options[:billing_address][:phone]),
|
|
162
|
-
:
|
|
162
|
+
credit_card: credit_card_params
|
|
163
163
|
)
|
|
164
164
|
Response.new(result.success?, message_from_result(result),
|
|
165
|
-
:
|
|
166
|
-
:
|
|
165
|
+
braintree_customer: (customer_hash(@braintree_gateway.customer.find(vault_id), :include_credit_cards) if result.success?),
|
|
166
|
+
customer_vault_id: (result.customer.id if result.success?)
|
|
167
167
|
)
|
|
168
168
|
end
|
|
169
169
|
end
|
|
@@ -215,33 +215,33 @@ module ActiveMerchant #:nodoc:
|
|
|
215
215
|
credit_card_params = { payment_method_nonce: options[:payment_method_nonce] }
|
|
216
216
|
else
|
|
217
217
|
credit_card_params = {
|
|
218
|
-
:
|
|
219
|
-
:
|
|
220
|
-
:
|
|
221
|
-
:
|
|
222
|
-
:
|
|
223
|
-
:
|
|
224
|
-
:
|
|
218
|
+
credit_card: {
|
|
219
|
+
cardholder_name: creditcard.name,
|
|
220
|
+
number: creditcard.number,
|
|
221
|
+
cvv: creditcard.verification_value,
|
|
222
|
+
expiration_month: creditcard.month.to_s.rjust(2, '0'),
|
|
223
|
+
expiration_year: creditcard.year.to_s,
|
|
224
|
+
token: options[:credit_card_token]
|
|
225
225
|
}
|
|
226
226
|
}
|
|
227
227
|
end
|
|
228
228
|
parameters = {
|
|
229
|
-
:
|
|
230
|
-
:
|
|
231
|
-
:
|
|
232
|
-
:
|
|
229
|
+
first_name: creditcard.first_name,
|
|
230
|
+
last_name: creditcard.last_name,
|
|
231
|
+
email: scrub_email(options[:email]),
|
|
232
|
+
phone: options[:phone] || (options[:billing_address][:phone] if options[:billing_address] &&
|
|
233
233
|
options[:billing_address][:phone]),
|
|
234
|
-
:
|
|
235
|
-
:
|
|
234
|
+
id: options[:customer],
|
|
235
|
+
device_data: options[:device_data],
|
|
236
236
|
}.merge credit_card_params
|
|
237
237
|
result = @braintree_gateway.customer.create(merge_credit_card_options(parameters, options))
|
|
238
238
|
Response.new(result.success?, message_from_result(result),
|
|
239
239
|
{
|
|
240
|
-
:
|
|
241
|
-
:
|
|
242
|
-
:
|
|
240
|
+
braintree_customer: (customer_hash(result.customer, :include_credit_cards) if result.success?),
|
|
241
|
+
customer_vault_id: (result.customer.id if result.success?),
|
|
242
|
+
credit_card_token: (result.customer.credit_cards[0].token if result.success?)
|
|
243
243
|
},
|
|
244
|
-
:
|
|
244
|
+
authorization: (result.customer.id if result.success?)
|
|
245
245
|
)
|
|
246
246
|
end
|
|
247
247
|
end
|
|
@@ -313,12 +313,12 @@ module ActiveMerchant #:nodoc:
|
|
|
313
313
|
|
|
314
314
|
def map_address(address)
|
|
315
315
|
mapped = {
|
|
316
|
-
:
|
|
317
|
-
:
|
|
318
|
-
:
|
|
319
|
-
:
|
|
320
|
-
:
|
|
321
|
-
:
|
|
316
|
+
street_address: address[:address1],
|
|
317
|
+
extended_address: address[:address2],
|
|
318
|
+
company: address[:company],
|
|
319
|
+
locality: address[:city],
|
|
320
|
+
region: address[:state],
|
|
321
|
+
postal_code: scrub_zip(address[:zip]),
|
|
322
322
|
}
|
|
323
323
|
|
|
324
324
|
mapped[:country_code_alpha2] = (address[:country] || address[:country_code_alpha2]) if address[:country] || address[:country_code_alpha2]
|
|
@@ -565,18 +565,18 @@ module ActiveMerchant #:nodoc:
|
|
|
565
565
|
|
|
566
566
|
def create_transaction_parameters(money, credit_card_or_vault_id, options)
|
|
567
567
|
parameters = {
|
|
568
|
-
:
|
|
569
|
-
:
|
|
570
|
-
:
|
|
571
|
-
:
|
|
572
|
-
:
|
|
573
|
-
:
|
|
568
|
+
amount: localized_amount(money, options[:currency] || default_currency).to_s,
|
|
569
|
+
order_id: options[:order_id],
|
|
570
|
+
customer: {
|
|
571
|
+
id: options[:store] == true ? '' : options[:store],
|
|
572
|
+
email: scrub_email(options[:email]),
|
|
573
|
+
phone: options[:phone] || (options[:billing_address][:phone] if options[:billing_address] &&
|
|
574
574
|
options[:billing_address][:phone])
|
|
575
575
|
},
|
|
576
|
-
:
|
|
577
|
-
:
|
|
578
|
-
:
|
|
579
|
-
:
|
|
576
|
+
options: {
|
|
577
|
+
store_in_vault: options[:store] ? true : false,
|
|
578
|
+
submit_for_settlement: options[:submit_for_settlement],
|
|
579
|
+
hold_in_escrow: options[:hold_in_escrow],
|
|
580
580
|
}
|
|
581
581
|
}
|
|
582
582
|
|
|
@@ -692,38 +692,38 @@ module ActiveMerchant #:nodoc:
|
|
|
692
692
|
end
|
|
693
693
|
else
|
|
694
694
|
parameters[:customer].merge!(
|
|
695
|
-
:
|
|
696
|
-
:
|
|
695
|
+
first_name: credit_card_or_vault_id.first_name,
|
|
696
|
+
last_name: credit_card_or_vault_id.last_name
|
|
697
697
|
)
|
|
698
698
|
if credit_card_or_vault_id.is_a?(NetworkTokenizationCreditCard)
|
|
699
699
|
if credit_card_or_vault_id.source == :apple_pay
|
|
700
700
|
parameters[:apple_pay_card] = {
|
|
701
|
-
:
|
|
702
|
-
:
|
|
703
|
-
:
|
|
704
|
-
:
|
|
705
|
-
:
|
|
706
|
-
:
|
|
701
|
+
number: credit_card_or_vault_id.number,
|
|
702
|
+
expiration_month: credit_card_or_vault_id.month.to_s.rjust(2, '0'),
|
|
703
|
+
expiration_year: credit_card_or_vault_id.year.to_s,
|
|
704
|
+
cardholder_name: credit_card_or_vault_id.name,
|
|
705
|
+
cryptogram: credit_card_or_vault_id.payment_cryptogram,
|
|
706
|
+
eci_indicator: credit_card_or_vault_id.eci
|
|
707
707
|
}
|
|
708
708
|
elsif credit_card_or_vault_id.source == :android_pay || credit_card_or_vault_id.source == :google_pay
|
|
709
709
|
parameters[:android_pay_card] = {
|
|
710
|
-
:
|
|
711
|
-
:
|
|
712
|
-
:
|
|
713
|
-
:
|
|
714
|
-
:
|
|
715
|
-
:
|
|
716
|
-
:
|
|
717
|
-
:
|
|
710
|
+
number: credit_card_or_vault_id.number,
|
|
711
|
+
cryptogram: credit_card_or_vault_id.payment_cryptogram,
|
|
712
|
+
expiration_month: credit_card_or_vault_id.month.to_s.rjust(2, '0'),
|
|
713
|
+
expiration_year: credit_card_or_vault_id.year.to_s,
|
|
714
|
+
google_transaction_id: credit_card_or_vault_id.transaction_id,
|
|
715
|
+
source_card_type: credit_card_or_vault_id.brand,
|
|
716
|
+
source_card_last_four: credit_card_or_vault_id.last_digits,
|
|
717
|
+
eci_indicator: credit_card_or_vault_id.eci
|
|
718
718
|
}
|
|
719
719
|
end
|
|
720
720
|
else
|
|
721
721
|
parameters[:credit_card] = {
|
|
722
|
-
:
|
|
723
|
-
:
|
|
724
|
-
:
|
|
725
|
-
:
|
|
726
|
-
:
|
|
722
|
+
number: credit_card_or_vault_id.number,
|
|
723
|
+
cvv: credit_card_or_vault_id.verification_value,
|
|
724
|
+
expiration_month: credit_card_or_vault_id.month.to_s.rjust(2, '0'),
|
|
725
|
+
expiration_year: credit_card_or_vault_id.year.to_s,
|
|
726
|
+
cardholder_name: credit_card_or_vault_id.name
|
|
727
727
|
}
|
|
728
728
|
end
|
|
729
729
|
end
|