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
@@ -0,0 +1,392 @@
|
|
1
|
+
module ActiveMerchant #:nodoc:
|
2
|
+
module Billing #:nodoc:
|
3
|
+
class PriorityGateway < Gateway
|
4
|
+
# Sandbox and Production
|
5
|
+
self.test_url = 'https://sandbox.api.mxmerchant.com/checkout/v3/payment'
|
6
|
+
self.live_url = 'https://api.mxmerchant.com/checkout/v3/payment'
|
7
|
+
|
8
|
+
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
|
+
|
10
|
+
# Sandbox and Production - verify card
|
11
|
+
self.test_url_verify = 'https://sandbox-api2.mxmerchant.com/merchant/v1/bin'
|
12
|
+
self.live_url_verify = 'https://api2.mxmerchant.com/merchant/v1/bin'
|
13
|
+
|
14
|
+
# Sandbox and Production - check batch status
|
15
|
+
self.test_url_batch = 'https://sandbox.api.mxmerchant.com/checkout/v3/batch'
|
16
|
+
self.live_url_batch = 'https://api.mxmerchant.com/checkout/v3/batch'
|
17
|
+
|
18
|
+
# Sandbox and Production - generate jwt for verify card url
|
19
|
+
self.test_url_jwt = 'https://sandbox-api2.mxmerchant.com/security/v1/application/merchantId'
|
20
|
+
self.live_url_jwt = 'https://api2.mxmerchant.com/security/v1/application/merchantId'
|
21
|
+
|
22
|
+
self.supported_countries = ['US']
|
23
|
+
self.default_currency = 'USD'
|
24
|
+
self.supported_cardtypes = %i[visa master american_express discover]
|
25
|
+
|
26
|
+
self.homepage_url = 'https://mxmerchant.com/'
|
27
|
+
self.display_name = 'Priority'
|
28
|
+
|
29
|
+
def initialize(options = {})
|
30
|
+
requires!(options, :merchant_id, :api_key, :secret)
|
31
|
+
super
|
32
|
+
end
|
33
|
+
|
34
|
+
def basic_auth
|
35
|
+
Base64.strict_encode64("#{@options[:api_key]}:#{@options[:secret]}")
|
36
|
+
end
|
37
|
+
|
38
|
+
def request_headers
|
39
|
+
{
|
40
|
+
'Content-Type' => 'application/json',
|
41
|
+
'Authorization' => "Basic #{basic_auth}"
|
42
|
+
}
|
43
|
+
end
|
44
|
+
|
45
|
+
def request_verify_headers(jwt)
|
46
|
+
{
|
47
|
+
'Authorization' => "Bearer #{jwt}"
|
48
|
+
}
|
49
|
+
end
|
50
|
+
|
51
|
+
def purchase(amount, credit_card, options = {})
|
52
|
+
params = {}
|
53
|
+
params['authOnly'] = false
|
54
|
+
params['isSettleFunds'] = true
|
55
|
+
|
56
|
+
add_merchant_id(params)
|
57
|
+
add_amount(params, amount, options)
|
58
|
+
add_auth_purchase_params(params, credit_card, options)
|
59
|
+
|
60
|
+
commit('purchase', params: params)
|
61
|
+
end
|
62
|
+
|
63
|
+
def authorize(amount, credit_card, options = {})
|
64
|
+
params = {}
|
65
|
+
params['authOnly'] = true
|
66
|
+
params['isSettleFunds'] = false
|
67
|
+
|
68
|
+
add_merchant_id(params)
|
69
|
+
add_amount(params, amount, options)
|
70
|
+
add_auth_purchase_params(params, credit_card, options)
|
71
|
+
|
72
|
+
commit('purchase', params: params)
|
73
|
+
end
|
74
|
+
|
75
|
+
def credit(amount, credit_card, options = {})
|
76
|
+
params = {}
|
77
|
+
params['authOnly'] = false
|
78
|
+
params['isSettleFunds'] = true
|
79
|
+
amount = -amount
|
80
|
+
|
81
|
+
add_merchant_id(params)
|
82
|
+
add_amount(params, amount, options)
|
83
|
+
add_credit_params(params, credit_card, options)
|
84
|
+
commit('credit', params: params)
|
85
|
+
end
|
86
|
+
|
87
|
+
def refund(amount, authorization, options = {})
|
88
|
+
params = {}
|
89
|
+
add_merchant_id(params)
|
90
|
+
params['paymentToken'] = payment_token(authorization) || options[:payment_token]
|
91
|
+
|
92
|
+
# refund amounts must be negative
|
93
|
+
params['amount'] = ('-' + localized_amount(amount.to_f, options[:currency])).to_f
|
94
|
+
|
95
|
+
commit('refund', params: params)
|
96
|
+
end
|
97
|
+
|
98
|
+
def capture(amount, authorization, options = {})
|
99
|
+
params = {}
|
100
|
+
add_merchant_id(params)
|
101
|
+
add_amount(params, amount, options)
|
102
|
+
params['paymentToken'] = payment_token(authorization) || options[:payment_token]
|
103
|
+
params['tenderType'] = options[:tender_type].present? ? options[:tender_type] : 'Card'
|
104
|
+
|
105
|
+
commit('capture', params: params)
|
106
|
+
end
|
107
|
+
|
108
|
+
def void(authorization, options = {})
|
109
|
+
params = {}
|
110
|
+
|
111
|
+
commit('void', params: params, iid: payment_id(authorization))
|
112
|
+
end
|
113
|
+
|
114
|
+
def verify(credit_card, _options = {})
|
115
|
+
jwt = create_jwt.params['jwtToken']
|
116
|
+
|
117
|
+
commit('verify', card_number: credit_card.number, jwt: jwt)
|
118
|
+
end
|
119
|
+
|
120
|
+
def get_payment_status(batch_id)
|
121
|
+
commit('get_payment_status', params: batch_id)
|
122
|
+
end
|
123
|
+
|
124
|
+
def close_batch(batch_id)
|
125
|
+
commit('close_batch', params: batch_id)
|
126
|
+
end
|
127
|
+
|
128
|
+
def create_jwt
|
129
|
+
commit('create_jwt', params: @options[:merchant_id])
|
130
|
+
end
|
131
|
+
|
132
|
+
def supports_scrubbing?
|
133
|
+
true
|
134
|
+
end
|
135
|
+
|
136
|
+
def scrub(transcript)
|
137
|
+
transcript.
|
138
|
+
gsub(%r((Authorization: Basic )\w+), '\1[FILTERED]').
|
139
|
+
gsub(%r((number\\?"\s*:\s*\\?")[^"]*)i, '\1[FILTERED]').
|
140
|
+
gsub(%r((cvv\\?"\s*:\s*\\?")[^"]*)i, '\1[FILTERED]')
|
141
|
+
end
|
142
|
+
|
143
|
+
private
|
144
|
+
|
145
|
+
def add_amount(params, amount, options)
|
146
|
+
params['amount'] = localized_amount(amount.to_f, options[:currency])
|
147
|
+
end
|
148
|
+
|
149
|
+
def add_merchant_id(params)
|
150
|
+
params['merchantId'] = @options[:merchant_id]
|
151
|
+
end
|
152
|
+
|
153
|
+
def add_auth_purchase_params(params, credit_card, options)
|
154
|
+
add_replay_id(params, options)
|
155
|
+
add_credit_card(params, credit_card, 'purchase', options)
|
156
|
+
add_purchases_data(params, options)
|
157
|
+
add_shipping_data(params, options)
|
158
|
+
add_pos_data(params, options)
|
159
|
+
add_additional_data(params, options)
|
160
|
+
end
|
161
|
+
|
162
|
+
def add_credit_params(params, credit_card, options)
|
163
|
+
add_replay_id(params, options)
|
164
|
+
add_credit_card(params, credit_card, 'purchase', options)
|
165
|
+
add_additional_data(params, options)
|
166
|
+
end
|
167
|
+
|
168
|
+
def add_replay_id(params, options)
|
169
|
+
params['replayId'] = options[:replay_id] if options[:replay_id]
|
170
|
+
end
|
171
|
+
|
172
|
+
def add_credit_card(params, credit_card, action, options)
|
173
|
+
return unless credit_card&.is_a?(CreditCard)
|
174
|
+
|
175
|
+
card_details = {}
|
176
|
+
card_details['expiryMonth'] = format(credit_card.month, :two_digits).to_s
|
177
|
+
card_details['expiryYear'] = format(credit_card.year, :two_digits).to_s
|
178
|
+
card_details['cardType'] = credit_card.brand
|
179
|
+
card_details['last4'] = credit_card.last_digits
|
180
|
+
card_details['cvv'] = credit_card.verification_value unless credit_card.verification_value.nil?
|
181
|
+
card_details['number'] = credit_card.number
|
182
|
+
card_details['avsStreet'] = options[:billing_address][:address1] if options[:billing_address]
|
183
|
+
card_details['avsZip'] = options[:billing_address][:zip] if !options[:billing_address].nil? && !options[:billing_address][:zip].nil?
|
184
|
+
|
185
|
+
params['cardAccount'] = card_details
|
186
|
+
end
|
187
|
+
|
188
|
+
def exp_date(credit_card)
|
189
|
+
"#{format(credit_card.month, :two_digits)}/#{format(credit_card.year, :two_digits)}"
|
190
|
+
end
|
191
|
+
|
192
|
+
def add_additional_data(params, options)
|
193
|
+
params['isAuth'] = options[:is_auth].present? ? options[:is_auth] : 'true'
|
194
|
+
params['paymentType'] = options[:payment_type].present? ? options[:payment_type] : 'Sale'
|
195
|
+
params['tenderType'] = options[:tender_type].present? ? options[:tender_type] : 'Card'
|
196
|
+
params['taxExempt'] = options[:tax_exempt].present? ? options[:tax_exempt] : 'false'
|
197
|
+
params['taxAmount'] = options[:tax_amount] if options[:tax_amount]
|
198
|
+
params['shouldGetCreditCardLevel'] = options[:should_get_credit_card_level] if options[:should_get_credit_card_level]
|
199
|
+
params['source'] = options[:source] if options[:source]
|
200
|
+
params['invoice'] = options[:invoice] if options[:invoice]
|
201
|
+
params['isTicket'] = options[:is_ticket] if options[:is_ticket]
|
202
|
+
params['shouldVaultCard'] = options[:should_vault_card] if options[:should_vault_card]
|
203
|
+
params['sourceZip'] = options[:source_zip] if options[:source_zip]
|
204
|
+
params['authCode'] = options[:auth_code] if options[:auth_code]
|
205
|
+
params['achIndicator'] = options[:ach_indicator] if options[:ach_indicator]
|
206
|
+
params['bankAccount'] = options[:bank_account] if options[:bank_account]
|
207
|
+
params['meta'] = options[:meta] if options[:meta]
|
208
|
+
end
|
209
|
+
|
210
|
+
def add_pos_data(params, options)
|
211
|
+
pos_data = {}
|
212
|
+
pos_data['cardholderPresence'] = options.dig(:pos_data, :cardholder_presence) || 'Ecom'
|
213
|
+
pos_data['deviceAttendance'] = options.dig(:pos_data, :device_attendance) || 'HomePc'
|
214
|
+
pos_data['deviceInputCapability'] = options.dig(:pos_data, :device_input_capability) || 'Unknown'
|
215
|
+
pos_data['deviceLocation'] = options.dig(:pos_data, :device_location) || 'HomePc'
|
216
|
+
pos_data['panCaptureMethod'] = options.dig(:pos_data, :pan_capture_method) || 'Manual'
|
217
|
+
pos_data['partialApprovalSupport'] = options.dig(:pos_data, :partial_approval_support) || 'NotSupported'
|
218
|
+
pos_data['pinCaptureCapability'] = options.dig(:pos_data, :pin_capture_capability) || 'Incapable'
|
219
|
+
|
220
|
+
params['posData'] = pos_data
|
221
|
+
end
|
222
|
+
|
223
|
+
def add_purchases_data(params, options)
|
224
|
+
return unless options[:purchases]
|
225
|
+
|
226
|
+
params['purchases'] = []
|
227
|
+
|
228
|
+
options[:purchases].each do |purchase|
|
229
|
+
purchase_object = {}
|
230
|
+
|
231
|
+
purchase_object['name'] = purchase[:name] if purchase[:name]
|
232
|
+
purchase_object['description'] = purchase[:description] if purchase[:description]
|
233
|
+
purchase_object['code'] = purchase[:code] if purchase[:code]
|
234
|
+
purchase_object['unitOfMeasure'] = purchase[:unit_of_measure] if purchase[:unit_of_measure]
|
235
|
+
purchase_object['unitPrice'] = purchase[:unit_price] if purchase[:unit_price]
|
236
|
+
purchase_object['quantity'] = purchase[:quantity] if purchase[:quantity]
|
237
|
+
purchase_object['taxRate'] = purchase[:tax_rate] if purchase[:tax_rate]
|
238
|
+
purchase_object['taxAmount'] = purchase[:tax_amount] if purchase[:tax_amount]
|
239
|
+
purchase_object['discountRate'] = purchase[:discount_rate] if purchase[:discount_rate]
|
240
|
+
purchase_object['discountAmount'] = purchase[:discount_amount] if purchase[:discount_amount]
|
241
|
+
purchase_object['extendedAmount'] = purchase[:extended_amount] if purchase[:extended_amount]
|
242
|
+
purchase_object['lineItemId'] = purchase[:line_item_id] if purchase[:line_item_id]
|
243
|
+
|
244
|
+
params['purchases'].append(purchase_object)
|
245
|
+
end
|
246
|
+
end
|
247
|
+
|
248
|
+
def add_shipping_data(params, options)
|
249
|
+
params['shipAmount'] = options[:ship_amount] if options[:ship_amount]
|
250
|
+
|
251
|
+
shipping_country = shipping_country_from(options)
|
252
|
+
params['shipToCountry'] = shipping_country if shipping_country
|
253
|
+
|
254
|
+
shipping_zip = shipping_zip_from(options)
|
255
|
+
params['shipToZip'] = shipping_zip if shipping_zip
|
256
|
+
end
|
257
|
+
|
258
|
+
def shipping_country_from(options)
|
259
|
+
options[:ship_to_country] || options.dig(:shipping_address, :country) || options.dig(:billing_address, :country)
|
260
|
+
end
|
261
|
+
|
262
|
+
def shipping_zip_from(options)
|
263
|
+
options[:ship_to_zip] || options.dig(:shipping_addres, :zip) || options.dig(:billing_address, :zip)
|
264
|
+
end
|
265
|
+
|
266
|
+
def payment_token(authorization)
|
267
|
+
return unless authorization
|
268
|
+
return authorization unless authorization.include?('|')
|
269
|
+
|
270
|
+
authorization.split('|').last
|
271
|
+
end
|
272
|
+
|
273
|
+
def payment_id(authorization)
|
274
|
+
return unless authorization
|
275
|
+
return authorization unless authorization.include?('|')
|
276
|
+
|
277
|
+
authorization.split('|').first
|
278
|
+
end
|
279
|
+
|
280
|
+
def commit(action, params: '', iid: '', card_number: nil, jwt: '')
|
281
|
+
response =
|
282
|
+
begin
|
283
|
+
case action
|
284
|
+
when 'void'
|
285
|
+
parse(ssl_request(:delete, url(action, params, ref_number: iid), nil, request_headers))
|
286
|
+
when 'verify'
|
287
|
+
parse(ssl_get(url(action, params, credit_card_number: card_number), request_verify_headers(jwt)))
|
288
|
+
when 'get_payment_status', 'create_jwt'
|
289
|
+
parse(ssl_get(url(action, params, ref_number: iid), request_headers))
|
290
|
+
when 'close_batch'
|
291
|
+
parse(ssl_request(:put, url(action, params, ref_number: iid), nil, request_headers))
|
292
|
+
else
|
293
|
+
parse(ssl_post(url(action, params), post_data(params), request_headers))
|
294
|
+
end
|
295
|
+
rescue ResponseError => e
|
296
|
+
# currently Priority returns a 404 with no body on certain calls. In those cases we will substitute the response status from response.message
|
297
|
+
gateway_response = e.response.body.presence || e.response.message
|
298
|
+
parse(gateway_response)
|
299
|
+
end
|
300
|
+
|
301
|
+
success = success_from(response, action)
|
302
|
+
Response.new(
|
303
|
+
success,
|
304
|
+
message_from(response),
|
305
|
+
response,
|
306
|
+
authorization: success ? authorization_from(response) : nil,
|
307
|
+
error_code: success || response == '' ? nil : error_from(response),
|
308
|
+
test: test?
|
309
|
+
)
|
310
|
+
end
|
311
|
+
|
312
|
+
def url(action, params, ref_number: '', credit_card_number: nil)
|
313
|
+
case action
|
314
|
+
when 'void'
|
315
|
+
base_url + "/#{ref_number}?force=true"
|
316
|
+
when 'verify'
|
317
|
+
(verify_url + '?search=') + credit_card_number.to_s[0..6]
|
318
|
+
when 'get_payment_status', 'close_batch'
|
319
|
+
batch_url + "/#{params}"
|
320
|
+
when 'create_jwt'
|
321
|
+
jwt_url + "/#{params}/token"
|
322
|
+
else
|
323
|
+
base_url + '?includeCustomerMatches=false&echo=true'
|
324
|
+
end
|
325
|
+
end
|
326
|
+
|
327
|
+
def base_url
|
328
|
+
test? ? test_url : live_url
|
329
|
+
end
|
330
|
+
|
331
|
+
def verify_url
|
332
|
+
test? ? self.test_url_verify : self.live_url_verify
|
333
|
+
end
|
334
|
+
|
335
|
+
def jwt_url
|
336
|
+
test? ? self.test_url_jwt : self.live_url_jwt
|
337
|
+
end
|
338
|
+
|
339
|
+
def batch_url
|
340
|
+
test? ? self.test_url_batch : self.live_url_batch
|
341
|
+
end
|
342
|
+
|
343
|
+
def handle_response(response)
|
344
|
+
case response.code.to_i
|
345
|
+
when 204
|
346
|
+
{ status: 'Success' }.to_json
|
347
|
+
when 200...300
|
348
|
+
response.body
|
349
|
+
else
|
350
|
+
raise ResponseError.new(response)
|
351
|
+
end
|
352
|
+
end
|
353
|
+
|
354
|
+
def parse(body)
|
355
|
+
return {} if body.blank?
|
356
|
+
|
357
|
+
parsed_response = JSON.parse(body)
|
358
|
+
parsed_response.is_a?(String) ? { 'message' => parsed_response } : parsed_response
|
359
|
+
rescue JSON::ParserError
|
360
|
+
message = 'Invalid JSON response received from Priority Gateway. Please contact Priority Gateway if you continue to receive this message.'
|
361
|
+
message += " (The raw response returned by the API was #{body.inspect})"
|
362
|
+
{
|
363
|
+
'message' => message
|
364
|
+
}
|
365
|
+
end
|
366
|
+
|
367
|
+
def success_from(response, action)
|
368
|
+
return !response['bank'].empty? if action == 'verify' && response['bank']
|
369
|
+
|
370
|
+
%w[Approved Open Success Settled Voided].include?(response['status'])
|
371
|
+
end
|
372
|
+
|
373
|
+
def message_from(response)
|
374
|
+
return response['details'][0] if response['details'] && response['details'][0]
|
375
|
+
|
376
|
+
response['authMessage'] || response['message'] || response['status']
|
377
|
+
end
|
378
|
+
|
379
|
+
def authorization_from(response)
|
380
|
+
[response['id'], response['paymentToken']].join('|')
|
381
|
+
end
|
382
|
+
|
383
|
+
def error_from(response)
|
384
|
+
response['errorCode'] || response['status']
|
385
|
+
end
|
386
|
+
|
387
|
+
def post_data(params)
|
388
|
+
params.to_json
|
389
|
+
end
|
390
|
+
end
|
391
|
+
end
|
392
|
+
end
|
@@ -6,10 +6,10 @@ module ActiveMerchant #:nodoc:
|
|
6
6
|
self.test_url = 'https://xmltest.propay.com/API/PropayAPI.aspx'
|
7
7
|
self.live_url = 'https://epay.propay.com/api/propayapi.aspx'
|
8
8
|
|
9
|
-
self.supported_countries = [
|
9
|
+
self.supported_countries = %w[US CA]
|
10
10
|
self.default_currency = 'USD'
|
11
11
|
self.money_format = :cents
|
12
|
-
self.supported_cardtypes = [
|
12
|
+
self.supported_cardtypes = %i[visa master american_express discover]
|
13
13
|
|
14
14
|
self.homepage_url = 'https://www.propay.com/'
|
15
15
|
self.display_name = 'ProPay'
|
@@ -133,12 +133,12 @@ module ActiveMerchant #:nodoc:
|
|
133
133
|
'99' => 'Generic decline or unable to parse issuer response code'
|
134
134
|
}
|
135
135
|
|
136
|
-
def initialize(options={})
|
136
|
+
def initialize(options = {})
|
137
137
|
requires!(options, :cert_str)
|
138
138
|
super
|
139
139
|
end
|
140
140
|
|
141
|
-
def purchase(money, payment, options={})
|
141
|
+
def purchase(money, payment, options = {})
|
142
142
|
request = build_xml_request do |xml|
|
143
143
|
add_invoice(xml, money, options)
|
144
144
|
add_payment(xml, payment, options)
|
@@ -151,7 +151,7 @@ module ActiveMerchant #:nodoc:
|
|
151
151
|
commit(request)
|
152
152
|
end
|
153
153
|
|
154
|
-
def authorize(money, payment, options={})
|
154
|
+
def authorize(money, payment, options = {})
|
155
155
|
request = build_xml_request do |xml|
|
156
156
|
add_invoice(xml, money, options)
|
157
157
|
add_payment(xml, payment, options)
|
@@ -164,7 +164,7 @@ module ActiveMerchant #:nodoc:
|
|
164
164
|
commit(request)
|
165
165
|
end
|
166
166
|
|
167
|
-
def capture(money, authorization, options={})
|
167
|
+
def capture(money, authorization, options = {})
|
168
168
|
request = build_xml_request do |xml|
|
169
169
|
add_invoice(xml, money, options)
|
170
170
|
add_account(xml, options)
|
@@ -175,7 +175,7 @@ module ActiveMerchant #:nodoc:
|
|
175
175
|
commit(request)
|
176
176
|
end
|
177
177
|
|
178
|
-
def refund(money, authorization, options={})
|
178
|
+
def refund(money, authorization, options = {})
|
179
179
|
request = build_xml_request do |xml|
|
180
180
|
add_invoice(xml, money, options)
|
181
181
|
add_account(xml, options)
|
@@ -186,11 +186,11 @@ module ActiveMerchant #:nodoc:
|
|
186
186
|
commit(request)
|
187
187
|
end
|
188
188
|
|
189
|
-
def void(authorization, options={})
|
189
|
+
def void(authorization, options = {})
|
190
190
|
refund(nil, authorization, options)
|
191
191
|
end
|
192
192
|
|
193
|
-
def credit(money, payment, options={})
|
193
|
+
def credit(money, payment, options = {})
|
194
194
|
request = build_xml_request do |xml|
|
195
195
|
add_invoice(xml, money, options)
|
196
196
|
add_payment(xml, payment, options)
|
@@ -201,7 +201,7 @@ module ActiveMerchant #:nodoc:
|
|
201
201
|
commit(request)
|
202
202
|
end
|
203
203
|
|
204
|
-
def verify(credit_card, options={})
|
204
|
+
def verify(credit_card, options = {})
|
205
205
|
MultiResponse.run(:use_first_response) do |r|
|
206
206
|
r.process { authorize(100, credit_card, options) }
|
207
207
|
r.process(:ignore_result) { void(r.authorization, options) }
|
@@ -253,7 +253,7 @@ module ActiveMerchant #:nodoc:
|
|
253
253
|
end
|
254
254
|
|
255
255
|
def parse(body)
|
256
|
-
results
|
256
|
+
results = {}
|
257
257
|
xml = Nokogiri::XML(body)
|
258
258
|
resp = xml.xpath('//XMLResponse/XMLTrans')
|
259
259
|
resp.children.each do |element|
|
@@ -284,6 +284,7 @@ module ActiveMerchant #:nodoc:
|
|
284
284
|
|
285
285
|
def message_from(response)
|
286
286
|
return 'Success' if success_from(response)
|
287
|
+
|
287
288
|
message = STATUS_RESPONSE_CODES[response[:status]]
|
288
289
|
message += " - #{TRANSACTION_RESPONSE_CODES[response[:response_code]]}" if response[:response_code]
|
289
290
|
|
@@ -295,9 +296,7 @@ module ActiveMerchant #:nodoc:
|
|
295
296
|
end
|
296
297
|
|
297
298
|
def error_code_from(response)
|
298
|
-
unless success_from(response)
|
299
|
-
response[:status]
|
300
|
-
end
|
299
|
+
response[:status] unless success_from(response)
|
301
300
|
end
|
302
301
|
|
303
302
|
def build_xml_request
|
@@ -38,7 +38,7 @@ module ActiveMerchant #:nodoc:
|
|
38
38
|
self.test_url = 'https://realtimestaging.psigate.com/xml'
|
39
39
|
self.live_url = 'https://realtime.psigate.com/xml'
|
40
40
|
|
41
|
-
self.supported_cardtypes = [
|
41
|
+
self.supported_cardtypes = %i[visa master american_express]
|
42
42
|
self.supported_countries = ['CA']
|
43
43
|
self.homepage_url = 'http://www.psigate.com/'
|
44
44
|
self.display_name = 'Psigate'
|
@@ -103,11 +103,10 @@ module ActiveMerchant #:nodoc:
|
|
103
103
|
response = parse(ssl_post(url, post_data(money, creditcard, options)))
|
104
104
|
|
105
105
|
Response.new(successful?(response), message_from(response), response,
|
106
|
-
:
|
107
|
-
:
|
108
|
-
:
|
109
|
-
:
|
110
|
-
)
|
106
|
+
test: test?,
|
107
|
+
authorization: build_authorization(response),
|
108
|
+
avs_result: { code: response[:avsresult] },
|
109
|
+
cvv_result: response[:cardidresult])
|
111
110
|
end
|
112
111
|
|
113
112
|
def url
|
@@ -119,7 +118,7 @@ module ActiveMerchant #:nodoc:
|
|
119
118
|
end
|
120
119
|
|
121
120
|
def parse(xml)
|
122
|
-
response = {:
|
121
|
+
response = { message: 'Global Error Receipt', complete: false }
|
123
122
|
|
124
123
|
xml = REXML::Document.new(xml)
|
125
124
|
xml.elements.each('//Result/*') do |node|
|
@@ -144,26 +143,26 @@ module ActiveMerchant #:nodoc:
|
|
144
143
|
def parameters(money, creditcard, options = {})
|
145
144
|
params = {
|
146
145
|
# General order parameters
|
147
|
-
:
|
148
|
-
:
|
149
|
-
:
|
150
|
-
:
|
151
|
-
:
|
152
|
-
:
|
153
|
-
:
|
154
|
-
:
|
155
|
-
:
|
146
|
+
StoreID: @options[:login],
|
147
|
+
Passphrase: @options[:password],
|
148
|
+
TestResult: options[:test_result],
|
149
|
+
OrderID: options[:order_id],
|
150
|
+
UserID: options[:user_id],
|
151
|
+
Phone: options[:phone],
|
152
|
+
Fax: options[:fax],
|
153
|
+
Email: options[:email],
|
154
|
+
TransRefNumber: options[:trans_ref_number],
|
156
155
|
|
157
156
|
# Credit Card parameters
|
158
|
-
:
|
159
|
-
:
|
157
|
+
PaymentType: 'CC',
|
158
|
+
CardAction: options[:CardAction],
|
160
159
|
|
161
160
|
# Financial parameters
|
162
|
-
:
|
163
|
-
:
|
164
|
-
:
|
165
|
-
:
|
166
|
-
:
|
161
|
+
CustomerIP: options[:ip],
|
162
|
+
SubTotal: amount(money),
|
163
|
+
Tax1: options[:tax1],
|
164
|
+
Tax2: options[:tax2],
|
165
|
+
ShippingTotal: options[:shipping_total]
|
167
166
|
}
|
168
167
|
|
169
168
|
if creditcard
|
@@ -172,15 +171,15 @@ module ActiveMerchant #:nodoc:
|
|
172
171
|
card_id_code = (creditcard.verification_value.blank? ? nil : '1')
|
173
172
|
|
174
173
|
params.update(
|
175
|
-
:
|
176
|
-
:
|
177
|
-
:
|
178
|
-
:
|
179
|
-
:
|
174
|
+
CardNumber: creditcard.number,
|
175
|
+
CardExpMonth: exp_month,
|
176
|
+
CardExpYear: exp_year,
|
177
|
+
CardIDCode: card_id_code,
|
178
|
+
CardIDNumber: creditcard.verification_value
|
180
179
|
)
|
181
180
|
end
|
182
181
|
|
183
|
-
if(address = (options[:billing_address] || options[:address]))
|
182
|
+
if (address = (options[:billing_address] || options[:address]))
|
184
183
|
params[:Bname] = address[:name] || creditcard.name
|
185
184
|
params[:Baddress1] = address[:address1] unless address[:address1].blank?
|
186
185
|
params[:Baddress2] = address[:address2] unless address[:address2].blank?
|
@@ -210,6 +209,7 @@ module ActiveMerchant #:nodoc:
|
|
210
209
|
return SUCCESS_MESSAGE
|
211
210
|
else
|
212
211
|
return FAILURE_MESSAGE if response[:errmsg].blank?
|
212
|
+
|
213
213
|
return response[:errmsg].gsub(/[^\w]/, ' ').split.join(' ').capitalize
|
214
214
|
end
|
215
215
|
end
|
@@ -21,7 +21,7 @@ module ActiveMerchant
|
|
21
21
|
# American Express, Diners Club, JCB, International Maestro,
|
22
22
|
# Style, Clydesdale Financial Services, Other
|
23
23
|
|
24
|
-
self.supported_cardtypes = [
|
24
|
+
self.supported_cardtypes = %i[visa master american_express diners_club jcb maestro]
|
25
25
|
self.homepage_url = 'http://www.paymentsolutionsltd.com/'
|
26
26
|
self.display_name = 'PSL Payment Solutions'
|
27
27
|
|
@@ -183,7 +183,7 @@ module ActiveMerchant
|
|
183
183
|
address = options[:billing_address] || options[:address]
|
184
184
|
return if address.nil?
|
185
185
|
|
186
|
-
post[:QAAddress] = [
|
186
|
+
post[:QAAddress] = %i[address1 address2 city state].collect { |a| address[a] }.reject(&:blank?).join(' ')
|
187
187
|
post[:QAPostcode] = address[:zip]
|
188
188
|
end
|
189
189
|
|
@@ -211,7 +211,7 @@ module ActiveMerchant
|
|
211
211
|
|
212
212
|
def add_purchase_details(post)
|
213
213
|
post[:EchoAmount] = 'YES'
|
214
|
-
post[:SCBI] = 'YES'
|
214
|
+
post[:SCBI] = 'YES' # Return information about the transaction
|
215
215
|
post[:MessageType] = MESSAGE_TYPE
|
216
216
|
end
|
217
217
|
|
@@ -260,11 +260,10 @@ module ActiveMerchant
|
|
260
260
|
response = parse(ssl_post(self.live_url, post_data(request)))
|
261
261
|
|
262
262
|
Response.new(response[:ResponseCode] == APPROVED, response[:Message], response,
|
263
|
-
:
|
264
|
-
:
|
265
|
-
:
|
266
|
-
:
|
267
|
-
)
|
263
|
+
test: test?,
|
264
|
+
authorization: response[:CrossReference],
|
265
|
+
cvv_result: CVV_CODE[response[:AVSCV2Check]],
|
266
|
+
avs_result: { code: AVS_CODE[response[:AVSCV2Check]] })
|
268
267
|
end
|
269
268
|
|
270
269
|
# Put the passed data into a format that can be submitted to PSL
|