activemerchant 1.110.0 → 1.116.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +82 -0
- data/lib/active_merchant.rb +1 -1
- data/lib/active_merchant/billing/avs_result.rb +1 -1
- data/lib/active_merchant/billing/compatibility.rb +3 -3
- data/lib/active_merchant/billing/credit_card.rb +1 -1
- data/lib/active_merchant/billing/credit_card_methods.rb +6 -6
- data/lib/active_merchant/billing/gateway.rb +1 -1
- data/lib/active_merchant/billing/gateways/adyen.rb +30 -15
- data/lib/active_merchant/billing/gateways/allied_wallet.rb +7 -7
- data/lib/active_merchant/billing/gateways/authorize_net.rb +19 -17
- data/lib/active_merchant/billing/gateways/authorize_net_arb.rb +3 -4
- data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +2 -2
- data/lib/active_merchant/billing/gateways/axcessms.rb +8 -9
- data/lib/active_merchant/billing/gateways/balanced.rb +5 -4
- data/lib/active_merchant/billing/gateways/bambora_apac.rb +8 -8
- data/lib/active_merchant/billing/gateways/bank_frick.rb +8 -8
- data/lib/active_merchant/billing/gateways/banwire.rb +1 -1
- data/lib/active_merchant/billing/gateways/barclaycard_smartpay.rb +6 -4
- data/lib/active_merchant/billing/gateways/beanstream.rb +3 -3
- data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +4 -5
- data/lib/active_merchant/billing/gateways/blue_pay.rb +2 -3
- data/lib/active_merchant/billing/gateways/blue_snap.rb +83 -23
- data/lib/active_merchant/billing/gateways/bogus.rb +19 -19
- data/lib/active_merchant/billing/gateways/borgun.rb +12 -12
- data/lib/active_merchant/billing/gateways/bpoint.rb +8 -8
- data/lib/active_merchant/billing/gateways/braintree.rb +1 -1
- data/lib/active_merchant/billing/gateways/braintree_blue.rb +14 -17
- data/lib/active_merchant/billing/gateways/bridge_pay.rb +7 -7
- data/lib/active_merchant/billing/gateways/cams.rb +8 -8
- data/lib/active_merchant/billing/gateways/card_connect.rb +1 -1
- data/lib/active_merchant/billing/gateways/card_save.rb +1 -1
- data/lib/active_merchant/billing/gateways/card_stream.rb +2 -2
- data/lib/active_merchant/billing/gateways/cardknox.rb +8 -8
- data/lib/active_merchant/billing/gateways/cardprocess.rb +1 -1
- data/lib/active_merchant/billing/gateways/cecabank.rb +5 -5
- data/lib/active_merchant/billing/gateways/cenpos.rb +11 -11
- data/lib/active_merchant/billing/gateways/checkout.rb +2 -2
- data/lib/active_merchant/billing/gateways/checkout_v2.rb +17 -20
- data/lib/active_merchant/billing/gateways/clearhaus.rb +7 -7
- data/lib/active_merchant/billing/gateways/commercegate.rb +1 -1
- data/lib/active_merchant/billing/gateways/conekta.rb +2 -2
- data/lib/active_merchant/billing/gateways/creditcall.rb +10 -10
- data/lib/active_merchant/billing/gateways/credorax.rb +15 -9
- data/lib/active_merchant/billing/gateways/ct_payment.rb +10 -10
- data/lib/active_merchant/billing/gateways/culqi.rb +10 -10
- data/lib/active_merchant/billing/gateways/cyber_source.rb +58 -37
- data/lib/active_merchant/billing/gateways/d_local.rb +11 -11
- data/lib/active_merchant/billing/gateways/data_cash.rb +2 -3
- data/lib/active_merchant/billing/gateways/decidir.rb +10 -9
- data/lib/active_merchant/billing/gateways/dibs.rb +8 -8
- data/lib/active_merchant/billing/gateways/digitzs.rb +6 -6
- data/lib/active_merchant/billing/gateways/ebanx.rb +9 -9
- data/lib/active_merchant/billing/gateways/efsnet.rb +3 -4
- data/lib/active_merchant/billing/gateways/elavon.rb +251 -232
- data/lib/active_merchant/billing/gateways/element.rb +12 -8
- data/lib/active_merchant/billing/gateways/evo_ca.rb +5 -6
- data/lib/active_merchant/billing/gateways/eway.rb +3 -4
- data/lib/active_merchant/billing/gateways/eway_managed.rb +6 -7
- data/lib/active_merchant/billing/gateways/eway_rapid.rb +8 -8
- data/lib/active_merchant/billing/gateways/exact.rb +8 -9
- data/lib/active_merchant/billing/gateways/ezic.rb +8 -8
- data/lib/active_merchant/billing/gateways/fat_zebra.rb +9 -7
- data/lib/active_merchant/billing/gateways/federated_canada.rb +2 -3
- data/lib/active_merchant/billing/gateways/first_giving.rb +1 -1
- data/lib/active_merchant/billing/gateways/first_pay.rb +6 -6
- data/lib/active_merchant/billing/gateways/firstdata_e4.rb +7 -7
- data/lib/active_merchant/billing/gateways/firstdata_e4_v27.rb +4 -4
- data/lib/active_merchant/billing/gateways/flo2cash.rb +9 -9
- data/lib/active_merchant/billing/gateways/flo2cash_simple.rb +1 -1
- data/lib/active_merchant/billing/gateways/forte.rb +14 -8
- data/lib/active_merchant/billing/gateways/global_collect.rb +15 -10
- data/lib/active_merchant/billing/gateways/global_transport.rb +7 -7
- data/lib/active_merchant/billing/gateways/hdfc.rb +10 -10
- data/lib/active_merchant/billing/gateways/hps.rb +16 -13
- data/lib/active_merchant/billing/gateways/iats_payments.rb +9 -4
- data/lib/active_merchant/billing/gateways/in_context_paypal_express.rb +1 -1
- data/lib/active_merchant/billing/gateways/inspire.rb +3 -4
- data/lib/active_merchant/billing/gateways/instapay.rb +1 -2
- data/lib/active_merchant/billing/gateways/ipp.rb +7 -7
- data/lib/active_merchant/billing/gateways/iridium.rb +16 -17
- data/lib/active_merchant/billing/gateways/iveri.rb +7 -7
- data/lib/active_merchant/billing/gateways/ixopay.rb +7 -7
- data/lib/active_merchant/billing/gateways/jetpay.rb +1 -2
- data/lib/active_merchant/billing/gateways/jetpay_v2.rb +4 -5
- data/lib/active_merchant/billing/gateways/kushki.rb +6 -6
- data/lib/active_merchant/billing/gateways/latitude19.rb +14 -14
- data/lib/active_merchant/billing/gateways/linkpoint.rb +5 -6
- data/lib/active_merchant/billing/gateways/litle.rb +12 -12
- data/lib/active_merchant/billing/gateways/mastercard.rb +12 -12
- data/lib/active_merchant/billing/gateways/mercado_pago.rb +8 -8
- data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +1 -2
- data/lib/active_merchant/billing/gateways/merchant_one.rb +1 -1
- data/lib/active_merchant/billing/gateways/merchant_partners.rb +10 -10
- data/lib/active_merchant/billing/gateways/merchant_ware.rb +5 -7
- data/lib/active_merchant/billing/gateways/merchant_ware_version_four.rb +4 -6
- data/lib/active_merchant/billing/gateways/mercury.rb +4 -4
- data/lib/active_merchant/billing/gateways/metrics_global.rb +4 -5
- data/lib/active_merchant/billing/gateways/micropayment.rb +8 -8
- data/lib/active_merchant/billing/gateways/migs.rb +3 -4
- data/lib/active_merchant/billing/gateways/modern_payments_cim.rb +2 -4
- data/lib/active_merchant/billing/gateways/monei.rb +7 -7
- data/lib/active_merchant/billing/gateways/moneris.rb +4 -3
- data/lib/active_merchant/billing/gateways/money_movers.rb +2 -3
- data/lib/active_merchant/billing/gateways/mundipagg.rb +37 -10
- data/lib/active_merchant/billing/gateways/nab_transact.rb +2 -4
- data/lib/active_merchant/billing/gateways/ncr_secure_pay.rb +7 -7
- data/lib/active_merchant/billing/gateways/net_registry.rb +1 -2
- data/lib/active_merchant/billing/gateways/netaxept.rb +6 -6
- data/lib/active_merchant/billing/gateways/netbanx.rb +12 -10
- data/lib/active_merchant/billing/gateways/netbilling.rb +4 -5
- data/lib/active_merchant/billing/gateways/network_merchants.rb +2 -3
- data/lib/active_merchant/billing/gateways/nmi.rb +21 -7
- data/lib/active_merchant/billing/gateways/ogone.rb +3 -3
- data/lib/active_merchant/billing/gateways/omise.rb +13 -13
- data/lib/active_merchant/billing/gateways/openpay.rb +4 -5
- data/lib/active_merchant/billing/gateways/opp.rb +12 -12
- data/lib/active_merchant/billing/gateways/optimal_payment.rb +3 -4
- data/lib/active_merchant/billing/gateways/orbital.rb +66 -64
- data/lib/active_merchant/billing/gateways/pac_net_raven.rb +3 -4
- data/lib/active_merchant/billing/gateways/pagarme.rb +9 -9
- data/lib/active_merchant/billing/gateways/pago_facil.rb +2 -2
- data/lib/active_merchant/billing/gateways/pay_conex.rb +8 -8
- data/lib/active_merchant/billing/gateways/pay_gate_xml.rb +6 -7
- data/lib/active_merchant/billing/gateways/pay_hub.rb +7 -8
- data/lib/active_merchant/billing/gateways/pay_junction.rb +4 -5
- data/lib/active_merchant/billing/gateways/pay_junction_v2.rb +9 -9
- data/lib/active_merchant/billing/gateways/pay_secure.rb +2 -3
- data/lib/active_merchant/billing/gateways/paybox_direct.rb +23 -1
- data/lib/active_merchant/billing/gateways/payeezy.rb +12 -12
- data/lib/active_merchant/billing/gateways/payex.rb +11 -12
- data/lib/active_merchant/billing/gateways/payflow.rb +4 -1
- data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +1 -1
- data/lib/active_merchant/billing/gateways/payflow/payflow_express_response.rb +1 -1
- data/lib/active_merchant/billing/gateways/payment_express.rb +1 -2
- data/lib/active_merchant/billing/gateways/paymentez.rb +5 -5
- data/lib/active_merchant/billing/gateways/paymill.rb +10 -10
- data/lib/active_merchant/billing/gateways/paypal_express.rb +1 -1
- data/lib/active_merchant/billing/gateways/paypal_express_common.rb +1 -1
- data/lib/active_merchant/billing/gateways/payscout.rb +1 -2
- data/lib/active_merchant/billing/gateways/paystation.rb +3 -4
- data/lib/active_merchant/billing/gateways/payu_in.rb +3 -3
- data/lib/active_merchant/billing/gateways/payu_latam.rb +21 -11
- data/lib/active_merchant/billing/gateways/payway.rb +8 -9
- data/lib/active_merchant/billing/gateways/plugnpay.rb +2 -3
- data/lib/active_merchant/billing/gateways/pro_pay.rb +8 -8
- data/lib/active_merchant/billing/gateways/psigate.rb +3 -4
- data/lib/active_merchant/billing/gateways/psl_card.rb +1 -2
- data/lib/active_merchant/billing/gateways/qbms.rb +4 -5
- data/lib/active_merchant/billing/gateways/quantum.rb +1 -2
- data/lib/active_merchant/billing/gateways/quickbooks.rb +4 -3
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb +3 -4
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_v4to7.rb +1 -2
- data/lib/active_merchant/billing/gateways/qvalent.rb +9 -9
- data/lib/active_merchant/billing/gateways/realex.rb +2 -1
- data/lib/active_merchant/billing/gateways/redsys.rb +7 -7
- data/lib/active_merchant/billing/gateways/s5.rb +7 -7
- data/lib/active_merchant/billing/gateways/safe_charge.rb +12 -12
- data/lib/active_merchant/billing/gateways/sage.rb +3 -5
- data/lib/active_merchant/billing/gateways/sage_pay.rb +6 -7
- data/lib/active_merchant/billing/gateways/sallie_mae.rb +1 -2
- data/lib/active_merchant/billing/gateways/secure_net.rb +1 -2
- data/lib/active_merchant/billing/gateways/secure_pay.rb +3 -4
- data/lib/active_merchant/billing/gateways/secure_pay_au.rb +2 -4
- data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +1 -2
- data/lib/active_merchant/billing/gateways/securion_pay.rb +5 -6
- data/lib/active_merchant/billing/gateways/skip_jack.rb +3 -4
- data/lib/active_merchant/billing/gateways/smart_ps.rb +5 -6
- data/lib/active_merchant/billing/gateways/so_easy_pay.rb +7 -7
- data/lib/active_merchant/billing/gateways/spreedly_core.rb +6 -6
- data/lib/active_merchant/billing/gateways/stripe.rb +11 -11
- data/lib/active_merchant/billing/gateways/stripe_payment_intents.rb +9 -0
- data/lib/active_merchant/billing/gateways/swipe_checkout.rb +3 -4
- data/lib/active_merchant/billing/gateways/telr.rb +9 -9
- data/lib/active_merchant/billing/gateways/trans_first.rb +3 -3
- data/lib/active_merchant/billing/gateways/trans_first_transaction_express.rb +14 -14
- data/lib/active_merchant/billing/gateways/transact_pro.rb +9 -9
- data/lib/active_merchant/billing/gateways/trust_commerce.rb +8 -9
- data/lib/active_merchant/billing/gateways/usa_epay.rb +1 -1
- data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +36 -36
- data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +4 -5
- data/lib/active_merchant/billing/gateways/vanco.rb +3 -3
- data/lib/active_merchant/billing/gateways/verifi.rb +1 -2
- data/lib/active_merchant/billing/gateways/viaklix.rb +1 -2
- data/lib/active_merchant/billing/gateways/visanet_peru.rb +10 -10
- data/lib/active_merchant/billing/gateways/webpay.rb +2 -2
- data/lib/active_merchant/billing/gateways/wepay.rb +3 -2
- data/lib/active_merchant/billing/gateways/wirecard.rb +1 -2
- data/lib/active_merchant/billing/gateways/worldpay.rb +12 -8
- data/lib/active_merchant/billing/gateways/worldpay_online_payments.rb +14 -16
- data/lib/active_merchant/billing/gateways/worldpay_us.rb +9 -9
- data/lib/active_merchant/billing/response.rb +1 -1
- data/lib/active_merchant/country.rb +1 -1
- data/lib/active_merchant/network_connection_retries.rb +2 -2
- data/lib/active_merchant/post_data.rb +1 -1
- data/lib/active_merchant/posts_data.rb +1 -1
- data/lib/active_merchant/version.rb +1 -1
- data/lib/support/ssl_verify.rb +2 -2
- data/lib/support/ssl_version.rb +2 -2
- metadata +16 -2
@@ -56,7 +56,7 @@ module ActiveMerchant #:nodoc:
|
|
56
56
|
commit("gateways/#{@options[:gateway_token]}/authorize.xml", request)
|
57
57
|
end
|
58
58
|
|
59
|
-
def capture(money, authorization, options={})
|
59
|
+
def capture(money, authorization, options = {})
|
60
60
|
request = build_xml_request('transaction') do |doc|
|
61
61
|
add_invoice(doc, money, options)
|
62
62
|
end
|
@@ -64,7 +64,7 @@ module ActiveMerchant #:nodoc:
|
|
64
64
|
commit("transactions/#{authorization}/capture.xml", request)
|
65
65
|
end
|
66
66
|
|
67
|
-
def refund(money, authorization, options={})
|
67
|
+
def refund(money, authorization, options = {})
|
68
68
|
request = build_xml_request('transaction') do |doc|
|
69
69
|
add_invoice(doc, money, options)
|
70
70
|
add_extra_options(:gateway_specific_fields, doc, options)
|
@@ -73,7 +73,7 @@ module ActiveMerchant #:nodoc:
|
|
73
73
|
commit("transactions/#{authorization}/credit.xml", request)
|
74
74
|
end
|
75
75
|
|
76
|
-
def void(authorization, options={})
|
76
|
+
def void(authorization, options = {})
|
77
77
|
commit("transactions/#{authorization}/void.xml", '')
|
78
78
|
end
|
79
79
|
|
@@ -98,7 +98,7 @@ module ActiveMerchant #:nodoc:
|
|
98
98
|
#
|
99
99
|
# credit_card - The CreditCard to store
|
100
100
|
# options - A standard ActiveMerchant options hash
|
101
|
-
def store(credit_card, options={})
|
101
|
+
def store(credit_card, options = {})
|
102
102
|
retain = (options.has_key?(:retain) ? options[:retain] : true)
|
103
103
|
save_card(retain, credit_card, options)
|
104
104
|
end
|
@@ -108,7 +108,7 @@ module ActiveMerchant #:nodoc:
|
|
108
108
|
#
|
109
109
|
# credit_card - The CreditCard to store
|
110
110
|
# options - A standard ActiveMerchant options hash
|
111
|
-
def unstore(authorization, options={})
|
111
|
+
def unstore(authorization, options = {})
|
112
112
|
commit("payment_methods/#{authorization}/redact.xml", '', :put)
|
113
113
|
end
|
114
114
|
|
@@ -117,7 +117,7 @@ module ActiveMerchant #:nodoc:
|
|
117
117
|
commit("transactions/#{transaction_token}.xml", nil, :get)
|
118
118
|
end
|
119
119
|
|
120
|
-
|
120
|
+
alias status find
|
121
121
|
|
122
122
|
def supports_scrubbing?
|
123
123
|
true
|
@@ -53,7 +53,7 @@ module ActiveMerchant #:nodoc:
|
|
53
53
|
|
54
54
|
BANK_ACCOUNT_HOLDER_TYPE_MAPPING = {
|
55
55
|
'personal' => 'individual',
|
56
|
-
'business' => 'company'
|
56
|
+
'business' => 'company'
|
57
57
|
}
|
58
58
|
|
59
59
|
MINIMUM_AUTHORIZE_AMOUNTS = {
|
@@ -221,7 +221,7 @@ module ActiveMerchant #:nodoc:
|
|
221
221
|
# The /cards endpoint does not update other customer parameters.
|
222
222
|
r.process { commit(:post, "customers/#{CGI.escape(options[:customer])}/cards", params, options) }
|
223
223
|
|
224
|
-
post[:default_card] = r.params['id'] if options[:set_default]
|
224
|
+
post[:default_card] = r.params['id'] if options[:set_default] && r.success? && !r.params['id'].blank?
|
225
225
|
|
226
226
|
r.process { update_customer(options[:customer], post) } if post.count > 0
|
227
227
|
end
|
@@ -309,8 +309,8 @@ module ActiveMerchant #:nodoc:
|
|
309
309
|
add_creditcard(post, payment, options, true)
|
310
310
|
add_source_owner(post, payment, options)
|
311
311
|
elsif type == 'three_d_secure'
|
312
|
-
post[:three_d_secure] = {card: payment}
|
313
|
-
post[:redirect] = {return_url: options[:redirect_url]}
|
312
|
+
post[:three_d_secure] = { card: payment }
|
313
|
+
post[:redirect] = { return_url: options[:redirect_url] }
|
314
314
|
end
|
315
315
|
commit(:post, 'sources', post, options)
|
316
316
|
end
|
@@ -560,11 +560,12 @@ module ActiveMerchant #:nodoc:
|
|
560
560
|
end
|
561
561
|
|
562
562
|
def add_connected_account(post, options = {})
|
563
|
+
post[:on_behalf_of] = options[:on_behalf_of] if options[:on_behalf_of]
|
564
|
+
|
563
565
|
return unless options[:transfer_destination]
|
564
566
|
|
565
567
|
post[:transfer_data] = { destination: options[:transfer_destination] }
|
566
568
|
post[:transfer_data][:amount] = options[:transfer_amount] if options[:transfer_amount]
|
567
|
-
post[:on_behalf_of] = options[:on_behalf_of] if options[:on_behalf_of]
|
568
569
|
post[:transfer_group] = options[:transfer_group] if options[:transfer_group]
|
569
570
|
post[:application_fee_amount] = options[:application_fee_amount] if options[:application_fee_amount]
|
570
571
|
end
|
@@ -617,7 +618,7 @@ module ActiveMerchant #:nodoc:
|
|
617
618
|
'User-Agent' => "Stripe/v1 ActiveMerchantBindings/#{ActiveMerchant::VERSION}",
|
618
619
|
'Stripe-Version' => api_version(options),
|
619
620
|
'X-Stripe-Client-User-Agent' => stripe_client_user_agent(options),
|
620
|
-
'X-Stripe-Client-User-Metadata' => {ip: options[:ip]}.to_json
|
621
|
+
'X-Stripe-Client-User-Metadata' => { ip: options[:ip] }.to_json
|
621
622
|
}
|
622
623
|
headers['Idempotency-Key'] = idempotency_key if idempotency_key
|
623
624
|
headers['Stripe-Account'] = options[:stripe_account] if options[:stripe_account]
|
@@ -627,7 +628,7 @@ module ActiveMerchant #:nodoc:
|
|
627
628
|
def stripe_client_user_agent(options)
|
628
629
|
return user_agent unless options[:application]
|
629
630
|
|
630
|
-
JSON.dump(JSON.parse(user_agent).merge!({application: options[:application]}))
|
631
|
+
JSON.dump(JSON.parse(user_agent).merge!({ application: options[:application] }))
|
631
632
|
end
|
632
633
|
|
633
634
|
def api_version(options)
|
@@ -666,8 +667,7 @@ module ActiveMerchant #:nodoc:
|
|
666
667
|
avs_result: { code: avs_code },
|
667
668
|
cvv_result: cvc_code,
|
668
669
|
emv_authorization: emv_authorization_from_response(response),
|
669
|
-
error_code: success ? nil : error_code_from(response)
|
670
|
-
)
|
670
|
+
error_code: success ? nil : error_code_from(response))
|
671
671
|
end
|
672
672
|
|
673
673
|
def authorization_from(success, url, method, response)
|
@@ -683,7 +683,7 @@ module ActiveMerchant #:nodoc:
|
|
683
683
|
end
|
684
684
|
|
685
685
|
def message_from(success, response)
|
686
|
-
success ? 'Transaction approved' : response.fetch('error', {'message' => 'No error details'})['message']
|
686
|
+
success ? 'Transaction approved' : response.fetch('error', { 'message' => 'No error details' })['message']
|
687
687
|
end
|
688
688
|
|
689
689
|
def success_from(response, options)
|
@@ -755,7 +755,7 @@ module ActiveMerchant #:nodoc:
|
|
755
755
|
currency: 'usd',
|
756
756
|
routing_number: bank_account.routing_number,
|
757
757
|
name: bank_account.name,
|
758
|
-
account_holder_type: account_holder_type
|
758
|
+
account_holder_type: account_holder_type
|
759
759
|
}
|
760
760
|
}
|
761
761
|
|
@@ -29,6 +29,7 @@ module ActiveMerchant #:nodoc:
|
|
29
29
|
add_shipping_address(post, options)
|
30
30
|
setup_future_usage(post, options)
|
31
31
|
add_exemption(post, options)
|
32
|
+
request_three_d_secure(post, options)
|
32
33
|
|
33
34
|
CREATE_INTENT_ATTRIBUTES.each do |attribute|
|
34
35
|
add_whitelisted_attribute(post, options, attribute)
|
@@ -267,6 +268,14 @@ module ActiveMerchant #:nodoc:
|
|
267
268
|
post[:payment_method_options][:card][:moto] = true if options[:moto]
|
268
269
|
end
|
269
270
|
|
271
|
+
def request_three_d_secure(post, options = {})
|
272
|
+
return unless options[:request_three_d_secure] && %w(any automatic).include?(options[:request_three_d_secure])
|
273
|
+
|
274
|
+
post[:payment_method_options] ||= {}
|
275
|
+
post[:payment_method_options][:card] ||= {}
|
276
|
+
post[:payment_method_options][:card][:request_three_d_secure] = options[:request_three_d_secure]
|
277
|
+
end
|
278
|
+
|
270
279
|
def setup_future_usage(post, options = {})
|
271
280
|
post[:setup_future_usage] = options[:setup_future_usage] if %w(on_session off_session).include?(options[:setup_future_usage])
|
272
281
|
post[:off_session] = options[:off_session] if options[:off_session] && options[:confirm] == true
|
@@ -109,8 +109,7 @@ module ActiveMerchant #:nodoc:
|
|
109
109
|
TRANSACTION_APPROVED_MSG :
|
110
110
|
TRANSACTION_DECLINED_MSG,
|
111
111
|
response,
|
112
|
-
test: test?
|
113
|
-
)
|
112
|
+
test: test?)
|
114
113
|
else
|
115
114
|
build_error_response(message, response)
|
116
115
|
end
|
@@ -125,7 +124,7 @@ module ActiveMerchant #:nodoc:
|
|
125
124
|
end
|
126
125
|
end
|
127
126
|
|
128
|
-
def call_api(api, params=nil)
|
127
|
+
def call_api(api, params = nil)
|
129
128
|
params ||= {}
|
130
129
|
params[:merchant_id] = @options[:login]
|
131
130
|
params[:api_key] = @options[:api_key]
|
@@ -139,7 +138,7 @@ module ActiveMerchant #:nodoc:
|
|
139
138
|
(test? ? self.test_url : self.live_url) + api
|
140
139
|
end
|
141
140
|
|
142
|
-
def build_error_response(message, params={})
|
141
|
+
def build_error_response(message, params = {})
|
143
142
|
Response.new(
|
144
143
|
false,
|
145
144
|
message,
|
@@ -17,7 +17,7 @@ module ActiveMerchant #:nodoc:
|
|
17
17
|
'Y' => 'M',
|
18
18
|
'N' => 'N',
|
19
19
|
'X' => 'P',
|
20
|
-
'E' => 'U'
|
20
|
+
'E' => 'U'
|
21
21
|
}
|
22
22
|
|
23
23
|
AVS_CODE_TRANSLATOR = {
|
@@ -28,12 +28,12 @@ module ActiveMerchant #:nodoc:
|
|
28
28
|
'E' => 'R'
|
29
29
|
}
|
30
30
|
|
31
|
-
def initialize(options={})
|
31
|
+
def initialize(options = {})
|
32
32
|
requires!(options, :merchant_id, :api_key)
|
33
33
|
super
|
34
34
|
end
|
35
35
|
|
36
|
-
def purchase(amount, payment_method, options={})
|
36
|
+
def purchase(amount, payment_method, options = {})
|
37
37
|
commit(:purchase, amount, options[:currency]) do |doc|
|
38
38
|
add_invoice(doc, 'sale', amount, payment_method, options)
|
39
39
|
add_payment_method(doc, payment_method, options)
|
@@ -41,7 +41,7 @@ module ActiveMerchant #:nodoc:
|
|
41
41
|
end
|
42
42
|
end
|
43
43
|
|
44
|
-
def authorize(amount, payment_method, options={})
|
44
|
+
def authorize(amount, payment_method, options = {})
|
45
45
|
commit(:authorize, amount, options[:currency]) do |doc|
|
46
46
|
add_invoice(doc, 'auth', amount, payment_method, options)
|
47
47
|
add_payment_method(doc, payment_method, options)
|
@@ -49,26 +49,26 @@ module ActiveMerchant #:nodoc:
|
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
52
|
-
def capture(amount, authorization, options={})
|
52
|
+
def capture(amount, authorization, options = {})
|
53
53
|
commit(:capture) do |doc|
|
54
54
|
add_invoice(doc, 'capture', amount, authorization, options)
|
55
55
|
end
|
56
56
|
end
|
57
57
|
|
58
|
-
def void(authorization, options={})
|
58
|
+
def void(authorization, options = {})
|
59
59
|
_, amount, currency = split_authorization(authorization)
|
60
60
|
commit(:void) do |doc|
|
61
61
|
add_invoice(doc, 'void', amount.to_i, authorization, options.merge(currency: currency))
|
62
62
|
end
|
63
63
|
end
|
64
64
|
|
65
|
-
def refund(amount, authorization, options={})
|
65
|
+
def refund(amount, authorization, options = {})
|
66
66
|
commit(:refund) do |doc|
|
67
67
|
add_invoice(doc, 'refund', amount, authorization, options)
|
68
68
|
end
|
69
69
|
end
|
70
70
|
|
71
|
-
def verify(credit_card, options={})
|
71
|
+
def verify(credit_card, options = {})
|
72
72
|
commit(:verify) do |doc|
|
73
73
|
add_invoice(doc, 'verify', 100, credit_card, options)
|
74
74
|
add_payment_method(doc, credit_card, options)
|
@@ -162,7 +162,7 @@ module ActiveMerchant #:nodoc:
|
|
162
162
|
country.code(:alpha2)
|
163
163
|
end
|
164
164
|
|
165
|
-
def commit(action, amount=nil, currency=nil)
|
165
|
+
def commit(action, amount = nil, currency = nil)
|
166
166
|
currency = default_currency if currency == nil
|
167
167
|
request = build_xml_request { |doc| yield(doc) }
|
168
168
|
response = ssl_post(live_url, request, headers)
|
@@ -18,7 +18,7 @@ module ActiveMerchant #:nodoc:
|
|
18
18
|
purchase_echeck: 'ACHDebit',
|
19
19
|
refund: 'CreditCardCredit',
|
20
20
|
refund_echeck: 'ACHVoidTransaction',
|
21
|
-
void: 'CreditCardAutoRefundorVoid'
|
21
|
+
void: 'CreditCardAutoRefundorVoid'
|
22
22
|
}
|
23
23
|
|
24
24
|
ENDPOINTS = {
|
@@ -46,7 +46,7 @@ module ActiveMerchant #:nodoc:
|
|
46
46
|
commit((payment.is_a?(Check) ? :purchase_echeck : :purchase), post)
|
47
47
|
end
|
48
48
|
|
49
|
-
def refund(money, authorization, options={})
|
49
|
+
def refund(money, authorization, options = {})
|
50
50
|
post = {}
|
51
51
|
|
52
52
|
transaction_id, payment_type = split_authorization(authorization)
|
@@ -57,7 +57,7 @@ module ActiveMerchant #:nodoc:
|
|
57
57
|
commit((payment_type == 'check' ? :refund_echeck : :refund), post)
|
58
58
|
end
|
59
59
|
|
60
|
-
def void(authorization, options={})
|
60
|
+
def void(authorization, options = {})
|
61
61
|
post = {}
|
62
62
|
|
63
63
|
transaction_id, = split_authorization(authorization)
|
@@ -152,7 +152,7 @@ module ActiveMerchant #:nodoc:
|
|
152
152
|
'R1' => 'The transaction was declined or returned, because the cardholder requested that payment of all recurring or installment payment transactions for a specific merchant account be stopped/ Reserved for client-specific use (declined)',
|
153
153
|
'Q1' => 'Card Authentication failed/ Reserved for client-specific use (declined)',
|
154
154
|
'XA' => 'Forward to Issuer/ Reserved for client-specific use (declined)',
|
155
|
-
'XD' => 'Forward to Issuer/ Reserved for client-specific use (declined)'
|
155
|
+
'XD' => 'Forward to Issuer/ Reserved for client-specific use (declined)'
|
156
156
|
}
|
157
157
|
|
158
158
|
EXTENDED_RESPONSE_MESSAGES = {
|
@@ -179,15 +179,15 @@ module ActiveMerchant #:nodoc:
|
|
179
179
|
refund_echeck: 16,
|
180
180
|
void_echeck: 16,
|
181
181
|
|
182
|
-
wallet_sale: 14
|
182
|
+
wallet_sale: 14
|
183
183
|
}
|
184
184
|
|
185
|
-
def initialize(options={})
|
185
|
+
def initialize(options = {})
|
186
186
|
requires!(options, :gateway_id, :reg_key)
|
187
187
|
super
|
188
188
|
end
|
189
189
|
|
190
|
-
def purchase(amount, payment_method, options={})
|
190
|
+
def purchase(amount, payment_method, options = {})
|
191
191
|
if credit_card?(payment_method)
|
192
192
|
action = :purchase
|
193
193
|
request = build_xml_transaction_request do |doc|
|
@@ -216,7 +216,7 @@ module ActiveMerchant #:nodoc:
|
|
216
216
|
commit(action, request)
|
217
217
|
end
|
218
218
|
|
219
|
-
def authorize(amount, payment_method, options={})
|
219
|
+
def authorize(amount, payment_method, options = {})
|
220
220
|
if credit_card?(payment_method)
|
221
221
|
request = build_xml_transaction_request do |doc|
|
222
222
|
add_credit_card(doc, payment_method)
|
@@ -234,7 +234,7 @@ module ActiveMerchant #:nodoc:
|
|
234
234
|
commit(:authorize, request)
|
235
235
|
end
|
236
236
|
|
237
|
-
def capture(amount, authorization, options={})
|
237
|
+
def capture(amount, authorization, options = {})
|
238
238
|
transaction_id = split_authorization(authorization)[1]
|
239
239
|
request = build_xml_transaction_request do |doc|
|
240
240
|
add_amount(doc, amount)
|
@@ -244,7 +244,7 @@ module ActiveMerchant #:nodoc:
|
|
244
244
|
commit(:capture, request)
|
245
245
|
end
|
246
246
|
|
247
|
-
def void(authorization, options={})
|
247
|
+
def void(authorization, options = {})
|
248
248
|
action, transaction_id = split_authorization(authorization)
|
249
249
|
|
250
250
|
request = build_xml_transaction_request do |doc|
|
@@ -254,7 +254,7 @@ module ActiveMerchant #:nodoc:
|
|
254
254
|
commit(void_type(action), request)
|
255
255
|
end
|
256
256
|
|
257
|
-
def refund(amount, authorization, options={})
|
257
|
+
def refund(amount, authorization, options = {})
|
258
258
|
action, transaction_id = split_authorization(authorization)
|
259
259
|
|
260
260
|
request = build_xml_transaction_request do |doc|
|
@@ -265,7 +265,7 @@ module ActiveMerchant #:nodoc:
|
|
265
265
|
commit(refund_type(action), request)
|
266
266
|
end
|
267
267
|
|
268
|
-
def credit(amount, payment_method, options={})
|
268
|
+
def credit(amount, payment_method, options = {})
|
269
269
|
request = build_xml_transaction_request do |doc|
|
270
270
|
add_pan(doc, payment_method)
|
271
271
|
add_amount(doc, amount)
|
@@ -274,7 +274,7 @@ module ActiveMerchant #:nodoc:
|
|
274
274
|
commit(:credit, request)
|
275
275
|
end
|
276
276
|
|
277
|
-
def verify(credit_card, options={})
|
277
|
+
def verify(credit_card, options = {})
|
278
278
|
request = build_xml_transaction_request do |doc|
|
279
279
|
add_credit_card(doc, credit_card)
|
280
280
|
add_contact(doc, credit_card.name, options)
|
@@ -283,7 +283,7 @@ module ActiveMerchant #:nodoc:
|
|
283
283
|
commit(:verify, request)
|
284
284
|
end
|
285
285
|
|
286
|
-
def store(payment_method, options={})
|
286
|
+
def store(payment_method, options = {})
|
287
287
|
store_customer_request = build_xml_payment_storage_request do |doc|
|
288
288
|
store_customer_details(doc, payment_method.name, options)
|
289
289
|
end
|
@@ -322,7 +322,7 @@ module ActiveMerchant #:nodoc:
|
|
322
322
|
|
323
323
|
private
|
324
324
|
|
325
|
-
CURRENCY_CODES = Hash.new { |
|
325
|
+
CURRENCY_CODES = Hash.new { |_h, k| raise ArgumentError.new("Unsupported currency: #{k}") }
|
326
326
|
CURRENCY_CODES['USD'] = '840'
|
327
327
|
|
328
328
|
def headers
|
@@ -462,7 +462,7 @@ module ActiveMerchant #:nodoc:
|
|
462
462
|
end
|
463
463
|
end
|
464
464
|
|
465
|
-
def build_xml_request(wrapper, merchant_product_type=nil)
|
465
|
+
def build_xml_request(wrapper, merchant_product_type = nil)
|
466
466
|
Nokogiri::XML::Builder.new(encoding: 'UTF-8') do |xml|
|
467
467
|
xml['soapenv'].Envelope('xmlns:soapenv' => SOAPENV_NAMESPACE) do
|
468
468
|
xml['soapenv'].Body do
|
@@ -485,7 +485,7 @@ module ActiveMerchant #:nodoc:
|
|
485
485
|
doc.root.to_xml
|
486
486
|
end
|
487
487
|
|
488
|
-
def add_merchant(doc, product_type=nil)
|
488
|
+
def add_merchant(doc, product_type = nil)
|
489
489
|
doc['v1'].merc do
|
490
490
|
doc['v1'].id @options[:gateway_id]
|
491
491
|
doc['v1'].regKey @options[:reg_key]
|
@@ -17,12 +17,12 @@ module ActiveMerchant #:nodoc:
|
|
17
17
|
self.homepage_url = 'https://www.transactpro.lv/business/online-payments-acceptance'
|
18
18
|
self.display_name = 'Transact Pro'
|
19
19
|
|
20
|
-
def initialize(options={})
|
20
|
+
def initialize(options = {})
|
21
21
|
requires!(options, :guid, :password, :terminal)
|
22
22
|
super
|
23
23
|
end
|
24
24
|
|
25
|
-
def purchase(amount, payment, options={})
|
25
|
+
def purchase(amount, payment, options = {})
|
26
26
|
post = PostData.new
|
27
27
|
add_invoice(post, amount, options)
|
28
28
|
add_payment(post, payment)
|
@@ -44,7 +44,7 @@ module ActiveMerchant #:nodoc:
|
|
44
44
|
end
|
45
45
|
end
|
46
46
|
|
47
|
-
def authorize(amount, payment, options={})
|
47
|
+
def authorize(amount, payment, options = {})
|
48
48
|
post = PostData.new
|
49
49
|
add_invoice(post, amount, options)
|
50
50
|
add_payment(post, payment)
|
@@ -66,7 +66,7 @@ module ActiveMerchant #:nodoc:
|
|
66
66
|
end
|
67
67
|
end
|
68
68
|
|
69
|
-
def capture(amount, authorization, options={})
|
69
|
+
def capture(amount, authorization, options = {})
|
70
70
|
identifier, original_amount = split_authorization(authorization)
|
71
71
|
raise ArgumentError.new("Partial capture is not supported, and #{amount.inspect} != #{original_amount.inspect}") if amount && (amount != original_amount)
|
72
72
|
|
@@ -78,7 +78,7 @@ module ActiveMerchant #:nodoc:
|
|
78
78
|
commit('charge_hold', post, original_amount)
|
79
79
|
end
|
80
80
|
|
81
|
-
def refund(amount, authorization, options={})
|
81
|
+
def refund(amount, authorization, options = {})
|
82
82
|
identifier, original_amount = split_authorization(authorization)
|
83
83
|
|
84
84
|
post = PostData.new
|
@@ -89,7 +89,7 @@ module ActiveMerchant #:nodoc:
|
|
89
89
|
commit('refund', post)
|
90
90
|
end
|
91
91
|
|
92
|
-
def void(authorization, options={})
|
92
|
+
def void(authorization, options = {})
|
93
93
|
identifier, amount = split_authorization(authorization)
|
94
94
|
|
95
95
|
post = PostData.new
|
@@ -99,7 +99,7 @@ module ActiveMerchant #:nodoc:
|
|
99
99
|
commit('cancel_dms', post)
|
100
100
|
end
|
101
101
|
|
102
|
-
def verify(credit_card, options={})
|
102
|
+
def verify(credit_card, options = {})
|
103
103
|
MultiResponse.run(:use_first_response) do |r|
|
104
104
|
r.process { authorize(100, credit_card, options) }
|
105
105
|
r.process(:ignore_result) { void(r.authorization, options) }
|
@@ -156,7 +156,7 @@ module ActiveMerchant #:nodoc:
|
|
156
156
|
post[:expire] = "#{month}/#{year[2..3]}"
|
157
157
|
end
|
158
158
|
|
159
|
-
def add_credentials(post, key
|
159
|
+
def add_credentials(post, key = :guid)
|
160
160
|
post[key] = @options[:guid]
|
161
161
|
post[:pwd] = Digest::SHA1.hexdigest(@options[:password])
|
162
162
|
end
|
@@ -176,7 +176,7 @@ module ActiveMerchant #:nodoc:
|
|
176
176
|
end
|
177
177
|
end
|
178
178
|
|
179
|
-
def commit(action, parameters, amount=nil)
|
179
|
+
def commit(action, parameters, amount = nil)
|
180
180
|
url = (test? ? test_url : live_url)
|
181
181
|
response = parse(ssl_post(url, post_data(action, parameters)))
|
182
182
|
|