activemerchant 1.105.0 → 1.107.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +99 -1
- data/README.md +2 -2
- 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 +18 -7
- 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 +17 -6
- data/lib/active_merchant/billing/gateways/bpoint.rb +1 -1
- data/lib/active_merchant/billing/gateways/braintree_blue.rb +81 -77
- 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 +20 -9
- 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 +154 -91
- data/lib/active_merchant/billing/gateways/d_local.rb +4 -2
- data/lib/active_merchant/billing/gateways/data_cash.rb +33 -33
- data/lib/active_merchant/billing/gateways/decidir.rb +7 -2
- data/lib/active_merchant/billing/gateways/ebanx.rb +14 -2
- data/lib/active_merchant/billing/gateways/efsnet.rb +23 -23
- data/lib/active_merchant/billing/gateways/elavon.rb +70 -18
- data/lib/active_merchant/billing/gateways/element.rb +12 -4
- 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 +21 -21
- data/lib/active_merchant/billing/gateways/firstdata_e4_v27.rb +20 -20
- data/lib/active_merchant/billing/gateways/flo2cash.rb +4 -4
- data/lib/active_merchant/billing/gateways/forte.rb +8 -7
- data/lib/active_merchant/billing/gateways/garanti.rb +8 -8
- data/lib/active_merchant/billing/gateways/global_collect.rb +30 -24
- data/lib/active_merchant/billing/gateways/hdfc.rb +3 -3
- data/lib/active_merchant/billing/gateways/hps.rb +5 -3
- data/lib/active_merchant/billing/gateways/iats_payments.rb +32 -15
- 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 +12 -10
- data/lib/active_merchant/billing/gateways/itransact.rb +7 -7
- data/lib/active_merchant/billing/gateways/iveri.rb +6 -3
- data/lib/active_merchant/billing/gateways/ixopay.rb +22 -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/kushki.rb +34 -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 +8 -3
- data/lib/active_merchant/billing/gateways/mastercard.rb +2 -2
- data/lib/active_merchant/billing/gateways/mercado_pago.rb +1 -0
- 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 +13 -7
- data/lib/active_merchant/billing/gateways/optimal_payment.rb +13 -9
- data/lib/active_merchant/billing/gateways/orbital.rb +54 -12
- 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 +9 -9
- 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 +17 -10
- 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 +16 -16
- 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 +15 -10
- data/lib/active_merchant/billing/gateways/stripe_payment_intents.rb +50 -9
- 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 +22 -20
- 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/billing/network_tokenization_credit_card.rb +1 -1
- 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 +4 -4
- data/lib/active_merchant/billing/gateways/moneris_us.rb +0 -352
@@ -34,7 +34,7 @@ module ActiveMerchant #:nodoc:
|
|
34
34
|
post[:TransType] = '5'
|
35
35
|
add_invoice(post, money, options)
|
36
36
|
add_payment_method(post, payment)
|
37
|
-
commit('authonly', post)
|
37
|
+
commit('authonly', post, options)
|
38
38
|
end
|
39
39
|
|
40
40
|
def capture(money, authorization, options={})
|
@@ -125,12 +125,12 @@ module ActiveMerchant #:nodoc:
|
|
125
125
|
response
|
126
126
|
end
|
127
127
|
|
128
|
-
def commit(action, post)
|
128
|
+
def commit(action, post, options={})
|
129
129
|
post[:Version] = '1000'
|
130
130
|
post[:Processor] = @options[:processor]
|
131
131
|
post[:MerchantID] = @options[:merchant_id]
|
132
132
|
|
133
|
-
request = build_request(action, post)
|
133
|
+
request = build_request(action, post, options)
|
134
134
|
raw = ssl_post(url(action), request, headers)
|
135
135
|
pairs = parse(raw)
|
136
136
|
success = success_from(pairs)
|
@@ -180,19 +180,30 @@ module ActiveMerchant #:nodoc:
|
|
180
180
|
}
|
181
181
|
end
|
182
182
|
|
183
|
-
def build_request(action, post)
|
183
|
+
def build_request(action, post, options={})
|
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)
|
190
190
|
end
|
191
|
+
build_airline_xml(xml, options[:passenger_itinerary_data]) if options[:passenger_itinerary_data]
|
191
192
|
end
|
192
193
|
inner = CGI.escapeHTML(xml.target!)
|
193
194
|
envelope(mode).sub(/{{ :body }}/, inner)
|
194
195
|
end
|
195
196
|
|
197
|
+
def build_airline_xml(xml, airline_data)
|
198
|
+
xml.tag!('PassengerItineraryData') do
|
199
|
+
xml.tag!('A1') do
|
200
|
+
airline_data.each do |field, value|
|
201
|
+
xml.tag!(field, value)
|
202
|
+
end
|
203
|
+
end
|
204
|
+
end
|
205
|
+
end
|
206
|
+
|
196
207
|
def envelope(mode)
|
197
208
|
<<-EOS
|
198
209
|
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:aut="http://Borgun/Heimir/pub/ws/Authorization">
|
@@ -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?
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'active_merchant/billing/gateways/braintree/braintree_common'
|
2
|
+
require 'active_support/core_ext/array/extract_options'
|
2
3
|
|
3
4
|
begin
|
4
5
|
require 'braintree'
|
@@ -60,12 +61,12 @@ module ActiveMerchant #:nodoc:
|
|
60
61
|
end
|
61
62
|
|
62
63
|
@configuration = Braintree::Configuration.new(
|
63
|
-
:
|
64
|
-
:
|
65
|
-
:
|
66
|
-
:
|
67
|
-
:
|
68
|
-
:
|
64
|
+
merchant_id: options[:merchant_id],
|
65
|
+
public_key: options[:public_key],
|
66
|
+
private_key: options[:private_key],
|
67
|
+
environment: (options[:environment] || (test? ? :sandbox : :production)).to_sym,
|
68
|
+
custom_user_agent: "ActiveMerchant #{ActiveMerchant::VERSION}",
|
69
|
+
logger: options[:logger] || logger
|
69
70
|
)
|
70
71
|
|
71
72
|
@braintree_gateway = Braintree::Gateway.new(@configuration)
|
@@ -83,7 +84,7 @@ module ActiveMerchant #:nodoc:
|
|
83
84
|
end
|
84
85
|
|
85
86
|
def purchase(money, credit_card_or_vault_id, options = {})
|
86
|
-
authorize(money, credit_card_or_vault_id, options.merge(:
|
87
|
+
authorize(money, credit_card_or_vault_id, options.merge(submit_for_settlement: true))
|
87
88
|
end
|
88
89
|
|
89
90
|
def credit(money, credit_card_or_vault_id, options = {})
|
@@ -98,10 +99,13 @@ module ActiveMerchant #:nodoc:
|
|
98
99
|
|
99
100
|
commit do
|
100
101
|
response = response_from_result(@braintree_gateway.transaction.refund(transaction_id, money))
|
101
|
-
return response if response.success?
|
102
|
-
return response unless options[:force_full_refund_if_unsettled]
|
103
102
|
|
104
|
-
|
103
|
+
if !response.success? && options[:force_full_refund_if_unsettled] &&
|
104
|
+
response.message =~ /#{ERROR_CODES[:cannot_refund_if_unsettled]}/
|
105
|
+
void(transaction_id)
|
106
|
+
else
|
107
|
+
response
|
108
|
+
end
|
105
109
|
end
|
106
110
|
end
|
107
111
|
|
@@ -144,26 +148,26 @@ module ActiveMerchant #:nodoc:
|
|
144
148
|
|
145
149
|
options[:update_existing_token] = braintree_credit_card.token
|
146
150
|
credit_card_params = merge_credit_card_options({
|
147
|
-
:
|
148
|
-
:
|
149
|
-
:
|
150
|
-
:
|
151
|
-
:
|
152
|
-
:
|
151
|
+
credit_card: {
|
152
|
+
cardholder_name: creditcard.name,
|
153
|
+
number: creditcard.number,
|
154
|
+
cvv: creditcard.verification_value,
|
155
|
+
expiration_month: creditcard.month.to_s.rjust(2, '0'),
|
156
|
+
expiration_year: creditcard.year.to_s
|
153
157
|
}
|
154
158
|
}, options)[:credit_card]
|
155
159
|
|
156
160
|
result = @braintree_gateway.customer.update(vault_id,
|
157
|
-
:
|
158
|
-
:
|
159
|
-
:
|
160
|
-
:
|
161
|
+
first_name: creditcard.first_name,
|
162
|
+
last_name: creditcard.last_name,
|
163
|
+
email: scrub_email(options[:email]),
|
164
|
+
phone: options[:phone] || (options[:billing_address][:phone] if options[:billing_address] &&
|
161
165
|
options[:billing_address][:phone]),
|
162
|
-
:
|
166
|
+
credit_card: credit_card_params
|
163
167
|
)
|
164
168
|
Response.new(result.success?, message_from_result(result),
|
165
|
-
:
|
166
|
-
:
|
169
|
+
braintree_customer: (customer_hash(@braintree_gateway.customer.find(vault_id), :include_credit_cards) if result.success?),
|
170
|
+
customer_vault_id: (result.customer.id if result.success?)
|
167
171
|
)
|
168
172
|
end
|
169
173
|
end
|
@@ -215,33 +219,33 @@ module ActiveMerchant #:nodoc:
|
|
215
219
|
credit_card_params = { payment_method_nonce: options[:payment_method_nonce] }
|
216
220
|
else
|
217
221
|
credit_card_params = {
|
218
|
-
:
|
219
|
-
:
|
220
|
-
:
|
221
|
-
:
|
222
|
-
:
|
223
|
-
:
|
224
|
-
:
|
222
|
+
credit_card: {
|
223
|
+
cardholder_name: creditcard.name,
|
224
|
+
number: creditcard.number,
|
225
|
+
cvv: creditcard.verification_value,
|
226
|
+
expiration_month: creditcard.month.to_s.rjust(2, '0'),
|
227
|
+
expiration_year: creditcard.year.to_s,
|
228
|
+
token: options[:credit_card_token]
|
225
229
|
}
|
226
230
|
}
|
227
231
|
end
|
228
232
|
parameters = {
|
229
|
-
:
|
230
|
-
:
|
231
|
-
:
|
232
|
-
:
|
233
|
+
first_name: creditcard.first_name,
|
234
|
+
last_name: creditcard.last_name,
|
235
|
+
email: scrub_email(options[:email]),
|
236
|
+
phone: options[:phone] || (options[:billing_address][:phone] if options[:billing_address] &&
|
233
237
|
options[:billing_address][:phone]),
|
234
|
-
:
|
235
|
-
:
|
238
|
+
id: options[:customer],
|
239
|
+
device_data: options[:device_data],
|
236
240
|
}.merge credit_card_params
|
237
241
|
result = @braintree_gateway.customer.create(merge_credit_card_options(parameters, options))
|
238
242
|
Response.new(result.success?, message_from_result(result),
|
239
243
|
{
|
240
|
-
:
|
241
|
-
:
|
242
|
-
:
|
244
|
+
braintree_customer: (customer_hash(result.customer, :include_credit_cards) if result.success?),
|
245
|
+
customer_vault_id: (result.customer.id if result.success?),
|
246
|
+
credit_card_token: (result.customer.credit_cards[0].token if result.success?)
|
243
247
|
},
|
244
|
-
:
|
248
|
+
authorization: (result.customer.id if result.success?)
|
245
249
|
)
|
246
250
|
end
|
247
251
|
end
|
@@ -313,12 +317,12 @@ module ActiveMerchant #:nodoc:
|
|
313
317
|
|
314
318
|
def map_address(address)
|
315
319
|
mapped = {
|
316
|
-
:
|
317
|
-
:
|
318
|
-
:
|
319
|
-
:
|
320
|
-
:
|
321
|
-
:
|
320
|
+
street_address: address[:address1],
|
321
|
+
extended_address: address[:address2],
|
322
|
+
company: address[:company],
|
323
|
+
locality: address[:city],
|
324
|
+
region: address[:state],
|
325
|
+
postal_code: scrub_zip(address[:zip]),
|
322
326
|
}
|
323
327
|
|
324
328
|
mapped[:country_code_alpha2] = (address[:country] || address[:country_code_alpha2]) if address[:country] || address[:country_code_alpha2]
|
@@ -565,18 +569,18 @@ module ActiveMerchant #:nodoc:
|
|
565
569
|
|
566
570
|
def create_transaction_parameters(money, credit_card_or_vault_id, options)
|
567
571
|
parameters = {
|
568
|
-
:
|
569
|
-
:
|
570
|
-
:
|
571
|
-
:
|
572
|
-
:
|
573
|
-
:
|
572
|
+
amount: localized_amount(money, options[:currency] || default_currency).to_s,
|
573
|
+
order_id: options[:order_id],
|
574
|
+
customer: {
|
575
|
+
id: options[:store] == true ? '' : options[:store],
|
576
|
+
email: scrub_email(options[:email]),
|
577
|
+
phone: options[:phone] || (options[:billing_address][:phone] if options[:billing_address] &&
|
574
578
|
options[:billing_address][:phone])
|
575
579
|
},
|
576
|
-
:
|
577
|
-
:
|
578
|
-
:
|
579
|
-
:
|
580
|
+
options: {
|
581
|
+
store_in_vault: options[:store] ? true : false,
|
582
|
+
submit_for_settlement: options[:submit_for_settlement],
|
583
|
+
hold_in_escrow: options[:hold_in_escrow],
|
580
584
|
}
|
581
585
|
}
|
582
586
|
|
@@ -692,38 +696,38 @@ module ActiveMerchant #:nodoc:
|
|
692
696
|
end
|
693
697
|
else
|
694
698
|
parameters[:customer].merge!(
|
695
|
-
:
|
696
|
-
:
|
699
|
+
first_name: credit_card_or_vault_id.first_name,
|
700
|
+
last_name: credit_card_or_vault_id.last_name
|
697
701
|
)
|
698
702
|
if credit_card_or_vault_id.is_a?(NetworkTokenizationCreditCard)
|
699
703
|
if credit_card_or_vault_id.source == :apple_pay
|
700
704
|
parameters[:apple_pay_card] = {
|
701
|
-
:
|
702
|
-
:
|
703
|
-
:
|
704
|
-
:
|
705
|
-
:
|
706
|
-
:
|
705
|
+
number: credit_card_or_vault_id.number,
|
706
|
+
expiration_month: credit_card_or_vault_id.month.to_s.rjust(2, '0'),
|
707
|
+
expiration_year: credit_card_or_vault_id.year.to_s,
|
708
|
+
cardholder_name: credit_card_or_vault_id.name,
|
709
|
+
cryptogram: credit_card_or_vault_id.payment_cryptogram,
|
710
|
+
eci_indicator: credit_card_or_vault_id.eci
|
707
711
|
}
|
708
712
|
elsif credit_card_or_vault_id.source == :android_pay || credit_card_or_vault_id.source == :google_pay
|
709
713
|
parameters[:android_pay_card] = {
|
710
|
-
:
|
711
|
-
:
|
712
|
-
:
|
713
|
-
:
|
714
|
-
:
|
715
|
-
:
|
716
|
-
:
|
717
|
-
:
|
714
|
+
number: credit_card_or_vault_id.number,
|
715
|
+
cryptogram: credit_card_or_vault_id.payment_cryptogram,
|
716
|
+
expiration_month: credit_card_or_vault_id.month.to_s.rjust(2, '0'),
|
717
|
+
expiration_year: credit_card_or_vault_id.year.to_s,
|
718
|
+
google_transaction_id: credit_card_or_vault_id.transaction_id,
|
719
|
+
source_card_type: credit_card_or_vault_id.brand,
|
720
|
+
source_card_last_four: credit_card_or_vault_id.last_digits,
|
721
|
+
eci_indicator: credit_card_or_vault_id.eci
|
718
722
|
}
|
719
723
|
end
|
720
724
|
else
|
721
725
|
parameters[:credit_card] = {
|
722
|
-
:
|
723
|
-
:
|
724
|
-
:
|
725
|
-
:
|
726
|
-
:
|
726
|
+
number: credit_card_or_vault_id.number,
|
727
|
+
cvv: credit_card_or_vault_id.verification_value,
|
728
|
+
expiration_month: credit_card_or_vault_id.month.to_s.rjust(2, '0'),
|
729
|
+
expiration_year: credit_card_or_vault_id.year.to_s,
|
730
|
+
cardholder_name: credit_card_or_vault_id.name
|
727
731
|
}
|
728
732
|
end
|
729
733
|
end
|
@@ -77,7 +77,7 @@ module ActiveMerchant #:nodoc:
|
|
77
77
|
def store(creditcard, options={})
|
78
78
|
post = initialize_required_fields('')
|
79
79
|
post[:transaction] = 'Create'
|
80
|
-
post[:CardNumber]
|
80
|
+
post[:CardNumber] = creditcard.number
|
81
81
|
post[:CustomerPaymentInfoKey] = ''
|
82
82
|
post[:token] = ''
|
83
83
|
add_payment_method(post, creditcard)
|
@@ -235,8 +235,8 @@ module ActiveMerchant #:nodoc:
|
|
235
235
|
|
236
236
|
def post_data(post)
|
237
237
|
{
|
238
|
-
:
|
239
|
-
:
|
238
|
+
UserName: @options[:user_name],
|
239
|
+
Password: @options[:password]
|
240
240
|
}.merge(post).collect { |k, v| "#{k}=#{CGI.escape(v.to_s)}" }.join('&')
|
241
241
|
end
|
242
242
|
end
|
@@ -287,7 +287,7 @@ module ActiveMerchant #:nodoc:
|
|
287
287
|
error_code: error_code_from(response)
|
288
288
|
)
|
289
289
|
rescue ResponseError => e
|
290
|
-
return Response.new(false, 'Unable to authenticate. Please check your credentials.', {}, :
|
290
|
+
return Response.new(false, 'Unable to authenticate. Please check your credentials.', {}, test: test?) if e.response.code == '401'
|
291
291
|
|
292
292
|
raise
|
293
293
|
end
|
@@ -173,7 +173,7 @@ module ActiveMerchant #:nodoc:
|
|
173
173
|
def capture(money, authorization, options = {})
|
174
174
|
post = {}
|
175
175
|
add_pair(post, :xref, authorization)
|
176
|
-
add_pair(post, :amount, localized_amount(money, options[:currency] || currency(money)), :
|
176
|
+
add_pair(post, :amount, localized_amount(money, options[:currency] || currency(money)), required: true)
|
177
177
|
add_remote_address(post, options)
|
178
178
|
|
179
179
|
commit('CAPTURE', post)
|
@@ -225,7 +225,7 @@ module ActiveMerchant #:nodoc:
|
|
225
225
|
|
226
226
|
def add_amount(post, money, options)
|
227
227
|
currency = options[:currency] || currency(money)
|
228
|
-
add_pair(post, :amount, localized_amount(money, currency), :
|
228
|
+
add_pair(post, :amount, localized_amount(money, currency), required: true)
|
229
229
|
add_pair(post, :currencyCode, currency_code(currency))
|
230
230
|
end
|
231
231
|
|
@@ -242,8 +242,8 @@ module ActiveMerchant #:nodoc:
|
|
242
242
|
end
|
243
243
|
|
244
244
|
def add_invoice(post, credit_card_or_reference, money, options)
|
245
|
-
add_pair(post, :transactionUnique, options[:order_id], :
|
246
|
-
add_pair(post, :orderRef, options[:description] || options[:order_id], :
|
245
|
+
add_pair(post, :transactionUnique, options[:order_id], required: true)
|
246
|
+
add_pair(post, :orderRef, options[:description] || options[:order_id], required: true)
|
247
247
|
add_pair(post, :statementNarrative1, options[:merchant_name]) if options[:merchant_name]
|
248
248
|
add_pair(post, :statementNarrative2, options[:dynamic_descriptor]) if options[:dynamic_descriptor]
|
249
249
|
if credit_card_or_reference.respond_to?(:number)
|
@@ -267,14 +267,14 @@ module ActiveMerchant #:nodoc:
|
|
267
267
|
end
|
268
268
|
|
269
269
|
def add_reference(post, reference)
|
270
|
-
add_pair(post, :xref, reference, :
|
270
|
+
add_pair(post, :xref, reference, required: true)
|
271
271
|
end
|
272
272
|
|
273
273
|
def add_credit_card(post, credit_card)
|
274
|
-
add_pair(post, :customerName, credit_card.name, :
|
275
|
-
add_pair(post, :cardNumber, credit_card.number, :
|
276
|
-
add_pair(post, :cardExpiryMonth, format(credit_card.month, :two_digits), :
|
277
|
-
add_pair(post, :cardExpiryYear, format(credit_card.year, :two_digits), :
|
274
|
+
add_pair(post, :customerName, credit_card.name, required: true)
|
275
|
+
add_pair(post, :cardNumber, credit_card.number, required: true)
|
276
|
+
add_pair(post, :cardExpiryMonth, format(credit_card.month, :two_digits), required: true)
|
277
|
+
add_pair(post, :cardExpiryYear, format(credit_card.year, :two_digits), required: true)
|
278
278
|
add_pair(post, :cardCVV, credit_card.verification_value)
|
279
279
|
end
|
280
280
|
|
@@ -309,10 +309,10 @@ module ActiveMerchant #:nodoc:
|
|
309
309
|
end
|
310
310
|
|
311
311
|
def commit(action, parameters)
|
312
|
-
parameters.update(:
|
312
|
+
parameters.update(countryCode: self.supported_countries[0]) unless ['CAPTURE', 'CANCEL'].include?(action)
|
313
313
|
parameters.update(
|
314
|
-
:
|
315
|
-
:
|
314
|
+
merchantID: @options[:login],
|
315
|
+
action: action
|
316
316
|
)
|
317
317
|
# adds a signature to the post hash/array
|
318
318
|
add_hmac(parameters)
|
@@ -323,10 +323,10 @@ module ActiveMerchant #:nodoc:
|
|
323
323
|
response[:responseCode] == '0',
|
324
324
|
response[:responseCode] == '0' ? 'APPROVED' : response[:responseMessage],
|
325
325
|
response,
|
326
|
-
:
|
327
|
-
:
|
328
|
-
:
|
329
|
-
:
|
326
|
+
test: test?,
|
327
|
+
authorization: response[:xref],
|
328
|
+
cvv_result: CVV_CODE[response[:avscv2ResponseCode].to_s[0, 1]],
|
329
|
+
avs_result: avs_from(response)
|
330
330
|
)
|
331
331
|
end
|
332
332
|
|
@@ -345,9 +345,9 @@ module ActiveMerchant #:nodoc:
|
|
345
345
|
end
|
346
346
|
|
347
347
|
AVSResult.new({
|
348
|
-
:
|
349
|
-
:
|
350
|
-
:
|
348
|
+
code: code,
|
349
|
+
postal_match: postal_match,
|
350
|
+
street_match: street_match
|
351
351
|
})
|
352
352
|
end
|
353
353
|
|
@@ -50,7 +50,7 @@ module ActiveMerchant #:nodoc:
|
|
50
50
|
def build_sale_request(type, money, creditcard, options = {})
|
51
51
|
requires!(options, :order_id)
|
52
52
|
|
53
|
-
xml = Builder::XmlMarkup.new :
|
53
|
+
xml = Builder::XmlMarkup.new indent: 2
|
54
54
|
|
55
55
|
xml.tag! 'CC5Request' do
|
56
56
|
add_login_tags(xml)
|
@@ -76,7 +76,7 @@ module ActiveMerchant #:nodoc:
|
|
76
76
|
end
|
77
77
|
|
78
78
|
def build_capture_request(money, authorization, options = {})
|
79
|
-
xml = Builder::XmlMarkup.new :
|
79
|
+
xml = Builder::XmlMarkup.new indent: 2
|
80
80
|
|
81
81
|
xml.tag! 'CC5Request' do
|
82
82
|
add_login_tags(xml)
|
@@ -87,7 +87,7 @@ module ActiveMerchant #:nodoc:
|
|
87
87
|
end
|
88
88
|
|
89
89
|
def build_void_request(authorization, options = {})
|
90
|
-
xml = Builder::XmlMarkup.new :
|
90
|
+
xml = Builder::XmlMarkup.new indent: 2
|
91
91
|
|
92
92
|
xml.tag! 'CC5Request' do
|
93
93
|
add_login_tags(xml)
|
@@ -97,7 +97,7 @@ module ActiveMerchant #:nodoc:
|
|
97
97
|
end
|
98
98
|
|
99
99
|
def build_authorization_credit_request(money, authorization, options = {})
|
100
|
-
xml = Builder::XmlMarkup.new :
|
100
|
+
xml = Builder::XmlMarkup.new indent: 2
|
101
101
|
|
102
102
|
xml.tag! 'CC5Request' do
|
103
103
|
add_login_tags(xml)
|
@@ -108,7 +108,7 @@ module ActiveMerchant #:nodoc:
|
|
108
108
|
end
|
109
109
|
|
110
110
|
def build_creditcard_credit_request(money, creditcard, options = {})
|
111
|
-
xml = Builder::XmlMarkup.new :
|
111
|
+
xml = Builder::XmlMarkup.new indent: 2
|
112
112
|
|
113
113
|
xml.tag! 'CC5Request' do
|
114
114
|
add_login_tags(xml)
|
@@ -157,8 +157,8 @@ module ActiveMerchant #:nodoc:
|
|
157
157
|
success,
|
158
158
|
(success ? 'Approved' : "Declined (Reason: #{response[:proc_return_code]} - #{response[:err_msg]})"),
|
159
159
|
response,
|
160
|
-
:
|
161
|
-
:
|
160
|
+
test: test?,
|
161
|
+
authorization: response[:order_id]
|
162
162
|
)
|
163
163
|
end
|
164
164
|
|