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,8 +1,10 @@
|
|
|
1
|
-
module ActiveMerchant
|
|
2
|
-
module Billing
|
|
1
|
+
module ActiveMerchant # :nodoc:
|
|
2
|
+
module Billing # :nodoc:
|
|
3
3
|
class PinGateway < Gateway
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
version '1'
|
|
5
|
+
|
|
6
|
+
self.test_url = "https://test-api.pinpayments.com/#{fetch_version}"
|
|
7
|
+
self.live_url = "https://api.pinpayments.com/#{fetch_version}"
|
|
6
8
|
|
|
7
9
|
self.default_currency = 'AUD'
|
|
8
10
|
self.money_format = :cents
|
|
@@ -16,37 +18,38 @@ module ActiveMerchant #:nodoc:
|
|
|
16
18
|
super
|
|
17
19
|
end
|
|
18
20
|
|
|
19
|
-
# Create a charge using a
|
|
21
|
+
# Create a charge using a payment method, card token or customer token
|
|
20
22
|
#
|
|
21
|
-
# To charge a
|
|
23
|
+
# To charge a payment method: purchase([money], [payment_method hash], ...)
|
|
22
24
|
# To charge a customer: purchase([money], [token], ...)
|
|
23
|
-
def purchase(money,
|
|
25
|
+
def purchase(money, payment_method, options = {})
|
|
24
26
|
post = {}
|
|
25
27
|
|
|
26
28
|
add_amount(post, money, options)
|
|
27
29
|
add_customer_data(post, options)
|
|
28
30
|
add_invoice(post, options)
|
|
29
|
-
|
|
30
|
-
add_address(post,
|
|
31
|
+
add_payment_method(post, payment_method)
|
|
32
|
+
add_address(post, payment_method, options)
|
|
31
33
|
add_capture(post, options)
|
|
32
34
|
add_metadata(post, options)
|
|
33
35
|
add_3ds(post, options)
|
|
36
|
+
add_platform_adjustment(post, options)
|
|
34
37
|
|
|
35
38
|
commit(:post, 'charges', post, options)
|
|
36
39
|
end
|
|
37
40
|
|
|
38
|
-
# Create a customer and associated
|
|
39
|
-
# can be used instead of a
|
|
40
|
-
def store(
|
|
41
|
+
# Create a customer and associated payment method. The token that is returned
|
|
42
|
+
# can be used instead of a payment method parameter in the purchase method
|
|
43
|
+
def store(payment_method, options = {})
|
|
41
44
|
post = {}
|
|
42
45
|
|
|
43
|
-
|
|
46
|
+
add_payment_method(post, payment_method)
|
|
44
47
|
add_customer_data(post, options)
|
|
45
|
-
add_address(post,
|
|
48
|
+
add_address(post, payment_method, options)
|
|
46
49
|
commit(:post, 'customers', post, options)
|
|
47
50
|
end
|
|
48
51
|
|
|
49
|
-
# Unstore a customer and associated
|
|
52
|
+
# Unstore a customer and associated payment method.
|
|
50
53
|
def unstore(token)
|
|
51
54
|
customer_token =
|
|
52
55
|
if /cus_/.match?(token)
|
|
@@ -62,12 +65,12 @@ module ActiveMerchant #:nodoc:
|
|
|
62
65
|
commit(:post, "charges/#{CGI.escape(token)}/refunds", { amount: amount(money) }, options)
|
|
63
66
|
end
|
|
64
67
|
|
|
65
|
-
# Authorize an amount on a
|
|
68
|
+
# Authorize an amount on a payment method. Once authorized, you can later
|
|
66
69
|
# capture this charge using the charge token that is returned.
|
|
67
|
-
def authorize(money,
|
|
70
|
+
def authorize(money, payment_method, options = {})
|
|
68
71
|
options[:capture] = false
|
|
69
72
|
|
|
70
|
-
purchase(money,
|
|
73
|
+
purchase(money, payment_method, options)
|
|
71
74
|
end
|
|
72
75
|
|
|
73
76
|
# Captures a previously authorized charge. Capturing only part of the original
|
|
@@ -81,14 +84,47 @@ module ActiveMerchant #:nodoc:
|
|
|
81
84
|
commit(:put, "charges/#{CGI.escape(token)}/void", {}, options)
|
|
82
85
|
end
|
|
83
86
|
|
|
84
|
-
#
|
|
85
|
-
def
|
|
87
|
+
# Returns the details of a charge
|
|
88
|
+
def inquire(token, options = {})
|
|
89
|
+
commit(:get, "charges/#{CGI.escape(token)}", nil, options)
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
# Returns a paginated list of charges matching the search criteria.
|
|
93
|
+
# ==== Options:
|
|
94
|
+
# * <tt>:query </tt> -- (Optional) Return only charges whose fields match the query. Fields covered include description, email, metadata, cardholder name, currency, amount (exact), charge token (exact), card token (exact), refund token (exact), and customer token (exact).
|
|
95
|
+
# * <tt>:start_date </tt> -- (Optional) Return only charges created on or after this date (e.g. 2012/12/25).
|
|
96
|
+
# * <tt>:end_date </tt> -- (Optional) Return only charges created before this date (e.g. 2013/12/25).
|
|
97
|
+
# * <tt>:sort</tt> -- (Optional) The field used to sort the charges (created_at or amount). Default value is created_at.
|
|
98
|
+
# * <tt>:direction </tt> -- (Optional) The direction in which to sort the charges (1 for ascending or -1 for descending). Default value is 1.
|
|
99
|
+
#
|
|
100
|
+
def transaction_search(options = {})
|
|
101
|
+
params = {}
|
|
102
|
+
params[:query] = options[:query] if options[:query]
|
|
103
|
+
params[:start_date] = options[:start_date] if options[:start_date]
|
|
104
|
+
params[:end_date] = options[:end_date] if options[:end_date]
|
|
105
|
+
params[:sort] = options[:sort] if options[:sort]
|
|
106
|
+
params[:direction] = options[:direction] if options[:direction]
|
|
107
|
+
params[:page] = options[:page] if options[:page]
|
|
108
|
+
|
|
109
|
+
action = 'charges/search'
|
|
110
|
+
action += '?' + params.to_query unless params.empty?
|
|
111
|
+
|
|
112
|
+
commit(:get, action, nil, options)
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
# Verify a previously authorized charge.
|
|
116
|
+
def verify_3ds(session_token, options = {})
|
|
117
|
+
commit(:get, "/charges/verify?session_token=#{session_token}", nil, options)
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
# Updates the payment method for the customer.
|
|
121
|
+
def update(token, payment_method, options = {})
|
|
86
122
|
post = {}
|
|
87
123
|
token = get_customer_token(token)
|
|
88
124
|
|
|
89
|
-
|
|
125
|
+
add_payment_method(post, payment_method)
|
|
90
126
|
add_customer_data(post, options)
|
|
91
|
-
add_address(post,
|
|
127
|
+
add_address(post, payment_method, options)
|
|
92
128
|
commit(:put, "customers/#{CGI.escape(token)}", post, options)
|
|
93
129
|
end
|
|
94
130
|
|
|
@@ -100,7 +136,8 @@ module ActiveMerchant #:nodoc:
|
|
|
100
136
|
transcript.
|
|
101
137
|
gsub(%r((Authorization: Basic )\w+), '\1[FILTERED]').
|
|
102
138
|
gsub(/(number\\?":\\?")(\d*)/, '\1[FILTERED]').
|
|
103
|
-
gsub(/(cvc\\?":\\?")(\d*)/, '\1[FILTERED]')
|
|
139
|
+
gsub(/(cvc\\?":\\?")(\d*)/, '\1[FILTERED]').
|
|
140
|
+
gsub(/(cryptogram\\?":\\?")(\w*)/, '\1[FILTERED]')
|
|
104
141
|
end
|
|
105
142
|
|
|
106
143
|
private
|
|
@@ -116,8 +153,8 @@ module ActiveMerchant #:nodoc:
|
|
|
116
153
|
post[:ip_address] = options[:ip] if options[:ip]
|
|
117
154
|
end
|
|
118
155
|
|
|
119
|
-
def add_address(post,
|
|
120
|
-
return if
|
|
156
|
+
def add_address(post, payment_method, options)
|
|
157
|
+
return if payment_method.kind_of?(String) || payment_method.kind_of?(NetworkTokenizationCreditCard)
|
|
121
158
|
|
|
122
159
|
address = (options[:billing_address] || options[:address])
|
|
123
160
|
return unless address
|
|
@@ -143,26 +180,51 @@ module ActiveMerchant #:nodoc:
|
|
|
143
180
|
post[:capture] = capture != false
|
|
144
181
|
end
|
|
145
182
|
|
|
146
|
-
def
|
|
147
|
-
|
|
148
|
-
post[:card] ||= {}
|
|
183
|
+
def add_payment_method(post, payment_method)
|
|
184
|
+
return unless payment_method
|
|
149
185
|
|
|
186
|
+
case payment_method
|
|
187
|
+
when NetworkTokenizationCreditCard
|
|
188
|
+
get_token = get_single_use_token(payment_method, options)
|
|
189
|
+
post[:payment_source_token] = get_token.params.dig('response', 'token')
|
|
190
|
+
when CreditCard
|
|
191
|
+
post[:card] ||= {}
|
|
150
192
|
post[:card].merge!(
|
|
151
|
-
number:
|
|
152
|
-
expiry_month:
|
|
153
|
-
expiry_year:
|
|
154
|
-
cvc:
|
|
155
|
-
name:
|
|
193
|
+
number: payment_method.number,
|
|
194
|
+
expiry_month: payment_method.month,
|
|
195
|
+
expiry_year: payment_method.year,
|
|
196
|
+
cvc: payment_method.verification_value,
|
|
197
|
+
name: payment_method.name
|
|
156
198
|
)
|
|
157
|
-
|
|
158
|
-
if /^card_/.match?(
|
|
159
|
-
post[:card_token] = get_card_token(
|
|
199
|
+
when String
|
|
200
|
+
if /^card_/.match?(payment_method)
|
|
201
|
+
post[:card_token] = get_card_token(payment_method)
|
|
160
202
|
else
|
|
161
|
-
post[:customer_token] =
|
|
203
|
+
post[:customer_token] = payment_method
|
|
162
204
|
end
|
|
205
|
+
else
|
|
206
|
+
raise ArgumentError, "Invalid payment method type: #{payment_method.class}"
|
|
163
207
|
end
|
|
164
208
|
end
|
|
165
209
|
|
|
210
|
+
# Get a single use token from Pin for NT based payment methods
|
|
211
|
+
# This is used to create a charge using a network tokenized card
|
|
212
|
+
def get_single_use_token(payment_method, options)
|
|
213
|
+
post = {
|
|
214
|
+
type: 'network_token',
|
|
215
|
+
source: {
|
|
216
|
+
number: payment_method.number,
|
|
217
|
+
expiry_month: payment_method.month,
|
|
218
|
+
expiry_year: payment_method.year,
|
|
219
|
+
network_type: payment_method.source.to_s.gsub('_', ''),
|
|
220
|
+
cryptogram: payment_method.payment_cryptogram,
|
|
221
|
+
eci: payment_method.eci
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
commit(:post, 'payment_sources', post, options)
|
|
226
|
+
end
|
|
227
|
+
|
|
166
228
|
def get_customer_token(token)
|
|
167
229
|
token.split(/;(?=cus)/).last
|
|
168
230
|
end
|
|
@@ -175,13 +237,23 @@ module ActiveMerchant #:nodoc:
|
|
|
175
237
|
post[:metadata] = options[:metadata] if options[:metadata]
|
|
176
238
|
end
|
|
177
239
|
|
|
240
|
+
def add_platform_adjustment(post, options)
|
|
241
|
+
post[:platform_adjustment] = options[:platform_adjustment] if options[:platform_adjustment]
|
|
242
|
+
end
|
|
243
|
+
|
|
178
244
|
def add_3ds(post, options)
|
|
179
245
|
if options[:three_d_secure]
|
|
180
246
|
post[:three_d_secure] = {}
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
247
|
+
if options[:three_d_secure][:enabled]
|
|
248
|
+
post[:three_d_secure][:enabled] = true
|
|
249
|
+
post[:three_d_secure][:fallback_ok] = options[:three_d_secure][:fallback_ok] unless options[:three_d_secure][:fallback_ok].nil?
|
|
250
|
+
post[:three_d_secure][:callback_url] = options[:three_d_secure][:callback_url] if options[:three_d_secure][:callback_url]
|
|
251
|
+
else
|
|
252
|
+
post[:three_d_secure][:version] = options[:three_d_secure][:version] if options[:three_d_secure][:version]
|
|
253
|
+
post[:three_d_secure][:eci] = options[:three_d_secure][:eci] if options[:three_d_secure][:eci]
|
|
254
|
+
post[:three_d_secure][:cavv] = options[:three_d_secure][:cavv] if options[:three_d_secure][:cavv]
|
|
255
|
+
post[:three_d_secure][:transaction_id] = options[:three_d_secure][:ds_transaction_id] || options[:three_d_secure][:xid]
|
|
256
|
+
end
|
|
185
257
|
end
|
|
186
258
|
end
|
|
187
259
|
|
|
@@ -208,6 +280,8 @@ module ActiveMerchant #:nodoc:
|
|
|
208
280
|
|
|
209
281
|
if body.nil?
|
|
210
282
|
no_content_response
|
|
283
|
+
elsif body['response'].is_a?(Array)
|
|
284
|
+
paginated_response(body)
|
|
211
285
|
elsif body['response']
|
|
212
286
|
success_response(body)
|
|
213
287
|
elsif body['error']
|
|
@@ -253,6 +327,15 @@ module ActiveMerchant #:nodoc:
|
|
|
253
327
|
return Response.new(false, message)
|
|
254
328
|
end
|
|
255
329
|
|
|
330
|
+
def paginated_response(body)
|
|
331
|
+
Response.new(
|
|
332
|
+
true,
|
|
333
|
+
'Search successful',
|
|
334
|
+
body,
|
|
335
|
+
test: test?
|
|
336
|
+
)
|
|
337
|
+
end
|
|
338
|
+
|
|
256
339
|
def token(response)
|
|
257
340
|
if response['token'].start_with?('cus')
|
|
258
341
|
"#{response.dig('card', 'token')};#{response['token']}"
|
|
@@ -266,6 +349,8 @@ module ActiveMerchant #:nodoc:
|
|
|
266
349
|
end
|
|
267
350
|
|
|
268
351
|
def post_data(parameters = {})
|
|
352
|
+
return nil unless parameters
|
|
353
|
+
|
|
269
354
|
parameters.to_json
|
|
270
355
|
end
|
|
271
356
|
end
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
module ActiveMerchant
|
|
2
|
-
module Billing
|
|
1
|
+
module ActiveMerchant # :nodoc:
|
|
2
|
+
module Billing # :nodoc:
|
|
3
3
|
class PlexoGateway < Gateway
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
version 'v1'
|
|
5
|
+
|
|
6
|
+
self.test_url = "https://api.testing.plexo.com.uy/#{fetch_version}/payments"
|
|
7
|
+
self.live_url = "https://api.plexo.com.uy/#{fetch_version}/payments"
|
|
6
8
|
|
|
7
9
|
self.supported_countries = ['UY']
|
|
8
10
|
self.default_currency = 'UYU'
|
|
@@ -44,6 +46,11 @@ module ActiveMerchant #:nodoc:
|
|
|
44
46
|
commit("/#{authorization}/captures", post, options)
|
|
45
47
|
end
|
|
46
48
|
|
|
49
|
+
def inquire(authorization, options = {})
|
|
50
|
+
post = { payment_id: authorization }
|
|
51
|
+
commit('status', post, options)
|
|
52
|
+
end
|
|
53
|
+
|
|
47
54
|
def refund(money, authorization, options = {})
|
|
48
55
|
post = {}
|
|
49
56
|
post[:ReferenceId] = options[:reference_id] || generate_unique_id
|
|
@@ -67,6 +74,7 @@ module ActiveMerchant #:nodoc:
|
|
|
67
74
|
def verify(credit_card, options = {})
|
|
68
75
|
post = {}
|
|
69
76
|
post[:ReferenceId] = options[:reference_id] || generate_unique_id
|
|
77
|
+
post[:Flow] = 'direct'
|
|
70
78
|
post[:MerchantId] = options[:merchant_id] || @credentials[:merchant_id]
|
|
71
79
|
post[:StatementDescriptor] = options[:statement_descriptor] if options[:statement_descriptor]
|
|
72
80
|
post[:CustomerId] = options[:customer_id] if options[:customer_id]
|
|
@@ -76,6 +84,7 @@ module ActiveMerchant #:nodoc:
|
|
|
76
84
|
add_metadata(post, options[:metadata])
|
|
77
85
|
add_amount(money, post, options)
|
|
78
86
|
add_browser_details(post, options)
|
|
87
|
+
add_invoice_number(post, options)
|
|
79
88
|
|
|
80
89
|
commit('/verify', post, options)
|
|
81
90
|
end
|
|
@@ -90,7 +99,8 @@ module ActiveMerchant #:nodoc:
|
|
|
90
99
|
gsub(%r(("Number\\?"\s*:\s*\\?")[^"]*)i, '\1[FILTERED]').
|
|
91
100
|
gsub(%r(("Cvc\\?"\s*:\s*\\?")[^"]*)i, '\1[FILTERED]').
|
|
92
101
|
gsub(%r(("InvoiceNumber\\?"\s*:\s*\\?")[^"]*)i, '\1[FILTERED]').
|
|
93
|
-
gsub(%r(("MerchantId\\?"\s*:\s*\\?")[^"]*)i, '\1[FILTERED]')
|
|
102
|
+
gsub(%r(("MerchantId\\?"\s*:\s*\\?")[^"]*)i, '\1[FILTERED]').
|
|
103
|
+
gsub(%r(("Cryptogram\\?"\s*:\s*\\?")[^"]*)i, '\1[FILTERED]')
|
|
94
104
|
end
|
|
95
105
|
|
|
96
106
|
private
|
|
@@ -105,12 +115,14 @@ module ActiveMerchant #:nodoc:
|
|
|
105
115
|
post[:Installments] = options[:installments] if options[:installments]
|
|
106
116
|
post[:StatementDescriptor] = options[:statement_descriptor] if options[:statement_descriptor]
|
|
107
117
|
post[:CustomerId] = options[:customer_id] if options[:customer_id]
|
|
118
|
+
post[:Flow] = 'direct'
|
|
108
119
|
|
|
109
120
|
add_payment_method(post, payment, options)
|
|
110
121
|
add_items(post, options[:items])
|
|
111
122
|
add_metadata(post, options[:metadata])
|
|
112
123
|
add_amount(money, post, options)
|
|
113
124
|
add_browser_details(post, options)
|
|
125
|
+
add_invoice_number(post, options)
|
|
114
126
|
end
|
|
115
127
|
|
|
116
128
|
def header(parameters = {})
|
|
@@ -186,18 +198,42 @@ module ActiveMerchant #:nodoc:
|
|
|
186
198
|
post[:BrowserDetails][:IpAddress] = browser_details[:ip] if browser_details[:ip]
|
|
187
199
|
end
|
|
188
200
|
|
|
201
|
+
def add_invoice_number(post, options)
|
|
202
|
+
post[:InvoiceNumber] = options[:invoice_number] if options[:invoice_number]
|
|
203
|
+
end
|
|
204
|
+
|
|
189
205
|
def add_payment_method(post, payment, options)
|
|
190
|
-
|
|
206
|
+
payment_method = build_payment_method(payment)
|
|
191
207
|
|
|
192
|
-
if
|
|
193
|
-
|
|
194
|
-
post[:paymentMethod]
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
post[:paymentMethod][:Card][:ExpYear] = format(payment.year, :two_digits) if payment.year
|
|
198
|
-
post[:paymentMethod][:Card][:Cvc] = payment.verification_value if payment.verification_value
|
|
208
|
+
if payment_method.present?
|
|
209
|
+
add_card_holder(payment_method[:NetworkToken] || payment_method[:Card], payment, options)
|
|
210
|
+
post[:paymentMethod] = payment_method
|
|
211
|
+
end
|
|
212
|
+
end
|
|
199
213
|
|
|
200
|
-
|
|
214
|
+
def build_payment_method(payment)
|
|
215
|
+
case payment
|
|
216
|
+
when NetworkTokenizationCreditCard
|
|
217
|
+
{
|
|
218
|
+
source: 'network-token',
|
|
219
|
+
id: payment.brand,
|
|
220
|
+
NetworkToken: {
|
|
221
|
+
Number: payment.number,
|
|
222
|
+
ExpMonth: (format(payment.month, :two_digits) if payment.month),
|
|
223
|
+
ExpYear: (format(payment.year, :two_digits) if payment.year),
|
|
224
|
+
Cryptogram: payment.payment_cryptogram
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
when CreditCard
|
|
228
|
+
{
|
|
229
|
+
type: 'card',
|
|
230
|
+
Card: {
|
|
231
|
+
Number: payment.number,
|
|
232
|
+
ExpMonth: (format(payment.month, :two_digits) if payment.month),
|
|
233
|
+
ExpYear: (format(payment.year, :two_digits) if payment.year),
|
|
234
|
+
Cvc: payment.verification_value
|
|
235
|
+
}
|
|
236
|
+
}
|
|
201
237
|
end
|
|
202
238
|
end
|
|
203
239
|
|
|
@@ -235,8 +271,11 @@ module ActiveMerchant #:nodoc:
|
|
|
235
271
|
JSON.parse(body)
|
|
236
272
|
end
|
|
237
273
|
|
|
238
|
-
def build_url(action,
|
|
239
|
-
|
|
274
|
+
def build_url(action, options, parameters)
|
|
275
|
+
base_url = test? ? test_url : live_url
|
|
276
|
+
return "#{base_url}/#{parameters[:payment_id]}" if action == 'status' && parameters[:payment_id]
|
|
277
|
+
|
|
278
|
+
url = base_url
|
|
240
279
|
url += action if APPENDED_URLS.any? { |key| action.include?(key) }
|
|
241
280
|
url
|
|
242
281
|
end
|
|
@@ -256,10 +295,12 @@ module ActiveMerchant #:nodoc:
|
|
|
256
295
|
end
|
|
257
296
|
|
|
258
297
|
def commit(action, parameters, options = {})
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
response =
|
|
298
|
+
url = build_url(action, options, parameters)
|
|
299
|
+
|
|
300
|
+
raw = make_request(action, url, parameters, options)
|
|
301
|
+
response = parse(raw)
|
|
302
|
+
|
|
303
|
+
reorder_amount_fields(response) if AMOUNT_IN_RESPONSE.include?(action)
|
|
263
304
|
|
|
264
305
|
Response.new(
|
|
265
306
|
success_from(response),
|
|
@@ -271,6 +312,16 @@ module ActiveMerchant #:nodoc:
|
|
|
271
312
|
)
|
|
272
313
|
end
|
|
273
314
|
|
|
315
|
+
def make_request(action, url, parameters, options)
|
|
316
|
+
if action == 'status'
|
|
317
|
+
ssl_get(url, header(options))
|
|
318
|
+
else
|
|
319
|
+
ssl_post(url, parameters.to_json, header(options))
|
|
320
|
+
end
|
|
321
|
+
rescue ResponseError => e
|
|
322
|
+
e.response.body
|
|
323
|
+
end
|
|
324
|
+
|
|
274
325
|
def handle_response(response)
|
|
275
326
|
case response.code.to_i
|
|
276
327
|
when 200...300, 400, 401
|
|
@@ -178,11 +178,15 @@ module ActiveMerchant
|
|
|
178
178
|
success = SUCCESS_CODES.include?(response[:finalstatus])
|
|
179
179
|
message = success ? 'Success' : message_from(response)
|
|
180
180
|
|
|
181
|
-
Response.new(
|
|
181
|
+
Response.new(
|
|
182
|
+
success,
|
|
183
|
+
message,
|
|
184
|
+
response,
|
|
182
185
|
test: test?,
|
|
183
186
|
authorization: response[:orderid],
|
|
184
187
|
avs_result: { code: response[:avs_code] },
|
|
185
|
-
cvv_result: response[:cvvresp]
|
|
188
|
+
cvv_result: response[:cvvresp]
|
|
189
|
+
)
|
|
186
190
|
end
|
|
187
191
|
|
|
188
192
|
def parse(body)
|
|
@@ -1,23 +1,27 @@
|
|
|
1
|
-
module ActiveMerchant
|
|
2
|
-
module Billing
|
|
1
|
+
module ActiveMerchant # :nodoc:
|
|
2
|
+
module Billing # :nodoc:
|
|
3
3
|
class PriorityGateway < Gateway
|
|
4
|
+
version 'v3'
|
|
5
|
+
version 'v1', :verify_card_api
|
|
6
|
+
version 'v1', :jwt_api
|
|
7
|
+
|
|
4
8
|
# Sandbox and Production
|
|
5
|
-
self.test_url =
|
|
6
|
-
self.live_url =
|
|
9
|
+
self.test_url = "https://sandbox.api.mxmerchant.com/checkout/#{fetch_version}/payment"
|
|
10
|
+
self.live_url = "https://api.mxmerchant.com/checkout/#{fetch_version}/payment"
|
|
7
11
|
|
|
8
12
|
class_attribute :test_url_verify, :live_url_verify, :test_auth, :live_auth, :test_env_verify, :live_env_verify, :test_url_batch, :live_url_batch, :test_url_jwt, :live_url_jwt, :merchant
|
|
9
13
|
|
|
10
14
|
# Sandbox and Production - verify card
|
|
11
|
-
self.test_url_verify =
|
|
12
|
-
self.live_url_verify =
|
|
15
|
+
self.test_url_verify = "https://sandbox-api2.mxmerchant.com/merchant/#{fetch_version(:verify_card_api)}/bin"
|
|
16
|
+
self.live_url_verify = "https://api2.mxmerchant.com/merchant/#{fetch_version(:verify_card_api)}/bin"
|
|
13
17
|
|
|
14
18
|
# Sandbox and Production - check batch status
|
|
15
|
-
self.test_url_batch =
|
|
16
|
-
self.live_url_batch =
|
|
19
|
+
self.test_url_batch = "https://sandbox.api.mxmerchant.com/checkout/#{fetch_version}/batch"
|
|
20
|
+
self.live_url_batch = "https://api.mxmerchant.com/checkout/#{fetch_version}/batch"
|
|
17
21
|
|
|
18
22
|
# Sandbox and Production - generate jwt for verify card url
|
|
19
|
-
self.test_url_jwt =
|
|
20
|
-
self.live_url_jwt =
|
|
23
|
+
self.test_url_jwt = "https://sandbox-api2.mxmerchant.com/security/#{fetch_version(:jwt_api)}/application/merchantId"
|
|
24
|
+
self.live_url_jwt = "https://api2.mxmerchant.com/security/#{fetch_version(:jwt_api)}/application/merchantId"
|
|
21
25
|
|
|
22
26
|
self.supported_countries = ['US']
|
|
23
27
|
self.default_currency = 'USD'
|
|
@@ -55,9 +59,10 @@ module ActiveMerchant #:nodoc:
|
|
|
55
59
|
|
|
56
60
|
add_merchant_id(params)
|
|
57
61
|
add_amount(params, amount, options)
|
|
58
|
-
add_auth_purchase_params(params,
|
|
62
|
+
add_auth_purchase_params(params, options)
|
|
63
|
+
add_credit_card(params, credit_card, 'purchase', options)
|
|
59
64
|
|
|
60
|
-
commit('purchase', params:
|
|
65
|
+
commit('purchase', params:)
|
|
61
66
|
end
|
|
62
67
|
|
|
63
68
|
def authorize(amount, credit_card, options = {})
|
|
@@ -67,9 +72,10 @@ module ActiveMerchant #:nodoc:
|
|
|
67
72
|
|
|
68
73
|
add_merchant_id(params)
|
|
69
74
|
add_amount(params, amount, options)
|
|
70
|
-
add_auth_purchase_params(params,
|
|
75
|
+
add_auth_purchase_params(params, options)
|
|
76
|
+
add_credit_card(params, credit_card, 'purchase', options)
|
|
71
77
|
|
|
72
|
-
commit('purchase', params:
|
|
78
|
+
commit('purchase', params:)
|
|
73
79
|
end
|
|
74
80
|
|
|
75
81
|
def credit(amount, credit_card, options = {})
|
|
@@ -81,7 +87,7 @@ module ActiveMerchant #:nodoc:
|
|
|
81
87
|
add_merchant_id(params)
|
|
82
88
|
add_amount(params, amount, options)
|
|
83
89
|
add_credit_params(params, credit_card, options)
|
|
84
|
-
commit('credit', params:
|
|
90
|
+
commit('credit', params:)
|
|
85
91
|
end
|
|
86
92
|
|
|
87
93
|
def refund(amount, authorization, options = {})
|
|
@@ -92,7 +98,7 @@ module ActiveMerchant #:nodoc:
|
|
|
92
98
|
# refund amounts must be negative
|
|
93
99
|
params['amount'] = ('-' + localized_amount(amount.to_f, options[:currency])).to_f
|
|
94
100
|
|
|
95
|
-
commit('refund', params:
|
|
101
|
+
commit('refund', params:)
|
|
96
102
|
end
|
|
97
103
|
|
|
98
104
|
def capture(amount, authorization, options = {})
|
|
@@ -100,21 +106,21 @@ module ActiveMerchant #:nodoc:
|
|
|
100
106
|
add_merchant_id(params)
|
|
101
107
|
add_amount(params, amount, options)
|
|
102
108
|
params['paymentToken'] = payment_token(authorization) || options[:payment_token]
|
|
103
|
-
params
|
|
109
|
+
add_auth_purchase_params(params, options)
|
|
104
110
|
|
|
105
|
-
commit('capture', params:
|
|
111
|
+
commit('capture', params:)
|
|
106
112
|
end
|
|
107
113
|
|
|
108
114
|
def void(authorization, options = {})
|
|
109
115
|
params = {}
|
|
110
116
|
|
|
111
|
-
commit('void', params
|
|
117
|
+
commit('void', params:, iid: payment_id(authorization))
|
|
112
118
|
end
|
|
113
119
|
|
|
114
120
|
def verify(credit_card, _options = {})
|
|
115
121
|
jwt = create_jwt.params['jwtToken']
|
|
116
122
|
|
|
117
|
-
commit('verify', card_number: credit_card.number, jwt:
|
|
123
|
+
commit('verify', card_number: credit_card.number, jwt:)
|
|
118
124
|
end
|
|
119
125
|
|
|
120
126
|
def get_payment_status(batch_id)
|
|
@@ -150,9 +156,8 @@ module ActiveMerchant #:nodoc:
|
|
|
150
156
|
params['merchantId'] = @options[:merchant_id]
|
|
151
157
|
end
|
|
152
158
|
|
|
153
|
-
def add_auth_purchase_params(params,
|
|
159
|
+
def add_auth_purchase_params(params, options)
|
|
154
160
|
add_replay_id(params, options)
|
|
155
|
-
add_credit_card(params, credit_card, 'purchase', options)
|
|
156
161
|
add_purchases_data(params, options)
|
|
157
162
|
add_shipping_data(params, options)
|
|
158
163
|
add_pos_data(params, options)
|
|
@@ -314,7 +319,7 @@ module ActiveMerchant #:nodoc:
|
|
|
314
319
|
when 'void'
|
|
315
320
|
base_url + "/#{ref_number}?force=true"
|
|
316
321
|
when 'verify'
|
|
317
|
-
(verify_url + '?search=') + credit_card_number.to_s[0..
|
|
322
|
+
(verify_url + '?search=') + credit_card_number.to_s[0..7]
|
|
318
323
|
when 'get_payment_status', 'close_batch'
|
|
319
324
|
batch_url + "/#{params}"
|
|
320
325
|
when 'create_jwt'
|
|
@@ -365,7 +370,7 @@ module ActiveMerchant #:nodoc:
|
|
|
365
370
|
end
|
|
366
371
|
|
|
367
372
|
def success_from(response, action)
|
|
368
|
-
return !response['bank'].empty? if action == 'verify' && response['bank']
|
|
373
|
+
return !response['bank'].empty? if action == 'verify' && response['bank'] && !response.dig('bank', 'name').blank?
|
|
369
374
|
|
|
370
375
|
%w[Approved Open Success Settled Voided].include?(response['status'])
|
|
371
376
|
end
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
require 'nokogiri'
|
|
2
2
|
|
|
3
|
-
module ActiveMerchant
|
|
4
|
-
module Billing
|
|
3
|
+
module ActiveMerchant # :nodoc:
|
|
4
|
+
module Billing # :nodoc:
|
|
5
5
|
class ProPayGateway < Gateway
|
|
6
6
|
self.test_url = 'https://xmltest.propay.com/API/PropayAPI.aspx'
|
|
7
7
|
self.live_url = 'https://epay.propay.com/api/propayapi.aspx'
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
require 'rexml/document'
|
|
2
2
|
|
|
3
|
-
module ActiveMerchant
|
|
4
|
-
module Billing
|
|
3
|
+
module ActiveMerchant # :nodoc:
|
|
4
|
+
module Billing # :nodoc:
|
|
5
5
|
# This class implements the Psigate gateway for the ActiveMerchant module.
|
|
6
6
|
#
|
|
7
7
|
# Modifications by Sean O'Hara ( sohara at sohara dot com )
|
|
@@ -102,11 +102,15 @@ module ActiveMerchant #:nodoc:
|
|
|
102
102
|
def commit(money, creditcard, options = {})
|
|
103
103
|
response = parse(ssl_post(url, post_data(money, creditcard, options)))
|
|
104
104
|
|
|
105
|
-
Response.new(
|
|
105
|
+
Response.new(
|
|
106
|
+
successful?(response),
|
|
107
|
+
message_from(response),
|
|
108
|
+
response,
|
|
106
109
|
test: test?,
|
|
107
110
|
authorization: build_authorization(response),
|
|
108
111
|
avs_result: { code: response[:avsresult] },
|
|
109
|
-
cvv_result: response[:cardidresult]
|
|
112
|
+
cvv_result: response[:cardidresult]
|
|
113
|
+
)
|
|
110
114
|
end
|
|
111
115
|
|
|
112
116
|
def url
|
|
@@ -259,11 +259,15 @@ module ActiveMerchant
|
|
|
259
259
|
def commit(request)
|
|
260
260
|
response = parse(ssl_post(self.live_url, post_data(request)))
|
|
261
261
|
|
|
262
|
-
Response.new(
|
|
262
|
+
Response.new(
|
|
263
|
+
response[:ResponseCode] == APPROVED,
|
|
264
|
+
response[:Message],
|
|
265
|
+
response,
|
|
263
266
|
test: test?,
|
|
264
267
|
authorization: response[:CrossReference],
|
|
265
268
|
cvv_result: CVV_CODE[response[:AVSCV2Check]],
|
|
266
|
-
avs_result: { code: AVS_CODE[response[:AVSCV2Check]] }
|
|
269
|
+
avs_result: { code: AVS_CODE[response[:AVSCV2Check]] }
|
|
270
|
+
)
|
|
267
271
|
end
|
|
268
272
|
|
|
269
273
|
# Put the passed data into a format that can be submitted to PSL
|