activemerchant 1.100.0 → 1.133.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +1057 -0
- data/README.md +11 -9
- data/lib/active_merchant/billing/avs_result.rb +9 -9
- data/lib/active_merchant/billing/base.rb +0 -13
- data/lib/active_merchant/billing/check.rb +49 -17
- data/lib/active_merchant/billing/compatibility.rb +5 -4
- data/lib/active_merchant/billing/credit_card.rb +55 -8
- data/lib/active_merchant/billing/credit_card_formatting.rb +1 -0
- data/lib/active_merchant/billing/credit_card_methods.rb +209 -36
- data/lib/active_merchant/billing/cvv_result.rb +0 -1
- data/lib/active_merchant/billing/gateway.rb +38 -36
- data/lib/active_merchant/billing/gateways/adyen.rb +399 -78
- data/lib/active_merchant/billing/gateways/airwallex.rb +370 -0
- data/lib/active_merchant/billing/gateways/alelo.rb +256 -0
- data/lib/active_merchant/billing/gateways/allied_wallet.rb +14 -14
- data/lib/active_merchant/billing/gateways/authorize_net.rb +200 -130
- data/lib/active_merchant/billing/gateways/authorize_net_arb.rb +27 -20
- data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +48 -51
- data/lib/active_merchant/billing/gateways/axcessms.rb +13 -15
- data/lib/active_merchant/billing/gateways/balanced.rb +43 -36
- data/lib/active_merchant/billing/gateways/bambora_apac.rb +16 -20
- data/lib/active_merchant/billing/gateways/bank_frick.rb +13 -13
- data/lib/active_merchant/billing/gateways/banwire.rb +5 -5
- data/lib/active_merchant/billing/gateways/barclaycard_smartpay.rb +43 -30
- data/lib/active_merchant/billing/gateways/barclays_epdq_extra_plus.rb +1 -1
- data/lib/active_merchant/billing/gateways/be2bill.rb +5 -5
- data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +37 -36
- data/lib/active_merchant/billing/gateways/beanstream.rb +21 -3
- data/lib/active_merchant/billing/gateways/beanstream_interac.rb +1 -1
- data/lib/active_merchant/billing/gateways/blue_pay.rb +53 -28
- data/lib/active_merchant/billing/gateways/blue_snap.rb +176 -54
- data/lib/active_merchant/billing/gateways/bogus.rb +24 -20
- data/lib/active_merchant/billing/gateways/borgun.rb +92 -38
- data/lib/active_merchant/billing/gateways/bpoint.rb +15 -15
- data/lib/active_merchant/billing/gateways/braintree/braintree_common.rb +8 -2
- data/lib/active_merchant/billing/gateways/braintree/token_nonce.rb +113 -0
- data/lib/active_merchant/billing/gateways/braintree.rb +1 -1
- data/lib/active_merchant/billing/gateways/braintree_blue.rb +387 -175
- data/lib/active_merchant/billing/gateways/bridge_pay.rb +13 -13
- data/lib/active_merchant/billing/gateways/cams.rb +10 -10
- data/lib/active_merchant/billing/gateways/card_connect.rb +33 -14
- data/lib/active_merchant/billing/gateways/card_save.rb +3 -4
- data/lib/active_merchant/billing/gateways/card_stream.rb +67 -40
- data/lib/active_merchant/billing/gateways/cardknox.rb +13 -13
- data/lib/active_merchant/billing/gateways/cardprocess.rb +4 -2
- data/lib/active_merchant/billing/gateways/cashnet.rb +28 -12
- data/lib/active_merchant/billing/gateways/cc5.rb +9 -9
- data/lib/active_merchant/billing/gateways/cecabank.rb +38 -38
- data/lib/active_merchant/billing/gateways/cenpos.rb +29 -28
- data/lib/active_merchant/billing/gateways/checkout.rb +7 -9
- data/lib/active_merchant/billing/gateways/checkout_v2.rb +316 -68
- data/lib/active_merchant/billing/gateways/citrus_pay.rb +1 -2
- data/lib/active_merchant/billing/gateways/clearhaus.rb +32 -33
- data/lib/active_merchant/billing/gateways/commerce_hub.rb +370 -0
- data/lib/active_merchant/billing/gateways/commercegate.rb +4 -4
- data/lib/active_merchant/billing/gateways/conekta.rb +8 -6
- data/lib/active_merchant/billing/gateways/creditcall.rb +18 -17
- data/lib/active_merchant/billing/gateways/credorax.rb +152 -63
- data/lib/active_merchant/billing/gateways/ct_payment.rb +15 -14
- data/lib/active_merchant/billing/gateways/culqi.rb +30 -28
- data/lib/active_merchant/billing/gateways/cyber_source/cyber_source_common.rb +36 -0
- data/lib/active_merchant/billing/gateways/cyber_source.rb +496 -187
- data/lib/active_merchant/billing/gateways/cyber_source_rest.rb +454 -0
- data/lib/active_merchant/billing/gateways/d_local.rb +148 -31
- data/lib/active_merchant/billing/gateways/data_cash.rb +34 -37
- data/lib/active_merchant/billing/gateways/decidir.rb +134 -21
- data/lib/active_merchant/billing/gateways/decidir_plus.rb +344 -0
- data/lib/active_merchant/billing/gateways/dibs.rb +10 -10
- data/lib/active_merchant/billing/gateways/digitzs.rb +11 -8
- data/lib/active_merchant/billing/gateways/ebanx.rb +90 -40
- data/lib/active_merchant/billing/gateways/efsnet.rb +36 -36
- data/lib/active_merchant/billing/gateways/elavon.rb +349 -194
- data/lib/active_merchant/billing/gateways/element.rb +71 -21
- data/lib/active_merchant/billing/gateways/epay.rb +43 -43
- data/lib/active_merchant/billing/gateways/evo_ca.rb +12 -13
- data/lib/active_merchant/billing/gateways/eway.rb +9 -9
- data/lib/active_merchant/billing/gateways/eway_managed.rb +55 -56
- data/lib/active_merchant/billing/gateways/eway_rapid.rb +37 -22
- data/lib/active_merchant/billing/gateways/exact.rb +19 -20
- data/lib/active_merchant/billing/gateways/ezic.rb +9 -9
- data/lib/active_merchant/billing/gateways/fat_zebra.rb +24 -19
- data/lib/active_merchant/billing/gateways/federated_canada.rb +6 -7
- data/lib/active_merchant/billing/gateways/finansbank.rb +3 -3
- data/lib/active_merchant/billing/gateways/first_giving.rb +5 -4
- data/lib/active_merchant/billing/gateways/first_pay.rb +7 -7
- data/lib/active_merchant/billing/gateways/firstdata_e4.rb +39 -38
- data/lib/active_merchant/billing/gateways/firstdata_e4_v27.rb +51 -31
- data/lib/active_merchant/billing/gateways/flo2cash.rb +24 -24
- data/lib/active_merchant/billing/gateways/flo2cash_simple.rb +1 -1
- data/lib/active_merchant/billing/gateways/forte.rb +38 -22
- data/lib/active_merchant/billing/gateways/garanti.rb +12 -15
- data/lib/active_merchant/billing/gateways/global_collect.rb +333 -89
- data/lib/active_merchant/billing/gateways/global_transport.rb +8 -9
- data/lib/active_merchant/billing/gateways/hdfc.rb +22 -23
- data/lib/active_merchant/billing/gateways/hps.rb +171 -50
- data/lib/active_merchant/billing/gateways/iats_payments.rb +47 -25
- data/lib/active_merchant/billing/gateways/in_context_paypal_express.rb +1 -1
- data/lib/active_merchant/billing/gateways/inspire.rb +22 -27
- data/lib/active_merchant/billing/gateways/instapay.rb +5 -8
- data/lib/active_merchant/billing/gateways/ipg.rb +420 -0
- data/lib/active_merchant/billing/gateways/ipp.rb +9 -9
- data/lib/active_merchant/billing/gateways/iridium.rb +30 -31
- data/lib/active_merchant/billing/gateways/itransact.rb +11 -10
- data/lib/active_merchant/billing/gateways/iveri.rb +62 -23
- data/lib/active_merchant/billing/gateways/ixopay.rb +320 -0
- data/lib/active_merchant/billing/gateways/jetpay.rb +10 -17
- data/lib/active_merchant/billing/gateways/jetpay_v2.rb +13 -18
- data/lib/active_merchant/billing/gateways/komoju.rb +1 -1
- data/lib/active_merchant/billing/gateways/kushki.rb +100 -22
- data/lib/active_merchant/billing/gateways/latitude19.rb +20 -19
- data/lib/active_merchant/billing/gateways/linkpoint.rb +71 -72
- data/lib/active_merchant/billing/gateways/litle.rb +181 -45
- data/lib/active_merchant/billing/gateways/mastercard.rb +16 -22
- data/lib/active_merchant/billing/gateways/maxipago.rb +2 -2
- data/lib/active_merchant/billing/gateways/mercado_pago.rb +89 -18
- data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +58 -24
- data/lib/active_merchant/billing/gateways/merchant_one.rb +7 -10
- data/lib/active_merchant/billing/gateways/merchant_partners.rb +19 -19
- data/lib/active_merchant/billing/gateways/merchant_ware.rb +18 -22
- data/lib/active_merchant/billing/gateways/merchant_ware_version_four.rb +15 -17
- data/lib/active_merchant/billing/gateways/merchant_warrior.rb +46 -8
- data/lib/active_merchant/billing/gateways/mercury.rb +19 -23
- data/lib/active_merchant/billing/gateways/metrics_global.rb +24 -33
- data/lib/active_merchant/billing/gateways/micropayment.rb +11 -12
- data/lib/active_merchant/billing/gateways/migs/migs_codes.rb +7 -7
- data/lib/active_merchant/billing/gateways/migs.rb +18 -21
- data/lib/active_merchant/billing/gateways/mit.rb +260 -0
- data/lib/active_merchant/billing/gateways/modern_payments_cim.rb +10 -12
- data/lib/active_merchant/billing/gateways/moka.rb +290 -0
- data/lib/active_merchant/billing/gateways/monei.rb +236 -150
- data/lib/active_merchant/billing/gateways/moneris.rb +122 -53
- data/lib/active_merchant/billing/gateways/money_movers.rb +6 -7
- data/lib/active_merchant/billing/gateways/mundipagg.rb +69 -23
- data/lib/active_merchant/billing/gateways/nab_transact.rb +18 -20
- data/lib/active_merchant/billing/gateways/ncr_secure_pay.rb +10 -12
- data/lib/active_merchant/billing/gateways/net_registry.rb +8 -9
- data/lib/active_merchant/billing/gateways/netaxept.rb +12 -12
- data/lib/active_merchant/billing/gateways/netbanx.rb +128 -46
- data/lib/active_merchant/billing/gateways/netbilling.rb +18 -21
- data/lib/active_merchant/billing/gateways/netpay.rb +5 -4
- data/lib/active_merchant/billing/gateways/network_merchants.rb +7 -10
- data/lib/active_merchant/billing/gateways/nmi.rb +69 -27
- data/lib/active_merchant/billing/gateways/ogone.rb +62 -31
- data/lib/active_merchant/billing/gateways/omise.rb +15 -16
- data/lib/active_merchant/billing/gateways/openpay.rb +33 -15
- data/lib/active_merchant/billing/gateways/opp.rb +39 -33
- data/lib/active_merchant/billing/gateways/optimal_payment.rb +43 -42
- data/lib/active_merchant/billing/gateways/orbital/orbital_soft_descriptors.rb +3 -5
- data/lib/active_merchant/billing/gateways/orbital.rb +623 -362
- data/lib/active_merchant/billing/gateways/pac_net_raven.rb +20 -20
- data/lib/active_merchant/billing/gateways/pagarme.rb +16 -23
- data/lib/active_merchant/billing/gateways/pago_facil.rb +4 -6
- data/lib/active_merchant/billing/gateways/pay_arc.rb +392 -0
- data/lib/active_merchant/billing/gateways/pay_conex.rb +17 -17
- data/lib/active_merchant/billing/gateways/pay_gate_xml.rb +30 -33
- data/lib/active_merchant/billing/gateways/pay_hub.rb +10 -10
- data/lib/active_merchant/billing/gateways/pay_junction.rb +31 -31
- data/lib/active_merchant/billing/gateways/pay_junction_v2.rb +36 -18
- data/lib/active_merchant/billing/gateways/pay_secure.rb +10 -11
- data/lib/active_merchant/billing/gateways/pay_trace.rb +450 -0
- data/lib/active_merchant/billing/gateways/paybox_direct.rb +64 -40
- data/lib/active_merchant/billing/gateways/payeezy.rb +130 -27
- data/lib/active_merchant/billing/gateways/payex.rb +24 -25
- data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +17 -17
- data/lib/active_merchant/billing/gateways/payflow/payflow_express_response.rb +1 -1
- data/lib/active_merchant/billing/gateways/payflow.rb +103 -25
- data/lib/active_merchant/billing/gateways/payflow_express.rb +4 -4
- data/lib/active_merchant/billing/gateways/payflow_uk.rb +1 -1
- data/lib/active_merchant/billing/gateways/payment_express.rb +22 -18
- data/lib/active_merchant/billing/gateways/paymentez.rb +89 -24
- data/lib/active_merchant/billing/gateways/paymill.rb +14 -16
- data/lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb +2 -1
- data/lib/active_merchant/billing/gateways/paypal/paypal_express_response.rb +4 -0
- data/lib/active_merchant/billing/gateways/paypal.rb +13 -5
- data/lib/active_merchant/billing/gateways/paypal_ca.rb +1 -1
- data/lib/active_merchant/billing/gateways/paypal_digital_goods.rb +1 -1
- data/lib/active_merchant/billing/gateways/paypal_express.rb +4 -1
- data/lib/active_merchant/billing/gateways/paypal_express_common.rb +1 -1
- data/lib/active_merchant/billing/gateways/paysafe.rb +420 -0
- data/lib/active_merchant/billing/gateways/payscout.rb +8 -9
- data/lib/active_merchant/billing/gateways/paystation.rb +6 -9
- data/lib/active_merchant/billing/gateways/payu_in.rb +20 -19
- data/lib/active_merchant/billing/gateways/payu_latam.rb +70 -37
- data/lib/active_merchant/billing/gateways/payway.rb +22 -22
- data/lib/active_merchant/billing/gateways/payway_dot_com.rb +253 -0
- data/lib/active_merchant/billing/gateways/pin.rb +60 -21
- data/lib/active_merchant/billing/gateways/plexo.rb +308 -0
- data/lib/active_merchant/billing/gateways/plugnpay.rb +20 -21
- data/lib/active_merchant/billing/gateways/priority.rb +392 -0
- data/lib/active_merchant/billing/gateways/pro_pay.rb +13 -14
- data/lib/active_merchant/billing/gateways/psigate.rb +29 -29
- data/lib/active_merchant/billing/gateways/psl_card.rb +7 -8
- data/lib/active_merchant/billing/gateways/qbms.rb +25 -26
- data/lib/active_merchant/billing/gateways/quantum.rb +9 -11
- data/lib/active_merchant/billing/gateways/quickbooks.rb +126 -39
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_common.rb +98 -98
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb +19 -23
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_v4to7.rb +3 -3
- data/lib/active_merchant/billing/gateways/quickpay.rb +0 -1
- data/lib/active_merchant/billing/gateways/qvalent.rb +36 -20
- data/lib/active_merchant/billing/gateways/rapyd.rb +319 -0
- data/lib/active_merchant/billing/gateways/reach.rb +277 -0
- data/lib/active_merchant/billing/gateways/realex.rb +42 -16
- data/lib/active_merchant/billing/gateways/redsys.rb +191 -86
- data/lib/active_merchant/billing/gateways/s5.rb +10 -9
- data/lib/active_merchant/billing/gateways/safe_charge.rb +70 -33
- data/lib/active_merchant/billing/gateways/sage.rb +19 -21
- data/lib/active_merchant/billing/gateways/sage_pay.rb +57 -57
- data/lib/active_merchant/billing/gateways/sallie_mae.rb +3 -4
- data/lib/active_merchant/billing/gateways/secure_net.rb +19 -26
- data/lib/active_merchant/billing/gateways/secure_pay.rb +24 -33
- data/lib/active_merchant/billing/gateways/secure_pay_au.rb +18 -20
- data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +4 -5
- data/lib/active_merchant/billing/gateways/securion_pay.rb +48 -7
- data/lib/active_merchant/billing/gateways/shift4.rb +345 -0
- data/lib/active_merchant/billing/gateways/simetrik.rb +368 -0
- data/lib/active_merchant/billing/gateways/skip_jack.rb +19 -19
- data/lib/active_merchant/billing/gateways/smart_ps.rb +26 -32
- data/lib/active_merchant/billing/gateways/so_easy_pay.rb +24 -25
- data/lib/active_merchant/billing/gateways/spreedly_core.rb +27 -21
- data/lib/active_merchant/billing/gateways/stripe.rb +126 -53
- data/lib/active_merchant/billing/gateways/stripe_payment_intents.rb +441 -113
- data/lib/active_merchant/billing/gateways/swipe_checkout.rb +7 -8
- data/lib/active_merchant/billing/gateways/telr.rb +17 -18
- data/lib/active_merchant/billing/gateways/tns.rb +3 -7
- data/lib/active_merchant/billing/gateways/trans_first.rb +10 -9
- data/lib/active_merchant/billing/gateways/trans_first_transaction_express.rb +28 -24
- data/lib/active_merchant/billing/gateways/transact_pro.rb +13 -15
- data/lib/active_merchant/billing/gateways/transax.rb +1 -2
- data/lib/active_merchant/billing/gateways/trexle.rb +5 -2
- data/lib/active_merchant/billing/gateways/trust_commerce.rb +57 -47
- data/lib/active_merchant/billing/gateways/usa_epay.rb +1 -2
- data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +176 -184
- data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +60 -48
- data/lib/active_merchant/billing/gateways/vanco.rb +17 -8
- data/lib/active_merchant/billing/gateways/verifi.rb +13 -14
- data/lib/active_merchant/billing/gateways/viaklix.rb +9 -14
- data/lib/active_merchant/billing/gateways/visanet_peru.rb +26 -21
- data/lib/active_merchant/billing/gateways/vpos.rb +223 -0
- data/lib/active_merchant/billing/gateways/webpay.rb +4 -4
- data/lib/active_merchant/billing/gateways/wepay.rb +14 -16
- data/lib/active_merchant/billing/gateways/wirecard.rb +14 -16
- data/lib/active_merchant/billing/gateways/wompi.rb +197 -0
- data/lib/active_merchant/billing/gateways/world_net.rb +36 -35
- data/lib/active_merchant/billing/gateways/worldpay.rb +556 -190
- data/lib/active_merchant/billing/gateways/worldpay_online_payments.rb +47 -54
- data/lib/active_merchant/billing/gateways/worldpay_us.rb +16 -16
- data/lib/active_merchant/billing/network_tokenization_credit_card.rb +2 -2
- data/lib/active_merchant/billing/response.rb +25 -6
- data/lib/active_merchant/billing/three_d_secure_eci_mapper.rb +27 -0
- data/lib/active_merchant/billing.rb +1 -0
- data/lib/active_merchant/connection.rb +14 -15
- data/lib/active_merchant/country.rb +3 -1
- data/lib/active_merchant/errors.rb +4 -1
- data/lib/active_merchant/net_http_ssl_connection.rb +1 -0
- data/lib/active_merchant/network_connection_retries.rb +15 -17
- data/lib/active_merchant/post_data.rb +3 -2
- data/lib/active_merchant/posts_data.rb +2 -2
- data/lib/active_merchant/version.rb +1 -1
- data/lib/active_merchant.rb +2 -2
- data/lib/certs/cacert.pem +1587 -2361
- data/lib/support/gateway_support.rb +1 -1
- data/lib/support/ssl_verify.rb +3 -7
- data/lib/support/ssl_version.rb +2 -3
- metadata +86 -34
- data/lib/active_merchant/billing/gateways/moneris_us.rb +0 -352
@@ -11,16 +11,16 @@ module ActiveMerchant #:nodoc:
|
|
11
11
|
self.homepage_url = 'http://payments.intuit.com/'
|
12
12
|
self.display_name = 'QuickBooks Merchant Services'
|
13
13
|
self.default_currency = 'USD'
|
14
|
-
self.supported_cardtypes = [
|
15
|
-
self.supported_countries = [
|
14
|
+
self.supported_cardtypes = %i[visa master discover american_express diners_club jcb]
|
15
|
+
self.supported_countries = ['US']
|
16
16
|
|
17
17
|
TYPES = {
|
18
|
-
:
|
19
|
-
:
|
20
|
-
:
|
21
|
-
:
|
22
|
-
:
|
23
|
-
:
|
18
|
+
authorize: 'CustomerCreditCardAuth',
|
19
|
+
capture: 'CustomerCreditCardCapture',
|
20
|
+
purchase: 'CustomerCreditCardCharge',
|
21
|
+
refund: 'CustomerCreditCardTxnVoidOrRefund',
|
22
|
+
void: 'CustomerCreditCardTxnVoid',
|
23
|
+
query: 'MerchantAccountQuery'
|
24
24
|
}
|
25
25
|
|
26
26
|
# Creates a new QbmsGateway
|
@@ -51,7 +51,7 @@ module ActiveMerchant #:nodoc:
|
|
51
51
|
# * <tt>options</tt> -- A hash of optional parameters.
|
52
52
|
#
|
53
53
|
def authorize(money, creditcard, options = {})
|
54
|
-
commit(:authorize, money, options.merge(:
|
54
|
+
commit(:authorize, money, options.merge(credit_card: creditcard))
|
55
55
|
end
|
56
56
|
|
57
57
|
# Perform a purchase, which is essentially an authorization and capture in a single operation.
|
@@ -63,7 +63,7 @@ module ActiveMerchant #:nodoc:
|
|
63
63
|
# * <tt>options</tt> -- A hash of optional parameters.
|
64
64
|
#
|
65
65
|
def purchase(money, creditcard, options = {})
|
66
|
-
commit(:purchase, money, options.merge(:
|
66
|
+
commit(:purchase, money, options.merge(credit_card: creditcard))
|
67
67
|
end
|
68
68
|
|
69
69
|
# Captures the funds from an authorized transaction.
|
@@ -74,7 +74,7 @@ module ActiveMerchant #:nodoc:
|
|
74
74
|
# * <tt>authorization</tt> -- The authorization returned from the previous authorize request.
|
75
75
|
#
|
76
76
|
def capture(money, authorization, options = {})
|
77
|
-
commit(:capture, money, options.merge(:
|
77
|
+
commit(:capture, money, options.merge(transaction_id: authorization))
|
78
78
|
end
|
79
79
|
|
80
80
|
# Void a previous transaction
|
@@ -84,7 +84,7 @@ module ActiveMerchant #:nodoc:
|
|
84
84
|
# * <tt>authorization</tt> - The authorization returned from the previous authorize request.
|
85
85
|
#
|
86
86
|
def void(authorization, options = {})
|
87
|
-
commit(:void, nil, options.merge(:
|
87
|
+
commit(:void, nil, options.merge(transaction_id: authorization))
|
88
88
|
end
|
89
89
|
|
90
90
|
# Credit an account.
|
@@ -105,7 +105,7 @@ module ActiveMerchant #:nodoc:
|
|
105
105
|
end
|
106
106
|
|
107
107
|
def refund(money, identification, options = {})
|
108
|
-
commit(:refund, money, options.merge(:
|
108
|
+
commit(:refund, money, options.merge(transaction_id: identification))
|
109
109
|
end
|
110
110
|
|
111
111
|
# Query the merchant account status
|
@@ -143,12 +143,11 @@ module ActiveMerchant #:nodoc:
|
|
143
143
|
message = (response[:status_message] || '').strip
|
144
144
|
|
145
145
|
Response.new(success?(response), message, response,
|
146
|
-
:
|
147
|
-
:
|
148
|
-
:
|
149
|
-
:
|
150
|
-
:
|
151
|
-
)
|
146
|
+
test: test?,
|
147
|
+
authorization: response[:credit_card_trans_id],
|
148
|
+
fraud_review: fraud_review?(response),
|
149
|
+
avs_result: { code: avs_result(response) },
|
150
|
+
cvv_result: cvv_result(response))
|
152
151
|
end
|
153
152
|
|
154
153
|
def success?(response)
|
@@ -167,16 +166,16 @@ module ActiveMerchant #:nodoc:
|
|
167
166
|
|
168
167
|
if status_code != 0
|
169
168
|
return {
|
170
|
-
:
|
171
|
-
:
|
169
|
+
status_code: status_code,
|
170
|
+
status_message: signon.attributes['statusMessage']
|
172
171
|
}
|
173
172
|
end
|
174
173
|
|
175
174
|
response = REXML::XPath.first(xml, "//QBMSXMLMsgsRs/#{type}Rs")
|
176
175
|
|
177
176
|
results = {
|
178
|
-
:
|
179
|
-
:
|
177
|
+
status_code: response.attributes['statusCode'].to_i,
|
178
|
+
status_message: response.attributes['statusMessage']
|
180
179
|
}
|
181
180
|
|
182
181
|
response.elements.each do |e|
|
@@ -195,10 +194,10 @@ module ActiveMerchant #:nodoc:
|
|
195
194
|
end
|
196
195
|
|
197
196
|
def build_request(type, money, parameters = {})
|
198
|
-
xml = Builder::XmlMarkup.new(:
|
197
|
+
xml = Builder::XmlMarkup.new(indent: 0)
|
199
198
|
|
200
|
-
xml.instruct!(:xml, :
|
201
|
-
xml.instruct!(:qbmsxml, :
|
199
|
+
xml.instruct!(:xml, version: '1.0', encoding: 'utf-8')
|
200
|
+
xml.instruct!(:qbmsxml, version: API_VERSION)
|
202
201
|
|
203
202
|
xml.tag!('QBMSXML') do
|
204
203
|
xml.tag!('SignonMsgsRq') do
|
@@ -13,7 +13,7 @@ module ActiveMerchant #:nodoc:
|
|
13
13
|
self.live_url = self.test_url = 'https://secure.quantumgateway.com/cgi/xml_requester.php'
|
14
14
|
|
15
15
|
# visa, master, american_express, discover
|
16
|
-
self.supported_cardtypes = [
|
16
|
+
self.supported_cardtypes = %i[visa master american_express discover]
|
17
17
|
self.supported_countries = ['US']
|
18
18
|
self.default_currency = 'USD'
|
19
19
|
self.money_format = :dollars
|
@@ -95,14 +95,14 @@ module ActiveMerchant #:nodoc:
|
|
95
95
|
def build_capture_request(money, authorization, options)
|
96
96
|
xml = Builder::XmlMarkup.new
|
97
97
|
add_common_credit_card_info(xml, 'PREVIOUS_SALE')
|
98
|
-
transaction_id,
|
98
|
+
transaction_id, = authorization_parts_from(authorization)
|
99
99
|
add_transaction_id(xml, transaction_id)
|
100
100
|
xml.target!
|
101
101
|
end
|
102
102
|
|
103
103
|
def build_purchase_request(money, creditcard, options)
|
104
104
|
xml = Builder::XmlMarkup.new
|
105
|
-
add_common_credit_card_info(xml, @options[:ignore_avs] ||
|
105
|
+
add_common_credit_card_info(xml, @options[:ignore_avs] || @options[:ignore_cvv] ? 'SALES' : 'AUTH_CAPTURE')
|
106
106
|
add_address(xml, creditcard, options[:billing_address], options)
|
107
107
|
add_purchase_data(xml, money)
|
108
108
|
add_creditcard(xml, creditcard)
|
@@ -116,7 +116,7 @@ module ActiveMerchant #:nodoc:
|
|
116
116
|
def build_void_request(authorization, options)
|
117
117
|
xml = Builder::XmlMarkup.new
|
118
118
|
add_common_credit_card_info(xml, 'VOID')
|
119
|
-
transaction_id,
|
119
|
+
transaction_id, = authorization_parts_from(authorization)
|
120
120
|
add_transaction_id(xml, transaction_id)
|
121
121
|
xml.target!
|
122
122
|
end
|
@@ -216,11 +216,10 @@ module ActiveMerchant #:nodoc:
|
|
216
216
|
end
|
217
217
|
|
218
218
|
Response.new(success, message, response,
|
219
|
-
:
|
220
|
-
:
|
221
|
-
:
|
222
|
-
:
|
223
|
-
)
|
219
|
+
test: test?,
|
220
|
+
authorization: authorization,
|
221
|
+
avs_result: { code: response[:AVSResponseCode] },
|
222
|
+
cvv_result: response[:CVV2ResponseCode])
|
224
223
|
end
|
225
224
|
|
226
225
|
# Parse the SOAP response
|
@@ -253,7 +252,7 @@ module ActiveMerchant #:nodoc:
|
|
253
252
|
if node.has_elements?
|
254
253
|
node.elements.each { |e| parse_element(reply, e) }
|
255
254
|
else
|
256
|
-
if node.parent.name
|
255
|
+
if /item/.match?(node.parent.name)
|
257
256
|
parent = node.parent.name + (node.parent.attributes['id'] ? '_' + node.parent.attributes['id'] : '')
|
258
257
|
reply[(parent + '_' + node.name).to_sym] = node.text
|
259
258
|
else
|
@@ -270,7 +269,6 @@ module ActiveMerchant #:nodoc:
|
|
270
269
|
def authorization_parts_from(authorization)
|
271
270
|
authorization.split(/;/)
|
272
271
|
end
|
273
|
-
|
274
272
|
end
|
275
273
|
end
|
276
274
|
end
|
@@ -6,17 +6,14 @@ module ActiveMerchant #:nodoc:
|
|
6
6
|
|
7
7
|
self.supported_countries = ['US']
|
8
8
|
self.default_currency = 'USD'
|
9
|
-
self.supported_cardtypes = [
|
9
|
+
self.supported_cardtypes = %i[visa master american_express discover diners]
|
10
10
|
|
11
11
|
self.homepage_url = 'http://payments.intuit.com'
|
12
12
|
self.display_name = 'QuickBooks Payments'
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
authorize_url: 'https://appcenter.intuit.com/Connect/Begin',
|
18
|
-
access_token_path: '/oauth/v1/get_access_token'
|
19
|
-
}
|
13
|
+
BASE = '/quickbooks/v4/payments'
|
14
|
+
ENDPOINT = "#{BASE}/charges"
|
15
|
+
VOID_ENDPOINT = "#{BASE}/txn-requests"
|
16
|
+
REFRESH_URI = 'https://oauth.platform.intuit.com/oauth2/v1/tokens/bearer'
|
20
17
|
|
21
18
|
# https://developer.intuit.com/docs/0150_payments/0300_developer_guides/error_handling
|
22
19
|
|
@@ -45,13 +42,21 @@ module ActiveMerchant #:nodoc:
|
|
45
42
|
'PMT-5001' => STANDARD_ERROR_CODE[:card_declined], # Merchant does not support given payment method
|
46
43
|
|
47
44
|
# System Error
|
48
|
-
'PMT-6000' => STANDARD_ERROR_CODE[:processing_error],
|
45
|
+
'PMT-6000' => STANDARD_ERROR_CODE[:processing_error], # A temporary Issue prevented this request from being processed.
|
49
46
|
}
|
50
47
|
|
51
48
|
FRAUD_WARNING_CODES = ['PMT-1000', 'PMT-1001', 'PMT-1002', 'PMT-1003']
|
52
49
|
|
53
50
|
def initialize(options = {})
|
54
|
-
|
51
|
+
# Quickbooks is deprecating OAuth 1.0 on December 17, 2019.
|
52
|
+
# OAuth 2.0 requires a client_id, client_secret, access_token, and refresh_token
|
53
|
+
# To maintain backwards compatibility, check for the presence of a refresh_token (only specified for OAuth 2.0)
|
54
|
+
# When present, validate that all OAuth 2.0 options are present
|
55
|
+
if options[:refresh_token]
|
56
|
+
requires!(options, :client_id, :client_secret, :access_token, :refresh_token)
|
57
|
+
else
|
58
|
+
requires!(options, :consumer_key, :consumer_secret, :access_token, :token_secret, :realm)
|
59
|
+
end
|
55
60
|
@options = options
|
56
61
|
super
|
57
62
|
end
|
@@ -62,7 +67,8 @@ module ActiveMerchant #:nodoc:
|
|
62
67
|
add_charge_data(post, payment, options)
|
63
68
|
post[:capture] = 'true'
|
64
69
|
|
65
|
-
commit(ENDPOINT, post)
|
70
|
+
response = commit(ENDPOINT, post)
|
71
|
+
check_token_response(response, ENDPOINT, post, options)
|
66
72
|
end
|
67
73
|
|
68
74
|
def authorize(money, payment, options = {})
|
@@ -71,30 +77,46 @@ module ActiveMerchant #:nodoc:
|
|
71
77
|
add_charge_data(post, payment, options)
|
72
78
|
post[:capture] = 'false'
|
73
79
|
|
74
|
-
commit(ENDPOINT, post)
|
80
|
+
response = commit(ENDPOINT, post)
|
81
|
+
check_token_response(response, ENDPOINT, post, options)
|
75
82
|
end
|
76
83
|
|
77
84
|
def capture(money, authorization, options = {})
|
78
85
|
post = {}
|
79
|
-
|
86
|
+
authorization, = split_authorization(authorization)
|
80
87
|
post[:amount] = localized_amount(money, currency(money))
|
81
88
|
add_context(post, options)
|
82
89
|
|
83
|
-
commit(capture_uri, post)
|
90
|
+
response = commit(capture_uri(authorization), post)
|
91
|
+
check_token_response(response, capture_uri(authorization), post, options)
|
84
92
|
end
|
85
93
|
|
86
94
|
def refund(money, authorization, options = {})
|
87
95
|
post = {}
|
88
96
|
post[:amount] = localized_amount(money, currency(money))
|
89
97
|
add_context(post, options)
|
98
|
+
authorization, = split_authorization(authorization)
|
90
99
|
|
91
|
-
commit(refund_uri(authorization), post)
|
100
|
+
response = commit(refund_uri(authorization), post)
|
101
|
+
check_token_response(response, refund_uri(authorization), post, options)
|
102
|
+
end
|
103
|
+
|
104
|
+
def void(authorization, options = {})
|
105
|
+
_, request_id = split_authorization(authorization)
|
106
|
+
|
107
|
+
response = commit(void_uri(request_id))
|
108
|
+
check_token_response(response, void_uri(request_id), {}, options)
|
92
109
|
end
|
93
110
|
|
94
111
|
def verify(credit_card, options = {})
|
95
112
|
authorize(1.00, credit_card, options)
|
96
113
|
end
|
97
114
|
|
115
|
+
def refresh
|
116
|
+
response = refresh_access_token
|
117
|
+
response_object(response)
|
118
|
+
end
|
119
|
+
|
98
120
|
def supports_scrubbing?
|
99
121
|
true
|
100
122
|
end
|
@@ -107,7 +129,12 @@ module ActiveMerchant #:nodoc:
|
|
107
129
|
gsub(%r((oauth_signature=\")[a-zA-Z%0-9]+), '\1[FILTERED]').
|
108
130
|
gsub(%r((oauth_token=\")\w+), '\1[FILTERED]').
|
109
131
|
gsub(%r((number\D+)\d{16}), '\1[FILTERED]').
|
110
|
-
gsub(%r((cvc\D+)\d{3}), '\1[FILTERED]')
|
132
|
+
gsub(%r((cvc\D+)\d{3}), '\1[FILTERED]').
|
133
|
+
gsub(%r((Authorization: Basic )\w+), '\1[FILTERED]').
|
134
|
+
gsub(%r((access_token\\?":\\?")[\w\-\.]+)i, '\1[FILTERED]').
|
135
|
+
gsub(%r((refresh_token\\?":\\?")\w+), '\1[FILTERED]').
|
136
|
+
gsub(%r((refresh_token=)\w+), '\1[FILTERED]').
|
137
|
+
gsub(%r((Authorization: Bearer )[\w\-\.]+)i, '\1[FILTERED]\2')
|
111
138
|
end
|
112
139
|
|
113
140
|
private
|
@@ -124,8 +151,9 @@ module ActiveMerchant #:nodoc:
|
|
124
151
|
if address = options[:billing_address] || options[:address]
|
125
152
|
card_address[:streetAddress] = address[:address1]
|
126
153
|
card_address[:city] = address[:city]
|
127
|
-
|
128
|
-
card_address[:
|
154
|
+
region = address[:state] || address[:region]
|
155
|
+
card_address[:region] = region if region.present?
|
156
|
+
card_address[:country] = address[:country] if address[:country].present?
|
129
157
|
card_address[:postalCode] = address[:zip] if address[:zip]
|
130
158
|
end
|
131
159
|
post[:card][:address] = card_address
|
@@ -170,30 +198,30 @@ module ActiveMerchant #:nodoc:
|
|
170
198
|
# The QuickBooks API returns HTTP 4xx on failed transactions, which causes a
|
171
199
|
# ResponseError raise, so we have to inspect the response and discern between
|
172
200
|
# a legitimate HTTP error and an actual gateway transactional error.
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
raise ArgumentError, "Invalid HTTP method: #{method}. Valid methods are :post and :get"
|
201
|
+
headers = {}
|
202
|
+
response =
|
203
|
+
begin
|
204
|
+
headers = headers(method, endpoint)
|
205
|
+
method == :post ? ssl_post(endpoint, post_data(body), headers) : ssl_request(:get, endpoint, nil, headers)
|
206
|
+
rescue ResponseError => e
|
207
|
+
extract_response_body_or_raise(e)
|
181
208
|
end
|
182
|
-
rescue ResponseError => e
|
183
|
-
extract_response_body_or_raise(e)
|
184
|
-
end
|
185
209
|
|
186
|
-
response_object(response)
|
210
|
+
response_object(response, headers)
|
187
211
|
end
|
188
212
|
|
189
|
-
def response_object(raw_response)
|
213
|
+
def response_object(raw_response, headers = {})
|
190
214
|
parsed_response = parse(raw_response)
|
191
215
|
|
216
|
+
# Include access_token and refresh_token in params for OAuth 2.0
|
217
|
+
parsed_response['access_token'] = @options[:access_token] if @options[:refresh_token]
|
218
|
+
parsed_response['refresh_token'] = @options[:refresh_token] if @options[:refresh_token]
|
219
|
+
|
192
220
|
Response.new(
|
193
221
|
success?(parsed_response),
|
194
222
|
message_from(parsed_response),
|
195
223
|
parsed_response,
|
196
|
-
authorization: authorization_from(parsed_response),
|
224
|
+
authorization: authorization_from(parsed_response, headers),
|
197
225
|
test: test?,
|
198
226
|
cvv_result: cvv_code_from(parsed_response),
|
199
227
|
error_code: errors_from(parsed_response),
|
@@ -210,7 +238,10 @@ module ActiveMerchant #:nodoc:
|
|
210
238
|
end
|
211
239
|
|
212
240
|
def headers(method, uri)
|
213
|
-
|
241
|
+
return oauth_v2_headers if @options[:refresh_token]
|
242
|
+
|
243
|
+
raise ArgumentError, "Invalid HTTP method: #{method}. Valid methods are :post and :get" unless %i[post get].include?(method)
|
244
|
+
|
214
245
|
request_uri = URI.parse(uri)
|
215
246
|
|
216
247
|
# Following the guidelines from http://nouncer.com/oauth/authentication.html
|
@@ -229,7 +260,7 @@ module ActiveMerchant #:nodoc:
|
|
229
260
|
hmac_signature = OpenSSL::HMAC.digest(OpenSSL::Digest.new('sha1'), oauth_signing_key, oauth_signature_base_string)
|
230
261
|
|
231
262
|
# append signature to required OAuth parameters
|
232
|
-
oauth_parameters[:oauth_signature] = CGI.escape(Base64.encode64(hmac_signature).chomp.
|
263
|
+
oauth_parameters[:oauth_signature] = CGI.escape(Base64.encode64(hmac_signature).chomp.delete("\n"))
|
233
264
|
|
234
265
|
# prepare Authorization header string
|
235
266
|
oauth_parameters = Hash[oauth_parameters.sort_by { |k, _| k }]
|
@@ -243,6 +274,45 @@ module ActiveMerchant #:nodoc:
|
|
243
274
|
}
|
244
275
|
end
|
245
276
|
|
277
|
+
def oauth_v2_headers
|
278
|
+
{
|
279
|
+
'Content-Type' => 'application/json',
|
280
|
+
'Request-Id' => generate_unique_id,
|
281
|
+
'Accept' => 'application/json',
|
282
|
+
'Authorization' => "Bearer #{@options[:access_token]}"
|
283
|
+
}
|
284
|
+
end
|
285
|
+
|
286
|
+
def check_token_response(response, endpoint, body = {}, options = {})
|
287
|
+
return response unless @options[:refresh_token]
|
288
|
+
return response unless options[:allow_refresh]
|
289
|
+
return response unless response.params['code'] == 'AuthenticationFailed'
|
290
|
+
|
291
|
+
refresh_access_token
|
292
|
+
commit(endpoint, body)
|
293
|
+
end
|
294
|
+
|
295
|
+
def refresh_access_token
|
296
|
+
post = {}
|
297
|
+
post[:grant_type] = 'refresh_token'
|
298
|
+
post[:refresh_token] = @options[:refresh_token]
|
299
|
+
data = post.collect { |key, value| "#{key}=#{CGI.escape(value.to_s)}" }.join('&')
|
300
|
+
|
301
|
+
basic_auth = Base64.strict_encode64("#{@options[:client_id]}:#{@options[:client_secret]}")
|
302
|
+
headers = {
|
303
|
+
'Content-Type' => 'application/x-www-form-urlencoded',
|
304
|
+
'Accept' => 'application/json',
|
305
|
+
'Authorization' => "Basic #{basic_auth}"
|
306
|
+
}
|
307
|
+
|
308
|
+
response = ssl_post(REFRESH_URI, data, headers)
|
309
|
+
json_response = JSON.parse(response)
|
310
|
+
|
311
|
+
@options[:access_token] = json_response['access_token'] if json_response['access_token']
|
312
|
+
@options[:refresh_token] = json_response['refresh_token'] if json_response['refresh_token']
|
313
|
+
response
|
314
|
+
end
|
315
|
+
|
246
316
|
def cvv_code_from(response)
|
247
317
|
if response['errors'].present?
|
248
318
|
FRAUD_WARNING_CODES.include?(response['errors'].first['code']) ? 'I' : ''
|
@@ -254,7 +324,7 @@ module ActiveMerchant #:nodoc:
|
|
254
324
|
def success?(response)
|
255
325
|
return FRAUD_WARNING_CODES.concat(['0']).include?(response['errors'].first['code']) if response['errors']
|
256
326
|
|
257
|
-
|
327
|
+
!%w[DECLINED CANCELLED].include?(response['status']) && !%w[AuthenticationFailed AuthorizationFailed].include?(response['code'])
|
258
328
|
end
|
259
329
|
|
260
330
|
def message_from(response)
|
@@ -262,11 +332,20 @@ module ActiveMerchant #:nodoc:
|
|
262
332
|
end
|
263
333
|
|
264
334
|
def errors_from(response)
|
265
|
-
|
335
|
+
if %w[AuthenticationFailed AuthorizationFailed].include?(response['code'])
|
336
|
+
response['code']
|
337
|
+
else
|
338
|
+
response['errors'].present? ? STANDARD_ERROR_CODE_MAPPING[response['errors'].first['code']] : ''
|
339
|
+
end
|
340
|
+
end
|
341
|
+
|
342
|
+
def authorization_from(response, headers = {})
|
343
|
+
[response['id'], headers['Request-Id']].join('|')
|
266
344
|
end
|
267
345
|
|
268
|
-
def
|
269
|
-
|
346
|
+
def split_authorization(authorization)
|
347
|
+
authorization, request_id = authorization.split('|')
|
348
|
+
[authorization, request_id]
|
270
349
|
end
|
271
350
|
|
272
351
|
def fraud_review_status_from(response)
|
@@ -283,7 +362,15 @@ module ActiveMerchant #:nodoc:
|
|
283
362
|
end
|
284
363
|
|
285
364
|
def refund_uri(authorization)
|
286
|
-
"#{ENDPOINT}/#{CGI.escape(authorization)}/refunds"
|
365
|
+
"#{ENDPOINT}/#{CGI.escape(authorization.to_s)}/refunds"
|
366
|
+
end
|
367
|
+
|
368
|
+
def capture_uri(authorization)
|
369
|
+
"#{ENDPOINT}/#{CGI.escape(authorization.to_s)}/capture"
|
370
|
+
end
|
371
|
+
|
372
|
+
def void_uri(request_id)
|
373
|
+
"#{VOID_ENDPOINT}/#{CGI.escape(request_id.to_s)}/void"
|
287
374
|
end
|
288
375
|
end
|
289
376
|
end
|