activemerchant 1.133.0 → 1.138.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG +450 -0
- data/CONTRIBUTORS +1 -0
- data/lib/active_merchant/billing/apple_pay_payment_token.rb +2 -2
- data/lib/active_merchant/billing/base.rb +2 -2
- data/lib/active_merchant/billing/check.rb +16 -4
- data/lib/active_merchant/billing/compatibility.rb +4 -4
- data/lib/active_merchant/billing/credit_card.rb +35 -16
- data/lib/active_merchant/billing/credit_card_formatting.rb +13 -2
- data/lib/active_merchant/billing/credit_card_methods.rb +74 -19
- data/lib/active_merchant/billing/gateway.rb +22 -2
- data/lib/active_merchant/billing/gateways/adyen.rb +282 -87
- data/lib/active_merchant/billing/gateways/airwallex.rb +46 -25
- data/lib/active_merchant/billing/gateways/alelo.rb +29 -11
- data/lib/active_merchant/billing/gateways/allied_wallet.rb +2 -2
- data/lib/active_merchant/billing/gateways/authorize_net.rb +49 -41
- data/lib/active_merchant/billing/gateways/authorize_net_arb.rb +14 -10
- data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +3 -5
- data/lib/active_merchant/billing/gateways/axcessms.rb +9 -5
- data/lib/active_merchant/billing/gateways/balanced.rb +2 -2
- data/lib/active_merchant/billing/gateways/bambora_apac.rb +2 -2
- data/lib/active_merchant/billing/gateways/bank_frick.rb +2 -2
- data/lib/active_merchant/billing/gateways/banwire.rb +6 -4
- data/lib/active_merchant/billing/gateways/barclaycard_smartpay.rb +8 -8
- data/lib/active_merchant/billing/gateways/barclays_epdq_extra_plus.rb +2 -2
- data/lib/active_merchant/billing/gateways/be2bill.rb +2 -2
- data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +12 -8
- data/lib/active_merchant/billing/gateways/beanstream.rb +2 -2
- data/lib/active_merchant/billing/gateways/beanstream_interac.rb +2 -2
- data/lib/active_merchant/billing/gateways/blue_pay.rb +15 -7
- data/lib/active_merchant/billing/gateways/blue_snap.rb +5 -5
- data/lib/active_merchant/billing/gateways/bogus.rb +2 -2
- data/lib/active_merchant/billing/gateways/borgun.rb +2 -2
- data/lib/active_merchant/billing/gateways/bpoint.rb +2 -2
- data/lib/active_merchant/billing/gateways/braintree/braintree_common.rb +3 -1
- data/lib/active_merchant/billing/gateways/braintree/token_nonce.rb +68 -23
- data/lib/active_merchant/billing/gateways/braintree.rb +2 -2
- data/lib/active_merchant/billing/gateways/braintree_blue.rb +266 -89
- data/lib/active_merchant/billing/gateways/braintree_orange.rb +3 -3
- data/lib/active_merchant/billing/gateways/bridge_pay.rb +2 -2
- data/lib/active_merchant/billing/gateways/cams.rb +2 -2
- data/lib/active_merchant/billing/gateways/card_connect.rb +7 -4
- data/lib/active_merchant/billing/gateways/card_save.rb +2 -2
- data/lib/active_merchant/billing/gateways/card_stream.rb +12 -13
- data/lib/active_merchant/billing/gateways/cardknox.rb +2 -2
- data/lib/active_merchant/billing/gateways/cardprocess.rb +2 -2
- data/lib/active_merchant/billing/gateways/cashnet.rb +4 -4
- data/lib/active_merchant/billing/gateways/cc5.rb +2 -2
- data/lib/active_merchant/billing/gateways/cecabank/cecabank_common.rb +36 -0
- data/lib/active_merchant/billing/gateways/cecabank/cecabank_json.rb +331 -0
- data/lib/active_merchant/billing/gateways/cecabank/cecabank_xml.rb +220 -0
- data/lib/active_merchant/billing/gateways/cecabank.rb +9 -242
- data/lib/active_merchant/billing/gateways/cenpos.rb +9 -3
- data/lib/active_merchant/billing/gateways/checkout.rb +5 -5
- data/lib/active_merchant/billing/gateways/checkout_v2.rb +362 -50
- data/lib/active_merchant/billing/gateways/clearhaus.rb +2 -2
- data/lib/active_merchant/billing/gateways/commerce_hub.rb +117 -35
- data/lib/active_merchant/billing/gateways/commercegate.rb +4 -4
- data/lib/active_merchant/billing/gateways/conekta.rb +2 -2
- data/lib/active_merchant/billing/gateways/creditcall.rb +2 -2
- data/lib/active_merchant/billing/gateways/credorax.rb +109 -20
- data/lib/active_merchant/billing/gateways/ct_payment.rb +6 -6
- data/lib/active_merchant/billing/gateways/culqi.rb +2 -2
- data/lib/active_merchant/billing/gateways/cyber_source/cyber_source_common.rb +2 -2
- data/lib/active_merchant/billing/gateways/cyber_source.rb +379 -100
- data/lib/active_merchant/billing/gateways/cyber_source_rest.rb +147 -76
- data/lib/active_merchant/billing/gateways/d_local.rb +45 -22
- data/lib/active_merchant/billing/gateways/data_cash.rb +22 -18
- data/lib/active_merchant/billing/gateways/datatrans.rb +284 -0
- data/lib/active_merchant/billing/gateways/decidir.rb +82 -46
- data/lib/active_merchant/billing/gateways/decidir_plus.rb +31 -35
- data/lib/active_merchant/billing/gateways/deepstack.rb +382 -0
- data/lib/active_merchant/billing/gateways/dibs.rb +3 -3
- data/lib/active_merchant/billing/gateways/digitzs.rb +2 -2
- data/lib/active_merchant/billing/gateways/ebanx.rb +116 -68
- data/lib/active_merchant/billing/gateways/efsnet.rb +13 -8
- data/lib/active_merchant/billing/gateways/elavon.rb +80 -47
- data/lib/active_merchant/billing/gateways/element.rb +39 -10
- data/lib/active_merchant/billing/gateways/epay.rb +8 -4
- data/lib/active_merchant/billing/gateways/evo_ca.rb +8 -4
- data/lib/active_merchant/billing/gateways/eway.rb +6 -4
- data/lib/active_merchant/billing/gateways/eway_managed.rb +8 -4
- data/lib/active_merchant/billing/gateways/eway_rapid.rb +3 -3
- data/lib/active_merchant/billing/gateways/exact.rb +8 -4
- data/lib/active_merchant/billing/gateways/fat_zebra.rb +37 -7
- data/lib/active_merchant/billing/gateways/federated_canada.rb +8 -4
- data/lib/active_merchant/billing/gateways/finansbank.rb +2 -2
- data/lib/active_merchant/billing/gateways/first_giving.rb +2 -2
- data/lib/active_merchant/billing/gateways/first_pay/first_pay_common.rb +15 -0
- data/lib/active_merchant/billing/gateways/first_pay/first_pay_json.rb +190 -0
- data/lib/active_merchant/billing/gateways/first_pay/first_pay_xml.rb +183 -0
- data/lib/active_merchant/billing/gateways/first_pay.rb +8 -174
- data/lib/active_merchant/billing/gateways/firstdata_e4.rb +8 -4
- data/lib/active_merchant/billing/gateways/firstdata_e4_v27.rb +9 -5
- data/lib/active_merchant/billing/gateways/flex_charge.rb +359 -0
- data/lib/active_merchant/billing/gateways/flo2cash.rb +4 -2
- data/lib/active_merchant/billing/gateways/flo2cash_simple.rb +2 -2
- data/lib/active_merchant/billing/gateways/forte.rb +6 -4
- data/lib/active_merchant/billing/gateways/fortis.rb +347 -0
- data/lib/active_merchant/billing/gateways/garanti.rb +6 -4
- data/lib/active_merchant/billing/gateways/global_collect.rb +69 -50
- data/lib/active_merchant/billing/gateways/global_transport.rb +2 -2
- data/lib/active_merchant/billing/gateways/hdfc.rb +2 -2
- data/lib/active_merchant/billing/gateways/hi_pay.rb +287 -0
- data/lib/active_merchant/billing/gateways/hps.rb +40 -47
- data/lib/active_merchant/billing/gateways/iats_payments.rb +9 -4
- data/lib/active_merchant/billing/gateways/in_context_paypal_express.rb +2 -2
- data/lib/active_merchant/billing/gateways/inspire.rb +8 -6
- data/lib/active_merchant/billing/gateways/instapay.rb +9 -6
- data/lib/active_merchant/billing/gateways/ipg.rb +14 -10
- data/lib/active_merchant/billing/gateways/ipp.rb +2 -2
- data/lib/active_merchant/billing/gateways/iridium.rb +18 -8
- data/lib/active_merchant/billing/gateways/itransact.rb +8 -4
- data/lib/active_merchant/billing/gateways/iveri.rb +12 -9
- data/lib/active_merchant/billing/gateways/ixopay.rb +4 -4
- data/lib/active_merchant/billing/gateways/jetpay.rb +6 -4
- data/lib/active_merchant/billing/gateways/jetpay_v2.rb +9 -6
- data/lib/active_merchant/billing/gateways/komoju.rb +2 -2
- data/lib/active_merchant/billing/gateways/kushki.rb +79 -16
- data/lib/active_merchant/billing/gateways/latitude19.rb +2 -2
- data/lib/active_merchant/billing/gateways/linkpoint.rb +8 -4
- data/lib/active_merchant/billing/gateways/litle.rb +37 -54
- data/lib/active_merchant/billing/gateways/loan_payment_pro.rb +267 -0
- data/lib/active_merchant/billing/gateways/loan_payment_pro_ach.rb +93 -0
- data/lib/active_merchant/billing/gateways/mastercard.rb +4 -4
- data/lib/active_merchant/billing/gateways/maxipago.rb +4 -4
- data/lib/active_merchant/billing/gateways/mercado_pago.rb +32 -11
- data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +10 -7
- data/lib/active_merchant/billing/gateways/merchant_one.rb +2 -2
- data/lib/active_merchant/billing/gateways/merchant_partners.rb +2 -2
- data/lib/active_merchant/billing/gateways/merchant_ware.rb +13 -6
- data/lib/active_merchant/billing/gateways/merchant_ware_version_four.rb +13 -6
- data/lib/active_merchant/billing/gateways/merchant_warrior.rb +21 -5
- data/lib/active_merchant/billing/gateways/mercury.rb +11 -5
- data/lib/active_merchant/billing/gateways/metrics_global.rb +10 -8
- data/lib/active_merchant/billing/gateways/micropayment.rb +2 -2
- data/lib/active_merchant/billing/gateways/migs/migs_codes.rb +7 -6
- data/lib/active_merchant/billing/gateways/migs.rb +8 -4
- data/lib/active_merchant/billing/gateways/mit.rb +10 -5
- data/lib/active_merchant/billing/gateways/modern_payments.rb +2 -2
- data/lib/active_merchant/billing/gateways/modern_payments_cim.rb +21 -13
- data/lib/active_merchant/billing/gateways/moka.rb +2 -2
- data/lib/active_merchant/billing/gateways/monei.rb +3 -3
- data/lib/active_merchant/billing/gateways/moneris.rb +11 -5
- data/lib/active_merchant/billing/gateways/money_movers.rb +8 -4
- data/lib/active_merchant/billing/gateways/multi_pay.rb +267 -0
- data/lib/active_merchant/billing/gateways/mundipagg.rb +5 -3
- data/lib/active_merchant/billing/gateways/nab_transact.rb +18 -10
- data/lib/active_merchant/billing/gateways/ncr_secure_pay.rb +2 -2
- data/lib/active_merchant/billing/gateways/net_registry.rb +6 -2
- data/lib/active_merchant/billing/gateways/netaxept.rb +4 -4
- data/lib/active_merchant/billing/gateways/netbanx.rb +4 -6
- data/lib/active_merchant/billing/gateways/netbilling.rb +8 -4
- data/lib/active_merchant/billing/gateways/netpay.rb +2 -2
- data/lib/active_merchant/billing/gateways/network_merchants.rb +9 -5
- data/lib/active_merchant/billing/gateways/nmi.rb +29 -8
- data/lib/active_merchant/billing/gateways/nuvei.rb +573 -0
- data/lib/active_merchant/billing/gateways/ogone.rb +8 -4
- data/lib/active_merchant/billing/gateways/omise.rb +2 -2
- data/lib/active_merchant/billing/gateways/openpay.rb +6 -4
- data/lib/active_merchant/billing/gateways/opp.rb +3 -4
- data/lib/active_merchant/billing/gateways/optimal_payment.rb +12 -6
- data/lib/active_merchant/billing/gateways/orbital/orbital_codes.rb +273 -0
- data/lib/active_merchant/billing/gateways/orbital/orbital_soft_descriptors.rb +3 -5
- data/lib/active_merchant/billing/gateways/orbital.rb +114 -94
- data/lib/active_merchant/billing/gateways/pac_net_raven.rb +9 -6
- data/lib/active_merchant/billing/gateways/pagarme.rb +2 -2
- data/lib/active_merchant/billing/gateways/pago_facil.rb +2 -2
- data/lib/active_merchant/billing/gateways/pay_arc.rb +9 -7
- data/lib/active_merchant/billing/gateways/pay_conex.rb +6 -4
- data/lib/active_merchant/billing/gateways/pay_gate_xml.rb +8 -4
- data/lib/active_merchant/billing/gateways/pay_hub.rb +7 -5
- data/lib/active_merchant/billing/gateways/pay_junction.rb +8 -4
- data/lib/active_merchant/billing/gateways/pay_junction_v2.rb +2 -2
- data/lib/active_merchant/billing/gateways/pay_secure.rb +8 -4
- data/lib/active_merchant/billing/gateways/pay_trace.rb +36 -22
- data/lib/active_merchant/billing/gateways/paybox_direct.rb +14 -14
- data/lib/active_merchant/billing/gateways/payeezy.rb +26 -13
- data/lib/active_merchant/billing/gateways/payex.rb +8 -6
- data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +3 -3
- data/lib/active_merchant/billing/gateways/payflow/payflow_express_response.rb +2 -2
- data/lib/active_merchant/billing/gateways/payflow/payflow_response.rb +2 -2
- data/lib/active_merchant/billing/gateways/payflow.rb +12 -11
- data/lib/active_merchant/billing/gateways/payflow_express.rb +2 -2
- data/lib/active_merchant/billing/gateways/payflow_express_uk.rb +2 -2
- data/lib/active_merchant/billing/gateways/payflow_uk.rb +2 -2
- data/lib/active_merchant/billing/gateways/payment_express.rb +10 -6
- data/lib/active_merchant/billing/gateways/paymentez.rb +30 -16
- data/lib/active_merchant/billing/gateways/paymill.rb +6 -4
- data/lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb +17 -12
- data/lib/active_merchant/billing/gateways/paypal/paypal_express_response.rb +2 -2
- data/lib/active_merchant/billing/gateways/paypal/paypal_recurring_api.rb +2 -2
- data/lib/active_merchant/billing/gateways/paypal.rb +4 -2
- data/lib/active_merchant/billing/gateways/paypal_ca.rb +2 -2
- data/lib/active_merchant/billing/gateways/paypal_digital_goods.rb +2 -2
- data/lib/active_merchant/billing/gateways/paypal_express.rb +4 -2
- data/lib/active_merchant/billing/gateways/paysafe.rb +48 -24
- data/lib/active_merchant/billing/gateways/payscout.rb +9 -6
- data/lib/active_merchant/billing/gateways/paystation.rb +9 -5
- data/lib/active_merchant/billing/gateways/payu_in.rb +2 -2
- data/lib/active_merchant/billing/gateways/payu_latam.rb +7 -5
- data/lib/active_merchant/billing/gateways/payway.rb +6 -2
- data/lib/active_merchant/billing/gateways/payway_dot_com.rb +6 -6
- data/lib/active_merchant/billing/gateways/pin.rb +126 -41
- data/lib/active_merchant/billing/gateways/plexo.rb +71 -20
- data/lib/active_merchant/billing/gateways/plugnpay.rb +6 -2
- data/lib/active_merchant/billing/gateways/priority.rb +29 -24
- data/lib/active_merchant/billing/gateways/pro_pay.rb +2 -2
- data/lib/active_merchant/billing/gateways/psigate.rb +8 -4
- data/lib/active_merchant/billing/gateways/psl_card.rb +6 -2
- data/lib/active_merchant/billing/gateways/qbms.rb +9 -5
- data/lib/active_merchant/billing/gateways/quantum.rb +9 -5
- data/lib/active_merchant/billing/gateways/quickbooks.rb +27 -17
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb +7 -4
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_v4to7.rb +8 -4
- data/lib/active_merchant/billing/gateways/quickpay.rb +2 -2
- data/lib/active_merchant/billing/gateways/qvalent.rb +2 -2
- data/lib/active_merchant/billing/gateways/rapyd.rb +172 -53
- data/lib/active_merchant/billing/gateways/reach.rb +16 -9
- data/lib/active_merchant/billing/gateways/redsys.rb +7 -15
- data/lib/active_merchant/billing/gateways/redsys_rest.rb +545 -0
- data/lib/active_merchant/billing/gateways/s5.rb +5 -5
- data/lib/active_merchant/billing/gateways/safe_charge.rb +47 -24
- data/lib/active_merchant/billing/gateways/sage.rb +14 -6
- data/lib/active_merchant/billing/gateways/sage_pay.rb +81 -7
- data/lib/active_merchant/billing/gateways/sallie_mae.rb +8 -4
- data/lib/active_merchant/billing/gateways/secure_net.rb +9 -5
- data/lib/active_merchant/billing/gateways/secure_pay.rb +10 -8
- data/lib/active_merchant/billing/gateways/secure_pay_au.rb +25 -15
- data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +8 -4
- data/lib/active_merchant/billing/gateways/securion_pay.rb +26 -12
- data/lib/active_merchant/billing/gateways/shift4.rb +34 -26
- data/lib/active_merchant/billing/gateways/shift4_v2.rb +117 -0
- data/lib/active_merchant/billing/gateways/simetrik.rb +26 -17
- data/lib/active_merchant/billing/gateways/skip_jack.rb +8 -4
- data/lib/active_merchant/billing/gateways/smart_ps.rb +10 -7
- data/lib/active_merchant/billing/gateways/so_easy_pay.rb +6 -4
- data/lib/active_merchant/billing/gateways/spreedly_core.rb +4 -6
- data/lib/active_merchant/billing/gateways/stripe.rb +88 -84
- data/lib/active_merchant/billing/gateways/stripe_payment_intents.rb +388 -77
- data/lib/active_merchant/billing/gateways/sum_up.rb +224 -0
- data/lib/active_merchant/billing/gateways/swipe_checkout.rb +6 -4
- data/lib/active_merchant/billing/gateways/telr.rb +6 -7
- data/lib/active_merchant/billing/gateways/trans_first.rb +6 -4
- data/lib/active_merchant/billing/gateways/trans_first_transaction_express.rb +10 -18
- data/lib/active_merchant/billing/gateways/transact_pro.rb +3 -3
- data/lib/active_merchant/billing/gateways/transax.rb +2 -2
- data/lib/active_merchant/billing/gateways/transnational.rb +2 -2
- data/lib/active_merchant/billing/gateways/trexle.rb +2 -2
- data/lib/active_merchant/billing/gateways/trust_commerce.rb +9 -5
- data/lib/active_merchant/billing/gateways/usa_epay.rb +2 -2
- data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +32 -31
- data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +8 -4
- data/lib/active_merchant/billing/gateways/vanco.rb +2 -4
- data/lib/active_merchant/billing/gateways/vantiv_express.rb +668 -0
- data/lib/active_merchant/billing/gateways/verifi.rb +12 -8
- data/lib/active_merchant/billing/gateways/versa_pay.rb +307 -0
- data/lib/active_merchant/billing/gateways/viaklix.rb +8 -4
- data/lib/active_merchant/billing/gateways/visanet_peru.rb +5 -5
- data/lib/active_merchant/billing/gateways/vpos.rb +25 -13
- data/lib/active_merchant/billing/gateways/webpay.rb +3 -3
- data/lib/active_merchant/billing/gateways/wepay.rb +6 -4
- data/lib/active_merchant/billing/gateways/wirecard.rb +10 -6
- data/lib/active_merchant/billing/gateways/wompi.rb +14 -7
- data/lib/active_merchant/billing/gateways/world_net.rb +2 -2
- data/lib/active_merchant/billing/gateways/worldpay.rb +297 -113
- data/lib/active_merchant/billing/gateways/worldpay_online_payments.rb +16 -13
- data/lib/active_merchant/billing/gateways/worldpay_us.rb +2 -2
- data/lib/active_merchant/billing/gateways/xpay.rb +244 -0
- data/lib/active_merchant/billing/network_tokenization_credit_card.rb +15 -3
- data/lib/active_merchant/billing/payment_token.rb +2 -2
- data/lib/active_merchant/billing/response.rb +7 -6
- data/lib/active_merchant/billing.rb +1 -0
- data/lib/active_merchant/connection.rb +8 -20
- data/lib/active_merchant/country.rb +3 -1
- data/lib/active_merchant/errors.rb +12 -2
- data/lib/active_merchant/net_http_ssl_connection.rb +35 -0
- data/lib/active_merchant/posts_data.rb +19 -4
- data/lib/active_merchant/version.rb +1 -1
- data/lib/active_merchant/versionable.rb +29 -0
- data/lib/certs/cacert.pem +1326 -1491
- data/lib/support/gateway_support.rb +3 -3
- data/lib/support/ssl_verify.rb +6 -6
- data/lib/support/ssl_version.rb +8 -8
- metadata +35 -9
|
@@ -1,20 +1,24 @@
|
|
|
1
1
|
require 'active_support/core_ext/hash/slice'
|
|
2
2
|
|
|
3
|
-
module ActiveMerchant
|
|
4
|
-
module Billing
|
|
3
|
+
module ActiveMerchant # :nodoc:
|
|
4
|
+
module Billing # :nodoc:
|
|
5
5
|
# This gateway uses an older version of the Stripe API.
|
|
6
6
|
# To utilize the updated {Payment Intents API}[https://stripe.com/docs/api/payment_intents], integrate with the StripePaymentIntents gateway
|
|
7
7
|
class StripeGateway < Gateway
|
|
8
|
+
version '2020-08-27'
|
|
9
|
+
|
|
8
10
|
self.live_url = 'https://api.stripe.com/v1/'
|
|
9
11
|
|
|
12
|
+
# Docs on AVS codes: https://en.wikipedia.org/w/index.php?title=Address_verification_service&_ga=2.97570079.1027215965.1655989706-2008268124.1655989706#AVS_response_codes
|
|
13
|
+
# possible response values: https://stripe.com/docs/api/payment_methods/object#payment_method_object-card-checks
|
|
10
14
|
AVS_CODE_TRANSLATOR = {
|
|
11
|
-
'line1: pass, zip: pass' => 'Y',
|
|
12
15
|
'line1: pass, zip: fail' => 'A',
|
|
13
16
|
'line1: pass, zip: unchecked' => 'B',
|
|
14
|
-
'line1:
|
|
17
|
+
'line1: unchecked, zip: unchecked' => 'I',
|
|
15
18
|
'line1: fail, zip: fail' => 'N',
|
|
16
19
|
'line1: unchecked, zip: pass' => 'P',
|
|
17
|
-
'line1:
|
|
20
|
+
'line1: pass, zip: pass' => 'Y',
|
|
21
|
+
'line1: fail, zip: pass' => 'Z'
|
|
18
22
|
}
|
|
19
23
|
|
|
20
24
|
CVC_CODE_TRANSLATOR = {
|
|
@@ -23,8 +27,6 @@ module ActiveMerchant #:nodoc:
|
|
|
23
27
|
'unchecked' => 'P'
|
|
24
28
|
}
|
|
25
29
|
|
|
26
|
-
DEFAULT_API_VERSION = '2020-08-27'
|
|
27
|
-
|
|
28
30
|
self.supported_countries = %w(AE AT AU BE BG BR CA CH CY CZ DE DK EE ES FI FR GB GR HK HU IE IN IT JP LT LU LV MT MX MY NL NO NZ PL PT RO SE SG SI SK US)
|
|
29
31
|
self.default_currency = 'USD'
|
|
30
32
|
self.money_format = :cents
|
|
@@ -86,18 +88,10 @@ module ActiveMerchant #:nodoc:
|
|
|
86
88
|
return Response.new(false, direct_bank_error)
|
|
87
89
|
end
|
|
88
90
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
end
|
|
94
|
-
r.process do
|
|
95
|
-
post = create_post_for_auth_or_purchase(money, payment, options)
|
|
96
|
-
add_application_fee(post, options) if emv_payment?(payment)
|
|
97
|
-
post[:capture] = 'false'
|
|
98
|
-
commit(:post, 'charges', post, options)
|
|
99
|
-
end
|
|
100
|
-
end.responses.last
|
|
91
|
+
post = create_post_for_auth_or_purchase(money, payment, options)
|
|
92
|
+
add_application_fee(post, options) if emv_payment?(payment)
|
|
93
|
+
post[:capture] = 'false'
|
|
94
|
+
commit(:post, 'charges', post, options)
|
|
101
95
|
end
|
|
102
96
|
|
|
103
97
|
# To create a charge on a card or a token, call
|
|
@@ -113,17 +107,9 @@ module ActiveMerchant #:nodoc:
|
|
|
113
107
|
return Response.new(false, direct_bank_error)
|
|
114
108
|
end
|
|
115
109
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
payment = StripePaymentToken.new(r.params['token']) if r.success?
|
|
120
|
-
end
|
|
121
|
-
r.process do
|
|
122
|
-
post = create_post_for_auth_or_purchase(money, payment, options)
|
|
123
|
-
post[:card][:processing_method] = 'quick_chip' if quickchip_payment?(payment)
|
|
124
|
-
commit(:post, 'charges', post, options)
|
|
125
|
-
end
|
|
126
|
-
end.responses.last
|
|
110
|
+
post = create_post_for_auth_or_purchase(money, payment, options)
|
|
111
|
+
post[:card][:processing_method] = 'quick_chip' if quickchip_payment?(payment)
|
|
112
|
+
commit(:post, 'charges', post, options)
|
|
127
113
|
end
|
|
128
114
|
|
|
129
115
|
def capture(money, authorization, options = {})
|
|
@@ -146,7 +132,7 @@ module ActiveMerchant #:nodoc:
|
|
|
146
132
|
def void(identification, options = {})
|
|
147
133
|
post = {}
|
|
148
134
|
post[:reverse_transfer] = options[:reverse_transfer] if options[:reverse_transfer]
|
|
149
|
-
post
|
|
135
|
+
add_metadata(post, options)
|
|
150
136
|
post[:reason] = options[:reason] if options[:reason]
|
|
151
137
|
post[:expand] = [:charge]
|
|
152
138
|
commit(:post, "charges/#{CGI.escape(identification)}/refunds", post, options)
|
|
@@ -157,7 +143,7 @@ module ActiveMerchant #:nodoc:
|
|
|
157
143
|
add_amount(post, money, options)
|
|
158
144
|
post[:refund_application_fee] = true if options[:refund_application_fee]
|
|
159
145
|
post[:reverse_transfer] = options[:reverse_transfer] if options[:reverse_transfer]
|
|
160
|
-
post
|
|
146
|
+
add_metadata(post, options)
|
|
161
147
|
post[:reason] = options[:reason] if options[:reason]
|
|
162
148
|
post[:expand] = [:charge]
|
|
163
149
|
|
|
@@ -197,12 +183,7 @@ module ActiveMerchant #:nodoc:
|
|
|
197
183
|
params = {}
|
|
198
184
|
post = {}
|
|
199
185
|
|
|
200
|
-
if payment.is_a?(
|
|
201
|
-
token_exchange_response = tokenize_apple_pay_token(payment)
|
|
202
|
-
params = { card: token_exchange_response.params['token']['id'] } if token_exchange_response.success?
|
|
203
|
-
elsif payment.is_a?(StripePaymentToken)
|
|
204
|
-
add_payment_token(params, payment, options)
|
|
205
|
-
elsif payment.is_a?(Check)
|
|
186
|
+
if payment.is_a?(Check)
|
|
206
187
|
bank_token_response = tokenize_bank_account(payment)
|
|
207
188
|
return bank_token_response unless bank_token_response.success?
|
|
208
189
|
|
|
@@ -253,17 +234,6 @@ module ActiveMerchant #:nodoc:
|
|
|
253
234
|
commit(:delete, "customers/#{CGI.escape(customer_id)}/cards/#{CGI.escape(card_id)}", nil, options)
|
|
254
235
|
end
|
|
255
236
|
|
|
256
|
-
def tokenize_apple_pay_token(apple_pay_payment_token, options = {})
|
|
257
|
-
token_response = api_request(:post, "tokens?pk_token=#{CGI.escape(apple_pay_payment_token.payment_data.to_json)}")
|
|
258
|
-
success = !token_response.key?('error')
|
|
259
|
-
|
|
260
|
-
if success && token_response.key?('id')
|
|
261
|
-
Response.new(success, nil, token: token_response)
|
|
262
|
-
else
|
|
263
|
-
Response.new(success, token_response['error']['message'])
|
|
264
|
-
end
|
|
265
|
-
end
|
|
266
|
-
|
|
267
237
|
def verify_credentials
|
|
268
238
|
begin
|
|
269
239
|
ssl_get(live_url + 'charges/nonexistent', headers)
|
|
@@ -292,7 +262,9 @@ module ActiveMerchant #:nodoc:
|
|
|
292
262
|
gsub(%r(((\[card\]|card)\[number\]=)\d+), '\1[FILTERED]').
|
|
293
263
|
gsub(%r(((\[card\]|card)\[swipe_data\]=)[^&]+(&?)), '\1[FILTERED]\3').
|
|
294
264
|
gsub(%r(((\[bank_account\]|bank_account)\[account_number\]=)\d+), '\1[FILTERED]').
|
|
295
|
-
gsub(%r(((\[payment_method_data\]|payment_method_data)\[card\]\[token\]=)[^&]+(&?)), '\1[FILTERED]\3')
|
|
265
|
+
gsub(%r(((\[payment_method_data\]|payment_method_data)\[card\]\[token\]=)[^&]+(&?)), '\1[FILTERED]\3').
|
|
266
|
+
gsub(%r(((\[payment_method_data\]|payment_method_data)\[card\]\[network_token\]\[number\]=)\d+), '\1[FILTERED]').
|
|
267
|
+
gsub(%r(((\[payment_method_options\]|payment_method_options)\[card\]\[network_token\]\[cryptogram\]=)[^&]+(&?)), '\1[FILTERED]')
|
|
296
268
|
end
|
|
297
269
|
|
|
298
270
|
def supports_network_tokenization?
|
|
@@ -364,12 +336,7 @@ module ActiveMerchant #:nodoc:
|
|
|
364
336
|
def create_post_for_auth_or_purchase(money, payment, options)
|
|
365
337
|
post = {}
|
|
366
338
|
|
|
367
|
-
|
|
368
|
-
add_payment_token(post, payment, options)
|
|
369
|
-
else
|
|
370
|
-
add_creditcard(post, payment, options)
|
|
371
|
-
end
|
|
372
|
-
|
|
339
|
+
add_creditcard(post, payment, options)
|
|
373
340
|
add_charge_details(post, money, payment, options)
|
|
374
341
|
post
|
|
375
342
|
end
|
|
@@ -436,7 +403,7 @@ module ActiveMerchant #:nodoc:
|
|
|
436
403
|
post[:level3] = level_three unless level_three.empty?
|
|
437
404
|
end
|
|
438
405
|
|
|
439
|
-
def add_expand_parameters(post, options)
|
|
406
|
+
def add_expand_parameters(post, options, method, url)
|
|
440
407
|
post[:expand] ||= []
|
|
441
408
|
post[:expand].concat(Array.wrap(options[:expand]).map(&:to_sym)).uniq!
|
|
442
409
|
end
|
|
@@ -508,9 +475,10 @@ module ActiveMerchant #:nodoc:
|
|
|
508
475
|
end
|
|
509
476
|
|
|
510
477
|
if creditcard.is_a?(NetworkTokenizationCreditCard)
|
|
478
|
+
tokenization_method = creditcard.source == :google_pay ? :android_pay : creditcard.source
|
|
511
479
|
card[:cryptogram] = creditcard.payment_cryptogram
|
|
512
480
|
card[:eci] = creditcard.eci.rjust(2, '0') if creditcard.eci =~ /^[0-9]+$/
|
|
513
|
-
card[:tokenization_method] =
|
|
481
|
+
card[:tokenization_method] = tokenization_method.to_s
|
|
514
482
|
end
|
|
515
483
|
post[:card] = card
|
|
516
484
|
|
|
@@ -533,10 +501,6 @@ module ActiveMerchant #:nodoc:
|
|
|
533
501
|
post[:card] = { emv_auth_data: icc_data }
|
|
534
502
|
end
|
|
535
503
|
|
|
536
|
-
def add_payment_token(post, token, options = {})
|
|
537
|
-
post[:card] = token.payment_data['id']
|
|
538
|
-
end
|
|
539
|
-
|
|
540
504
|
def add_customer(post, payment, options)
|
|
541
505
|
post[:customer] = options[:customer] if options[:customer] && !payment.respond_to?(:number)
|
|
542
506
|
end
|
|
@@ -577,7 +541,7 @@ module ActiveMerchant #:nodoc:
|
|
|
577
541
|
|
|
578
542
|
def add_source_owner(post, creditcard, options)
|
|
579
543
|
post[:owner] = {}
|
|
580
|
-
post[:owner][:name] = creditcard.name if creditcard.name
|
|
544
|
+
post[:owner][:name] = creditcard.name if creditcard.respond_to?(:name) && creditcard.name
|
|
581
545
|
post[:owner][:email] = options[:email] if options[:email]
|
|
582
546
|
|
|
583
547
|
if address = options[:billing_address] || options[:address]
|
|
@@ -613,8 +577,32 @@ module ActiveMerchant #:nodoc:
|
|
|
613
577
|
post[:radar_options] = radar_options unless radar_options.empty?
|
|
614
578
|
end
|
|
615
579
|
|
|
580
|
+
def add_header_fields(response)
|
|
581
|
+
return unless @response_headers.present?
|
|
582
|
+
|
|
583
|
+
headers = {}
|
|
584
|
+
headers['response_headers'] = {}
|
|
585
|
+
headers['response_headers']['idempotent_replayed'] = @response_headers['idempotent-replayed'] if @response_headers['idempotent-replayed']
|
|
586
|
+
headers['response_headers']['stripe_should_retry'] = @response_headers['stripe-should-retry'] if @response_headers['stripe-should-retry']
|
|
587
|
+
|
|
588
|
+
response.merge!(headers)
|
|
589
|
+
end
|
|
590
|
+
|
|
591
|
+
def add_card_response_field(response)
|
|
592
|
+
return if @card_3d_supported.nil?
|
|
593
|
+
|
|
594
|
+
card_details = {}
|
|
595
|
+
card_details['three_d_secure_usage_supported'] = @card_3d_supported
|
|
596
|
+
|
|
597
|
+
response.merge!(card_details)
|
|
598
|
+
end
|
|
599
|
+
|
|
616
600
|
def parse(body)
|
|
617
|
-
JSON.parse(body)
|
|
601
|
+
response = JSON.parse(body)
|
|
602
|
+
add_header_fields(response)
|
|
603
|
+
add_card_response_field(response)
|
|
604
|
+
|
|
605
|
+
response
|
|
618
606
|
end
|
|
619
607
|
|
|
620
608
|
def post_data(params)
|
|
@@ -656,7 +644,7 @@ module ActiveMerchant #:nodoc:
|
|
|
656
644
|
options[:key] || @api_key
|
|
657
645
|
end
|
|
658
646
|
|
|
659
|
-
def headers(options = {})
|
|
647
|
+
def headers(method = :post, options = {})
|
|
660
648
|
headers = {
|
|
661
649
|
'Authorization' => 'Basic ' + Base64.strict_encode64(key(options).to_s + ':').strip,
|
|
662
650
|
'User-Agent' => "Stripe/v1 ActiveMerchantBindings/#{ActiveMerchant::VERSION}",
|
|
@@ -664,7 +652,7 @@ module ActiveMerchant #:nodoc:
|
|
|
664
652
|
'X-Stripe-Client-User-Agent' => stripe_client_user_agent(options),
|
|
665
653
|
'X-Stripe-Client-User-Metadata' => { ip: options[:ip] }.to_json
|
|
666
654
|
}
|
|
667
|
-
headers['Idempotency-Key'] = options[:idempotency_key] if options[:idempotency_key]
|
|
655
|
+
headers['Idempotency-Key'] = options[:idempotency_key] if options[:idempotency_key] && method != :get
|
|
668
656
|
headers['Stripe-Account'] = options[:stripe_account] if options[:stripe_account]
|
|
669
657
|
headers
|
|
670
658
|
end
|
|
@@ -676,13 +664,13 @@ module ActiveMerchant #:nodoc:
|
|
|
676
664
|
end
|
|
677
665
|
|
|
678
666
|
def api_version(options)
|
|
679
|
-
options[:version] || @options[:version] ||
|
|
667
|
+
options[:version] || @options[:version] || fetch_version
|
|
680
668
|
end
|
|
681
669
|
|
|
682
670
|
def api_request(method, endpoint, parameters = nil, options = {})
|
|
683
671
|
raw_response = response = nil
|
|
684
672
|
begin
|
|
685
|
-
raw_response = ssl_request(method, self.live_url + endpoint, post_data(parameters), headers(options))
|
|
673
|
+
raw_response = ssl_request(method, self.live_url + endpoint, post_data(parameters), headers(method, options))
|
|
686
674
|
response = parse(raw_response)
|
|
687
675
|
rescue ResponseError => e
|
|
688
676
|
raw_response = e.response.body
|
|
@@ -694,52 +682,56 @@ module ActiveMerchant #:nodoc:
|
|
|
694
682
|
end
|
|
695
683
|
|
|
696
684
|
def commit(method, url, parameters = nil, options = {})
|
|
697
|
-
add_expand_parameters(parameters, options) if parameters
|
|
698
|
-
|
|
685
|
+
add_expand_parameters(parameters, options, method, url) if parameters
|
|
699
686
|
return Response.new(false, 'Invalid API Key provided') unless key_valid?(options)
|
|
700
687
|
|
|
701
688
|
response = api_request(method, url, parameters, options)
|
|
702
689
|
response['webhook_id'] = options[:webhook_id] if options[:webhook_id]
|
|
703
690
|
success = success_from(response, options)
|
|
704
691
|
|
|
705
|
-
|
|
706
|
-
avs_code = AVS_CODE_TRANSLATOR["line1: #{
|
|
707
|
-
cvc_code = CVC_CODE_TRANSLATOR[
|
|
708
|
-
Response.new(
|
|
692
|
+
card_checks = card_from_response(response)
|
|
693
|
+
avs_code = AVS_CODE_TRANSLATOR["line1: #{card_checks['address_line1_check']}, zip: #{card_checks['address_zip_check'] || card_checks['address_postal_code_check']}"]
|
|
694
|
+
cvc_code = CVC_CODE_TRANSLATOR[card_checks['cvc_check']]
|
|
695
|
+
Response.new(
|
|
696
|
+
success,
|
|
709
697
|
message_from(success, response),
|
|
710
698
|
response,
|
|
711
699
|
test: response_is_test?(response),
|
|
712
|
-
authorization: authorization_from(success, url, method, response),
|
|
700
|
+
authorization: authorization_from(success, url, method, response, options),
|
|
713
701
|
avs_result: { code: avs_code },
|
|
714
702
|
cvv_result: cvc_code,
|
|
715
703
|
emv_authorization: emv_authorization_from_response(response),
|
|
716
|
-
error_code: success ? nil : error_code_from(response)
|
|
704
|
+
error_code: success ? nil : error_code_from(response)
|
|
705
|
+
)
|
|
717
706
|
end
|
|
718
707
|
|
|
719
708
|
def key_valid?(options)
|
|
720
709
|
return true unless test?
|
|
721
710
|
|
|
722
711
|
%w(sk rk).each do |k|
|
|
723
|
-
if key(options).start_with?(k)
|
|
724
|
-
return false unless key(options).start_with?("#{k}_test")
|
|
725
|
-
end
|
|
712
|
+
return false if key(options).start_with?(k) && !key(options).start_with?("#{k}_test")
|
|
726
713
|
end
|
|
727
714
|
|
|
728
715
|
true
|
|
729
716
|
end
|
|
730
717
|
|
|
731
|
-
def authorization_from(success, url, method, response)
|
|
732
|
-
return response
|
|
718
|
+
def authorization_from(success, url, method, response, options)
|
|
719
|
+
return error_id(response, url) unless success
|
|
733
720
|
|
|
734
721
|
if url == 'customers'
|
|
735
722
|
[response['id'], response.dig('sources', 'data').first&.dig('id')].join('|')
|
|
736
|
-
elsif method == :post && (url.match(/customers\/.*\/cards/) || url.match(/payment_methods\/.*\/attach/))
|
|
737
|
-
[response['
|
|
723
|
+
elsif method == :post && (url.match(/customers\/.*\/cards/) || url.match(/payment_methods\/.*\/attach/) || options[:action] == :store)
|
|
724
|
+
response_id = options[:action] == :store ? response['payment_method'] : response['id']
|
|
725
|
+
[response['customer'], response_id].join('|')
|
|
738
726
|
else
|
|
739
727
|
response['id']
|
|
740
728
|
end
|
|
741
729
|
end
|
|
742
730
|
|
|
731
|
+
def error_id(response, url)
|
|
732
|
+
response.dig('error', 'charge') || response.dig('error', 'setup_intent', 'id') || response['id']
|
|
733
|
+
end
|
|
734
|
+
|
|
743
735
|
def message_from(success, response)
|
|
744
736
|
success ? 'Transaction approved' : response.fetch('error', { 'message' => 'No error details' })['message']
|
|
745
737
|
end
|
|
@@ -748,6 +740,18 @@ module ActiveMerchant #:nodoc:
|
|
|
748
740
|
!response.key?('error') && response['status'] != 'failed'
|
|
749
741
|
end
|
|
750
742
|
|
|
743
|
+
# Override the regular handle response so we can access the headers
|
|
744
|
+
# set header fields and values so we can add them to the response body
|
|
745
|
+
def handle_response(response)
|
|
746
|
+
@response_headers = response.each_header.to_h if response.respond_to?(:header)
|
|
747
|
+
case response.code.to_i
|
|
748
|
+
when 200...300
|
|
749
|
+
response.body
|
|
750
|
+
else
|
|
751
|
+
raise ResponseError.new(response)
|
|
752
|
+
end
|
|
753
|
+
end
|
|
754
|
+
|
|
751
755
|
def response_error(raw_response)
|
|
752
756
|
parse(raw_response)
|
|
753
757
|
rescue JSON::ParserError
|
|
@@ -813,7 +817,7 @@ module ActiveMerchant #:nodoc:
|
|
|
813
817
|
currency: 'usd',
|
|
814
818
|
routing_number: bank_account.routing_number,
|
|
815
819
|
account_holder_name: bank_account.name,
|
|
816
|
-
account_holder_type:
|
|
820
|
+
account_holder_type:
|
|
817
821
|
}
|
|
818
822
|
}
|
|
819
823
|
|