activemerchant 1.103.0 → 1.104.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +41 -0
- data/lib/active_merchant.rb +1 -1
- data/lib/active_merchant/billing/avs_result.rb +8 -8
- data/lib/active_merchant/billing/compatibility.rb +2 -1
- data/lib/active_merchant/billing/credit_card.rb +3 -1
- data/lib/active_merchant/billing/credit_card_methods.rb +12 -0
- data/lib/active_merchant/billing/cvv_result.rb +0 -1
- data/lib/active_merchant/billing/gateway.rb +3 -0
- data/lib/active_merchant/billing/gateways/adyen.rb +32 -9
- data/lib/active_merchant/billing/gateways/allied_wallet.rb +2 -2
- data/lib/active_merchant/billing/gateways/authorize_net.rb +10 -9
- data/lib/active_merchant/billing/gateways/authorize_net_arb.rb +10 -0
- data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +1 -0
- data/lib/active_merchant/billing/gateways/axcessms.rb +1 -0
- data/lib/active_merchant/billing/gateways/balanced.rb +18 -15
- data/lib/active_merchant/billing/gateways/barclaycard_smartpay.rb +4 -0
- data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +3 -1
- data/lib/active_merchant/billing/gateways/blue_pay.rb +6 -5
- data/lib/active_merchant/billing/gateways/blue_snap.rb +31 -3
- data/lib/active_merchant/billing/gateways/borgun.rb +1 -1
- data/lib/active_merchant/billing/gateways/bpoint.rb +0 -2
- data/lib/active_merchant/billing/gateways/braintree/braintree_common.rb +1 -0
- data/lib/active_merchant/billing/gateways/braintree_blue.rb +11 -4
- data/lib/active_merchant/billing/gateways/bridge_pay.rb +1 -1
- data/lib/active_merchant/billing/gateways/card_connect.rb +2 -1
- data/lib/active_merchant/billing/gateways/card_save.rb +2 -3
- data/lib/active_merchant/billing/gateways/card_stream.rb +6 -6
- data/lib/active_merchant/billing/gateways/cardprocess.rb +2 -0
- data/lib/active_merchant/billing/gateways/cashnet.rb +1 -0
- data/lib/active_merchant/billing/gateways/cc5.rb +1 -1
- data/lib/active_merchant/billing/gateways/cecabank.rb +1 -0
- data/lib/active_merchant/billing/gateways/cenpos.rb +4 -3
- data/lib/active_merchant/billing/gateways/checkout_v2.rb +2 -0
- data/lib/active_merchant/billing/gateways/citrus_pay.rb +0 -1
- data/lib/active_merchant/billing/gateways/clearhaus.rb +3 -2
- data/lib/active_merchant/billing/gateways/conekta.rb +5 -3
- data/lib/active_merchant/billing/gateways/creditcall.rb +1 -0
- data/lib/active_merchant/billing/gateways/credorax.rb +17 -10
- data/lib/active_merchant/billing/gateways/ct_payment.rb +1 -0
- data/lib/active_merchant/billing/gateways/cyber_source.rb +38 -0
- data/lib/active_merchant/billing/gateways/d_local.rb +6 -0
- data/lib/active_merchant/billing/gateways/data_cash.rb +1 -1
- data/lib/active_merchant/billing/gateways/decidir.rb +18 -2
- data/lib/active_merchant/billing/gateways/digitzs.rb +3 -0
- data/lib/active_merchant/billing/gateways/ebanx.rb +13 -2
- data/lib/active_merchant/billing/gateways/efsnet.rb +3 -2
- data/lib/active_merchant/billing/gateways/elavon.rb +1 -1
- data/lib/active_merchant/billing/gateways/eway.rb +2 -1
- data/lib/active_merchant/billing/gateways/eway_managed.rb +2 -3
- data/lib/active_merchant/billing/gateways/eway_rapid.rb +1 -0
- data/lib/active_merchant/billing/gateways/exact.rb +3 -3
- data/lib/active_merchant/billing/gateways/fat_zebra.rb +2 -1
- data/lib/active_merchant/billing/gateways/first_giving.rb +2 -1
- data/lib/active_merchant/billing/gateways/firstdata_e4.rb +2 -2
- data/lib/active_merchant/billing/gateways/firstdata_e4_v27.rb +1 -0
- data/lib/active_merchant/billing/gateways/flo2cash.rb +2 -2
- data/lib/active_merchant/billing/gateways/forte.rb +1 -0
- data/lib/active_merchant/billing/gateways/garanti.rb +0 -1
- data/lib/active_merchant/billing/gateways/global_collect.rb +29 -0
- data/lib/active_merchant/billing/gateways/global_transport.rb +0 -1
- data/lib/active_merchant/billing/gateways/hdfc.rb +1 -0
- data/lib/active_merchant/billing/gateways/hps.rb +9 -7
- data/lib/active_merchant/billing/gateways/iats_payments.rb +4 -4
- data/lib/active_merchant/billing/gateways/iridium.rb +1 -1
- data/lib/active_merchant/billing/gateways/itransact.rb +3 -2
- data/lib/active_merchant/billing/gateways/iveri.rb +1 -0
- data/lib/active_merchant/billing/gateways/jetpay.rb +1 -1
- data/lib/active_merchant/billing/gateways/jetpay_v2.rb +1 -1
- data/lib/active_merchant/billing/gateways/latitude19.rb +2 -1
- data/lib/active_merchant/billing/gateways/litle.rb +3 -0
- data/lib/active_merchant/billing/gateways/mastercard.rb +1 -0
- data/lib/active_merchant/billing/gateways/mercado_pago.rb +45 -0
- data/lib/active_merchant/billing/gateways/merchant_one.rb +0 -1
- data/lib/active_merchant/billing/gateways/merchant_partners.rb +3 -3
- data/lib/active_merchant/billing/gateways/merchant_ware.rb +1 -1
- data/lib/active_merchant/billing/gateways/merchant_warrior.rb +16 -1
- data/lib/active_merchant/billing/gateways/mercury.rb +2 -2
- data/lib/active_merchant/billing/gateways/metrics_global.rb +2 -2
- data/lib/active_merchant/billing/gateways/micropayment.rb +0 -1
- data/lib/active_merchant/billing/gateways/migs/migs_codes.rb +7 -7
- data/lib/active_merchant/billing/gateways/moneris.rb +36 -8
- data/lib/active_merchant/billing/gateways/moneris_us.rb +2 -0
- data/lib/active_merchant/billing/gateways/mundipagg.rb +6 -1
- data/lib/active_merchant/billing/gateways/nab_transact.rb +2 -2
- data/lib/active_merchant/billing/gateways/net_registry.rb +1 -1
- data/lib/active_merchant/billing/gateways/netbanx.rb +3 -1
- data/lib/active_merchant/billing/gateways/netbilling.rb +3 -3
- data/lib/active_merchant/billing/gateways/netpay.rb +1 -0
- data/lib/active_merchant/billing/gateways/nmi.rb +5 -6
- data/lib/active_merchant/billing/gateways/ogone.rb +4 -2
- data/lib/active_merchant/billing/gateways/omise.rb +1 -2
- data/lib/active_merchant/billing/gateways/openpay.rb +3 -1
- data/lib/active_merchant/billing/gateways/opp.rb +1 -0
- data/lib/active_merchant/billing/gateways/optimal_payment.rb +4 -5
- data/lib/active_merchant/billing/gateways/orbital.rb +17 -13
- data/lib/active_merchant/billing/gateways/orbital/orbital_soft_descriptors.rb +1 -1
- data/lib/active_merchant/billing/gateways/pac_net_raven.rb +1 -1
- data/lib/active_merchant/billing/gateways/pagarme.rb +1 -0
- data/lib/active_merchant/billing/gateways/pay_conex.rb +1 -1
- data/lib/active_merchant/billing/gateways/pay_gate_xml.rb +1 -1
- data/lib/active_merchant/billing/gateways/pay_hub.rb +1 -0
- data/lib/active_merchant/billing/gateways/pay_junction_v2.rb +1 -0
- data/lib/active_merchant/billing/gateways/pay_secure.rb +1 -1
- data/lib/active_merchant/billing/gateways/paybox_direct.rb +4 -2
- data/lib/active_merchant/billing/gateways/payeezy.rb +2 -0
- data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +1 -0
- data/lib/active_merchant/billing/gateways/payment_express.rb +2 -2
- data/lib/active_merchant/billing/gateways/paymentez.rb +4 -0
- data/lib/active_merchant/billing/gateways/paypal_digital_goods.rb +1 -1
- data/lib/active_merchant/billing/gateways/paystation.rb +1 -3
- data/lib/active_merchant/billing/gateways/payu_in.rb +1 -1
- data/lib/active_merchant/billing/gateways/payu_latam.rb +6 -0
- data/lib/active_merchant/billing/gateways/payway.rb +3 -2
- data/lib/active_merchant/billing/gateways/pin.rb +1 -0
- data/lib/active_merchant/billing/gateways/plugnpay.rb +4 -4
- data/lib/active_merchant/billing/gateways/pro_pay.rb +1 -0
- data/lib/active_merchant/billing/gateways/psigate.rb +2 -1
- data/lib/active_merchant/billing/gateways/psl_card.rb +1 -1
- data/lib/active_merchant/billing/gateways/qbms.rb +2 -2
- data/lib/active_merchant/billing/gateways/quantum.rb +0 -1
- data/lib/active_merchant/billing/gateways/quickbooks.rb +2 -0
- data/lib/active_merchant/billing/gateways/quickpay.rb +0 -1
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_common.rb +5 -5
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb +1 -0
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_v4to7.rb +1 -0
- data/lib/active_merchant/billing/gateways/qvalent.rb +2 -0
- data/lib/active_merchant/billing/gateways/realex.rb +3 -1
- data/lib/active_merchant/billing/gateways/redsys.rb +3 -2
- data/lib/active_merchant/billing/gateways/s5.rb +1 -0
- data/lib/active_merchant/billing/gateways/safe_charge.rb +2 -0
- data/lib/active_merchant/billing/gateways/sage.rb +1 -1
- data/lib/active_merchant/billing/gateways/sage_pay.rb +8 -6
- data/lib/active_merchant/billing/gateways/secure_net.rb +2 -4
- data/lib/active_merchant/billing/gateways/secure_pay.rb +2 -2
- data/lib/active_merchant/billing/gateways/secure_pay_au.rb +1 -1
- data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +1 -1
- data/lib/active_merchant/billing/gateways/securion_pay.rb +2 -0
- data/lib/active_merchant/billing/gateways/skip_jack.rb +6 -5
- data/lib/active_merchant/billing/gateways/smart_ps.rb +0 -1
- data/lib/active_merchant/billing/gateways/so_easy_pay.rb +0 -1
- data/lib/active_merchant/billing/gateways/spreedly_core.rb +1 -0
- data/lib/active_merchant/billing/gateways/stripe.rb +7 -0
- data/lib/active_merchant/billing/gateways/stripe_payment_intents.rb +9 -4
- data/lib/active_merchant/billing/gateways/swipe_checkout.rb +1 -1
- data/lib/active_merchant/billing/gateways/telr.rb +3 -0
- data/lib/active_merchant/billing/gateways/tns.rb +0 -1
- data/lib/active_merchant/billing/gateways/trans_first.rb +1 -0
- data/lib/active_merchant/billing/gateways/trans_first_transaction_express.rb +4 -2
- data/lib/active_merchant/billing/gateways/transax.rb +0 -1
- data/lib/active_merchant/billing/gateways/trexle.rb +3 -0
- data/lib/active_merchant/billing/gateways/usa_epay.rb +0 -1
- data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +15 -16
- data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +5 -0
- data/lib/active_merchant/billing/gateways/vanco.rb +1 -1
- data/lib/active_merchant/billing/gateways/visanet_peru.rb +1 -0
- data/lib/active_merchant/billing/gateways/wepay.rb +7 -6
- data/lib/active_merchant/billing/gateways/wirecard.rb +6 -3
- data/lib/active_merchant/billing/gateways/world_net.rb +1 -0
- data/lib/active_merchant/billing/gateways/worldpay.rb +4 -0
- data/lib/active_merchant/billing/gateways/worldpay_online_payments.rb +0 -1
- data/lib/active_merchant/billing/gateways/worldpay_us.rb +2 -2
- data/lib/active_merchant/billing/response.rb +1 -1
- data/lib/active_merchant/connection.rb +2 -0
- data/lib/active_merchant/country.rb +1 -0
- data/lib/active_merchant/net_http_ssl_connection.rb +1 -0
- data/lib/active_merchant/post_data.rb +1 -0
- data/lib/active_merchant/version.rb +1 -1
- data/lib/support/ssl_verify.rb +0 -2
- data/lib/support/ssl_version.rb +0 -1
- metadata +2 -2
@@ -207,6 +207,7 @@ module ActiveMerchant #:nodoc:
|
|
207
207
|
|
208
208
|
def message_from(response)
|
209
209
|
return 'Success' if success_from(response)
|
210
|
+
|
210
211
|
response[:reason_codes] || response[:reason]
|
211
212
|
end
|
212
213
|
|
@@ -240,6 +241,7 @@ module ActiveMerchant #:nodoc:
|
|
240
241
|
|
241
242
|
params.map do |key, value|
|
242
243
|
next if value != false && value.blank?
|
244
|
+
|
243
245
|
"#{key}=#{CGI.escape(value.to_s)}"
|
244
246
|
end.compact.join('&')
|
245
247
|
end
|
@@ -115,6 +115,7 @@ module ActiveMerchant #:nodoc:
|
|
115
115
|
# use the same method as in pay_conex
|
116
116
|
def force_utf8(string)
|
117
117
|
return nil unless string
|
118
|
+
|
118
119
|
binary = string.encode('BINARY', invalid: :replace, undef: :replace, replace: '?') # Needed for Ruby 2.0 since #encode is a no-op if the string is already UTF-8. It's not needed for Ruby 2.1 and up since it's not a no-op there.
|
119
120
|
binary.encode('UTF-8', invalid: :replace, undef: :replace, replace: '?')
|
120
121
|
end
|
@@ -296,7 +297,6 @@ module ActiveMerchant #:nodoc:
|
|
296
297
|
end
|
297
298
|
|
298
299
|
class SageVault
|
299
|
-
|
300
300
|
def initialize(options, gateway)
|
301
301
|
@live_url = 'https://www.sagepayments.net/web_services/wsVault/wsVault.asmx'
|
302
302
|
@options = options
|
@@ -312,6 +312,7 @@ module ActiveMerchant #:nodoc:
|
|
312
312
|
|
313
313
|
def sanitize_phone(phone)
|
314
314
|
return nil unless phone
|
315
|
+
|
315
316
|
cleansed = phone.to_s.gsub(/[^0-9+]/, '')
|
316
317
|
truncate(cleansed, 20)
|
317
318
|
end
|
@@ -361,11 +362,11 @@ module ActiveMerchant #:nodoc:
|
|
361
362
|
when :store
|
362
363
|
response['Token']
|
363
364
|
else
|
364
|
-
[
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
365
|
+
[params[:VendorTxCode],
|
366
|
+
response['VPSTxId'] || params[:VPSTxId],
|
367
|
+
response['TxAuthNo'],
|
368
|
+
response['SecurityKey'] || params[:SecurityKey],
|
369
|
+
action].join(';')
|
369
370
|
end
|
370
371
|
end
|
371
372
|
|
@@ -389,7 +390,7 @@ module ActiveMerchant #:nodoc:
|
|
389
390
|
end
|
390
391
|
|
391
392
|
def build_simulator_url(action)
|
392
|
-
endpoint = [
|
393
|
+
endpoint = [:purchase, :authorization].include?(action) ? 'VSPDirectGateway.asp' : "VSPServerGateway.asp?Service=Vendor#{TRANSACTIONS[action].capitalize}Tx"
|
393
394
|
"#{self.simulator_url}/#{endpoint}"
|
394
395
|
end
|
395
396
|
|
@@ -426,6 +427,7 @@ module ActiveMerchant #:nodoc:
|
|
426
427
|
|
427
428
|
def past_purchase_reference?(payment_method)
|
428
429
|
return false unless payment_method.is_a?(String)
|
430
|
+
|
429
431
|
payment_method.split(';').last == 'purchase'
|
430
432
|
end
|
431
433
|
end
|
@@ -1,7 +1,6 @@
|
|
1
1
|
module ActiveMerchant #:nodoc:
|
2
2
|
module Billing #:nodoc:
|
3
3
|
class SecureNetGateway < Gateway
|
4
|
-
|
5
4
|
API_VERSION = '4.0'
|
6
5
|
|
7
6
|
TRANSACTIONS = {
|
@@ -28,8 +27,8 @@ module ActiveMerchant #:nodoc:
|
|
28
27
|
|
29
28
|
APPROVED, DECLINED = 1, 2
|
30
29
|
|
31
|
-
CARD_CODE_ERRORS = %w(
|
32
|
-
AVS_ERRORS = %w(
|
30
|
+
CARD_CODE_ERRORS = %w(N S)
|
31
|
+
AVS_ERRORS = %w(A E N R W Z)
|
33
32
|
|
34
33
|
def initialize(options = {})
|
35
34
|
requires!(options, :login, :password)
|
@@ -257,7 +256,6 @@ module ActiveMerchant #:nodoc:
|
|
257
256
|
def build_authorization(response)
|
258
257
|
[response[:transactionid], response[:transactionamount], response[:last4_digits]].join('|')
|
259
258
|
end
|
260
|
-
|
261
259
|
end
|
262
260
|
end
|
263
261
|
end
|
@@ -21,8 +21,8 @@ module ActiveMerchant #:nodoc:
|
|
21
21
|
self.homepage_url = 'http://www.securepay.com/'
|
22
22
|
self.display_name = 'SecurePay'
|
23
23
|
|
24
|
-
CARD_CODE_ERRORS = %w(
|
25
|
-
AVS_ERRORS = %w(
|
24
|
+
CARD_CODE_ERRORS = %w(N S)
|
25
|
+
AVS_ERRORS = %w(A E N R W Z)
|
26
26
|
AVS_REASON_CODES = %w(27 45)
|
27
27
|
TRANSACTION_ALREADY_ACTIONED = %w(310 311)
|
28
28
|
|
@@ -2,7 +2,7 @@ module ActiveMerchant #:nodoc:
|
|
2
2
|
module Billing #:nodoc:
|
3
3
|
class SecurePayTechGateway < Gateway
|
4
4
|
class SecurePayTechPostData < PostData
|
5
|
-
self.required_fields = [
|
5
|
+
self.required_fields = [:OrderReference, :CardNumber, :CardExpiry, :CardHolderName, :CardType, :MerchantID, :MerchantKey, :Amount, :Currency]
|
6
6
|
end
|
7
7
|
|
8
8
|
self.live_url = self.test_url = 'https://tx.securepaytech.com/web/HttpPostPurchase'
|
@@ -166,6 +166,7 @@ module ActiveMerchant #:nodoc:
|
|
166
166
|
|
167
167
|
def add_address(post, options)
|
168
168
|
return unless post[:card]&.kind_of?(Hash)
|
169
|
+
|
169
170
|
if address = options[:billing_address]
|
170
171
|
post[:card][:addressLine1] = address[:address1] if address[:address1]
|
171
172
|
post[:card][:addressLine2] = address[:address2] if address[:address2]
|
@@ -214,6 +215,7 @@ module ActiveMerchant #:nodoc:
|
|
214
215
|
|
215
216
|
params.map do |key, value|
|
216
217
|
next if value.blank?
|
218
|
+
|
217
219
|
if value.is_a?(Hash)
|
218
220
|
h = {}
|
219
221
|
value.each do |k, v|
|
@@ -21,7 +21,7 @@ module ActiveMerchant #:nodoc:
|
|
21
21
|
|
22
22
|
MONETARY_CHANGE_STATUSES = ['SETTLE', 'AUTHORIZE', 'AUTHORIZE ADDITIONAL', 'CREDIT', 'SPLITSETTLE']
|
23
23
|
|
24
|
-
CARD_CODE_ERRORS = %w(
|
24
|
+
CARD_CODE_ERRORS = %w(N S "")
|
25
25
|
|
26
26
|
CARD_CODE_MESSAGES = {
|
27
27
|
'M' => 'Card verification number matched',
|
@@ -32,7 +32,7 @@ module ActiveMerchant #:nodoc:
|
|
32
32
|
'' => 'Transaction failed because incorrect card verification number was entered or no number was entered'
|
33
33
|
}
|
34
34
|
|
35
|
-
AVS_ERRORS = %w(
|
35
|
+
AVS_ERRORS = %w(A B C E I N O P R W Z)
|
36
36
|
|
37
37
|
AVS_MESSAGES = {
|
38
38
|
'A' => 'Street address matches billing information, zip/postal code does not',
|
@@ -300,9 +300,9 @@ module ActiveMerchant #:nodoc:
|
|
300
300
|
when :authorization
|
301
301
|
parse_authorization_response(body)
|
302
302
|
when :get_status
|
303
|
-
parse_status_response(body, [
|
303
|
+
parse_status_response(body, [:SerialNumber, :TransactionAmount, :TransactionStatusCode, :TransactionStatusMessage, :OrderNumber, :TransactionDateTime, :TransactionID, :ApprovalCode, :BatchNumber])
|
304
304
|
else
|
305
|
-
parse_status_response(body, [
|
305
|
+
parse_status_response(body, [:SerialNumber, :TransactionAmount, :DesiredStatus, :StatusResponse, :StatusResponseMessage, :OrderNumber, :AuditID])
|
306
306
|
end
|
307
307
|
end
|
308
308
|
|
@@ -329,7 +329,7 @@ module ActiveMerchant #:nodoc:
|
|
329
329
|
def parse_status_response(body, response_keys)
|
330
330
|
lines = split_lines(body)
|
331
331
|
|
332
|
-
keys = [
|
332
|
+
keys = [:szSerialNumber, :szErrorCode, :szNumberRecords]
|
333
333
|
values = split_line(lines[0])[0..2]
|
334
334
|
|
335
335
|
result = Hash[*keys.zip(values).flatten]
|
@@ -434,6 +434,7 @@ module ActiveMerchant #:nodoc:
|
|
434
434
|
return CARD_CODE_MESSAGES[response[:szCVV2ResponseCode]] if CARD_CODE_ERRORS.include?(response[:szCVV2ResponseCode])
|
435
435
|
return AVS_MESSAGES[response[:szAVSResponseMessage]] if AVS_ERRORS.include?(response[:szAVSResponseCode])
|
436
436
|
return RETURN_CODE_MESSAGES[response[:szReturnCode]] if response[:szReturnCode] != '1'
|
437
|
+
|
437
438
|
return response[:szAuthorizationDeclinedMessage]
|
438
439
|
end
|
439
440
|
end
|
@@ -198,6 +198,7 @@ module ActiveMerchant #:nodoc:
|
|
198
198
|
elsif payment.is_a?(Check)
|
199
199
|
bank_token_response = tokenize_bank_account(payment)
|
200
200
|
return bank_token_response unless bank_token_response.success?
|
201
|
+
|
201
202
|
params = { source: bank_token_response.params['token']['id'] }
|
202
203
|
else
|
203
204
|
add_creditcard(params, payment, options)
|
@@ -431,6 +432,7 @@ module ActiveMerchant #:nodoc:
|
|
431
432
|
|
432
433
|
def add_address(post, options)
|
433
434
|
return unless post[:card]&.kind_of?(Hash)
|
435
|
+
|
434
436
|
if address = options[:billing_address] || options[:address]
|
435
437
|
post[:card][:address_line1] = address[:address1] if address[:address1]
|
436
438
|
post[:card][:address_line2] = address[:address2] if address[:address2]
|
@@ -559,12 +561,14 @@ module ActiveMerchant #:nodoc:
|
|
559
561
|
|
560
562
|
def post_data(params)
|
561
563
|
return nil unless params
|
564
|
+
|
562
565
|
flatten_params([], params).join('&')
|
563
566
|
end
|
564
567
|
|
565
568
|
def flatten_params(flattened, params, prefix = nil)
|
566
569
|
params.each do |key, value|
|
567
570
|
next if value != false && value.blank?
|
571
|
+
|
568
572
|
flattened_key = prefix.nil? ? key : "#{prefix}[#{key}]"
|
569
573
|
if value.is_a?(Hash)
|
570
574
|
flatten_params(flattened, value, flattened_key)
|
@@ -608,6 +612,7 @@ module ActiveMerchant #:nodoc:
|
|
608
612
|
|
609
613
|
def stripe_client_user_agent(options)
|
610
614
|
return user_agent unless options[:application]
|
615
|
+
|
611
616
|
JSON.dump(JSON.parse(user_agent).merge!({application: options[:application]}))
|
612
617
|
end
|
613
618
|
|
@@ -761,6 +766,7 @@ module ActiveMerchant #:nodoc:
|
|
761
766
|
|
762
767
|
def auth_minimum_amount(options)
|
763
768
|
return 100 unless options[:currency]
|
769
|
+
|
764
770
|
return MINIMUM_AUTHORIZE_AMOUNTS[options[:currency].upcase] || 100
|
765
771
|
end
|
766
772
|
|
@@ -768,6 +774,7 @@ module ActiveMerchant #:nodoc:
|
|
768
774
|
source_path ||= dest_path
|
769
775
|
source_path.each do |key|
|
770
776
|
return nil unless source[key]
|
777
|
+
|
771
778
|
source = source[key]
|
772
779
|
end
|
773
780
|
|
@@ -5,7 +5,6 @@ module ActiveMerchant #:nodoc:
|
|
5
5
|
# This gateway uses the current Stripe {Payment Intents API}[https://stripe.com/docs/api/payment_intents].
|
6
6
|
# For the legacy API, see the Stripe gateway
|
7
7
|
class StripePaymentIntentsGateway < StripeGateway
|
8
|
-
|
9
8
|
self.supported_countries = %w(AT AU BE BR CA CH DE DK EE ES FI FR GB GR HK IE IT JP LT LU LV MX NL NO NZ PL PT SE SG SI SK US)
|
10
9
|
|
11
10
|
ALLOWED_METHOD_STATES = %w[automatic manual].freeze
|
@@ -65,7 +64,7 @@ module ActiveMerchant #:nodoc:
|
|
65
64
|
|
66
65
|
def update_intent(money, intent_id, payment_method, options = {})
|
67
66
|
post = {}
|
68
|
-
post
|
67
|
+
add_amount(post, money, options)
|
69
68
|
|
70
69
|
add_payment_method_token(post, payment_method, options)
|
71
70
|
add_payment_method_types(post, options)
|
@@ -91,7 +90,8 @@ module ActiveMerchant #:nodoc:
|
|
91
90
|
|
92
91
|
def capture(money, intent_id, options = {})
|
93
92
|
post = {}
|
94
|
-
|
93
|
+
currency = options[:currency] || currency(money)
|
94
|
+
post[:amount_to_capture] = localized_amount(money, currency)
|
95
95
|
if options[:transfer_amount]
|
96
96
|
post[:transfer_data] = {}
|
97
97
|
post[:transfer_data][:amount] = options[:transfer_amount]
|
@@ -174,6 +174,7 @@ module ActiveMerchant #:nodoc:
|
|
174
174
|
|
175
175
|
def add_return_url(post, options)
|
176
176
|
return unless options[:confirm]
|
177
|
+
|
177
178
|
post[:confirm] = options[:confirm]
|
178
179
|
post[:return_url] = options[:return_url] if options[:return_url]
|
179
180
|
post
|
@@ -211,19 +212,21 @@ module ActiveMerchant #:nodoc:
|
|
211
212
|
|
212
213
|
def add_exemption(post, options = {})
|
213
214
|
return unless options[:confirm]
|
215
|
+
|
214
216
|
post[:payment_method_options] ||= {}
|
215
217
|
post[:payment_method_options][:card] ||= {}
|
216
218
|
post[:payment_method_options][:card][:moto] = true if options[:moto]
|
217
219
|
end
|
218
220
|
|
219
221
|
def setup_future_usage(post, options = {})
|
220
|
-
post[:setup_future_usage] = options[:setup_future_usage] if %w(
|
222
|
+
post[:setup_future_usage] = options[:setup_future_usage] if %w(on_session off_session).include?(options[:setup_future_usage])
|
221
223
|
post[:off_session] = options[:off_session] if options[:off_session] && options[:confirm] == true
|
222
224
|
post
|
223
225
|
end
|
224
226
|
|
225
227
|
def add_connected_account(post, options = {})
|
226
228
|
return unless options[:transfer_destination]
|
229
|
+
|
227
230
|
post[:transfer_data] = {}
|
228
231
|
post[:transfer_data][:destination] = options[:transfer_destination]
|
229
232
|
post[:transfer_data][:amount] = options[:transfer_amount] if options[:transfer_amount]
|
@@ -235,6 +238,7 @@ module ActiveMerchant #:nodoc:
|
|
235
238
|
|
236
239
|
def add_billing_address(post, options = {})
|
237
240
|
return unless billing = options[:billing_address] || options[:address]
|
241
|
+
|
238
242
|
post[:billing_details] = {}
|
239
243
|
post[:billing_details][:address] = {}
|
240
244
|
post[:billing_details][:address][:city] = billing[:city] if billing[:city]
|
@@ -251,6 +255,7 @@ module ActiveMerchant #:nodoc:
|
|
251
255
|
|
252
256
|
def add_shipping_address(post, options = {})
|
253
257
|
return unless shipping = options[:shipping]
|
258
|
+
|
254
259
|
post[:shipping] = {}
|
255
260
|
post[:shipping][:address] = {}
|
256
261
|
post[:shipping][:address][:line1] = shipping[:address][:line1]
|
@@ -11,7 +11,7 @@ module ActiveMerchant #:nodoc:
|
|
11
11
|
|
12
12
|
TRANSACTION_API = '/createShopifyTransaction.php'
|
13
13
|
|
14
|
-
self.supported_countries = %w[
|
14
|
+
self.supported_countries = %w[NZ CA]
|
15
15
|
self.default_currency = 'NZD'
|
16
16
|
self.supported_cardtypes = [:visa, :master]
|
17
17
|
self.homepage_url = 'https://www.swipehq.com/checkout'
|
@@ -109,6 +109,7 @@ module ActiveMerchant #:nodoc:
|
|
109
109
|
|
110
110
|
def add_payment_method(doc, payment_method, options)
|
111
111
|
return if payment_method.is_a?(String)
|
112
|
+
|
112
113
|
doc.card do
|
113
114
|
doc.number(payment_method.number)
|
114
115
|
doc.cvv(payment_method.verification_value)
|
@@ -121,6 +122,7 @@ module ActiveMerchant #:nodoc:
|
|
121
122
|
|
122
123
|
def add_customer_data(doc, payment_method, options)
|
123
124
|
return if payment_method.is_a?(String)
|
125
|
+
|
124
126
|
doc.billing do
|
125
127
|
doc.name do
|
126
128
|
doc.first(payment_method.first_name)
|
@@ -140,6 +142,7 @@ module ActiveMerchant #:nodoc:
|
|
140
142
|
doc.city(address[:city] || 'City')
|
141
143
|
doc.line1(address[:address1] || 'Address')
|
142
144
|
return unless address
|
145
|
+
|
143
146
|
doc.line2(address[:address2]) if address[:address2]
|
144
147
|
doc.zip(address[:zip]) if address[:zip]
|
145
148
|
doc.region(address[:state]) if address[:state]
|
@@ -291,6 +291,7 @@ module ActiveMerchant #:nodoc:
|
|
291
291
|
MultiResponse.run do |r|
|
292
292
|
r.process { commit(:store, store_customer_request) }
|
293
293
|
return r unless r.success? && r.params['custId']
|
294
|
+
|
294
295
|
customer_id = r.params['custId']
|
295
296
|
|
296
297
|
store_payment_method_request = build_xml_payment_storage_request do |doc|
|
@@ -384,6 +385,7 @@ module ActiveMerchant #:nodoc:
|
|
384
385
|
|
385
386
|
def error_code_from(succeeded, response)
|
386
387
|
return if succeeded
|
388
|
+
|
387
389
|
response['errorCode'] || response['rspCode']
|
388
390
|
end
|
389
391
|
|
@@ -548,7 +550,7 @@ module ActiveMerchant #:nodoc:
|
|
548
550
|
doc['v1'].addrLn2 billing_address[:address2] unless billing_address[:address2].blank?
|
549
551
|
doc['v1'].city billing_address[:city] if billing_address[:city]
|
550
552
|
doc['v1'].state billing_address[:state] if billing_address[:state]
|
551
|
-
doc['v1'].zipCode billing_address[:zip] if billing_address[:zip]
|
553
|
+
doc['v1'].zipCode billing_address[:zip].delete('-') if billing_address[:zip]
|
552
554
|
doc['v1'].ctry 'US'
|
553
555
|
end
|
554
556
|
|
@@ -563,7 +565,7 @@ module ActiveMerchant #:nodoc:
|
|
563
565
|
doc['v1'].addrLn2 shipping_address[:address2] unless shipping_address[:address2].blank?
|
564
566
|
doc['v1'].city shipping_address[:city] if shipping_address[:city]
|
565
567
|
doc['v1'].state shipping_address[:state] if shipping_address[:state]
|
566
|
-
doc['v1'].zipCode shipping_address[:zip] if shipping_address[:zip]
|
568
|
+
doc['v1'].zipCode shipping_address[:zip].delete('-') if shipping_address[:zip]
|
567
569
|
doc['v1'].phone shipping_address[:phone].gsub(/\D/, '') if shipping_address[:phone]
|
568
570
|
doc['v1'].email shipping_address[:email] if shipping_address[:email]
|
569
571
|
end
|