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,19 +1,20 @@
|
|
|
1
1
|
require 'nokogiri'
|
|
2
2
|
|
|
3
|
-
module ActiveMerchant
|
|
4
|
-
module Billing
|
|
3
|
+
module ActiveMerchant # :nodoc:
|
|
4
|
+
module Billing # :nodoc:
|
|
5
5
|
class SafeChargeGateway < Gateway
|
|
6
6
|
self.test_url = 'https://process.sandbox.safecharge.com/service.asmx/Process'
|
|
7
7
|
self.live_url = 'https://process.safecharge.com/service.asmx/Process'
|
|
8
8
|
|
|
9
|
-
self.supported_countries = %w[AT BE BG CY CZ DE DK EE GR ES FI FR GI HK HR HU IE IS IT LI LT LU LV MT MX NL NO PL PT RO SE SG SI SK GB US]
|
|
9
|
+
self.supported_countries = %w[AT AU BE BG CA CY CZ DE DK EE GR ES FI FR GI HK HR HU IE IS IT LI LT LU LV MT MX NL NO PL PT RO SE SG SI SK GB US]
|
|
10
10
|
self.default_currency = 'USD'
|
|
11
11
|
self.supported_cardtypes = %i[visa master]
|
|
12
12
|
|
|
13
13
|
self.homepage_url = 'https://www.safecharge.com'
|
|
14
14
|
self.display_name = 'SafeCharge'
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
# Define the API version using the Versionable module
|
|
17
|
+
version '4.1.0'
|
|
17
18
|
|
|
18
19
|
def initialize(options = {})
|
|
19
20
|
requires!(options, :client_login_id, :client_password)
|
|
@@ -88,7 +89,7 @@ module ActiveMerchant #:nodoc:
|
|
|
88
89
|
add_transaction_data('Credit', post, money, options)
|
|
89
90
|
add_customer_details(post, payment, options)
|
|
90
91
|
|
|
91
|
-
post[:sg_CreditType] = 1
|
|
92
|
+
options[:unreferenced_refund].to_s == 'true' ? post[:sg_CreditType] = 2 : post[:sg_CreditType] = 1
|
|
92
93
|
|
|
93
94
|
commit(post)
|
|
94
95
|
end
|
|
@@ -133,7 +134,7 @@ module ActiveMerchant #:nodoc:
|
|
|
133
134
|
post[:sg_ClientLoginID] = @options[:client_login_id]
|
|
134
135
|
post[:sg_ClientPassword] = @options[:client_password]
|
|
135
136
|
post[:sg_ResponseFormat] = '4'
|
|
136
|
-
post[:sg_Version] =
|
|
137
|
+
post[:sg_Version] = fetch_version
|
|
137
138
|
post[:sg_ClientUniqueID] = options[:order_id] if options[:order_id]
|
|
138
139
|
post[:sg_UserID] = options[:user_id] if options[:user_id]
|
|
139
140
|
post[:sg_AuthType] = options[:auth_type] if options[:auth_type]
|
|
@@ -149,32 +150,54 @@ module ActiveMerchant #:nodoc:
|
|
|
149
150
|
end
|
|
150
151
|
|
|
151
152
|
def add_payment(post, payment, options = {})
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
post[:
|
|
158
|
-
post[:
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
153
|
+
case payment
|
|
154
|
+
when String
|
|
155
|
+
add_token(post, payment)
|
|
156
|
+
when CreditCard
|
|
157
|
+
post[:sg_ExpMonth] = format(payment.month, :two_digits)
|
|
158
|
+
post[:sg_ExpYear] = format(payment.year, :two_digits)
|
|
159
|
+
post[:sg_CardNumber] = payment.number
|
|
160
|
+
|
|
161
|
+
if payment.is_a?(NetworkTokenizationCreditCard) && payment.source == :network_token
|
|
162
|
+
add_network_token(post, payment, options)
|
|
163
|
+
else
|
|
164
|
+
add_credit_card(post, payment, options)
|
|
165
|
+
end
|
|
165
166
|
end
|
|
166
167
|
end
|
|
167
168
|
|
|
169
|
+
def add_token(post, payment)
|
|
170
|
+
_, transaction_id, token = payment.split('|')
|
|
171
|
+
|
|
172
|
+
post[:sg_TransactionID] = transaction_id
|
|
173
|
+
post[:sg_CCToken] = token
|
|
174
|
+
end
|
|
175
|
+
|
|
176
|
+
def add_credit_card(post, payment, options)
|
|
177
|
+
post[:sg_CVV2] = payment.verification_value
|
|
178
|
+
post[:sg_NameOnCard] = payment.name
|
|
179
|
+
post[:sg_StoredCredentialMode] = (options[:stored_credential_mode] == true ? 1 : 0)
|
|
180
|
+
end
|
|
181
|
+
|
|
182
|
+
def add_network_token(post, payment, options)
|
|
183
|
+
post[:sg_CAVV] = payment.payment_cryptogram
|
|
184
|
+
post[:sg_ECI] = (options[:three_d_secure] && options[:three_d_secure][:eci]) || '05'
|
|
185
|
+
post[:sg_IsExternalMPI] = 1
|
|
186
|
+
post[:sg_ExternalTokenProvider] = 5
|
|
187
|
+
end
|
|
188
|
+
|
|
168
189
|
def add_customer_details(post, payment, options)
|
|
169
190
|
if address = options[:billing_address] || options[:address]
|
|
170
|
-
post[:sg_FirstName] = payment.first_name
|
|
171
|
-
post[:sg_LastName] = payment.last_name
|
|
191
|
+
post[:sg_FirstName] = payment.first_name if payment.respond_to?(:first_name)
|
|
192
|
+
post[:sg_LastName] = payment.last_name if payment.respond_to?(:last_name)
|
|
172
193
|
post[:sg_Address] = address[:address1] if address[:address1]
|
|
173
194
|
post[:sg_City] = address[:city] if address[:city]
|
|
174
195
|
post[:sg_State] = address[:state] if address[:state]
|
|
175
196
|
post[:sg_Zip] = address[:zip] if address[:zip]
|
|
176
197
|
post[:sg_Country] = address[:country] if address[:country]
|
|
177
198
|
post[:sg_Phone] = address[:phone] if address[:phone]
|
|
199
|
+
post[:sg_middleName] = options[:middle_name] if options[:middle_name]
|
|
200
|
+
post[:sg_doCardHolderNameVerification] = options[:card_holder_verification] if options[:card_holder_verification]
|
|
178
201
|
end
|
|
179
202
|
|
|
180
203
|
post[:sg_Email] = options[:email]
|
|
@@ -264,9 +287,9 @@ module ActiveMerchant #:nodoc:
|
|
|
264
287
|
auth_code, transaction_id, token, month, year, original_amount = authorization.split('|')
|
|
265
288
|
|
|
266
289
|
{
|
|
267
|
-
auth_code
|
|
268
|
-
transaction_id
|
|
269
|
-
token
|
|
290
|
+
auth_code:,
|
|
291
|
+
transaction_id:,
|
|
292
|
+
token:,
|
|
270
293
|
exp_month: month,
|
|
271
294
|
exp_year: year,
|
|
272
295
|
original_amount: amount(original_amount.to_f * 100)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
module ActiveMerchant
|
|
2
|
-
module Billing
|
|
1
|
+
module ActiveMerchant # :nodoc:
|
|
2
|
+
module Billing # :nodoc:
|
|
3
3
|
class SageGateway < Gateway
|
|
4
4
|
include Empty
|
|
5
5
|
|
|
@@ -260,11 +260,15 @@ module ActiveMerchant #:nodoc:
|
|
|
260
260
|
url = url(params, source)
|
|
261
261
|
response = parse(ssl_post(url, post_data(action, params)), source)
|
|
262
262
|
|
|
263
|
-
Response.new(
|
|
263
|
+
Response.new(
|
|
264
|
+
success?(response),
|
|
265
|
+
response[:message],
|
|
266
|
+
response,
|
|
264
267
|
test: test?,
|
|
265
268
|
authorization: authorization_from(response, source),
|
|
266
269
|
avs_result: { code: response[:avs_result] },
|
|
267
|
-
cvv_result: response[:cvv_result]
|
|
270
|
+
cvv_result: response[:cvv_result]
|
|
271
|
+
)
|
|
268
272
|
end
|
|
269
273
|
|
|
270
274
|
def url(params, source)
|
|
@@ -380,8 +384,12 @@ module ActiveMerchant #:nodoc:
|
|
|
380
384
|
message = success ? 'Succeeded' : 'Failed'
|
|
381
385
|
end
|
|
382
386
|
|
|
383
|
-
Response.new(
|
|
384
|
-
|
|
387
|
+
Response.new(
|
|
388
|
+
success,
|
|
389
|
+
message,
|
|
390
|
+
response,
|
|
391
|
+
authorization: response[:guid]
|
|
392
|
+
)
|
|
385
393
|
end
|
|
386
394
|
|
|
387
395
|
ENVELOPE_NAMESPACES = {
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
module ActiveMerchant
|
|
2
|
-
module Billing
|
|
1
|
+
module ActiveMerchant # :nodoc:
|
|
2
|
+
module Billing # :nodoc:
|
|
3
3
|
class SagePayGateway < Gateway
|
|
4
4
|
cattr_accessor :simulate
|
|
5
5
|
self.simulate = false
|
|
6
6
|
|
|
7
7
|
class_attribute :simulator_url
|
|
8
8
|
|
|
9
|
-
self.test_url = 'https://
|
|
10
|
-
self.live_url = 'https://live.
|
|
9
|
+
self.test_url = 'https://sandbox.opayo.eu.elavon.com/gateway/service'
|
|
10
|
+
self.live_url = 'https://live.opayo.eu.elavon.com/gateway/service'
|
|
11
11
|
self.simulator_url = 'https://test.sagepay.com/Simulator'
|
|
12
12
|
|
|
13
13
|
APPROVED = 'OK'
|
|
@@ -78,6 +78,7 @@ module ActiveMerchant #:nodoc:
|
|
|
78
78
|
|
|
79
79
|
def initialize(options = {})
|
|
80
80
|
requires!(options, :login)
|
|
81
|
+
@protocol_version = options.fetch(:protocol_version, '3.00')
|
|
81
82
|
super
|
|
82
83
|
end
|
|
83
84
|
|
|
@@ -86,6 +87,9 @@ module ActiveMerchant #:nodoc:
|
|
|
86
87
|
|
|
87
88
|
post = {}
|
|
88
89
|
|
|
90
|
+
add_override_protocol_version(options)
|
|
91
|
+
add_three_ds_data(post, options)
|
|
92
|
+
add_stored_credentials_data(post, options)
|
|
89
93
|
add_amount(post, money, options)
|
|
90
94
|
add_invoice(post, options)
|
|
91
95
|
add_payment_method(post, payment_method, options)
|
|
@@ -101,6 +105,9 @@ module ActiveMerchant #:nodoc:
|
|
|
101
105
|
|
|
102
106
|
post = {}
|
|
103
107
|
|
|
108
|
+
add_three_ds_data(post, options)
|
|
109
|
+
add_stored_credentials_data(post, options)
|
|
110
|
+
add_override_protocol_version(options)
|
|
104
111
|
add_amount(post, money, options)
|
|
105
112
|
add_invoice(post, options)
|
|
106
113
|
add_payment_method(post, payment_method, options)
|
|
@@ -115,6 +122,7 @@ module ActiveMerchant #:nodoc:
|
|
|
115
122
|
def capture(money, identification, options = {})
|
|
116
123
|
post = {}
|
|
117
124
|
|
|
125
|
+
add_override_protocol_version(options)
|
|
118
126
|
add_reference(post, identification)
|
|
119
127
|
add_release_amount(post, money, options)
|
|
120
128
|
|
|
@@ -124,6 +132,7 @@ module ActiveMerchant #:nodoc:
|
|
|
124
132
|
def void(identification, options = {})
|
|
125
133
|
post = {}
|
|
126
134
|
|
|
135
|
+
add_override_protocol_version(options)
|
|
127
136
|
add_reference(post, identification)
|
|
128
137
|
action = abort_or_void_from(identification)
|
|
129
138
|
|
|
@@ -136,6 +145,7 @@ module ActiveMerchant #:nodoc:
|
|
|
136
145
|
|
|
137
146
|
post = {}
|
|
138
147
|
|
|
148
|
+
add_override_protocol_version(options)
|
|
139
149
|
add_related_reference(post, identification)
|
|
140
150
|
add_amount(post, money, options)
|
|
141
151
|
add_invoice(post, options)
|
|
@@ -150,6 +160,7 @@ module ActiveMerchant #:nodoc:
|
|
|
150
160
|
|
|
151
161
|
def store(credit_card, options = {})
|
|
152
162
|
post = {}
|
|
163
|
+
add_override_protocol_version(options)
|
|
153
164
|
add_credit_card(post, credit_card)
|
|
154
165
|
add_currency(post, 0, options)
|
|
155
166
|
|
|
@@ -158,6 +169,7 @@ module ActiveMerchant #:nodoc:
|
|
|
158
169
|
|
|
159
170
|
def unstore(token, options = {})
|
|
160
171
|
post = {}
|
|
172
|
+
add_override_protocol_version(options)
|
|
161
173
|
add_token(post, token)
|
|
162
174
|
commit(:unstore, post)
|
|
163
175
|
end
|
|
@@ -182,6 +194,58 @@ module ActiveMerchant #:nodoc:
|
|
|
182
194
|
|
|
183
195
|
private
|
|
184
196
|
|
|
197
|
+
def add_override_protocol_version(options)
|
|
198
|
+
@protocol_version = options[:protocol_version] if options[:protocol_version]
|
|
199
|
+
end
|
|
200
|
+
|
|
201
|
+
def add_three_ds_data(post, options)
|
|
202
|
+
return unless @protocol_version == '4.00'
|
|
203
|
+
return unless three_ds_2_options = options[:three_ds_2]
|
|
204
|
+
|
|
205
|
+
add_pair(post, :ThreeDSNotificationURL, three_ds_2_options[:notification_url])
|
|
206
|
+
return unless three_ds_2_options[:browser_info]
|
|
207
|
+
|
|
208
|
+
add_browser_info(post, three_ds_2_options[:browser_info])
|
|
209
|
+
end
|
|
210
|
+
|
|
211
|
+
def add_browser_info(post, browser_info)
|
|
212
|
+
add_pair(post, :BrowserAcceptHeader, browser_info[:accept_header])
|
|
213
|
+
add_pair(post, :BrowserColorDepth, browser_info[:depth])
|
|
214
|
+
add_pair(post, :BrowserJavascriptEnabled, format_boolean(browser_info[:java]))
|
|
215
|
+
add_pair(post, :BrowserJavaEnabled, format_boolean(browser_info[:java]))
|
|
216
|
+
add_pair(post, :BrowserLanguage, browser_info[:language])
|
|
217
|
+
add_pair(post, :BrowserScreenHeight, browser_info[:height])
|
|
218
|
+
add_pair(post, :BrowserScreenWidth, browser_info[:width])
|
|
219
|
+
add_pair(post, :BrowserTZ, browser_info[:timezone])
|
|
220
|
+
add_pair(post, :BrowserUserAgent, browser_info[:user_agent])
|
|
221
|
+
add_pair(post, :ChallengeWindowSize, browser_info[:browser_size])
|
|
222
|
+
end
|
|
223
|
+
|
|
224
|
+
def add_stored_credentials_data(post, options)
|
|
225
|
+
return unless @protocol_version == '4.00'
|
|
226
|
+
return unless stored_credential = options[:stored_credential]
|
|
227
|
+
|
|
228
|
+
initiator = stored_credential[:initiator] == 'cardholder' ? 'CIT' : 'MIT'
|
|
229
|
+
cof_usage = if stored_credential[:initial_transaction] && initiator == 'CIT'
|
|
230
|
+
'FIRST'
|
|
231
|
+
elsif !stored_credential[:initial_transaction] && initiator == 'MIT'
|
|
232
|
+
'SUBSEQUENT'
|
|
233
|
+
end
|
|
234
|
+
|
|
235
|
+
add_pair(post, :COFUsage, cof_usage) if cof_usage
|
|
236
|
+
add_pair(post, :InitiatedTYPE, initiator)
|
|
237
|
+
add_pair(post, :SchemeTraceID, stored_credential[:network_transaction_id]) if stored_credential[:network_transaction_id]
|
|
238
|
+
|
|
239
|
+
reasoning = stored_credential[:reason_type] == 'installment' ? 'instalment' : stored_credential[:reason_type]
|
|
240
|
+
add_pair(post, :MITType, reasoning.upcase)
|
|
241
|
+
|
|
242
|
+
if %w(instalment recurring).any?(reasoning)
|
|
243
|
+
add_pair(post, :RecurringExpiry, options[:recurring_expiry])
|
|
244
|
+
add_pair(post, :RecurringFrequency, options[:recurring_frequency])
|
|
245
|
+
add_pair(post, :PurchaseInstalData, options[:installment_data])
|
|
246
|
+
end
|
|
247
|
+
end
|
|
248
|
+
|
|
185
249
|
def truncate(value, max_size)
|
|
186
250
|
return nil unless value
|
|
187
251
|
return value.to_s if CGI.escape(value.to_s).length <= max_size
|
|
@@ -346,14 +410,18 @@ module ActiveMerchant #:nodoc:
|
|
|
346
410
|
def commit(action, parameters)
|
|
347
411
|
response = parse(ssl_post(url_for(action), post_data(action, parameters)))
|
|
348
412
|
|
|
349
|
-
Response.new(
|
|
413
|
+
Response.new(
|
|
414
|
+
response['Status'] == APPROVED,
|
|
415
|
+
message_from(response),
|
|
416
|
+
response,
|
|
350
417
|
test: test?,
|
|
351
418
|
authorization: authorization_from(response, parameters, action),
|
|
352
419
|
avs_result: {
|
|
353
420
|
street_match: AVS_CODE[response['AddressResult']],
|
|
354
421
|
postal_match: AVS_CODE[response['PostCodeResult']]
|
|
355
422
|
},
|
|
356
|
-
cvv_result: CVV_CODE[response['CV2Result']]
|
|
423
|
+
cvv_result: CVV_CODE[response['CV2Result']]
|
|
424
|
+
)
|
|
357
425
|
end
|
|
358
426
|
|
|
359
427
|
def authorization_from(response, params, action)
|
|
@@ -401,7 +469,7 @@ module ActiveMerchant #:nodoc:
|
|
|
401
469
|
parameters.update(
|
|
402
470
|
Vendor: @options[:login],
|
|
403
471
|
TxType: TRANSACTIONS[action],
|
|
404
|
-
VPSProtocol: @
|
|
472
|
+
VPSProtocol: @protocol_version
|
|
405
473
|
)
|
|
406
474
|
|
|
407
475
|
parameters.update(ReferrerID: application_id) if application_id && (application_id != Gateway.application_id)
|
|
@@ -409,6 +477,12 @@ module ActiveMerchant #:nodoc:
|
|
|
409
477
|
parameters.collect { |key, value| "#{key}=#{CGI.escape(value.to_s)}" }.join('&')
|
|
410
478
|
end
|
|
411
479
|
|
|
480
|
+
def format_boolean(value)
|
|
481
|
+
return if value.nil?
|
|
482
|
+
|
|
483
|
+
value ? '1' : '0'
|
|
484
|
+
end
|
|
485
|
+
|
|
412
486
|
# SagePay returns data in the following format
|
|
413
487
|
# Key1=value1
|
|
414
488
|
# Key2=value2
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
module ActiveMerchant
|
|
2
|
-
module Billing
|
|
1
|
+
module ActiveMerchant # :nodoc:
|
|
2
|
+
module Billing # :nodoc:
|
|
3
3
|
class SallieMaeGateway < Gateway
|
|
4
4
|
self.live_url = self.test_url = 'https://trans.salliemae.com/cgi-bin/process.cgi'
|
|
5
5
|
|
|
@@ -120,9 +120,13 @@ module ActiveMerchant #:nodoc:
|
|
|
120
120
|
end
|
|
121
121
|
|
|
122
122
|
response = parse(ssl_post(self.live_url, parameters.to_post_data) || '')
|
|
123
|
-
Response.new(
|
|
123
|
+
Response.new(
|
|
124
|
+
successful?(response),
|
|
125
|
+
message_from(response),
|
|
126
|
+
response,
|
|
124
127
|
test: test?,
|
|
125
|
-
authorization: response['refcode']
|
|
128
|
+
authorization: response['refcode']
|
|
129
|
+
)
|
|
126
130
|
end
|
|
127
131
|
|
|
128
132
|
def successful?(response)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
module ActiveMerchant
|
|
2
|
-
module Billing
|
|
1
|
+
module ActiveMerchant # :nodoc:
|
|
2
|
+
module Billing # :nodoc:
|
|
3
3
|
class SecureNetGateway < Gateway
|
|
4
|
-
|
|
4
|
+
version '4.0'
|
|
5
5
|
|
|
6
6
|
TRANSACTIONS = {
|
|
7
7
|
auth_only: '0000',
|
|
@@ -79,11 +79,15 @@ module ActiveMerchant #:nodoc:
|
|
|
79
79
|
data = ssl_post(url, xml, 'Content-Type' => 'text/xml')
|
|
80
80
|
response = parse(data)
|
|
81
81
|
|
|
82
|
-
Response.new(
|
|
82
|
+
Response.new(
|
|
83
|
+
success?(response),
|
|
84
|
+
message_from(response),
|
|
85
|
+
response,
|
|
83
86
|
test: test?,
|
|
84
87
|
authorization: build_authorization(response),
|
|
85
88
|
avs_result: { code: response[:avs_result_code] },
|
|
86
|
-
cvv_result: response[:card_code_response_code]
|
|
89
|
+
cvv_result: response[:card_code_response_code]
|
|
90
|
+
)
|
|
87
91
|
end
|
|
88
92
|
|
|
89
93
|
def build_request(request)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
require 'active_merchant/billing/gateways/authorize_net'
|
|
2
2
|
|
|
3
|
-
module ActiveMerchant
|
|
4
|
-
module Billing
|
|
3
|
+
module ActiveMerchant # :nodoc:
|
|
4
|
+
module Billing # :nodoc:
|
|
5
5
|
class SecurePayGateway < Gateway
|
|
6
6
|
API_VERSION = '3.1'
|
|
7
7
|
|
|
@@ -56,12 +56,16 @@ module ActiveMerchant #:nodoc:
|
|
|
56
56
|
|
|
57
57
|
message = message_from(response)
|
|
58
58
|
|
|
59
|
-
Response.new(
|
|
59
|
+
Response.new(
|
|
60
|
+
success?(response),
|
|
61
|
+
message,
|
|
62
|
+
response,
|
|
60
63
|
test: test?,
|
|
61
64
|
authorization: response[:transaction_id],
|
|
62
65
|
fraud_review: fraud_review?(response),
|
|
63
66
|
avs_result: { code: response[:avs_result_code] },
|
|
64
|
-
cvv_result: response[:card_code]
|
|
67
|
+
cvv_result: response[:card_code]
|
|
68
|
+
)
|
|
65
69
|
end
|
|
66
70
|
|
|
67
71
|
def success?(response)
|
|
@@ -75,7 +79,7 @@ module ActiveMerchant #:nodoc:
|
|
|
75
79
|
def parse(body)
|
|
76
80
|
fields = split(body)
|
|
77
81
|
|
|
78
|
-
|
|
82
|
+
{
|
|
79
83
|
response_code: fields[RESPONSE_CODE].to_i,
|
|
80
84
|
response_reason_code: fields[RESPONSE_REASON_CODE],
|
|
81
85
|
response_reason_text: fields[RESPONSE_REASON_TEXT],
|
|
@@ -85,7 +89,6 @@ module ActiveMerchant #:nodoc:
|
|
|
85
89
|
authorization_code: fields[AUTHORIZATION_CODE],
|
|
86
90
|
cardholder_authentication_code: fields[CARDHOLDER_AUTH_CODE]
|
|
87
91
|
}
|
|
88
|
-
results
|
|
89
92
|
end
|
|
90
93
|
|
|
91
94
|
def post_data(action, parameters = {})
|
|
@@ -101,8 +104,7 @@ module ActiveMerchant #:nodoc:
|
|
|
101
104
|
post[:encap_char] = '$'
|
|
102
105
|
post[:solution_ID] = application_id if application_id
|
|
103
106
|
|
|
104
|
-
|
|
105
|
-
request
|
|
107
|
+
post.merge(parameters).collect { |key, value| "x_#{key}=#{CGI.escape(value.to_s)}" }.join('&')
|
|
106
108
|
end
|
|
107
109
|
|
|
108
110
|
def add_currency_code(post, money, options)
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
require 'rexml/document'
|
|
2
2
|
|
|
3
|
-
module ActiveMerchant
|
|
4
|
-
module Billing
|
|
3
|
+
module ActiveMerchant # :nodoc:
|
|
4
|
+
module Billing # :nodoc:
|
|
5
5
|
class SecurePayAuGateway < Gateway
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
version 'xml-4.2'
|
|
7
|
+
version 'spxml-3.0', :periodic_api
|
|
8
8
|
|
|
9
9
|
class_attribute :test_periodic_url, :live_periodic_url
|
|
10
10
|
|
|
@@ -23,9 +23,6 @@ module ActiveMerchant #:nodoc:
|
|
|
23
23
|
# The name of the gateway
|
|
24
24
|
self.display_name = 'SecurePay'
|
|
25
25
|
|
|
26
|
-
class_attribute :request_timeout
|
|
27
|
-
self.request_timeout = 60
|
|
28
|
-
|
|
29
26
|
self.money_format = :cents
|
|
30
27
|
self.default_currency = 'AUD'
|
|
31
28
|
|
|
@@ -61,6 +58,10 @@ module ActiveMerchant #:nodoc:
|
|
|
61
58
|
super
|
|
62
59
|
end
|
|
63
60
|
|
|
61
|
+
def request_timeout
|
|
62
|
+
@options[:request_timeout] || 60
|
|
63
|
+
end
|
|
64
|
+
|
|
64
65
|
def purchase(money, credit_card_or_stored_id, options = {})
|
|
65
66
|
if credit_card_or_stored_id.respond_to?(:number)
|
|
66
67
|
requires!(options, :order_id)
|
|
@@ -157,7 +158,7 @@ module ActiveMerchant #:nodoc:
|
|
|
157
158
|
xml.tag! 'messageID', SecureRandom.hex(15)
|
|
158
159
|
xml.tag! 'messageTimestamp', generate_timestamp
|
|
159
160
|
xml.tag! 'timeoutValue', request_timeout
|
|
160
|
-
xml.tag! 'apiVersion',
|
|
161
|
+
xml.tag! 'apiVersion', fetch_version
|
|
161
162
|
end
|
|
162
163
|
|
|
163
164
|
xml.tag! 'MerchantInfo' do
|
|
@@ -181,11 +182,15 @@ module ActiveMerchant #:nodoc:
|
|
|
181
182
|
end
|
|
182
183
|
|
|
183
184
|
def commit(action, request)
|
|
184
|
-
response = parse(ssl_post(test? ? self.test_url : self.live_url, build_request(action, request)))
|
|
185
|
+
response = parse(ssl_post(test? ? self.test_url : self.live_url, build_request(action, request), { 'Content-Type' => 'text/xml; charset=utf-8' }))
|
|
185
186
|
|
|
186
|
-
Response.new(
|
|
187
|
+
Response.new(
|
|
188
|
+
success?(response),
|
|
189
|
+
message_from(response),
|
|
190
|
+
response,
|
|
187
191
|
test: test?,
|
|
188
|
-
authorization: authorization_from(response)
|
|
192
|
+
authorization: authorization_from(response)
|
|
193
|
+
)
|
|
189
194
|
end
|
|
190
195
|
|
|
191
196
|
def build_periodic_item(action, money, credit_card, options)
|
|
@@ -203,6 +208,7 @@ module ActiveMerchant #:nodoc:
|
|
|
203
208
|
end
|
|
204
209
|
xml.tag! 'amount', amount(money)
|
|
205
210
|
xml.tag! 'periodicType', PERIODIC_TYPES[action] if PERIODIC_TYPES[action]
|
|
211
|
+
xml.tag! 'transactionReference', options[:order_id] if options[:order_id]
|
|
206
212
|
|
|
207
213
|
xml.target!
|
|
208
214
|
end
|
|
@@ -215,7 +221,7 @@ module ActiveMerchant #:nodoc:
|
|
|
215
221
|
xml.tag! 'messageID', SecureRandom.hex(15)
|
|
216
222
|
xml.tag! 'messageTimestamp', generate_timestamp
|
|
217
223
|
xml.tag! 'timeoutValue', request_timeout
|
|
218
|
-
xml.tag! 'apiVersion',
|
|
224
|
+
xml.tag! 'apiVersion', fetch_version(:periodic_api)
|
|
219
225
|
end
|
|
220
226
|
|
|
221
227
|
xml.tag! 'MerchantInfo' do
|
|
@@ -237,11 +243,15 @@ module ActiveMerchant #:nodoc:
|
|
|
237
243
|
|
|
238
244
|
def commit_periodic(request)
|
|
239
245
|
my_request = build_periodic_request(request)
|
|
240
|
-
response = parse(ssl_post(test? ? self.test_periodic_url : self.live_periodic_url, my_request))
|
|
246
|
+
response = parse(ssl_post(test? ? self.test_periodic_url : self.live_periodic_url, my_request, { 'Content-Type' => 'text/xml; charset=utf-8' }))
|
|
241
247
|
|
|
242
|
-
Response.new(
|
|
248
|
+
Response.new(
|
|
249
|
+
success?(response),
|
|
250
|
+
message_from(response),
|
|
251
|
+
response,
|
|
243
252
|
test: test?,
|
|
244
|
-
authorization: authorization_from(response)
|
|
253
|
+
authorization: authorization_from(response)
|
|
254
|
+
)
|
|
245
255
|
end
|
|
246
256
|
|
|
247
257
|
def success?(response)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
module ActiveMerchant
|
|
2
|
-
module Billing
|
|
1
|
+
module ActiveMerchant # :nodoc:
|
|
2
|
+
module Billing # :nodoc:
|
|
3
3
|
class SecurePayTechGateway < Gateway
|
|
4
4
|
class SecurePayTechPostData < PostData
|
|
5
5
|
self.required_fields = %i[OrderReference CardNumber CardExpiry CardHolderName CardType MerchantID MerchantKey Amount Currency]
|
|
@@ -84,9 +84,13 @@ module ActiveMerchant #:nodoc:
|
|
|
84
84
|
def commit(action, post)
|
|
85
85
|
response = parse(ssl_post(self.live_url, post_data(action, post)))
|
|
86
86
|
|
|
87
|
-
Response.new(
|
|
87
|
+
Response.new(
|
|
88
|
+
response[:result_code] == 1,
|
|
89
|
+
message_from(response),
|
|
90
|
+
response,
|
|
88
91
|
test: test?,
|
|
89
|
-
authorization: response[:merchant_transaction_reference]
|
|
92
|
+
authorization: response[:merchant_transaction_reference]
|
|
93
|
+
)
|
|
90
94
|
end
|
|
91
95
|
|
|
92
96
|
def message_from(result)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
module ActiveMerchant
|
|
2
|
-
module Billing
|
|
1
|
+
module ActiveMerchant # :nodoc:
|
|
2
|
+
module Billing # :nodoc:
|
|
3
3
|
class SecurionPayGateway < Gateway
|
|
4
4
|
self.test_url = 'https://api.securionpay.com/'
|
|
5
5
|
self.live_url = 'https://api.securionpay.com/'
|
|
@@ -193,7 +193,8 @@ module ActiveMerchant #:nodoc:
|
|
|
193
193
|
post[:card] = card
|
|
194
194
|
add_address(post, options)
|
|
195
195
|
elsif creditcard.kind_of?(String)
|
|
196
|
-
|
|
196
|
+
key = creditcard.match(/^pm_/) ? :paymentMethod : :card
|
|
197
|
+
post[key] = creditcard
|
|
197
198
|
else
|
|
198
199
|
raise ArgumentError.new("Unhandled payment method #{creditcard.class}.")
|
|
199
200
|
end
|
|
@@ -223,24 +224,37 @@ module ActiveMerchant #:nodoc:
|
|
|
223
224
|
end
|
|
224
225
|
|
|
225
226
|
response = api_request(url, parameters, options, method)
|
|
226
|
-
success =
|
|
227
|
+
success = success?(response)
|
|
227
228
|
|
|
228
|
-
Response.new(
|
|
229
|
+
Response.new(
|
|
230
|
+
success,
|
|
229
231
|
(success ? 'Transaction approved' : response['error']['message']),
|
|
230
232
|
response,
|
|
231
233
|
test: test?,
|
|
232
|
-
authorization: (
|
|
233
|
-
error_code: (success ? nil : STANDARD_ERROR_CODE_MAPPING[response['error']['code']])
|
|
234
|
+
authorization: authorization_from(url, response),
|
|
235
|
+
error_code: (success ? nil : STANDARD_ERROR_CODE_MAPPING[response['error']['code']])
|
|
236
|
+
)
|
|
237
|
+
end
|
|
238
|
+
|
|
239
|
+
def authorization_from(action, response)
|
|
240
|
+
if action == 'customers' && success?(response) && response['cards'].present?
|
|
241
|
+
response['cards'].first['id']
|
|
242
|
+
else
|
|
243
|
+
success?(response) ? response['id'] : (response.dig('error', 'charge') || response.dig('error', 'chargeId'))
|
|
244
|
+
end
|
|
245
|
+
end
|
|
246
|
+
|
|
247
|
+
def success?(response)
|
|
248
|
+
!response.key?('error')
|
|
234
249
|
end
|
|
235
250
|
|
|
236
251
|
def headers(options = {})
|
|
237
252
|
secret_key = options[:secret_key] || @options[:secret_key]
|
|
238
253
|
|
|
239
|
-
|
|
254
|
+
{
|
|
240
255
|
'Authorization' => 'Basic ' + Base64.encode64(secret_key.to_s + ':').strip,
|
|
241
256
|
'User-Agent' => "SecurionPay/v1 ActiveMerchantBindings/#{ActiveMerchant::VERSION}"
|
|
242
257
|
}
|
|
243
|
-
headers
|
|
244
258
|
end
|
|
245
259
|
|
|
246
260
|
def response_error(raw_response)
|
|
@@ -287,8 +301,8 @@ module ActiveMerchant #:nodoc:
|
|
|
287
301
|
response
|
|
288
302
|
end
|
|
289
303
|
|
|
290
|
-
def json_error(raw_response)
|
|
291
|
-
msg =
|
|
304
|
+
def json_error(raw_response, gateway_name = 'SecurionPay')
|
|
305
|
+
msg = "Invalid response received from the #{gateway_name} API."
|
|
292
306
|
msg += " (The raw response returned by the API was #{raw_response.inspect})"
|
|
293
307
|
{
|
|
294
308
|
'error' => {
|
|
@@ -298,7 +312,7 @@ module ActiveMerchant #:nodoc:
|
|
|
298
312
|
end
|
|
299
313
|
|
|
300
314
|
def test?
|
|
301
|
-
|
|
315
|
+
@options[:secret_key]&.include?('_test_')
|
|
302
316
|
end
|
|
303
317
|
end
|
|
304
318
|
end
|