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
@@ -10,13 +10,13 @@ module ActiveMerchant #:nodoc:
|
|
10
10
|
self.display_name = 'USA ePay'
|
11
11
|
|
12
12
|
TRANSACTIONS = {
|
13
|
-
:
|
14
|
-
:
|
15
|
-
:
|
16
|
-
:
|
17
|
-
:
|
18
|
-
:
|
19
|
-
:
|
13
|
+
authorization: 'cc:authonly',
|
14
|
+
purchase: 'cc:sale',
|
15
|
+
capture: 'cc:capture',
|
16
|
+
refund: 'cc:refund',
|
17
|
+
void: 'cc:void',
|
18
|
+
void_release: 'cc:void:release',
|
19
|
+
check_purchase: 'check:sale'
|
20
20
|
}
|
21
21
|
|
22
22
|
STANDARD_ERROR_CODE_MAPPING = {
|
@@ -82,7 +82,7 @@ module ActiveMerchant #:nodoc:
|
|
82
82
|
end
|
83
83
|
|
84
84
|
def capture(money, authorization, options = {})
|
85
|
-
post = { :
|
85
|
+
post = { refNum: authorization }
|
86
86
|
|
87
87
|
add_amount(post, money)
|
88
88
|
add_test_mode(post, options)
|
@@ -90,7 +90,7 @@ module ActiveMerchant #:nodoc:
|
|
90
90
|
end
|
91
91
|
|
92
92
|
def refund(money, authorization, options = {})
|
93
|
-
post = { :
|
93
|
+
post = { refNum: authorization }
|
94
94
|
|
95
95
|
add_amount(post, money)
|
96
96
|
add_test_mode(post, options)
|
@@ -107,7 +107,7 @@ module ActiveMerchant #:nodoc:
|
|
107
107
|
# Pass `no_release: true` to keep the void from immediately settling
|
108
108
|
def void(authorization, options = {})
|
109
109
|
command = (options[:no_release] ? :void : :void_release)
|
110
|
-
post = { :
|
110
|
+
post = { refNum: authorization }
|
111
111
|
add_test_mode(post, options)
|
112
112
|
commit(command, post)
|
113
113
|
end
|
@@ -296,20 +296,20 @@ module ActiveMerchant #:nodoc:
|
|
296
296
|
end
|
297
297
|
|
298
298
|
{
|
299
|
-
:
|
300
|
-
:
|
301
|
-
:
|
302
|
-
:
|
303
|
-
:
|
304
|
-
:
|
305
|
-
:
|
306
|
-
:
|
307
|
-
:
|
308
|
-
:
|
309
|
-
:
|
310
|
-
:
|
311
|
-
:
|
312
|
-
:
|
299
|
+
status: fields['UMstatus'],
|
300
|
+
auth_code: fields['UMauthCode'],
|
301
|
+
ref_num: fields['UMrefNum'],
|
302
|
+
batch: fields['UMbatch'],
|
303
|
+
avs_result: fields['UMavsResult'],
|
304
|
+
avs_result_code: fields['UMavsResultCode'],
|
305
|
+
cvv2_result: fields['UMcvv2Result'],
|
306
|
+
cvv2_result_code: fields['UMcvv2ResultCode'],
|
307
|
+
vpas_result_code: fields['UMvpasResultCode'],
|
308
|
+
result: fields['UMresult'],
|
309
|
+
error: fields['UMerror'],
|
310
|
+
error_code: fields['UMerrorcode'],
|
311
|
+
acs_url: fields['UMacsurl'],
|
312
|
+
payload: fields['UMpayload']
|
313
313
|
}.delete_if { |k, v| v.nil? }
|
314
314
|
end
|
315
315
|
|
@@ -320,11 +320,11 @@ module ActiveMerchant #:nodoc:
|
|
320
320
|
error_code = nil
|
321
321
|
error_code = (STANDARD_ERROR_CODE_MAPPING[response[:error_code]] || STANDARD_ERROR_CODE[:processing_error]) unless approved
|
322
322
|
Response.new(approved, message_from(response), response,
|
323
|
-
:
|
324
|
-
:
|
325
|
-
:
|
326
|
-
:
|
327
|
-
:
|
323
|
+
test: test?,
|
324
|
+
authorization: response[:ref_num],
|
325
|
+
cvv_result: response[:cvv2_result_code],
|
326
|
+
avs_result: { code: response[:avs_result_code] },
|
327
|
+
error_code: error_code
|
328
328
|
)
|
329
329
|
end
|
330
330
|
|
@@ -50,12 +50,12 @@ module ActiveMerchant #:nodoc:
|
|
50
50
|
SUCCESS = 1
|
51
51
|
|
52
52
|
TRANSACTIONS = {
|
53
|
-
:
|
54
|
-
:
|
55
|
-
:
|
56
|
-
:
|
57
|
-
:
|
58
|
-
:
|
53
|
+
authorization: 'auth',
|
54
|
+
purchase: 'sale',
|
55
|
+
capture: 'capture',
|
56
|
+
void: 'void',
|
57
|
+
credit: 'credit',
|
58
|
+
refund: 'refund'
|
59
59
|
}
|
60
60
|
|
61
61
|
self.supported_countries = ['US']
|
@@ -195,10 +195,10 @@ module ActiveMerchant #:nodoc:
|
|
195
195
|
response = parse(ssl_post(self.live_url, post_data(trx_type, post)))
|
196
196
|
|
197
197
|
Response.new(response[:response].to_i == SUCCESS, message_from(response), response,
|
198
|
-
:
|
199
|
-
:
|
200
|
-
:
|
201
|
-
:
|
198
|
+
test: test?,
|
199
|
+
authorization: response[:transactionid],
|
200
|
+
avs_result: { code: response[:avsresponse] },
|
201
|
+
cvv_result: response[:cvvresponse]
|
202
202
|
)
|
203
203
|
end
|
204
204
|
|
@@ -8,8 +8,8 @@ module ActiveMerchant #:nodoc:
|
|
8
8
|
self.delimiter = "\r\n"
|
9
9
|
|
10
10
|
self.actions = {
|
11
|
-
:
|
12
|
-
:
|
11
|
+
purchase: 'SALE',
|
12
|
+
credit: 'CREDIT'
|
13
13
|
}
|
14
14
|
|
15
15
|
APPROVED = '0'
|
@@ -137,10 +137,10 @@ module ActiveMerchant #:nodoc:
|
|
137
137
|
response = parse(ssl_post(test? ? self.test_url : self.live_url, post_data(parameters)))
|
138
138
|
|
139
139
|
Response.new(response['result'] == APPROVED, message_from(response), response,
|
140
|
-
:
|
141
|
-
:
|
142
|
-
:
|
143
|
-
:
|
140
|
+
test: @options[:test] || test?,
|
141
|
+
authorization: authorization_from(response),
|
142
|
+
avs_result: { code: response['avs_response'] },
|
143
|
+
cvv_result: response['cvv2_response']
|
144
144
|
)
|
145
145
|
end
|
146
146
|
|
@@ -155,9 +155,9 @@ module ActiveMerchant #:nodoc:
|
|
155
155
|
success_from(response),
|
156
156
|
message_from(response, options, action),
|
157
157
|
response,
|
158
|
-
:
|
159
|
-
:
|
160
|
-
:
|
158
|
+
test: test?,
|
159
|
+
authorization: authorization_from(params, response, options),
|
160
|
+
error_code: response['errorCode']
|
161
161
|
)
|
162
162
|
end
|
163
163
|
|
@@ -230,9 +230,9 @@ module ActiveMerchant #:nodoc:
|
|
230
230
|
false,
|
231
231
|
message_from(response, options, action),
|
232
232
|
response,
|
233
|
-
:
|
234
|
-
:
|
235
|
-
:
|
233
|
+
test: test?,
|
234
|
+
authorization: response['transactionUUID'],
|
235
|
+
error_code: response['errorCode']
|
236
236
|
)
|
237
237
|
end
|
238
238
|
|
@@ -53,7 +53,7 @@ module ActiveMerchant #:nodoc:
|
|
53
53
|
|
54
54
|
return r unless options[:set_default] and r.success? and !r.params['id'].blank?
|
55
55
|
|
56
|
-
r.process { update_customer(options[:customer], :
|
56
|
+
r.process { update_customer(options[:customer], default_card: r.params['id']) }
|
57
57
|
end
|
58
58
|
else
|
59
59
|
commit(:post, 'customers', post, options)
|
@@ -89,7 +89,7 @@ module ActiveMerchant #:nodoc:
|
|
89
89
|
'Authorization' => 'Basic ' + Base64.encode64(@api_key.to_s + ':').strip,
|
90
90
|
'User-Agent' => "Webpay/v1 ActiveMerchantBindings/#{ActiveMerchant::VERSION}",
|
91
91
|
'X-Webpay-Client-User-Agent' => user_agent,
|
92
|
-
'X-Webpay-Client-User-Metadata' => {:
|
92
|
+
'X-Webpay-Client-User-Metadata' => {ip: options[:ip]}.to_json
|
93
93
|
}
|
94
94
|
end
|
95
95
|
end
|
@@ -180,10 +180,10 @@ module ActiveMerchant #:nodoc:
|
|
180
180
|
authorization = response[:GuWID]
|
181
181
|
|
182
182
|
Response.new(success, message, response,
|
183
|
-
:
|
184
|
-
:
|
185
|
-
:
|
186
|
-
:
|
183
|
+
test: test?,
|
184
|
+
authorization: authorization,
|
185
|
+
avs_result: { code: avs_code(response, options) },
|
186
|
+
cvv_result: response[:CVCResponseCode]
|
187
187
|
)
|
188
188
|
rescue ResponseError => e
|
189
189
|
if e.response.code == '401'
|
@@ -197,7 +197,7 @@ module ActiveMerchant #:nodoc:
|
|
197
197
|
def build_request(action, money, options)
|
198
198
|
options = prepare_options_hash(options)
|
199
199
|
options[:action] = action
|
200
|
-
xml = Builder::XmlMarkup.new :
|
200
|
+
xml = Builder::XmlMarkup.new indent: 2
|
201
201
|
xml.instruct!
|
202
202
|
xml.tag! 'WIRECARD_BXML' do
|
203
203
|
xml.tag! 'W_REQUEST' do
|
@@ -391,7 +391,7 @@ module ActiveMerchant #:nodoc:
|
|
391
391
|
string << error[:Message] if error[:Message]
|
392
392
|
error[:Advice].each_with_index do |advice, index|
|
393
393
|
string << ' (' if index == 0
|
394
|
-
string << "#{index+1}. #{advice}"
|
394
|
+
string << "#{index + 1}. #{advice}"
|
395
395
|
string << ' and ' if index < error[:Advice].size - 1
|
396
396
|
string << ')' if index == error[:Advice].size - 1
|
397
397
|
end
|
@@ -57,7 +57,7 @@ module ActiveMerchant #:nodoc:
|
|
57
57
|
def purchase(money, payment_method, options = {})
|
58
58
|
MultiResponse.run do |r|
|
59
59
|
r.process { authorize(money, payment_method, options) }
|
60
|
-
r.process { capture(money, r.authorization, options.merge(:
|
60
|
+
r.process { capture(money, r.authorization, options.merge(authorization_validated: true)) }
|
61
61
|
end
|
62
62
|
end
|
63
63
|
|
@@ -73,7 +73,7 @@ module ActiveMerchant #:nodoc:
|
|
73
73
|
r.process { inquire_request(authorization, options, 'AUTHORISED') } unless options[:authorization_validated]
|
74
74
|
if r.params
|
75
75
|
authorization_currency = r.params['amount_currency_code']
|
76
|
-
options = options.merge(:
|
76
|
+
options = options.merge(currency: authorization_currency) if authorization_currency.present?
|
77
77
|
end
|
78
78
|
r.process { capture_request(money, authorization, options) }
|
79
79
|
end
|
@@ -94,10 +94,12 @@ module ActiveMerchant #:nodoc:
|
|
94
94
|
r.process { refund_request(money, authorization, options) }
|
95
95
|
end
|
96
96
|
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
97
|
+
if !response.success? && options[:force_full_refund_if_unsettled] &&
|
98
|
+
response.params['last_event'] == 'AUTHORISED'
|
99
|
+
void(authorization, options)
|
100
|
+
else
|
101
|
+
response
|
102
|
+
end
|
101
103
|
end
|
102
104
|
|
103
105
|
# Credits only function on a Merchant ID/login/profile flagged for Payouts
|
@@ -106,13 +108,13 @@ module ActiveMerchant #:nodoc:
|
|
106
108
|
# merchant ID.
|
107
109
|
def credit(money, payment_method, options = {})
|
108
110
|
payment_details = payment_details_from(payment_method)
|
109
|
-
credit_request(money, payment_method, payment_details.merge(:
|
111
|
+
credit_request(money, payment_method, payment_details.merge(credit: true, **options))
|
110
112
|
end
|
111
113
|
|
112
114
|
def verify(payment_method, options={})
|
113
115
|
MultiResponse.run(:use_first_response) do |r|
|
114
116
|
r.process { authorize(100, payment_method, options) }
|
115
|
-
r.process(:ignore_result) { void(r.authorization, options.merge(:
|
117
|
+
r.process(:ignore_result) { void(r.authorization, options.merge(authorization_validated: true)) }
|
116
118
|
end
|
117
119
|
end
|
118
120
|
|
@@ -163,8 +165,8 @@ module ActiveMerchant #:nodoc:
|
|
163
165
|
end
|
164
166
|
|
165
167
|
def build_request
|
166
|
-
xml = Builder::XmlMarkup.new :
|
167
|
-
xml.instruct! :xml, :
|
168
|
+
xml = Builder::XmlMarkup.new indent: 2
|
169
|
+
xml.instruct! :xml, encoding: 'UTF-8'
|
168
170
|
xml.declare! :DOCTYPE, :paymentService, :PUBLIC, '-//WorldPay//DTD WorldPay PaymentService v1//EN', 'http://dtd.worldpay.com/paymentService_v1.dtd'
|
169
171
|
xml.paymentService 'version' => '1.4', 'merchantCode' => @options[:login] do
|
170
172
|
yield xml
|
@@ -222,7 +224,7 @@ module ActiveMerchant #:nodoc:
|
|
222
224
|
build_order_modify_request(authorization) do |xml|
|
223
225
|
xml.capture do
|
224
226
|
time = Time.now
|
225
|
-
xml.date 'dayOfMonth' => time.day, 'month' => time.month, 'year'=> time.year
|
227
|
+
xml.date 'dayOfMonth' => time.day, 'month' => time.month, 'year' => time.year
|
226
228
|
add_amount(xml, money, options)
|
227
229
|
end
|
228
230
|
end
|
@@ -235,7 +237,7 @@ module ActiveMerchant #:nodoc:
|
|
235
237
|
def build_refund_request(money, authorization, options)
|
236
238
|
build_order_modify_request(authorization) do |xml|
|
237
239
|
xml.refund do
|
238
|
-
add_amount(xml, money, options.merge(:
|
240
|
+
add_amount(xml, money, options.merge(debit_credit_indicator: 'credit'))
|
239
241
|
end
|
240
242
|
end
|
241
243
|
end
|
@@ -544,7 +546,7 @@ module ActiveMerchant #:nodoc:
|
|
544
546
|
xml = xml.strip.gsub(/\&/, '&')
|
545
547
|
doc = Nokogiri::XML(xml, &:strict)
|
546
548
|
doc.remove_namespaces!
|
547
|
-
resp_params = {:
|
549
|
+
resp_params = {action: action}
|
548
550
|
|
549
551
|
parse_elements(doc.root, resp_params)
|
550
552
|
resp_params
|
@@ -580,7 +582,7 @@ module ActiveMerchant #:nodoc:
|
|
580
582
|
xml = ssl_post(url, request, headers(options))
|
581
583
|
raw = parse(action, xml)
|
582
584
|
if options[:execute_threed]
|
583
|
-
raw[:cookie] = @cookie
|
585
|
+
raw[:cookie] = @cookie if defined?(@cookie)
|
584
586
|
raw[:session_id] = options[:session_id]
|
585
587
|
raw[:is3DSOrder] = true
|
586
588
|
end
|
@@ -591,17 +593,17 @@ module ActiveMerchant #:nodoc:
|
|
591
593
|
success,
|
592
594
|
message,
|
593
595
|
raw,
|
594
|
-
:
|
595
|
-
:
|
596
|
-
:
|
597
|
-
:
|
598
|
-
:
|
596
|
+
authorization: authorization_from(action, raw, options),
|
597
|
+
error_code: error_code_from(success, raw),
|
598
|
+
test: test?,
|
599
|
+
avs_result: AVSResult.new(code: AVS_CODE_MAP[raw[:avs_result_code_description]]),
|
600
|
+
cvv_result: CVVResult.new(CVC_CODE_MAP[raw[:cvc_result_code_description]])
|
599
601
|
)
|
600
602
|
rescue Nokogiri::SyntaxError
|
601
603
|
unparsable_response(xml)
|
602
604
|
rescue ActiveMerchant::ResponseError => e
|
603
605
|
if e.response.code.to_s == '401'
|
604
|
-
return Response.new(false, 'Invalid credentials', {}, :
|
606
|
+
return Response.new(false, 'Invalid credentials', {}, test: test?)
|
605
607
|
else
|
606
608
|
raise e
|
607
609
|
end
|
@@ -21,7 +21,7 @@ module ActiveMerchant #:nodoc:
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def authorize(money, credit_card, options={})
|
24
|
-
response = create_token(true, credit_card.first_name+' '+credit_card.last_name, credit_card.month, credit_card.year, credit_card.number, credit_card.verification_value)
|
24
|
+
response = create_token(true, credit_card.first_name + ' ' + credit_card.last_name, credit_card.month, credit_card.year, credit_card.number, credit_card.verification_value)
|
25
25
|
if response.success?
|
26
26
|
options[:authorizeOnly] = true
|
27
27
|
post = create_post_for_auth_or_purchase(response.authorization, money, options)
|
@@ -32,22 +32,22 @@ module ActiveMerchant #:nodoc:
|
|
32
32
|
|
33
33
|
def capture(money, authorization, options={})
|
34
34
|
if authorization
|
35
|
-
commit(:post, "orders/#{CGI.escape(authorization)}/capture", {'captureAmount'=>money}, options, 'capture')
|
35
|
+
commit(:post, "orders/#{CGI.escape(authorization)}/capture", {'captureAmount' => money}, options, 'capture')
|
36
36
|
else
|
37
37
|
Response.new(false,
|
38
38
|
'FAILED',
|
39
39
|
'FAILED',
|
40
|
-
:
|
41
|
-
:
|
42
|
-
:
|
43
|
-
:
|
44
|
-
:
|
40
|
+
test: test?,
|
41
|
+
authorization: false,
|
42
|
+
avs_result: {},
|
43
|
+
cvv_result: {},
|
44
|
+
error_code: false
|
45
45
|
)
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
49
49
|
def purchase(money, credit_card, options={})
|
50
|
-
response = create_token(true, credit_card.first_name+' '+credit_card.last_name, credit_card.month, credit_card.year, credit_card.number, credit_card.verification_value)
|
50
|
+
response = create_token(true, credit_card.first_name + ' ' + credit_card.last_name, credit_card.month, credit_card.year, credit_card.number, credit_card.verification_value)
|
51
51
|
if response.success?
|
52
52
|
post = create_post_for_auth_or_purchase(response.authorization, money, options)
|
53
53
|
response = commit(:post, 'orders', post, options, 'purchase')
|
@@ -74,16 +74,16 @@ module ActiveMerchant #:nodoc:
|
|
74
74
|
|
75
75
|
def create_token(reusable, name, exp_month, exp_year, number, cvc)
|
76
76
|
obj = {
|
77
|
-
'reusable'=> reusable,
|
78
|
-
'paymentMethod'=> {
|
79
|
-
'type'=> 'Card',
|
80
|
-
'name'=> name,
|
81
|
-
'expiryMonth'=> exp_month,
|
82
|
-
'expiryYear'=> exp_year,
|
83
|
-
'cardNumber'=> number,
|
84
|
-
'cvc'=> cvc
|
77
|
+
'reusable' => reusable,
|
78
|
+
'paymentMethod' => {
|
79
|
+
'type' => 'Card',
|
80
|
+
'name' => name,
|
81
|
+
'expiryMonth' => exp_month,
|
82
|
+
'expiryYear' => exp_year,
|
83
|
+
'cardNumber' => number,
|
84
|
+
'cvc' => cvc
|
85
85
|
},
|
86
|
-
'clientKey'=> @client_key
|
86
|
+
'clientKey' => @client_key
|
87
87
|
}
|
88
88
|
token_response = commit(:post, 'tokens', obj, {'Authorization' => @service_key}, 'token')
|
89
89
|
token_response
|
@@ -95,15 +95,15 @@ module ActiveMerchant #:nodoc:
|
|
95
95
|
'orderDescription' => options[:description] || 'Worldpay Order',
|
96
96
|
'amount' => money,
|
97
97
|
'currencyCode' => options[:currency] || default_currency,
|
98
|
-
'name' => options[:billing_address]&&options[:billing_address][:name] ? options[:billing_address][:name] : '',
|
98
|
+
'name' => options[:billing_address] && options[:billing_address][:name] ? options[:billing_address][:name] : '',
|
99
99
|
'billingAddress' => {
|
100
|
-
'address1'=>options[:billing_address]&&options[:billing_address][:address1] ? options[:billing_address][:address1] : '',
|
101
|
-
'address2'=>options[:billing_address]&&options[:billing_address][:address2] ? options[:billing_address][:address2] : '',
|
102
|
-
'address3'=>'',
|
103
|
-
'postalCode'=>options[:billing_address]&&options[:billing_address][:zip] ? options[:billing_address][:zip] : '',
|
104
|
-
'city'=>options[:billing_address]&&options[:billing_address][:city] ? options[:billing_address][:city] : '',
|
105
|
-
'state'=>options[:billing_address]&&options[:billing_address][:state] ? options[:billing_address][:state] : '',
|
106
|
-
'countryCode'=>options[:billing_address]&&options[:billing_address][:country] ? options[:billing_address][:country] : ''
|
100
|
+
'address1' => options[:billing_address] && options[:billing_address][:address1] ? options[:billing_address][:address1] : '',
|
101
|
+
'address2' => options[:billing_address] && options[:billing_address][:address2] ? options[:billing_address][:address2] : '',
|
102
|
+
'address3' => '',
|
103
|
+
'postalCode' => options[:billing_address] && options[:billing_address][:zip] ? options[:billing_address][:zip] : '',
|
104
|
+
'city' => options[:billing_address] && options[:billing_address][:city] ? options[:billing_address][:city] : '',
|
105
|
+
'state' => options[:billing_address] && options[:billing_address][:state] ? options[:billing_address][:state] : '',
|
106
|
+
'countryCode' => options[:billing_address] && options[:billing_address][:country] ? options[:billing_address][:country] : ''
|
107
107
|
},
|
108
108
|
'customerOrderCode' => options[:order_id],
|
109
109
|
'orderType' => 'ECOM',
|
@@ -121,7 +121,7 @@ module ActiveMerchant #:nodoc:
|
|
121
121
|
'Content-Type' => 'application/json',
|
122
122
|
'User-Agent' => "Worldpay/v1 ActiveMerchantBindings/#{ActiveMerchant::VERSION}",
|
123
123
|
'X-Worldpay-Client-User-Agent' => user_agent,
|
124
|
-
'X-Worldpay-Client-User-Metadata' => {:
|
124
|
+
'X-Worldpay-Client-User-Metadata' => {ip: options[:ip]}.to_json
|
125
125
|
}
|
126
126
|
headers['Authorization'] = options['Authorization'] if options['Authorization']
|
127
127
|
headers
|
@@ -147,7 +147,7 @@ module ActiveMerchant #:nodoc:
|
|
147
147
|
success = true
|
148
148
|
elsif type == 'purchase' && response['paymentStatus'] == 'SUCCESS'
|
149
149
|
success = true
|
150
|
-
elsif type == 'capture' || type=='refund' || type=='void'
|
150
|
+
elsif type == 'capture' || type == 'refund' || type == 'void'
|
151
151
|
success = true
|
152
152
|
end
|
153
153
|
end
|
@@ -174,11 +174,11 @@ module ActiveMerchant #:nodoc:
|
|
174
174
|
Response.new(success,
|
175
175
|
success ? 'SUCCESS' : response['message'],
|
176
176
|
response,
|
177
|
-
:
|
178
|
-
:
|
179
|
-
:
|
180
|
-
:
|
181
|
-
:
|
177
|
+
test: test?,
|
178
|
+
authorization: authorization,
|
179
|
+
avs_result: {},
|
180
|
+
cvv_result: {},
|
181
|
+
error_code: success ? nil : response['customCode']
|
182
182
|
)
|
183
183
|
end
|
184
184
|
|