activemerchant 1.79.2 → 1.129.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG +1391 -0
- data/README.md +29 -14
- data/lib/active_merchant/billing/avs_result.rb +25 -28
- data/lib/active_merchant/billing/base.rb +0 -13
- data/lib/active_merchant/billing/check.rb +55 -22
- data/lib/active_merchant/billing/compatibility.rb +10 -12
- data/lib/active_merchant/billing/credit_card.rb +82 -62
- data/lib/active_merchant/billing/credit_card_formatting.rb +4 -4
- data/lib/active_merchant/billing/credit_card_methods.rb +328 -58
- data/lib/active_merchant/billing/cvv_result.rb +0 -1
- data/lib/active_merchant/billing/gateway.rb +61 -56
- data/lib/active_merchant/billing/gateways/adyen.rb +562 -87
- 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 +35 -36
- data/lib/active_merchant/billing/gateways/authorize_net.rb +297 -196
- data/lib/active_merchant/billing/gateways/authorize_net_arb.rb +31 -24
- data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +94 -98
- data/lib/active_merchant/billing/gateways/axcessms.rb +64 -66
- data/lib/active_merchant/billing/gateways/balanced.rb +72 -65
- data/lib/active_merchant/billing/gateways/bambora_apac.rb +222 -0
- data/lib/active_merchant/billing/gateways/bank_frick.rb +16 -16
- data/lib/active_merchant/billing/gateways/banwire.rb +12 -12
- data/lib/active_merchant/billing/gateways/barclaycard_smartpay.rb +140 -69
- data/lib/active_merchant/billing/gateways/barclays_epdq_extra_plus.rb +7 -7
- data/lib/active_merchant/billing/gateways/be2bill.rb +7 -7
- data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +115 -115
- data/lib/active_merchant/billing/gateways/beanstream.rb +39 -13
- data/lib/active_merchant/billing/gateways/beanstream_interac.rb +1 -2
- data/lib/active_merchant/billing/gateways/blue_pay.rb +87 -58
- data/lib/active_merchant/billing/gateways/blue_snap.rb +405 -104
- data/lib/active_merchant/billing/gateways/bogus.rb +34 -30
- data/lib/active_merchant/billing/gateways/borgun.rb +97 -47
- data/lib/active_merchant/billing/gateways/bpoint.rb +20 -20
- data/lib/active_merchant/billing/gateways/braintree/braintree_common.rb +9 -3
- 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 +561 -259
- data/lib/active_merchant/billing/gateways/braintree_orange.rb +1 -1
- data/lib/active_merchant/billing/gateways/bridge_pay.rb +53 -54
- data/lib/active_merchant/billing/gateways/cams.rb +31 -31
- data/lib/active_merchant/billing/gateways/card_connect.rb +85 -33
- data/lib/active_merchant/billing/gateways/card_save.rb +7 -9
- data/lib/active_merchant/billing/gateways/card_stream.rb +187 -169
- data/lib/active_merchant/billing/gateways/cardknox.rb +24 -25
- data/lib/active_merchant/billing/gateways/cardprocess.rb +9 -7
- data/lib/active_merchant/billing/gateways/cashnet.rb +43 -27
- data/lib/active_merchant/billing/gateways/cc5.rb +14 -17
- data/lib/active_merchant/billing/gateways/cecabank.rb +62 -52
- data/lib/active_merchant/billing/gateways/cenpos.rb +63 -62
- data/lib/active_merchant/billing/gateways/checkout.rb +21 -23
- data/lib/active_merchant/billing/gateways/checkout_v2.rb +391 -113
- data/lib/active_merchant/billing/gateways/citrus_pay.rb +1 -3
- data/lib/active_merchant/billing/gateways/clearhaus.rb +40 -41
- data/lib/active_merchant/billing/gateways/commerce_hub.rb +361 -0
- data/lib/active_merchant/billing/gateways/commercegate.rb +11 -12
- data/lib/active_merchant/billing/gateways/conekta.rb +35 -30
- data/lib/active_merchant/billing/gateways/creditcall.rb +59 -59
- data/lib/active_merchant/billing/gateways/credorax.rb +326 -145
- data/lib/active_merchant/billing/gateways/ct_payment.rb +269 -0
- data/lib/active_merchant/billing/gateways/culqi.rb +53 -53
- data/lib/active_merchant/billing/gateways/cyber_source/cyber_source_common.rb +36 -0
- data/lib/active_merchant/billing/gateways/cyber_source.rb +566 -208
- data/lib/active_merchant/billing/gateways/cyber_source_rest.rb +456 -0
- data/lib/active_merchant/billing/gateways/d_local.rb +342 -0
- data/lib/active_merchant/billing/gateways/data_cash.rb +40 -56
- data/lib/active_merchant/billing/gateways/decidir.rb +358 -0
- data/lib/active_merchant/billing/gateways/decidir_plus.rb +344 -0
- data/lib/active_merchant/billing/gateways/dibs.rb +34 -40
- data/lib/active_merchant/billing/gateways/digitzs.rb +48 -45
- data/lib/active_merchant/billing/gateways/ebanx.rb +110 -60
- data/lib/active_merchant/billing/gateways/efsnet.rb +46 -50
- data/lib/active_merchant/billing/gateways/elavon.rb +351 -189
- data/lib/active_merchant/billing/gateways/element.rb +106 -56
- data/lib/active_merchant/billing/gateways/epay.rb +74 -64
- data/lib/active_merchant/billing/gateways/evo_ca.rb +13 -14
- data/lib/active_merchant/billing/gateways/eway.rb +74 -73
- data/lib/active_merchant/billing/gateways/eway_managed.rb +85 -87
- data/lib/active_merchant/billing/gateways/eway_rapid.rb +105 -60
- data/lib/active_merchant/billing/gateways/exact.rb +29 -37
- data/lib/active_merchant/billing/gateways/ezic.rb +21 -22
- data/lib/active_merchant/billing/gateways/fat_zebra.rb +70 -48
- data/lib/active_merchant/billing/gateways/federated_canada.rb +11 -13
- data/lib/active_merchant/billing/gateways/finansbank.rb +3 -4
- data/lib/active_merchant/billing/gateways/first_giving.rb +23 -23
- data/lib/active_merchant/billing/gateways/first_pay.rb +33 -13
- data/lib/active_merchant/billing/gateways/firstdata_e4.rb +106 -105
- data/lib/active_merchant/billing/gateways/firstdata_e4_v27.rb +505 -0
- data/lib/active_merchant/billing/gateways/flo2cash.rb +36 -36
- data/lib/active_merchant/billing/gateways/flo2cash_simple.rb +2 -2
- data/lib/active_merchant/billing/gateways/forte.rb +70 -40
- data/lib/active_merchant/billing/gateways/garanti.rb +24 -31
- data/lib/active_merchant/billing/gateways/global_collect.rb +378 -154
- data/lib/active_merchant/billing/gateways/global_transport.rb +12 -13
- data/lib/active_merchant/billing/gateways/hdfc.rb +55 -57
- data/lib/active_merchant/billing/gateways/hps.rb +236 -69
- data/lib/active_merchant/billing/gateways/iats_payments.rb +61 -39
- data/lib/active_merchant/billing/gateways/in_context_paypal_express.rb +1 -1
- data/lib/active_merchant/billing/gateways/inspire.rb +41 -47
- data/lib/active_merchant/billing/gateways/instapay.rb +10 -14
- data/lib/active_merchant/billing/gateways/ipg.rb +420 -0
- data/lib/active_merchant/billing/gateways/ipp.rb +25 -24
- data/lib/active_merchant/billing/gateways/iridium.rb +243 -244
- data/lib/active_merchant/billing/gateways/itransact.rb +14 -14
- data/lib/active_merchant/billing/gateways/iveri.rb +73 -34
- data/lib/active_merchant/billing/gateways/ixopay.rb +320 -0
- data/lib/active_merchant/billing/gateways/jetpay.rb +145 -152
- data/lib/active_merchant/billing/gateways/jetpay_v2.rb +154 -159
- data/lib/active_merchant/billing/gateways/komoju.rb +16 -16
- data/lib/active_merchant/billing/gateways/kushki.rb +127 -57
- data/lib/active_merchant/billing/gateways/latitude19.rb +111 -115
- data/lib/active_merchant/billing/gateways/linkpoint.rb +82 -85
- data/lib/active_merchant/billing/gateways/litle.rb +247 -53
- data/lib/active_merchant/billing/gateways/mastercard.rb +41 -23
- data/lib/active_merchant/billing/gateways/maxipago.rb +5 -5
- data/lib/active_merchant/billing/gateways/mercado_pago.rb +135 -49
- data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +62 -29
- data/lib/active_merchant/billing/gateways/merchant_one.rb +16 -20
- data/lib/active_merchant/billing/gateways/merchant_partners.rb +40 -40
- data/lib/active_merchant/billing/gateways/merchant_ware.rb +54 -60
- data/lib/active_merchant/billing/gateways/merchant_ware_version_four.rb +42 -44
- data/lib/active_merchant/billing/gateways/merchant_warrior.rb +52 -14
- data/lib/active_merchant/billing/gateways/mercury.rb +47 -51
- data/lib/active_merchant/billing/gateways/metrics_global.rb +32 -42
- data/lib/active_merchant/billing/gateways/micropayment.rb +42 -45
- data/lib/active_merchant/billing/gateways/migs/migs_codes.rb +7 -7
- data/lib/active_merchant/billing/gateways/migs.rb +45 -40
- data/lib/active_merchant/billing/gateways/mit.rb +260 -0
- data/lib/active_merchant/billing/gateways/modern_payments.rb +2 -2
- data/lib/active_merchant/billing/gateways/modern_payments_cim.rb +29 -31
- data/lib/active_merchant/billing/gateways/moka.rb +290 -0
- data/lib/active_merchant/billing/gateways/monei.rb +255 -138
- data/lib/active_merchant/billing/gateways/moneris.rb +226 -88
- data/lib/active_merchant/billing/gateways/money_movers.rb +11 -13
- data/lib/active_merchant/billing/gateways/mundipagg.rb +117 -43
- data/lib/active_merchant/billing/gateways/nab_transact.rb +28 -31
- data/lib/active_merchant/billing/gateways/ncr_secure_pay.rb +13 -15
- data/lib/active_merchant/billing/gateways/net_registry.rb +12 -12
- data/lib/active_merchant/billing/gateways/netaxept.rb +33 -34
- data/lib/active_merchant/billing/gateways/netbanx.rb +167 -80
- data/lib/active_merchant/billing/gateways/netbilling.rb +27 -30
- data/lib/active_merchant/billing/gateways/netpay.rb +10 -10
- data/lib/active_merchant/billing/gateways/network_merchants.rb +7 -11
- data/lib/active_merchant/billing/gateways/nmi.rb +134 -48
- data/lib/active_merchant/billing/gateways/ogone.rb +88 -58
- data/lib/active_merchant/billing/gateways/omise.rb +30 -31
- data/lib/active_merchant/billing/gateways/openpay.rb +45 -26
- data/lib/active_merchant/billing/gateways/opp.rb +166 -144
- data/lib/active_merchant/billing/gateways/optimal_payment.rb +67 -64
- data/lib/active_merchant/billing/gateways/orbital/orbital_soft_descriptors.rb +5 -7
- data/lib/active_merchant/billing/gateways/orbital.rb +726 -382
- data/lib/active_merchant/billing/gateways/pac_net_raven.rb +26 -27
- data/lib/active_merchant/billing/gateways/pagarme.rb +47 -56
- data/lib/active_merchant/billing/gateways/pago_facil.rb +12 -14
- data/lib/active_merchant/billing/gateways/pay_arc.rb +392 -0
- data/lib/active_merchant/billing/gateways/pay_conex.rb +39 -40
- data/lib/active_merchant/billing/gateways/pay_gate_xml.rb +65 -65
- data/lib/active_merchant/billing/gateways/pay_hub.rb +39 -39
- data/lib/active_merchant/billing/gateways/pay_junction.rb +37 -37
- data/lib/active_merchant/billing/gateways/pay_junction_v2.rb +70 -54
- data/lib/active_merchant/billing/gateways/pay_secure.rb +15 -17
- data/lib/active_merchant/billing/gateways/pay_trace.rb +450 -0
- data/lib/active_merchant/billing/gateways/paybox_direct.rb +71 -47
- data/lib/active_merchant/billing/gateways/payeezy.rb +159 -32
- data/lib/active_merchant/billing/gateways/payex.rb +39 -42
- data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +41 -36
- data/lib/active_merchant/billing/gateways/payflow/payflow_express_response.rb +11 -8
- data/lib/active_merchant/billing/gateways/payflow/payflow_response.rb +3 -3
- data/lib/active_merchant/billing/gateways/payflow.rb +178 -54
- data/lib/active_merchant/billing/gateways/payflow_express.rb +61 -65
- data/lib/active_merchant/billing/gateways/payflow_express_uk.rb +0 -1
- data/lib/active_merchant/billing/gateways/payflow_uk.rb +1 -2
- data/lib/active_merchant/billing/gateways/payment_express.rb +66 -58
- data/lib/active_merchant/billing/gateways/paymentez.rb +114 -25
- data/lib/active_merchant/billing/gateways/paymill.rb +134 -133
- 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 +27 -14
- data/lib/active_merchant/billing/gateways/paypal_ca.rb +1 -1
- data/lib/active_merchant/billing/gateways/paypal_digital_goods.rb +2 -2
- data/lib/active_merchant/billing/gateways/paypal_express.rb +5 -2
- 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 +10 -13
- data/lib/active_merchant/billing/gateways/paystation.rb +79 -82
- data/lib/active_merchant/billing/gateways/payu_in.rb +59 -58
- data/lib/active_merchant/billing/gateways/payu_latam.rb +139 -97
- data/lib/active_merchant/billing/gateways/payway.rb +27 -27
- data/lib/active_merchant/billing/gateways/payway_dot_com.rb +253 -0
- data/lib/active_merchant/billing/gateways/pin.rb +87 -34
- data/lib/active_merchant/billing/gateways/plexo.rb +308 -0
- data/lib/active_merchant/billing/gateways/plugnpay.rb +82 -82
- data/lib/active_merchant/billing/gateways/priority.rb +392 -0
- data/lib/active_merchant/billing/gateways/pro_pay.rb +139 -140
- data/lib/active_merchant/billing/gateways/psigate.rb +44 -44
- data/lib/active_merchant/billing/gateways/psl_card.rb +29 -37
- data/lib/active_merchant/billing/gateways/qbms.rb +75 -76
- data/lib/active_merchant/billing/gateways/quantum.rb +21 -23
- data/lib/active_merchant/billing/gateways/quickbooks.rb +142 -55
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_common.rb +103 -107
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb +156 -158
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_v4to7.rb +7 -8
- data/lib/active_merchant/billing/gateways/quickpay.rb +1 -3
- data/lib/active_merchant/billing/gateways/qvalent.rb +137 -68
- 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 +132 -50
- data/lib/active_merchant/billing/gateways/redsys.rb +382 -186
- data/lib/active_merchant/billing/gateways/s5.rb +16 -16
- data/lib/active_merchant/billing/gateways/safe_charge.rb +83 -47
- data/lib/active_merchant/billing/gateways/sage.rb +49 -48
- data/lib/active_merchant/billing/gateways/sage_pay.rb +76 -83
- data/lib/active_merchant/billing/gateways/sallie_mae.rb +13 -15
- data/lib/active_merchant/billing/gateways/secure_net.rb +32 -40
- data/lib/active_merchant/billing/gateways/secure_pay.rb +30 -40
- data/lib/active_merchant/billing/gateways/secure_pay_au.rb +23 -26
- data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +14 -16
- data/lib/active_merchant/billing/gateways/securion_pay.rb +69 -31
- data/lib/active_merchant/billing/gateways/shift4.rb +342 -0
- data/lib/active_merchant/billing/gateways/simetrik.rb +368 -0
- data/lib/active_merchant/billing/gateways/skip_jack.rb +52 -53
- data/lib/active_merchant/billing/gateways/smart_ps.rb +51 -60
- data/lib/active_merchant/billing/gateways/so_easy_pay.rb +29 -29
- data/lib/active_merchant/billing/gateways/spreedly_core.rb +66 -47
- data/lib/active_merchant/billing/gateways/stripe.rb +309 -148
- data/lib/active_merchant/billing/gateways/stripe_payment_intents.rb +556 -0
- data/lib/active_merchant/billing/gateways/swipe_checkout.rb +18 -23
- data/lib/active_merchant/billing/gateways/telr.rb +46 -48
- data/lib/active_merchant/billing/gateways/tns.rb +8 -7
- data/lib/active_merchant/billing/gateways/trans_first.rb +37 -37
- data/lib/active_merchant/billing/gateways/trans_first_transaction_express.rb +249 -245
- data/lib/active_merchant/billing/gateways/transact_pro.rb +25 -27
- data/lib/active_merchant/billing/gateways/transax.rb +6 -8
- data/lib/active_merchant/billing/gateways/transnational.rb +1 -2
- data/lib/active_merchant/billing/gateways/trexle.rb +22 -18
- data/lib/active_merchant/billing/gateways/trust_commerce.rb +161 -88
- data/lib/active_merchant/billing/gateways/usa_epay.rb +5 -6
- data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +231 -238
- data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +129 -55
- data/lib/active_merchant/billing/gateways/vanco.rb +42 -33
- data/lib/active_merchant/billing/gateways/verifi.rb +52 -53
- data/lib/active_merchant/billing/gateways/viaklix.rb +18 -22
- data/lib/active_merchant/billing/gateways/visanet_peru.rb +115 -74
- data/lib/active_merchant/billing/gateways/vpos.rb +223 -0
- data/lib/active_merchant/billing/gateways/webpay.rb +9 -9
- data/lib/active_merchant/billing/gateways/wepay.rb +38 -41
- data/lib/active_merchant/billing/gateways/wirecard.rb +36 -37
- data/lib/active_merchant/billing/gateways/wompi.rb +197 -0
- data/lib/active_merchant/billing/gateways/world_net.rb +39 -38
- data/lib/active_merchant/billing/gateways/worldpay.rb +756 -142
- data/lib/active_merchant/billing/gateways/worldpay_online_payments.rb +73 -83
- data/lib/active_merchant/billing/gateways/worldpay_us.rb +31 -31
- data/lib/active_merchant/billing/model.rb +2 -2
- data/lib/active_merchant/billing/network_tokenization_credit_card.rb +3 -3
- data/lib/active_merchant/billing/rails.rb +1 -1
- data/lib/active_merchant/billing/response.rb +32 -13
- 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 +24 -38
- data/lib/active_merchant/country.rb +9 -5
- data/lib/active_merchant/errors.rb +4 -1
- data/lib/active_merchant/net_http_ssl_connection.rb +2 -0
- data/lib/active_merchant/network_connection_retries.rb +28 -31
- data/lib/active_merchant/post_data.rb +5 -3
- data/lib/active_merchant/posts_data.rb +5 -7
- data/lib/active_merchant/version.rb +1 -1
- data/lib/active_merchant.rb +3 -3
- data/lib/activemerchant.rb +1 -1
- data/lib/certs/cacert.pem +1592 -2329
- data/lib/support/gateway_support.rb +8 -10
- data/lib/support/ssl_verify.rb +9 -14
- data/lib/support/ssl_version.rb +9 -10
- metadata +98 -37
- data/lib/active_merchant/billing/gateways/ideal/ideal_base.rb +0 -246
- data/lib/active_merchant/billing/gateways/ideal/ideal_rabobank.pem +0 -13
- data/lib/active_merchant/billing/gateways/ideal/ideal_response.rb +0 -29
- data/lib/active_merchant/billing/gateways/ideal_rabobank.rb +0 -66
- data/lib/active_merchant/billing/gateways/moneris_us.rb +0 -309
@@ -11,7 +11,7 @@ module ActiveMerchant
|
|
11
11
|
self.money_format = :cents
|
12
12
|
self.supported_countries = %w(US CA)
|
13
13
|
|
14
|
-
self.supported_cardtypes = [
|
14
|
+
self.supported_cardtypes = %i[visa master american_express discover jcb diners_club]
|
15
15
|
|
16
16
|
self.homepage_url = 'https://developer.payeezy.com/'
|
17
17
|
self.display_name = 'Payeezy'
|
@@ -34,28 +34,36 @@ module ActiveMerchant
|
|
34
34
|
params = payment_method.is_a?(String) ? { transaction_type: 'recurring' } : { transaction_type: 'purchase' }
|
35
35
|
|
36
36
|
add_invoice(params, options)
|
37
|
+
add_reversal_id(params, options)
|
37
38
|
add_payment_method(params, payment_method, options)
|
38
39
|
add_address(params, options)
|
39
40
|
add_amount(params, amount, options)
|
40
41
|
add_soft_descriptors(params, options)
|
42
|
+
add_level2_data(params, options)
|
43
|
+
add_stored_credentials(params, options)
|
44
|
+
add_external_three_ds(params, payment_method, options)
|
41
45
|
|
42
46
|
commit(params, options)
|
43
47
|
end
|
44
48
|
|
45
49
|
def authorize(amount, payment_method, options = {})
|
46
|
-
params = {transaction_type: 'authorize'}
|
50
|
+
params = { transaction_type: 'authorize' }
|
47
51
|
|
48
52
|
add_invoice(params, options)
|
53
|
+
add_reversal_id(params, options)
|
49
54
|
add_payment_method(params, payment_method, options)
|
50
55
|
add_address(params, options)
|
51
56
|
add_amount(params, amount, options)
|
52
57
|
add_soft_descriptors(params, options)
|
58
|
+
add_level2_data(params, options)
|
59
|
+
add_stored_credentials(params, options)
|
60
|
+
add_external_three_ds(params, payment_method, options)
|
53
61
|
|
54
62
|
commit(params, options)
|
55
63
|
end
|
56
64
|
|
57
65
|
def capture(amount, authorization, options = {})
|
58
|
-
params = {transaction_type: 'capture'}
|
66
|
+
params = { transaction_type: 'capture' }
|
59
67
|
|
60
68
|
add_authorization_info(params, authorization)
|
61
69
|
add_amount(params, amount, options)
|
@@ -65,16 +73,28 @@ module ActiveMerchant
|
|
65
73
|
end
|
66
74
|
|
67
75
|
def refund(amount, authorization, options = {})
|
68
|
-
params = {transaction_type: 'refund'}
|
76
|
+
params = { transaction_type: 'refund' }
|
69
77
|
|
70
78
|
add_authorization_info(params, authorization)
|
71
79
|
add_amount(params, (amount || amount_from_authorization(authorization)), options)
|
80
|
+
add_soft_descriptors(params, options)
|
81
|
+
add_invoice(params, options)
|
82
|
+
|
83
|
+
commit(params, options)
|
84
|
+
end
|
85
|
+
|
86
|
+
def credit(amount, payment_method, options = {})
|
87
|
+
params = { transaction_type: 'refund' }
|
72
88
|
|
89
|
+
add_amount(params, amount, options)
|
90
|
+
add_payment_method(params, payment_method, options)
|
91
|
+
add_soft_descriptors(params, options)
|
92
|
+
add_invoice(params, options)
|
73
93
|
commit(params, options)
|
74
94
|
end
|
75
95
|
|
76
96
|
def store(payment_method, options = {})
|
77
|
-
params = {transaction_type: 'store'}
|
97
|
+
params = { transaction_type: 'store' }
|
78
98
|
|
79
99
|
add_creditcard_for_tokenization(params, payment_method, options)
|
80
100
|
|
@@ -82,17 +102,17 @@ module ActiveMerchant
|
|
82
102
|
end
|
83
103
|
|
84
104
|
def void(authorization, options = {})
|
85
|
-
params = {transaction_type: 'void'}
|
105
|
+
params = { transaction_type: 'void' }
|
86
106
|
|
87
|
-
add_authorization_info(params, authorization)
|
107
|
+
add_authorization_info(params, authorization, options)
|
88
108
|
add_amount(params, amount_from_authorization(authorization), options)
|
89
109
|
|
90
110
|
commit(params, options)
|
91
111
|
end
|
92
112
|
|
93
|
-
def verify(credit_card, options={})
|
113
|
+
def verify(credit_card, options = {})
|
94
114
|
MultiResponse.run(:use_first_response) do |r|
|
95
|
-
r.process { authorize(
|
115
|
+
r.process { authorize(0, credit_card, options) }
|
96
116
|
r.process(:ignore_result) { void(r.authorization, options) }
|
97
117
|
end
|
98
118
|
end
|
@@ -107,6 +127,7 @@ module ActiveMerchant
|
|
107
127
|
gsub(%r((Apikey: )(\w|-)+), '\1[FILTERED]').
|
108
128
|
gsub(%r((\\?"card_number\\?":\\?")\d+), '\1[FILTERED]').
|
109
129
|
gsub(%r((\\?"cvv\\?":\\?")\d+), '\1[FILTERED]').
|
130
|
+
gsub(%r((\\?"cvv\\?":\\?)\d+), '\1[FILTERED]').
|
110
131
|
gsub(%r((\\?"account_number\\?":\\?")\d+), '\1[FILTERED]').
|
111
132
|
gsub(%r((\\?"routing_number\\?":\\?")\d+), '\1[FILTERED]').
|
112
133
|
gsub(%r((\\?card_number=)\d+(&?)), '\1[FILTERED]').
|
@@ -114,24 +135,57 @@ module ActiveMerchant
|
|
114
135
|
gsub(%r((\\?apikey=)\w+(&?)), '\1[FILTERED]').
|
115
136
|
gsub(%r{(\\?"credit_card\.card_number\\?":)(\\?"[^"]+\\?")}, '\1[FILTERED]').
|
116
137
|
gsub(%r{(\\?"credit_card\.cvv\\?":)(\\?"[^"]+\\?")}, '\1[FILTERED]').
|
117
|
-
gsub(%r{(\\?"apikey\\?":)(\\?"[^"]+\\?")}, '\1[FILTERED]')
|
138
|
+
gsub(%r{(\\?"apikey\\?":)(\\?"[^"]+\\?")}, '\1[FILTERED]').
|
139
|
+
gsub(%r{(\\?"cavv\\?":)(\\?"[^"]+\\?")}, '\1[FILTERED]').
|
140
|
+
gsub(%r{(\\?"xid\\?":)(\\?"[^"]+\\?")}, '\1[FILTERED]')
|
118
141
|
end
|
119
142
|
|
120
143
|
private
|
121
144
|
|
145
|
+
def add_external_three_ds(params, payment_method, options)
|
146
|
+
return unless three_ds = options[:three_d_secure]
|
147
|
+
|
148
|
+
params[:'3DS'] = {
|
149
|
+
program_protocol: three_ds[:version][0],
|
150
|
+
directory_server_transaction_id: three_ds[:ds_transaction_id],
|
151
|
+
cardholder_name: payment_method.name,
|
152
|
+
card_number: payment_method.number,
|
153
|
+
exp_date: format_exp_date(payment_method.month, payment_method.year),
|
154
|
+
cvv: payment_method.verification_value,
|
155
|
+
xid: three_ds[:acs_transaction_id],
|
156
|
+
cavv: three_ds[:cavv],
|
157
|
+
wallet_provider_id: 'NO_WALLET',
|
158
|
+
type: 'D'
|
159
|
+
}.compact
|
160
|
+
|
161
|
+
params[:eci_indicator] = options[:three_d_secure][:eci]
|
162
|
+
params[:method] = '3DS'
|
163
|
+
end
|
164
|
+
|
122
165
|
def add_invoice(params, options)
|
123
166
|
params[:merchant_ref] = options[:order_id]
|
124
167
|
end
|
125
168
|
|
169
|
+
def add_reversal_id(params, options)
|
170
|
+
params[:reversal_id] = options[:reversal_id] if options[:reversal_id]
|
171
|
+
end
|
172
|
+
|
126
173
|
def amount_from_authorization(authorization)
|
127
174
|
authorization.split('|').last.to_i
|
128
175
|
end
|
129
176
|
|
130
|
-
def add_authorization_info(params, authorization)
|
131
|
-
transaction_id, transaction_tag, method,
|
132
|
-
params[:
|
133
|
-
|
134
|
-
params[:method] =
|
177
|
+
def add_authorization_info(params, authorization, options = {})
|
178
|
+
transaction_id, transaction_tag, method, = authorization.split('|')
|
179
|
+
params[:method] = method == 'token' ? 'credit_card' : method
|
180
|
+
# If the previous transaction `method` value was 3DS, it needs to be set to `credit_card` on follow up transactions
|
181
|
+
params[:method] = 'credit_card' if method == '3DS'
|
182
|
+
|
183
|
+
if options[:reversal_id]
|
184
|
+
params[:reversal_id] = options[:reversal_id]
|
185
|
+
else
|
186
|
+
params[:transaction_id] = transaction_id
|
187
|
+
params[:transaction_tag] = transaction_tag
|
188
|
+
end
|
135
189
|
end
|
136
190
|
|
137
191
|
def add_creditcard_for_tokenization(params, payment_method, options)
|
@@ -142,7 +196,7 @@ module ActiveMerchant
|
|
142
196
|
params[:auth] = 'false'
|
143
197
|
end
|
144
198
|
|
145
|
-
def
|
199
|
+
def store_action?(params)
|
146
200
|
params[:transaction_type] == 'store'
|
147
201
|
end
|
148
202
|
|
@@ -151,6 +205,8 @@ module ActiveMerchant
|
|
151
205
|
add_echeck(params, payment_method, options)
|
152
206
|
elsif payment_method.is_a? String
|
153
207
|
add_token(params, payment_method, options)
|
208
|
+
elsif payment_method.is_a? NetworkTokenizationCreditCard
|
209
|
+
add_network_tokenization(params, payment_method, options)
|
154
210
|
else
|
155
211
|
add_creditcard(params, payment_method)
|
156
212
|
end
|
@@ -159,11 +215,11 @@ module ActiveMerchant
|
|
159
215
|
def add_echeck(params, echeck, options)
|
160
216
|
tele_check = {}
|
161
217
|
|
162
|
-
tele_check[:check_number] = echeck.number ||
|
163
|
-
tele_check[:check_type] =
|
218
|
+
tele_check[:check_number] = echeck.number || '001'
|
219
|
+
tele_check[:check_type] = 'P'
|
164
220
|
tele_check[:routing_number] = echeck.routing_number
|
165
221
|
tele_check[:account_number] = echeck.account_number
|
166
|
-
tele_check[:accountholder_name] =
|
222
|
+
tele_check[:accountholder_name] = name_from_payment_method(echeck)
|
167
223
|
tele_check[:customer_id_type] = options[:customer_id_type] if options[:customer_id_type]
|
168
224
|
tele_check[:customer_id_number] = options[:customer_id_number] if options[:customer_id_number]
|
169
225
|
tele_check[:client_email] = options[:client_email] if options[:client_email]
|
@@ -206,10 +262,37 @@ module ActiveMerchant
|
|
206
262
|
card
|
207
263
|
end
|
208
264
|
|
265
|
+
def add_network_tokenization(params, payment_method, options)
|
266
|
+
nt_card = {}
|
267
|
+
nt_card[:type] = 'D'
|
268
|
+
nt_card[:cardholder_name] = name_from_payment_method(payment_method) || name_from_address(options)
|
269
|
+
nt_card[:card_number] = payment_method.number
|
270
|
+
nt_card[:exp_date] = format_exp_date(payment_method.month, payment_method.year)
|
271
|
+
nt_card[:cvv] = payment_method.verification_value
|
272
|
+
nt_card[:xid] = payment_method.payment_cryptogram unless payment_method.payment_cryptogram.empty? || payment_method.brand.include?('american_express')
|
273
|
+
nt_card[:cavv] = payment_method.payment_cryptogram unless payment_method.payment_cryptogram.empty?
|
274
|
+
nt_card[:wallet_provider_id] = 'APPLE_PAY'
|
275
|
+
|
276
|
+
params['3DS'] = nt_card
|
277
|
+
params[:method] = '3DS'
|
278
|
+
params[:eci_indicator] = payment_method.eci.nil? ? '5' : payment_method.eci
|
279
|
+
end
|
280
|
+
|
209
281
|
def format_exp_date(month, year)
|
210
282
|
"#{format(month, :two_digits)}#{format(year, :two_digits)}"
|
211
283
|
end
|
212
284
|
|
285
|
+
def name_from_address(options)
|
286
|
+
return unless address = options[:billing_address]
|
287
|
+
return address[:name] if address[:name]
|
288
|
+
end
|
289
|
+
|
290
|
+
def name_from_payment_method(payment_method)
|
291
|
+
return unless payment_method.first_name && payment_method.last_name
|
292
|
+
|
293
|
+
return "#{payment_method.first_name} #{payment_method.last_name}"
|
294
|
+
end
|
295
|
+
|
213
296
|
def add_address(params, options)
|
214
297
|
address = options[:billing_address]
|
215
298
|
return unless address
|
@@ -233,6 +316,41 @@ module ActiveMerchant
|
|
233
316
|
params[:soft_descriptors] = options[:soft_descriptors] if options[:soft_descriptors]
|
234
317
|
end
|
235
318
|
|
319
|
+
def add_level2_data(params, options)
|
320
|
+
return unless level2_data = options[:level2]
|
321
|
+
|
322
|
+
params[:level2] = {}
|
323
|
+
params[:level2][:customer_ref] = level2_data[:customer_ref]
|
324
|
+
end
|
325
|
+
|
326
|
+
def add_stored_credentials(params, options)
|
327
|
+
if options[:sequence] || options[:stored_credential]
|
328
|
+
params[:stored_credentials] = {}
|
329
|
+
params[:stored_credentials][:cardbrand_original_transaction_id] = original_transaction_id(options) if original_transaction_id(options)
|
330
|
+
params[:stored_credentials][:initiator] = initiator(options) if initiator(options)
|
331
|
+
params[:stored_credentials][:sequence] = options[:sequence] || sequence(options[:stored_credential][:initial_transaction])
|
332
|
+
params[:stored_credentials][:is_scheduled] = options[:is_scheduled] || is_scheduled(options[:stored_credential][:reason_type])
|
333
|
+
params[:stored_credentials][:auth_type_override] = options[:auth_type_override] if options[:auth_type_override]
|
334
|
+
end
|
335
|
+
end
|
336
|
+
|
337
|
+
def original_transaction_id(options)
|
338
|
+
return options[:cardbrand_original_transaction_id] || options.dig(:stored_credential, :network_transaction_id)
|
339
|
+
end
|
340
|
+
|
341
|
+
def initiator(options)
|
342
|
+
return options[:initiator] if options[:initiator]
|
343
|
+
return options[:stored_credential][:initiator].upcase if options.dig(:stored_credential, :initiator)
|
344
|
+
end
|
345
|
+
|
346
|
+
def sequence(initial_transaction)
|
347
|
+
initial_transaction ? 'FIRST' : 'SUBSEQUENT'
|
348
|
+
end
|
349
|
+
|
350
|
+
def is_scheduled(reason_type)
|
351
|
+
reason_type == 'recurring' ? 'true' : 'false'
|
352
|
+
end
|
353
|
+
|
236
354
|
def commit(params, options)
|
237
355
|
url = base_url(options) + endpoint(params)
|
238
356
|
|
@@ -248,15 +366,16 @@ module ActiveMerchant
|
|
248
366
|
response = json_error(e.response.body)
|
249
367
|
end
|
250
368
|
|
369
|
+
success = success_from(response)
|
251
370
|
Response.new(
|
252
|
-
|
253
|
-
handle_message(response,
|
371
|
+
success,
|
372
|
+
handle_message(response, success),
|
254
373
|
response,
|
255
374
|
test: test?,
|
256
375
|
authorization: authorization_from(params, response),
|
257
|
-
avs_result: {code: response['avs']},
|
376
|
+
avs_result: { code: response['avs'] },
|
258
377
|
cvv_result: response['cvv2'],
|
259
|
-
error_code:
|
378
|
+
error_code: success ? nil : error_code_from(response)
|
260
379
|
)
|
261
380
|
end
|
262
381
|
|
@@ -271,7 +390,7 @@ module ActiveMerchant
|
|
271
390
|
end
|
272
391
|
|
273
392
|
def endpoint(params)
|
274
|
-
|
393
|
+
store_action?(params) ? '/transactions/tokens' : '/transactions'
|
275
394
|
end
|
276
395
|
|
277
396
|
def api_request(url, params)
|
@@ -281,7 +400,8 @@ module ActiveMerchant
|
|
281
400
|
|
282
401
|
def post_data(params)
|
283
402
|
return nil unless params
|
284
|
-
|
403
|
+
|
404
|
+
params.reject { |_k, v| v.blank? }.collect { |k, v| "#{k}=#{CGI.escape(v.to_s)}" }.join('&')
|
285
405
|
end
|
286
406
|
|
287
407
|
def generate_hmac(nonce, current_timestamp, payload)
|
@@ -291,7 +411,7 @@ module ActiveMerchant
|
|
291
411
|
current_timestamp.to_s,
|
292
412
|
@options[:token],
|
293
413
|
payload
|
294
|
-
].join(
|
414
|
+
].join('')
|
295
415
|
hash = Base64.strict_encode64(OpenSSL::HMAC.hexdigest('sha256', @options[:apisecret], message))
|
296
416
|
hash
|
297
417
|
end
|
@@ -309,9 +429,16 @@ module ActiveMerchant
|
|
309
429
|
}
|
310
430
|
end
|
311
431
|
|
312
|
-
def
|
313
|
-
|
314
|
-
response['
|
432
|
+
def error_code_from(response)
|
433
|
+
error_code = nil
|
434
|
+
if response['bank_resp_code'] == '100'
|
435
|
+
return
|
436
|
+
elsif response['bank_resp_code']
|
437
|
+
error_code = response['bank_resp_code']
|
438
|
+
elsif error_code = response['Error'].to_h['messages'].to_a.map { |e| e['code'] }.join(', ')
|
439
|
+
end
|
440
|
+
|
441
|
+
error_code
|
315
442
|
end
|
316
443
|
|
317
444
|
def success_from(response)
|
@@ -347,7 +474,7 @@ module ActiveMerchant
|
|
347
474
|
end
|
348
475
|
|
349
476
|
def authorization_from(params, response)
|
350
|
-
if
|
477
|
+
if store_action?(params)
|
351
478
|
if success_from(response)
|
352
479
|
[
|
353
480
|
response['token']['type'],
|
@@ -363,7 +490,7 @@ module ActiveMerchant
|
|
363
490
|
response['transaction_id'],
|
364
491
|
response['transaction_tag'],
|
365
492
|
params[:method],
|
366
|
-
|
493
|
+
response['amount']&.to_i
|
367
494
|
].join('|')
|
368
495
|
end
|
369
496
|
end
|
@@ -379,7 +506,7 @@ module ActiveMerchant
|
|
379
506
|
end
|
380
507
|
|
381
508
|
def json_error(raw_response)
|
382
|
-
{
|
509
|
+
{ 'error' => "Unable to parse response: #{raw_response.inspect}" }
|
383
510
|
end
|
384
511
|
end
|
385
512
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require 'nokogiri'
|
2
2
|
|
3
3
|
module ActiveMerchant #:nodoc:
|
4
4
|
module Billing #:nodoc:
|
@@ -12,11 +12,11 @@ module ActiveMerchant #:nodoc:
|
|
12
12
|
self.test_confined_url = 'https://test-confined.payex.com/'
|
13
13
|
|
14
14
|
self.money_format = :cents
|
15
|
-
self.supported_countries = [
|
16
|
-
self.supported_cardtypes = [
|
15
|
+
self.supported_countries = %w[DK FI NO SE]
|
16
|
+
self.supported_cardtypes = %i[visa master american_express discover]
|
17
17
|
self.homepage_url = 'http://payex.com/'
|
18
18
|
self.display_name = 'Payex'
|
19
|
-
self.default_currency =
|
19
|
+
self.default_currency = 'EUR'
|
20
20
|
|
21
21
|
TRANSACTION_STATUS = {
|
22
22
|
sale: '0',
|
@@ -25,18 +25,18 @@ module ActiveMerchant #:nodoc:
|
|
25
25
|
authorize: '3',
|
26
26
|
cancel: '4',
|
27
27
|
failure: '5',
|
28
|
-
capture: '6'
|
28
|
+
capture: '6'
|
29
29
|
}
|
30
30
|
|
31
31
|
SOAP_ACTIONS = {
|
32
32
|
initialize: { name: 'Initialize8', url: 'pxorder/pxorder.asmx', xmlns: 'http://external.payex.com/PxOrder/' },
|
33
|
-
purchasecc: { name: 'PurchaseCC', url: 'pxconfined/pxorder.asmx', xmlns: 'http://confined.payex.com/PxOrder/', confined: true},
|
33
|
+
purchasecc: { name: 'PurchaseCC', url: 'pxconfined/pxorder.asmx', xmlns: 'http://confined.payex.com/PxOrder/', confined: true },
|
34
34
|
cancel: { name: 'Cancel2', url: 'pxorder/pxorder.asmx', xmlns: 'http://external.payex.com/PxOrder/' },
|
35
35
|
capture: { name: 'Capture5', url: 'pxorder/pxorder.asmx', xmlns: 'http://external.payex.com/PxOrder/' },
|
36
36
|
credit: { name: 'Credit5', url: 'pxorder/pxorder.asmx', xmlns: 'http://external.payex.com/PxOrder/' },
|
37
37
|
create_agreement: { name: 'CreateAgreement3', url: 'pxagreement/pxagreement.asmx', xmlns: 'http://external.payex.com/PxAgreement/' },
|
38
38
|
delete_agreement: { name: 'DeleteAgreement', url: 'pxagreement/pxagreement.asmx', xmlns: 'http://external.payex.com/PxAgreement/' },
|
39
|
-
autopay: { name: 'AutoPay3', url: 'pxagreement/pxagreement.asmx', xmlns: 'http://external.payex.com/PxAgreement/' }
|
39
|
+
autopay: { name: 'AutoPay3', url: 'pxagreement/pxagreement.asmx', xmlns: 'http://external.payex.com/PxAgreement/' }
|
40
40
|
}
|
41
41
|
|
42
42
|
def initialize(options = {})
|
@@ -63,14 +63,13 @@ module ActiveMerchant #:nodoc:
|
|
63
63
|
if payment_method.respond_to?(:number)
|
64
64
|
# credit card authorization
|
65
65
|
MultiResponse.new.tap do |r|
|
66
|
-
r.process {send_initialize(amount, true, options)}
|
67
|
-
r.process {send_purchasecc(payment_method, r.params['orderref'])}
|
66
|
+
r.process { send_initialize(amount, true, options) }
|
67
|
+
r.process { send_purchasecc(payment_method, r.params['orderref']) }
|
68
68
|
end
|
69
69
|
else
|
70
70
|
# stored authorization
|
71
71
|
send_autopay(amount, payment_method, true, options)
|
72
72
|
end
|
73
|
-
|
74
73
|
end
|
75
74
|
|
76
75
|
# Public: Send a purchase Payex request
|
@@ -92,8 +91,8 @@ module ActiveMerchant #:nodoc:
|
|
92
91
|
if payment_method.respond_to?(:number)
|
93
92
|
# credit card purchase
|
94
93
|
MultiResponse.new.tap do |r|
|
95
|
-
r.process {send_initialize(amount, false, options)}
|
96
|
-
r.process {send_purchasecc(payment_method, r.params['orderref'])}
|
94
|
+
r.process { send_initialize(amount, false, options) }
|
95
|
+
r.process { send_purchasecc(payment_method, r.params['orderref']) }
|
97
96
|
end
|
98
97
|
else
|
99
98
|
# stored purchase
|
@@ -118,7 +117,7 @@ module ActiveMerchant #:nodoc:
|
|
118
117
|
# options - A standard ActiveMerchant options hash
|
119
118
|
#
|
120
119
|
# Returns an ActiveMerchant::Billing::Response object
|
121
|
-
def void(authorization, options={})
|
120
|
+
def void(authorization, options = {})
|
122
121
|
send_cancel(authorization)
|
123
122
|
end
|
124
123
|
|
@@ -155,10 +154,10 @@ module ActiveMerchant #:nodoc:
|
|
155
154
|
requires!(options, :order_id)
|
156
155
|
amount = amount(1) # 1 cent for authorization
|
157
156
|
MultiResponse.run(:first) do |r|
|
158
|
-
r.process {send_create_agreement(options)}
|
159
|
-
r.process {send_initialize(amount, true, options.merge({agreement_ref: r.authorization}))}
|
157
|
+
r.process { send_create_agreement(options) }
|
158
|
+
r.process { send_initialize(amount, true, options.merge({ agreement_ref: r.authorization })) }
|
160
159
|
order_ref = r.params['orderref']
|
161
|
-
r.process {send_purchasecc(creditcard, order_ref)}
|
160
|
+
r.process { send_purchasecc(creditcard, order_ref) }
|
162
161
|
end
|
163
162
|
end
|
164
163
|
|
@@ -194,9 +193,9 @@ module ActiveMerchant #:nodoc:
|
|
194
193
|
cancelUrl: nil,
|
195
194
|
clientLanguage: nil
|
196
195
|
}
|
197
|
-
hash_fields = [
|
198
|
-
|
199
|
-
|
196
|
+
hash_fields = %i[accountNumber purchaseOperation price priceArgList currency vat orderID
|
197
|
+
productNumber description clientIPAddress clientIdentifier additionalValues
|
198
|
+
externalID returnUrl view agreementRef cancelUrl clientLanguage]
|
200
199
|
add_request_hash(properties, hash_fields)
|
201
200
|
soap_action = SOAP_ACTIONS[:initialize]
|
202
201
|
request = build_xml_request(soap_action, properties)
|
@@ -214,8 +213,8 @@ module ActiveMerchant #:nodoc:
|
|
214
213
|
cardHolderName: payment_method.name,
|
215
214
|
cardNumberCVC: payment_method.verification_value
|
216
215
|
}
|
217
|
-
hash_fields = [
|
218
|
-
|
216
|
+
hash_fields = %i[accountNumber orderRef transactionType cardNumber cardNumberExpireMonth
|
217
|
+
cardNumberExpireYear cardNumberCVC cardHolderName]
|
219
218
|
add_request_hash(properties, hash_fields)
|
220
219
|
|
221
220
|
soap_action = SOAP_ACTIONS[:purchasecc]
|
@@ -232,9 +231,9 @@ module ActiveMerchant #:nodoc:
|
|
232
231
|
description: options[:description] || options[:order_id],
|
233
232
|
orderId: options[:order_id],
|
234
233
|
purchaseOperation: is_auth ? 'AUTHORIZATION' : 'SALE',
|
235
|
-
currency: (options[:currency] || default_currency)
|
234
|
+
currency: (options[:currency] || default_currency)
|
236
235
|
}
|
237
|
-
hash_fields = [
|
236
|
+
hash_fields = %i[accountNumber agreementRef price productNumber description orderId purchaseOperation currency]
|
238
237
|
add_request_hash(properties, hash_fields)
|
239
238
|
|
240
239
|
soap_action = SOAP_ACTIONS[:autopay]
|
@@ -251,7 +250,7 @@ module ActiveMerchant #:nodoc:
|
|
251
250
|
vatAmount: options[:vat_amount] || 0,
|
252
251
|
additionalValues: ''
|
253
252
|
}
|
254
|
-
hash_fields = [
|
253
|
+
hash_fields = %i[accountNumber transactionNumber amount orderId vatAmount additionalValues]
|
255
254
|
add_request_hash(properties, hash_fields)
|
256
255
|
|
257
256
|
soap_action = SOAP_ACTIONS[:capture]
|
@@ -268,7 +267,7 @@ module ActiveMerchant #:nodoc:
|
|
268
267
|
vatAmount: options[:vat_amount] || 0,
|
269
268
|
additionalValues: ''
|
270
269
|
}
|
271
|
-
hash_fields = [
|
270
|
+
hash_fields = %i[accountNumber transactionNumber amount orderId vatAmount additionalValues]
|
272
271
|
add_request_hash(properties, hash_fields)
|
273
272
|
|
274
273
|
soap_action = SOAP_ACTIONS[:credit]
|
@@ -279,9 +278,9 @@ module ActiveMerchant #:nodoc:
|
|
279
278
|
def send_cancel(transaction_number)
|
280
279
|
properties = {
|
281
280
|
accountNumber: @options[:account],
|
282
|
-
transactionNumber: transaction_number
|
281
|
+
transactionNumber: transaction_number
|
283
282
|
}
|
284
|
-
hash_fields = [
|
283
|
+
hash_fields = %i[accountNumber transactionNumber]
|
285
284
|
add_request_hash(properties, hash_fields)
|
286
285
|
|
287
286
|
soap_action = SOAP_ACTIONS[:cancel]
|
@@ -300,7 +299,7 @@ module ActiveMerchant #:nodoc:
|
|
300
299
|
startDate: options[:startDate] || '',
|
301
300
|
stopDate: options[:stopDate] || ''
|
302
301
|
}
|
303
|
-
hash_fields = [
|
302
|
+
hash_fields = %i[accountNumber merchantRef description purchaseOperation maxAmount notifyUrl startDate stopDate]
|
304
303
|
add_request_hash(properties, hash_fields)
|
305
304
|
|
306
305
|
soap_action = SOAP_ACTIONS[:create_agreement]
|
@@ -311,9 +310,9 @@ module ActiveMerchant #:nodoc:
|
|
311
310
|
def send_delete_agreement(authorization)
|
312
311
|
properties = {
|
313
312
|
accountNumber: @options[:account],
|
314
|
-
agreementRef: authorization
|
313
|
+
agreementRef: authorization
|
315
314
|
}
|
316
|
-
hash_fields = [
|
315
|
+
hash_fields = %i[accountNumber agreementRef]
|
317
316
|
add_request_hash(properties, hash_fields)
|
318
317
|
|
319
318
|
soap_action = SOAP_ACTIONS[:delete_agreement]
|
@@ -342,9 +341,9 @@ module ActiveMerchant #:nodoc:
|
|
342
341
|
|
343
342
|
def build_xml_request(soap_action, properties)
|
344
343
|
builder = Nokogiri::XML::Builder.new
|
345
|
-
builder.__send__('soap12:Envelope', {'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
|
344
|
+
builder.__send__('soap12:Envelope', { 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
|
346
345
|
'xmlns:xsd' => 'http://www.w3.org/2001/XMLSchema',
|
347
|
-
'xmlns:soap12' => 'http://www.w3.org/2003/05/soap-envelope'}) do |root|
|
346
|
+
'xmlns:soap12' => 'http://www.w3.org/2003/05/soap-envelope' }) do |root|
|
348
347
|
root.__send__('soap12:Body') do |body|
|
349
348
|
body.__send__(soap_action[:name], xmlns: soap_action[:xmlns]) do |doc|
|
350
349
|
properties.each do |key, val|
|
@@ -360,12 +359,12 @@ module ActiveMerchant #:nodoc:
|
|
360
359
|
response = {}
|
361
360
|
|
362
361
|
xmldoc = Nokogiri::XML(xml)
|
363
|
-
body = xmldoc.xpath(
|
362
|
+
body = xmldoc.xpath('//soap:Body/*[1]')[0].inner_text
|
364
363
|
|
365
364
|
doc = Nokogiri::XML(body)
|
366
365
|
|
367
|
-
doc.root
|
368
|
-
if
|
366
|
+
doc.root&.xpath('*')&.each do |node|
|
367
|
+
if node.elements.size == 0
|
369
368
|
response[node.name.downcase.to_sym] = node.text
|
370
369
|
else
|
371
370
|
node.elements.each do |childnode|
|
@@ -373,7 +372,7 @@ module ActiveMerchant #:nodoc:
|
|
373
372
|
response[name.to_sym] = childnode.text
|
374
373
|
end
|
375
374
|
end
|
376
|
-
end
|
375
|
+
end
|
377
376
|
|
378
377
|
response
|
379
378
|
end
|
@@ -387,11 +386,10 @@ module ActiveMerchant #:nodoc:
|
|
387
386
|
}
|
388
387
|
response = parse(ssl_post(url, request, headers))
|
389
388
|
Response.new(success?(response),
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
)
|
389
|
+
message_from(response),
|
390
|
+
response,
|
391
|
+
test: test?,
|
392
|
+
authorization: build_authorization(response))
|
395
393
|
end
|
396
394
|
|
397
395
|
def build_authorization(response)
|
@@ -409,4 +407,3 @@ module ActiveMerchant #:nodoc:
|
|
409
407
|
end
|
410
408
|
end
|
411
409
|
end
|
412
|
-
|