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
@@ -62,7 +62,7 @@ module ActiveMerchant #:nodoc:
|
|
62
62
|
# * {USA ePay Developer Login}[https://www.usaepay.com/developer/login]
|
63
63
|
#
|
64
64
|
class UsaEpayAdvancedGateway < Gateway
|
65
|
-
API_VERSION =
|
65
|
+
API_VERSION = '1.4'
|
66
66
|
|
67
67
|
TEST_URL_BASE = 'https://sandbox.usaepay.com/soap/gate/' #:nodoc:
|
68
68
|
LIVE_URL_BASE = 'https://www.usaepay.com/soap/gate/' #:nodoc:
|
@@ -70,37 +70,37 @@ module ActiveMerchant #:nodoc:
|
|
70
70
|
self.test_url = TEST_URL_BASE
|
71
71
|
self.live_url = LIVE_URL_BASE
|
72
72
|
|
73
|
-
FAILURE_MESSAGE =
|
73
|
+
FAILURE_MESSAGE = 'Default Failure' #:nodoc:
|
74
74
|
|
75
75
|
self.supported_countries = ['US']
|
76
|
-
self.supported_cardtypes = [
|
76
|
+
self.supported_cardtypes = %i[visa master american_express discover diners_club jcb]
|
77
77
|
self.homepage_url = 'http://www.usaepay.com/'
|
78
78
|
self.display_name = 'USA ePay Advanced SOAP Interface'
|
79
79
|
|
80
80
|
CUSTOMER_PROFILE_OPTIONS = {
|
81
|
-
:
|
82
|
-
:
|
83
|
-
:
|
84
|
-
:
|
81
|
+
id: [:string, 'CustomerID'], # merchant assigned number
|
82
|
+
notes: [:string, 'Notes'],
|
83
|
+
data: [:string, 'CustomData'],
|
84
|
+
url: [:string, 'URL']
|
85
85
|
} #:nodoc:
|
86
86
|
|
87
87
|
CUSTOMER_RECURRING_BILLING_OPTIONS = {
|
88
|
-
:
|
89
|
-
:
|
90
|
-
:
|
91
|
-
:
|
92
|
-
:
|
93
|
-
:
|
94
|
-
:
|
95
|
-
:
|
96
|
-
:
|
97
|
-
:
|
88
|
+
enabled: [:boolean, 'Enabled'],
|
89
|
+
schedule: [:string, 'Schedule'],
|
90
|
+
number_left: [:integer, 'NumLeft'],
|
91
|
+
currency: [:string, 'Currency'],
|
92
|
+
description: [:string, 'Description'],
|
93
|
+
order_id: [:string, 'OrderID'],
|
94
|
+
user: [:string, 'User'],
|
95
|
+
source: [:string, 'Source'],
|
96
|
+
send_receipt: [:boolean, 'SendReceipt'],
|
97
|
+
receipt_note: [:string, 'ReceiptNote']
|
98
98
|
} #:nodoc:
|
99
99
|
|
100
100
|
CUSTOMER_POINT_OF_SALE_OPTIONS = {
|
101
|
-
:
|
102
|
-
:
|
103
|
-
:
|
101
|
+
price_tier: [:string, 'PriceTier'],
|
102
|
+
tax_class: [:string, 'TaxClass'],
|
103
|
+
lookup_code: [:string, 'LookupCode']
|
104
104
|
} #:nodoc:
|
105
105
|
|
106
106
|
CUSTOMER_OPTIONS = [
|
@@ -110,23 +110,23 @@ module ActiveMerchant #:nodoc:
|
|
110
110
|
].inject(:merge) #:nodoc:
|
111
111
|
|
112
112
|
COMMON_ADDRESS_OPTIONS = {
|
113
|
-
:
|
114
|
-
:
|
115
|
-
:
|
116
|
-
:
|
117
|
-
:
|
118
|
-
:
|
119
|
-
:
|
120
|
-
:
|
121
|
-
:
|
122
|
-
:
|
113
|
+
first_name: [:string, 'FirstName'],
|
114
|
+
last_name: [:string, 'LastName'],
|
115
|
+
city: [:string, 'City'],
|
116
|
+
state: [:string, 'State'],
|
117
|
+
zip: [:string, 'Zip'],
|
118
|
+
country: [:string, 'Country'],
|
119
|
+
phone: [:string, 'Phone'],
|
120
|
+
email: [:string, 'Email'],
|
121
|
+
fax: [:string, 'Fax'],
|
122
|
+
company: [:string, 'Company']
|
123
123
|
} #:nodoc:
|
124
124
|
|
125
125
|
ADDRESS_OPTIONS = [
|
126
126
|
COMMON_ADDRESS_OPTIONS,
|
127
127
|
{
|
128
|
-
:
|
129
|
-
:
|
128
|
+
address1: [:string, 'Street'],
|
129
|
+
address2: [:string, 'Street2']
|
130
130
|
}
|
131
131
|
].inject(:merge) #:nodoc
|
132
132
|
|
@@ -135,116 +135,116 @@ module ActiveMerchant #:nodoc:
|
|
135
135
|
CUSTOMER_RECURRING_BILLING_OPTIONS,
|
136
136
|
COMMON_ADDRESS_OPTIONS,
|
137
137
|
{
|
138
|
-
:
|
139
|
-
:
|
138
|
+
address1: [:string, 'Address'],
|
139
|
+
address2: [:string, 'Address2']
|
140
140
|
},
|
141
141
|
{
|
142
|
-
:
|
143
|
-
:
|
144
|
-
:
|
145
|
-
:
|
146
|
-
:
|
147
|
-
:
|
142
|
+
card_number: [:string, 'CardNumber'],
|
143
|
+
card_exp: [:string, 'CardExp'],
|
144
|
+
account: [:string, 'Account'],
|
145
|
+
routing: [:string, 'Routing'],
|
146
|
+
check_format: [:string, 'CheckFormat'],
|
147
|
+
record_type: [:string, 'RecordType']
|
148
148
|
}
|
149
149
|
].inject(:merge) #:nodoc
|
150
150
|
|
151
151
|
CUSTOMER_TRANSACTION_REQUEST_OPTIONS = {
|
152
|
-
:
|
153
|
-
:
|
154
|
-
:
|
155
|
-
:
|
156
|
-
:
|
157
|
-
:
|
158
|
-
:
|
159
|
-
:
|
160
|
-
:
|
161
|
-
:
|
162
|
-
:
|
163
|
-
:
|
152
|
+
command: [:string, 'Command'],
|
153
|
+
ignore_duplicate: [:boolean, 'IgnoreDuplicate'],
|
154
|
+
client_ip: [:string, 'ClientIP'],
|
155
|
+
customer_receipt: [:boolean, 'CustReceipt'],
|
156
|
+
customer_email: [:boolean, 'CustReceiptEmail'],
|
157
|
+
customer_template: [:boolean, 'CustReceiptName'],
|
158
|
+
merchant_receipt: [:boolean, 'MerchReceipt'],
|
159
|
+
merchant_email: [:boolean, 'MerchReceiptEmail'],
|
160
|
+
merchant_template: [:boolean, 'MerchReceiptName'],
|
161
|
+
recurring: [:boolean, 'isRecurring'],
|
162
|
+
verification_value: [:string, 'CardCode'],
|
163
|
+
software: [:string, 'Software']
|
164
164
|
} #:nodoc:
|
165
165
|
|
166
166
|
TRANSACTION_REQUEST_OBJECT_OPTIONS = {
|
167
|
-
:
|
168
|
-
:
|
169
|
-
:
|
170
|
-
:
|
171
|
-
:
|
172
|
-
:
|
173
|
-
:
|
174
|
-
:
|
175
|
-
:
|
176
|
-
:
|
167
|
+
command: [:string, 'Command'],
|
168
|
+
ignore_duplicate: [:boolean, 'IgnoreDuplicate'],
|
169
|
+
authorization_code: [:string, 'AuthCode'],
|
170
|
+
reference_number: [:string, 'RefNum'],
|
171
|
+
account_holder: [:string, 'AccountHolder'],
|
172
|
+
client_ip: [:string, 'ClientIP'],
|
173
|
+
customer_id: [:string, 'CustomerID'],
|
174
|
+
customer_receipt: [:boolean, 'CustReceipt'],
|
175
|
+
customer_template: [:boolean, 'CustReceiptName'],
|
176
|
+
software: [:string, 'Software']
|
177
177
|
} #:nodoc:
|
178
178
|
|
179
179
|
TRANSACTION_DETAIL_OPTIONS = {
|
180
|
-
:
|
181
|
-
:
|
182
|
-
:
|
183
|
-
:
|
184
|
-
:
|
185
|
-
:
|
186
|
-
:
|
187
|
-
:
|
188
|
-
:
|
189
|
-
:
|
190
|
-
:
|
180
|
+
invoice: [:string, 'Invoice'],
|
181
|
+
po_number: [:string, 'PONum'],
|
182
|
+
order_id: [:string, 'OrderID'],
|
183
|
+
clerk: [:string, 'Clerk'],
|
184
|
+
terminal: [:string, 'Terminal'],
|
185
|
+
table: [:string, 'Table'],
|
186
|
+
description: [:string, 'Description'],
|
187
|
+
comments: [:string, 'Comments'],
|
188
|
+
allow_partial_auth: [:boolean, 'AllowPartialAuth'],
|
189
|
+
currency: [:string, 'Currency'],
|
190
|
+
non_tax: [:boolean, 'NonTax']
|
191
191
|
} #:nodoc:
|
192
192
|
|
193
193
|
TRANSACTION_DETAIL_MONEY_OPTIONS = {
|
194
|
-
:
|
195
|
-
:
|
196
|
-
:
|
197
|
-
:
|
198
|
-
:
|
199
|
-
:
|
200
|
-
:
|
194
|
+
amount: [:double, 'Amount'],
|
195
|
+
tax: [:double, 'Tax'],
|
196
|
+
tip: [:double, 'Tip'],
|
197
|
+
non_tax: [:boolean, 'NonTax'],
|
198
|
+
shipping: [:double, 'Shipping'],
|
199
|
+
discount: [:double, 'Discount'],
|
200
|
+
subtotal: [:double, 'Subtotal']
|
201
201
|
} #:nodoc:
|
202
202
|
|
203
203
|
CREDIT_CARD_DATA_OPTIONS = {
|
204
|
-
:
|
205
|
-
:
|
206
|
-
:
|
207
|
-
:
|
208
|
-
:
|
209
|
-
:
|
210
|
-
:
|
211
|
-
:
|
212
|
-
:
|
213
|
-
:
|
204
|
+
magnetic_stripe: [:string, 'MagStripe'],
|
205
|
+
dukpt: [:string, 'DUKPT'],
|
206
|
+
signature: [:string, 'Signature'],
|
207
|
+
terminal_type: [:string, 'TermType'],
|
208
|
+
magnetic_support: [:string, 'MagSupport'],
|
209
|
+
xid: [:string, 'XID'],
|
210
|
+
cavv: [:string, 'CAVV'],
|
211
|
+
eci: [:integer, 'ECI'],
|
212
|
+
internal_card_authorization: [:boolean, 'InternalCardAuth'],
|
213
|
+
pares: [:string, 'Pares']
|
214
214
|
} #:nodoc:
|
215
215
|
|
216
216
|
CHECK_DATA_OPTIONS = {
|
217
|
-
:
|
218
|
-
:
|
219
|
-
:
|
220
|
-
:
|
221
|
-
:
|
222
|
-
:
|
223
|
-
:
|
217
|
+
drivers_license: [:string, 'DriversLicense'],
|
218
|
+
drivers_license_state: [:string, 'DriversLicenseState'],
|
219
|
+
record_type: [:string, 'RecordType'],
|
220
|
+
aux_on_us: [:string, 'AuxOnUS'],
|
221
|
+
epc_code: [:string, 'EpcCode'],
|
222
|
+
front_image: [:string, 'FrontImage'],
|
223
|
+
back_image: [:string, 'BackImage']
|
224
224
|
} #:nodoc:
|
225
225
|
|
226
226
|
RECURRING_BILLING_OPTIONS = {
|
227
|
-
:
|
228
|
-
:
|
229
|
-
:
|
227
|
+
schedule: [:string, 'Schedule'],
|
228
|
+
number_left: [:integer, 'NumLeft'],
|
229
|
+
enabled: [:boolean, 'Enabled']
|
230
230
|
} #:nodoc:
|
231
231
|
|
232
232
|
AVS_RESULTS = {
|
233
|
-
'Y' => %w(
|
234
|
-
'Z' => %w(
|
235
|
-
'A' => %w(
|
236
|
-
'N' => %w(
|
237
|
-
'X' => %w(
|
238
|
-
'W' => %w(
|
239
|
-
'XXW' => %w(
|
240
|
-
'XXU' => %w(
|
241
|
-
'R' => %w(
|
242
|
-
'S' => %w(
|
243
|
-
'XXE' => %w(
|
244
|
-
'G' => %w(
|
245
|
-
'B' => %w(
|
246
|
-
'D' => %w(
|
247
|
-
'P' => %w(
|
233
|
+
'Y' => %w(YYY Y YYA YYD),
|
234
|
+
'Z' => %w(NYZ Z),
|
235
|
+
'A' => %w(YNA A YNY),
|
236
|
+
'N' => %w(NNN N NN),
|
237
|
+
'X' => %w(YYX X),
|
238
|
+
'W' => %w(NYW W),
|
239
|
+
'XXW' => %w(XXW),
|
240
|
+
'XXU' => %w(XXU),
|
241
|
+
'R' => %w(XXR R U E),
|
242
|
+
'S' => %w(XXS S),
|
243
|
+
'XXE' => %w(XXE),
|
244
|
+
'G' => %w(XXG G C I),
|
245
|
+
'B' => %w(YYG B M),
|
246
|
+
'D' => %w(GGG D),
|
247
|
+
'P' => %w(YGG P)
|
248
248
|
}.inject({}) do |map, (type, codes)|
|
249
249
|
codes.each { |code| map[code] = type }
|
250
250
|
map
|
@@ -272,8 +272,8 @@ module ActiveMerchant #:nodoc:
|
|
272
272
|
requires!(options, :login, :password)
|
273
273
|
|
274
274
|
if options[:software_id]
|
275
|
-
self.live_url = "#{LIVE_URL_BASE}#{options[:software_id]
|
276
|
-
self.test_url = "#{TEST_URL_BASE}#{options[:software_id]
|
275
|
+
self.live_url = "#{LIVE_URL_BASE}#{options[:software_id]}"
|
276
|
+
self.test_url = "#{TEST_URL_BASE}#{options[:software_id]}"
|
277
277
|
else
|
278
278
|
self.live_url = options[:live_url].to_s
|
279
279
|
self.test_url = options[:test_url].to_s if options[:test_url]
|
@@ -289,43 +289,43 @@ module ActiveMerchant #:nodoc:
|
|
289
289
|
#
|
290
290
|
# Note: See run_transaction for additional options.
|
291
291
|
#
|
292
|
-
def purchase(money, creditcard, options={})
|
293
|
-
run_sale(options.merge!(:
|
292
|
+
def purchase(money, creditcard, options = {})
|
293
|
+
run_sale(options.merge!(amount: money, payment_method: creditcard))
|
294
294
|
end
|
295
295
|
|
296
296
|
# Authorize an amount on a credit card or account.
|
297
297
|
#
|
298
298
|
# Note: See run_transaction for additional options.
|
299
299
|
#
|
300
|
-
def authorize(money, creditcard, options={})
|
301
|
-
run_auth_only(options.merge!(:
|
300
|
+
def authorize(money, creditcard, options = {})
|
301
|
+
run_auth_only(options.merge!(amount: money, payment_method: creditcard))
|
302
302
|
end
|
303
303
|
|
304
304
|
# Capture an authorized transaction.
|
305
305
|
#
|
306
306
|
# Note: See run_transaction for additional options.
|
307
307
|
#
|
308
|
-
def capture(money, identification, options={})
|
309
|
-
capture_transaction(options.merge!(:
|
308
|
+
def capture(money, identification, options = {})
|
309
|
+
capture_transaction(options.merge!(amount: money, reference_number: identification))
|
310
310
|
end
|
311
311
|
|
312
312
|
# Void a previous transaction that has not been settled.
|
313
313
|
#
|
314
314
|
# Note: See run_transaction for additional options.
|
315
315
|
#
|
316
|
-
def void(identification, options={})
|
317
|
-
void_transaction(options.merge!(:
|
316
|
+
def void(identification, options = {})
|
317
|
+
void_transaction(options.merge!(reference_number: identification))
|
318
318
|
end
|
319
319
|
|
320
320
|
# Refund a previous transaction.
|
321
321
|
#
|
322
322
|
# Note: See run_transaction for additional options.
|
323
323
|
#
|
324
|
-
def refund(money, identification, options={})
|
325
|
-
refund_transaction(options.merge!(:
|
324
|
+
def refund(money, identification, options = {})
|
325
|
+
refund_transaction(options.merge!(amount: money, reference_number: identification))
|
326
326
|
end
|
327
327
|
|
328
|
-
def credit(money, identification, options={})
|
328
|
+
def credit(money, identification, options = {})
|
329
329
|
ActiveMerchant.deprecated CREDIT_DEPRECATION_MESSAGE
|
330
330
|
refund(money, identification, options)
|
331
331
|
end
|
@@ -368,7 +368,7 @@ module ActiveMerchant #:nodoc:
|
|
368
368
|
# ==== Response
|
369
369
|
# * <tt>#message</tt> -- customer number assigned by gateway
|
370
370
|
#
|
371
|
-
def add_customer(options={})
|
371
|
+
def add_customer(options = {})
|
372
372
|
request = build_request(__method__, options)
|
373
373
|
commit(__method__, request)
|
374
374
|
end
|
@@ -381,7 +381,7 @@ module ActiveMerchant #:nodoc:
|
|
381
381
|
# ==== Options
|
382
382
|
# * Same as add_customer
|
383
383
|
#
|
384
|
-
def update_customer(options={})
|
384
|
+
def update_customer(options = {})
|
385
385
|
requires! options, :customer_number
|
386
386
|
|
387
387
|
request = build_request(__method__, options)
|
@@ -429,7 +429,7 @@ module ActiveMerchant #:nodoc:
|
|
429
429
|
# ==== Response
|
430
430
|
# * <tt>#message</tt> -- boolean; Returns true if successful. Exception thrown all failures.
|
431
431
|
#
|
432
|
-
def quick_update_customer(options={})
|
432
|
+
def quick_update_customer(options = {})
|
433
433
|
requires! options, :customer_number
|
434
434
|
requires! options, :update_data
|
435
435
|
|
@@ -444,7 +444,7 @@ module ActiveMerchant #:nodoc:
|
|
444
444
|
# ==== Required
|
445
445
|
# * <tt>:customer_number</tt>
|
446
446
|
#
|
447
|
-
def enable_customer(options={})
|
447
|
+
def enable_customer(options = {})
|
448
448
|
requires! options, :customer_number
|
449
449
|
|
450
450
|
request = build_request(__method__, options)
|
@@ -456,7 +456,7 @@ module ActiveMerchant #:nodoc:
|
|
456
456
|
# ==== Required
|
457
457
|
# * <tt>:customer_number</tt>
|
458
458
|
#
|
459
|
-
def disable_customer(options={})
|
459
|
+
def disable_customer(options = {})
|
460
460
|
requires! options, :customer_number
|
461
461
|
|
462
462
|
request = build_request(__method__, options)
|
@@ -479,7 +479,7 @@ module ActiveMerchant #:nodoc:
|
|
479
479
|
# ==== Response
|
480
480
|
# * <tt>#message</tt> -- method_id of new customer payment method
|
481
481
|
#
|
482
|
-
def add_customer_payment_method(options={})
|
482
|
+
def add_customer_payment_method(options = {})
|
483
483
|
requires! options, :customer_number
|
484
484
|
|
485
485
|
request = build_request(__method__, options)
|
@@ -494,7 +494,7 @@ module ActiveMerchant #:nodoc:
|
|
494
494
|
# ==== Response
|
495
495
|
# * <tt>#message</tt> -- either a single hash or an array of hashes of payment methods
|
496
496
|
#
|
497
|
-
def get_customer_payment_methods(options={})
|
497
|
+
def get_customer_payment_methods(options = {})
|
498
498
|
requires! options, :customer_number
|
499
499
|
|
500
500
|
request = build_request(__method__, options)
|
@@ -510,7 +510,7 @@ module ActiveMerchant #:nodoc:
|
|
510
510
|
# ==== Response
|
511
511
|
# * <tt>#message</tt> -- hash of payment method
|
512
512
|
#
|
513
|
-
def get_customer_payment_method(options={})
|
513
|
+
def get_customer_payment_method(options = {})
|
514
514
|
requires! options, :customer_number, :method_id
|
515
515
|
|
516
516
|
request = build_request(__method__, options)
|
@@ -531,7 +531,7 @@ module ActiveMerchant #:nodoc:
|
|
531
531
|
# ==== Response
|
532
532
|
# * <tt>#message</tt> -- hash of payment method
|
533
533
|
#
|
534
|
-
def update_customer_payment_method(options={})
|
534
|
+
def update_customer_payment_method(options = {})
|
535
535
|
requires! options, :method_id
|
536
536
|
|
537
537
|
request = build_request(__method__, options)
|
@@ -544,7 +544,7 @@ module ActiveMerchant #:nodoc:
|
|
544
544
|
# * <tt>:customer_number</tt>
|
545
545
|
# * <tt>:method_id</tt>
|
546
546
|
#
|
547
|
-
def delete_customer_payment_method(options={})
|
547
|
+
def delete_customer_payment_method(options = {})
|
548
548
|
requires! options, :customer_number, :method_id
|
549
549
|
|
550
550
|
request = build_request(__method__, options)
|
@@ -556,7 +556,7 @@ module ActiveMerchant #:nodoc:
|
|
556
556
|
# ==== Required
|
557
557
|
# * <tt>:customer_number</tt>
|
558
558
|
#
|
559
|
-
def delete_customer(options={})
|
559
|
+
def delete_customer(options = {})
|
560
560
|
requires! options, :customer_number
|
561
561
|
|
562
562
|
request = build_request(__method__, options)
|
@@ -607,7 +607,7 @@ module ActiveMerchant #:nodoc:
|
|
607
607
|
# ==== Response
|
608
608
|
# * <tt>#message</tt> -- transaction response hash
|
609
609
|
#
|
610
|
-
def run_customer_transaction(options={})
|
610
|
+
def run_customer_transaction(options = {})
|
611
611
|
requires! options, :customer_number, :command, :amount
|
612
612
|
|
613
613
|
request = build_request(__method__, options)
|
@@ -671,14 +671,14 @@ module ActiveMerchant #:nodoc:
|
|
671
671
|
# ==== Response
|
672
672
|
# * <tt>#message</tt> -- transaction response hash
|
673
673
|
#
|
674
|
-
def run_transaction(options={})
|
674
|
+
def run_transaction(options = {})
|
675
675
|
request = build_request(__method__, options)
|
676
676
|
commit(__method__, request)
|
677
677
|
end
|
678
678
|
|
679
|
-
TRANSACTION_METHODS = [
|
680
|
-
|
681
|
-
|
679
|
+
TRANSACTION_METHODS = %i[
|
680
|
+
run_sale run_auth_only run_credit
|
681
|
+
run_check_sale run_check_credit
|
682
682
|
] #:nodoc:
|
683
683
|
|
684
684
|
TRANSACTION_METHODS.each do |method|
|
@@ -699,7 +699,7 @@ module ActiveMerchant #:nodoc:
|
|
699
699
|
# ==== Response
|
700
700
|
# * <tt>#message</tt> -- transaction response hash
|
701
701
|
#
|
702
|
-
def post_auth(options={})
|
702
|
+
def post_auth(options = {})
|
703
703
|
requires! options, :authorization_code
|
704
704
|
|
705
705
|
request = build_request(__method__, options)
|
@@ -721,7 +721,7 @@ module ActiveMerchant #:nodoc:
|
|
721
721
|
# ==== Response
|
722
722
|
# * <tt>#message</tt> -- transaction response hash
|
723
723
|
#
|
724
|
-
def capture_transaction(options={})
|
724
|
+
def capture_transaction(options = {})
|
725
725
|
requires! options, :reference_number
|
726
726
|
|
727
727
|
request = build_request(__method__, options)
|
@@ -738,7 +738,7 @@ module ActiveMerchant #:nodoc:
|
|
738
738
|
# ==== Response
|
739
739
|
# * <tt>#message</tt> -- transaction response hash
|
740
740
|
#
|
741
|
-
def void_transaction(options={})
|
741
|
+
def void_transaction(options = {})
|
742
742
|
requires! options, :reference_number
|
743
743
|
|
744
744
|
request = build_request(__method__, options)
|
@@ -757,7 +757,7 @@ module ActiveMerchant #:nodoc:
|
|
757
757
|
# ==== Response
|
758
758
|
# * <tt>#message</tt> -- transaction response hash
|
759
759
|
#
|
760
|
-
def refund_transaction(options={})
|
760
|
+
def refund_transaction(options = {})
|
761
761
|
requires! options, :reference_number, :amount
|
762
762
|
|
763
763
|
request = build_request(__method__, options)
|
@@ -777,7 +777,7 @@ module ActiveMerchant #:nodoc:
|
|
777
777
|
# ==== Response
|
778
778
|
# * <tt>#message</tt> -- transaction response hash
|
779
779
|
#
|
780
|
-
def override_transaction(options={})
|
780
|
+
def override_transaction(options = {})
|
781
781
|
requires! options, :reference_number
|
782
782
|
|
783
783
|
request = build_request(__method__, options)
|
@@ -820,7 +820,7 @@ module ActiveMerchant #:nodoc:
|
|
820
820
|
# ==== Response
|
821
821
|
# * <tt>#message</tt> -- transaction response hash
|
822
822
|
#
|
823
|
-
def run_quick_sale(options={})
|
823
|
+
def run_quick_sale(options = {})
|
824
824
|
requires! options, :reference_number, :amount
|
825
825
|
|
826
826
|
request = build_request(__method__, options)
|
@@ -858,7 +858,7 @@ module ActiveMerchant #:nodoc:
|
|
858
858
|
# ==== Response
|
859
859
|
# * <tt>#message</tt> -- transaction response hash
|
860
860
|
#
|
861
|
-
def run_quick_credit(options={})
|
861
|
+
def run_quick_credit(options = {})
|
862
862
|
requires! options, :reference_number
|
863
863
|
|
864
864
|
request = build_request(__method__, options)
|
@@ -875,7 +875,7 @@ module ActiveMerchant #:nodoc:
|
|
875
875
|
# ==== Response
|
876
876
|
# * <tt>#message</tt> -- transaction hash
|
877
877
|
#
|
878
|
-
def get_transaction(options={})
|
878
|
+
def get_transaction(options = {})
|
879
879
|
requires! options, :reference_number
|
880
880
|
|
881
881
|
request = build_request(__method__, options)
|
@@ -892,7 +892,7 @@ module ActiveMerchant #:nodoc:
|
|
892
892
|
# * <tt>response.message</tt> -- message of the referenced transaction
|
893
893
|
# * <tt>response.authorization</tt> -- same as :reference_number in options
|
894
894
|
#
|
895
|
-
def get_transaction_status(options={})
|
895
|
+
def get_transaction_status(options = {})
|
896
896
|
requires! options, :reference_number
|
897
897
|
|
898
898
|
request = build_request(__method__, options)
|
@@ -990,7 +990,7 @@ module ActiveMerchant #:nodoc:
|
|
990
990
|
# ==== Response
|
991
991
|
# * <tt>#message</tt> -- hash; keys are the field values
|
992
992
|
#
|
993
|
-
def get_transaction_custom(options={})
|
993
|
+
def get_transaction_custom(options = {})
|
994
994
|
requires! options, :reference_number, :fields
|
995
995
|
|
996
996
|
request = build_request(__method__, options)
|
@@ -1005,7 +1005,7 @@ module ActiveMerchant #:nodoc:
|
|
1005
1005
|
# ==== Response
|
1006
1006
|
# * <tt>#message</tt> -- check trace hash
|
1007
1007
|
#
|
1008
|
-
def get_check_trace(options={})
|
1008
|
+
def get_check_trace(options = {})
|
1009
1009
|
requires! options, :reference_number
|
1010
1010
|
|
1011
1011
|
request = build_request(__method__, options)
|
@@ -1031,15 +1031,15 @@ module ActiveMerchant #:nodoc:
|
|
1031
1031
|
# Build soap header, etc.
|
1032
1032
|
def build_request(action, options = {})
|
1033
1033
|
soap = Builder::XmlMarkup.new
|
1034
|
-
soap.instruct!(:xml, :
|
1035
|
-
soap.tag!
|
1034
|
+
soap.instruct!(:xml, version: '1.0', encoding: 'utf-8')
|
1035
|
+
soap.tag! 'SOAP-ENV:Envelope',
|
1036
1036
|
'xmlns:SOAP-ENV' => 'http://schemas.xmlsoap.org/soap/envelope/',
|
1037
1037
|
'xmlns:ns1' => 'urn:usaepay',
|
1038
1038
|
'xmlns:xsd' => 'http://www.w3.org/2001/XMLSchema',
|
1039
1039
|
'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
|
1040
1040
|
'xmlns:SOAP-ENC' => 'http://schemas.xmlsoap.org/soap/encoding/',
|
1041
1041
|
'SOAP-ENV:encodingStyle' => 'http://schemas.xmlsoap.org/soap/encoding/' do
|
1042
|
-
soap.tag!
|
1042
|
+
soap.tag! 'SOAP-ENV:Body' do
|
1043
1043
|
send("build_#{action}", soap, options)
|
1044
1044
|
end
|
1045
1045
|
end
|
@@ -1058,9 +1058,9 @@ module ActiveMerchant #:nodoc:
|
|
1058
1058
|
soap.Token 'xsi:type' => 'ns1:ueSecurityToken' do
|
1059
1059
|
build_tag soap, :string, 'ClientIP', options[:client_ip]
|
1060
1060
|
soap.PinHash 'xsi:type' => 'ns1:ueHash' do
|
1061
|
-
build_tag soap, :string,
|
1062
|
-
build_tag soap, :string,
|
1063
|
-
build_tag soap, :string,
|
1061
|
+
build_tag soap, :string, 'HashValue', hash
|
1062
|
+
build_tag soap, :string, 'Seed', seed
|
1063
|
+
build_tag soap, :string, 'Type', 'sha1'
|
1064
1064
|
end
|
1065
1065
|
build_tag soap, :string, 'SourceKey', @options[:login]
|
1066
1066
|
end
|
@@ -1069,16 +1069,16 @@ module ActiveMerchant #:nodoc:
|
|
1069
1069
|
# Customer ======================================================
|
1070
1070
|
|
1071
1071
|
def build_add_customer(soap, options)
|
1072
|
-
soap.tag!
|
1072
|
+
soap.tag! 'ns1:addCustomer' do
|
1073
1073
|
build_token soap, options
|
1074
1074
|
build_customer_data soap, options
|
1075
1075
|
build_tag soap, :double, 'Amount', amount(options[:amount])
|
1076
1076
|
build_tag soap, :double, 'Tax', amount(options[:tax])
|
1077
|
-
build_tag soap, :string, 'Next', options[:next].strftime(
|
1077
|
+
build_tag soap, :string, 'Next', options[:next].strftime('%Y-%m-%d') if options[:next]
|
1078
1078
|
end
|
1079
1079
|
end
|
1080
1080
|
|
1081
|
-
def build_customer(soap, options, type, add_customer_data=false)
|
1081
|
+
def build_customer(soap, options, type, add_customer_data = false)
|
1082
1082
|
soap.tag! "ns1:#{type}" do
|
1083
1083
|
build_token soap, options
|
1084
1084
|
build_tag soap, :integer, 'CustNum', options[:customer_number]
|
@@ -1103,15 +1103,15 @@ module ActiveMerchant #:nodoc:
|
|
1103
1103
|
end
|
1104
1104
|
|
1105
1105
|
def build_quick_update_customer(soap, options)
|
1106
|
-
soap.tag!
|
1106
|
+
soap.tag! 'ns1:quickUpdateCustomer' do
|
1107
1107
|
build_token soap, options
|
1108
1108
|
build_tag soap, :integer, 'CustNum', options[:customer_number]
|
1109
|
-
build_field_value_array soap,
|
1109
|
+
build_field_value_array soap, 'UpdateData', 'FieldValue', options[:update_data], CUSTOMER_UPDATE_DATA_FIELDS
|
1110
1110
|
end
|
1111
1111
|
end
|
1112
1112
|
|
1113
1113
|
def build_add_customer_payment_method(soap, options)
|
1114
|
-
soap.tag!
|
1114
|
+
soap.tag! 'ns1:addCustomerPaymentMethod' do
|
1115
1115
|
build_token soap, options
|
1116
1116
|
build_tag soap, :integer, 'CustNum', options[:customer_number]
|
1117
1117
|
build_customer_payment_methods soap, options
|
@@ -1141,7 +1141,7 @@ module ActiveMerchant #:nodoc:
|
|
1141
1141
|
end
|
1142
1142
|
|
1143
1143
|
def build_delete_customer_payment_method(soap, options)
|
1144
|
-
soap.tag!
|
1144
|
+
soap.tag! 'ns1:deleteCustomerPaymentMethod' do
|
1145
1145
|
build_token soap, options
|
1146
1146
|
build_tag soap, :integer, 'Custnum', options[:customer_number]
|
1147
1147
|
build_tag soap, :integer, 'PaymentMethodID', options[:method_id]
|
@@ -1149,7 +1149,7 @@ module ActiveMerchant #:nodoc:
|
|
1149
1149
|
end
|
1150
1150
|
|
1151
1151
|
def build_run_customer_transaction(soap, options)
|
1152
|
-
soap.tag!
|
1152
|
+
soap.tag! 'ns1:runCustomerTransaction' do
|
1153
1153
|
build_token soap, options
|
1154
1154
|
build_tag soap, :integer, 'CustNum', options[:customer_number]
|
1155
1155
|
build_tag soap, :integer, 'PaymentMethodID', options[:method_id] || 0
|
@@ -1226,21 +1226,21 @@ module ActiveMerchant #:nodoc:
|
|
1226
1226
|
end
|
1227
1227
|
|
1228
1228
|
def build_get_transaction(soap, options)
|
1229
|
-
soap.tag!
|
1229
|
+
soap.tag! 'ns1:getTransaction' do
|
1230
1230
|
build_token soap, options
|
1231
1231
|
build_tag soap, :integer, 'RefNum', options[:reference_number]
|
1232
1232
|
end
|
1233
1233
|
end
|
1234
1234
|
|
1235
1235
|
def build_get_transaction_status(soap, options)
|
1236
|
-
soap.tag!
|
1236
|
+
soap.tag! 'ns1:getTransactionStatus' do
|
1237
1237
|
build_token soap, options
|
1238
1238
|
build_tag soap, :integer, 'RefNum', options[:reference_number]
|
1239
1239
|
end
|
1240
1240
|
end
|
1241
1241
|
|
1242
1242
|
def build_get_transaction_custom(soap, options)
|
1243
|
-
soap.tag!
|
1243
|
+
soap.tag! 'ns1:getTransactionCustom' do
|
1244
1244
|
build_token soap, options
|
1245
1245
|
build_tag soap, :integer, 'RefNum', options[:reference_number]
|
1246
1246
|
build_transaction_field_array soap, options
|
@@ -1248,14 +1248,14 @@ module ActiveMerchant #:nodoc:
|
|
1248
1248
|
end
|
1249
1249
|
|
1250
1250
|
def build_get_check_trace(soap, options)
|
1251
|
-
soap.tag!
|
1251
|
+
soap.tag! 'ns1:getCheckTrace' do
|
1252
1252
|
build_token soap, options
|
1253
1253
|
build_tag soap, :integer, 'RefNum', options[:reference_number]
|
1254
1254
|
end
|
1255
1255
|
end
|
1256
1256
|
|
1257
1257
|
def build_capture_transaction(soap, options)
|
1258
|
-
soap.tag!
|
1258
|
+
soap.tag! 'ns1:captureTransaction' do
|
1259
1259
|
build_token soap, options
|
1260
1260
|
build_tag soap, :integer, 'RefNum', options[:reference_number]
|
1261
1261
|
build_tag soap, :double, 'Amount', amount(options[:amount])
|
@@ -1263,14 +1263,14 @@ module ActiveMerchant #:nodoc:
|
|
1263
1263
|
end
|
1264
1264
|
|
1265
1265
|
def build_void_transaction(soap, options)
|
1266
|
-
soap.tag!
|
1266
|
+
soap.tag! 'ns1:voidTransaction' do
|
1267
1267
|
build_token soap, options
|
1268
1268
|
build_tag soap, :integer, 'RefNum', options[:reference_number]
|
1269
1269
|
end
|
1270
1270
|
end
|
1271
1271
|
|
1272
1272
|
def build_refund_transaction(soap, options)
|
1273
|
-
soap.tag!
|
1273
|
+
soap.tag! 'ns1:refundTransaction' do
|
1274
1274
|
build_token soap, options
|
1275
1275
|
build_tag soap, :integer, 'RefNum', options[:reference_number]
|
1276
1276
|
build_tag soap, :integer, 'Amount', amount(options[:amount])
|
@@ -1278,7 +1278,7 @@ module ActiveMerchant #:nodoc:
|
|
1278
1278
|
end
|
1279
1279
|
|
1280
1280
|
def build_override_transaction(soap, options)
|
1281
|
-
soap.tag!
|
1281
|
+
soap.tag! 'ns1:overrideTransaction' do
|
1282
1282
|
build_token soap, options
|
1283
1283
|
build_tag soap, :integer, 'RefNum', options[:reference_number]
|
1284
1284
|
build_tag soap, :string, 'Reason', options[:reason]
|
@@ -1288,7 +1288,7 @@ module ActiveMerchant #:nodoc:
|
|
1288
1288
|
# Account =======================================================
|
1289
1289
|
|
1290
1290
|
def build_get_account_details(soap, options)
|
1291
|
-
soap.tag!
|
1291
|
+
soap.tag! 'ns1:getAccountDetails' do
|
1292
1292
|
build_token soap, options
|
1293
1293
|
end
|
1294
1294
|
end
|
@@ -1297,7 +1297,7 @@ module ActiveMerchant #:nodoc:
|
|
1297
1297
|
|
1298
1298
|
def build_customer_data(soap, options)
|
1299
1299
|
soap.CustomerData 'xsi:type' => 'ns1:CustomerObject' do
|
1300
|
-
CUSTOMER_OPTIONS.each do |k,v|
|
1300
|
+
CUSTOMER_OPTIONS.each do |k, v|
|
1301
1301
|
build_tag soap, v[0], v[1], options[k]
|
1302
1302
|
end
|
1303
1303
|
build_billing_address soap, options
|
@@ -1310,7 +1310,7 @@ module ActiveMerchant #:nodoc:
|
|
1310
1310
|
if options[:payment_methods]
|
1311
1311
|
length = options[:payment_methods].length
|
1312
1312
|
soap.PaymentMethods 'SOAP-ENC:arrayType' => "ns1:PaymentMethod[#{length}]",
|
1313
|
-
|
1313
|
+
'xsi:type' => 'ns1:PaymentMethodArray' do
|
1314
1314
|
build_customer_payment_methods soap, options
|
1315
1315
|
end
|
1316
1316
|
end
|
@@ -1336,7 +1336,7 @@ module ActiveMerchant #:nodoc:
|
|
1336
1336
|
when payment_method[:method].kind_of?(ActiveMerchant::Billing::CreditCard)
|
1337
1337
|
build_tag soap, :string, 'CardNumber', payment_method[:method].number
|
1338
1338
|
build_tag soap, :string, 'CardExpiration',
|
1339
|
-
"#{
|
1339
|
+
"#{'%02d' % payment_method[:method].month}#{payment_method[:method].year.to_s[-2..-1]}"
|
1340
1340
|
if options[:billing_address]
|
1341
1341
|
build_tag soap, :string, 'AvsStreet', options[:billing_address][:address1]
|
1342
1342
|
build_tag soap, :string, 'AvsZip', options[:billing_address][:zip]
|
@@ -1345,9 +1345,7 @@ module ActiveMerchant #:nodoc:
|
|
1345
1345
|
when payment_method[:method].kind_of?(ActiveMerchant::Billing::Check)
|
1346
1346
|
build_tag soap, :string, 'Account', payment_method[:method].account_number
|
1347
1347
|
build_tag soap, :string, 'Routing', payment_method[:method].routing_number
|
1348
|
-
unless payment_method[:method].account_type.nil?
|
1349
|
-
build_tag soap, :string, 'AccountType', payment_method[:method].account_type.capitalize
|
1350
|
-
end
|
1348
|
+
build_tag soap, :string, 'AccountType', payment_method[:method].account_type.capitalize unless payment_method[:method].account_type.nil?
|
1351
1349
|
build_tag soap, :string, 'DriversLicense', options[:drivers_license]
|
1352
1350
|
build_tag soap, :string, 'DriversLicenseState', options[:drivers_license_state]
|
1353
1351
|
build_tag soap, :string, 'RecordType', options[:record_type]
|
@@ -1357,7 +1355,7 @@ module ActiveMerchant #:nodoc:
|
|
1357
1355
|
def build_customer_payment_methods(soap, options)
|
1358
1356
|
payment_methods, tag_name = extract_methods_and_tag(options)
|
1359
1357
|
payment_methods.each do |payment_method|
|
1360
|
-
soap.tag! tag_name, 'xsi:type' =>
|
1358
|
+
soap.tag! tag_name, 'xsi:type' => 'ns1:PaymentMethod' do
|
1361
1359
|
build_tag soap, :integer, 'MethodID', payment_method[:method_id]
|
1362
1360
|
build_tag soap, :string, 'MethodType', payment_method[:type]
|
1363
1361
|
build_tag soap, :string, 'MethodName', payment_method[:name]
|
@@ -1368,9 +1366,9 @@ module ActiveMerchant #:nodoc:
|
|
1368
1366
|
end
|
1369
1367
|
|
1370
1368
|
def build_customer_transaction(soap, options)
|
1371
|
-
soap.Parameters 'xsi:type' =>
|
1369
|
+
soap.Parameters 'xsi:type' => 'ns1:CustomerTransactionRequest' do
|
1372
1370
|
build_transaction_detail soap, options
|
1373
|
-
CUSTOMER_TRANSACTION_REQUEST_OPTIONS.each do |k,v|
|
1371
|
+
CUSTOMER_TRANSACTION_REQUEST_OPTIONS.each do |k, v|
|
1374
1372
|
build_tag soap, v[0], v[1], options[k]
|
1375
1373
|
end
|
1376
1374
|
build_custom_fields soap, options
|
@@ -1380,13 +1378,14 @@ module ActiveMerchant #:nodoc:
|
|
1380
1378
|
|
1381
1379
|
# Transaction Helpers ===========================================
|
1382
1380
|
|
1383
|
-
def build_transaction_request_object(soap, options, name='Params')
|
1384
|
-
soap.tag! name, 'xsi:type' =>
|
1385
|
-
TRANSACTION_REQUEST_OBJECT_OPTIONS.each do |k,v|
|
1381
|
+
def build_transaction_request_object(soap, options, name = 'Params')
|
1382
|
+
soap.tag! name, 'xsi:type' => 'ns1:TransactionRequestObject' do
|
1383
|
+
TRANSACTION_REQUEST_OBJECT_OPTIONS.each do |k, v|
|
1386
1384
|
build_tag soap, v[0], v[1], options[k]
|
1387
1385
|
end
|
1388
1386
|
case
|
1389
|
-
when options[:payment_method]
|
1387
|
+
when options[:payment_method].nil?
|
1388
|
+
nil
|
1390
1389
|
when options[:payment_method].kind_of?(ActiveMerchant::Billing::CreditCard)
|
1391
1390
|
build_credit_card_data soap, options
|
1392
1391
|
when options[:payment_method].kind_of?(ActiveMerchant::Billing::Check)
|
@@ -1404,18 +1403,18 @@ module ActiveMerchant #:nodoc:
|
|
1404
1403
|
end
|
1405
1404
|
|
1406
1405
|
def build_transaction_detail(soap, options)
|
1407
|
-
soap.Details 'xsi:type' =>
|
1408
|
-
TRANSACTION_DETAIL_OPTIONS.each do |k,v|
|
1406
|
+
soap.Details 'xsi:type' => 'ns1:TransactionDetail' do
|
1407
|
+
TRANSACTION_DETAIL_OPTIONS.each do |k, v|
|
1409
1408
|
build_tag soap, v[0], v[1], options[k]
|
1410
1409
|
end
|
1411
|
-
TRANSACTION_DETAIL_MONEY_OPTIONS.each do |k,v|
|
1410
|
+
TRANSACTION_DETAIL_MONEY_OPTIONS.each do |k, v|
|
1412
1411
|
build_tag soap, v[0], v[1], amount(options[k])
|
1413
1412
|
end
|
1414
1413
|
end
|
1415
1414
|
end
|
1416
1415
|
|
1417
1416
|
def build_credit_card_data(soap, options)
|
1418
|
-
soap.CreditCardData 'xsi:type' =>
|
1417
|
+
soap.CreditCardData 'xsi:type' => 'ns1:CreditCardData' do
|
1419
1418
|
build_tag soap, :string, 'CardNumber', options[:payment_method].number
|
1420
1419
|
build_tag soap, :string, 'CardExpiration', build_card_expiration(options)
|
1421
1420
|
if options[:billing_address]
|
@@ -1424,7 +1423,7 @@ module ActiveMerchant #:nodoc:
|
|
1424
1423
|
end
|
1425
1424
|
build_tag soap, :string, 'CardCode', options[:payment_method].verification_value
|
1426
1425
|
build_tag soap, :boolean, 'CardPresent', options[:card_present] || false
|
1427
|
-
CREDIT_CARD_DATA_OPTIONS.each do |k,v|
|
1426
|
+
CREDIT_CARD_DATA_OPTIONS.each do |k, v|
|
1428
1427
|
build_tag soap, v[0], v[1], options[k]
|
1429
1428
|
end
|
1430
1429
|
end
|
@@ -1433,18 +1432,16 @@ module ActiveMerchant #:nodoc:
|
|
1433
1432
|
def build_card_expiration(options)
|
1434
1433
|
month = options[:payment_method].month
|
1435
1434
|
year = options[:payment_method].year
|
1436
|
-
unless month.nil? || year.nil?
|
1437
|
-
"#{"%02d" % month}#{year.to_s[-2..-1]}"
|
1438
|
-
end
|
1435
|
+
"#{'%02d' % month}#{year.to_s[-2..-1]}" unless month.nil? || year.nil?
|
1439
1436
|
end
|
1440
1437
|
|
1441
1438
|
def build_check_data(soap, options)
|
1442
|
-
soap.CheckData 'xsi:type' =>
|
1439
|
+
soap.CheckData 'xsi:type' => 'ns1:CheckData' do
|
1443
1440
|
build_tag soap, :integer, 'CheckNumber', options[:payment_method].number
|
1444
1441
|
build_tag soap, :string, 'Account', options[:payment_method].account_number
|
1445
1442
|
build_tag soap, :string, 'Routing', options[:payment_method].routing_number
|
1446
1443
|
build_tag soap, :string, 'AccountType', options[:payment_method].account_type.capitalize
|
1447
|
-
CHECK_DATA_OPTIONS.each do |k,v|
|
1444
|
+
CHECK_DATA_OPTIONS.each do |k, v|
|
1448
1445
|
build_tag soap, v[0], v[1], options[k]
|
1449
1446
|
end
|
1450
1447
|
end
|
@@ -1452,11 +1449,11 @@ module ActiveMerchant #:nodoc:
|
|
1452
1449
|
|
1453
1450
|
def build_recurring_billing(soap, options)
|
1454
1451
|
if options[:recurring]
|
1455
|
-
soap.RecurringBilling 'xsi:type' =>
|
1452
|
+
soap.RecurringBilling 'xsi:type' => 'ns1:RecurringBilling' do
|
1456
1453
|
build_tag soap, :double, 'Amount', amount(options[:recurring][:amount])
|
1457
|
-
build_tag soap, :string, 'Next', options[:recurring][:next].strftime(
|
1458
|
-
build_tag soap, :string, 'Expire', options[:recurring][:expire].strftime(
|
1459
|
-
RECURRING_BILLING_OPTIONS.each do |k,v|
|
1454
|
+
build_tag soap, :string, 'Next', options[:recurring][:next].strftime('%Y-%m-%d') if options[:recurring][:next]
|
1455
|
+
build_tag soap, :string, 'Expire', options[:recurring][:expire].strftime('%Y-%m-%d') if options[:recurring][:expire]
|
1456
|
+
RECURRING_BILLING_OPTIONS.each do |k, v|
|
1460
1457
|
build_tag soap, v[0], v[1], options[:recurring][k]
|
1461
1458
|
end
|
1462
1459
|
end
|
@@ -1475,11 +1472,9 @@ module ActiveMerchant #:nodoc:
|
|
1475
1472
|
|
1476
1473
|
def build_billing_address(soap, options)
|
1477
1474
|
if options[:billing_address]
|
1478
|
-
if options[:billing_address][:name]
|
1479
|
-
|
1480
|
-
|
1481
|
-
soap.BillingAddress 'xsi:type' => "ns1:Address" do
|
1482
|
-
ADDRESS_OPTIONS.each do |k,v|
|
1475
|
+
options[:billing_address][:first_name], options[:billing_address][:last_name] = split_names(options[:billing_address][:name]) if options[:billing_address][:name]
|
1476
|
+
soap.BillingAddress 'xsi:type' => 'ns1:Address' do
|
1477
|
+
ADDRESS_OPTIONS.each do |k, v|
|
1483
1478
|
build_tag soap, v[0], v[1], options[:billing_address][k]
|
1484
1479
|
end
|
1485
1480
|
end
|
@@ -1488,11 +1483,9 @@ module ActiveMerchant #:nodoc:
|
|
1488
1483
|
|
1489
1484
|
def build_shipping_address(soap, options)
|
1490
1485
|
if options[:shipping_address]
|
1491
|
-
if options[:shipping_address][:name]
|
1492
|
-
|
1493
|
-
|
1494
|
-
soap.ShippingAddress 'xsi:type' => "ns1:Address" do
|
1495
|
-
ADDRESS_OPTIONS.each do |k,v|
|
1486
|
+
options[:shipping_address][:first_name], options[:shipping_address][:last_name] = split_names(options[:shipping_address][:name]) if options[:shipping_address][:name]
|
1487
|
+
soap.ShippingAddress 'xsi:type' => 'ns1:Address' do
|
1488
|
+
ADDRESS_OPTIONS.each do |k, v|
|
1496
1489
|
build_tag soap, v[0], v[1], options[:shipping_address][k]
|
1497
1490
|
end
|
1498
1491
|
end
|
@@ -1502,7 +1495,7 @@ module ActiveMerchant #:nodoc:
|
|
1502
1495
|
def build_field_value_array(soap, tag_name, type, custom_data, fields)
|
1503
1496
|
soap.tag! tag_name, 'SOAP-ENC:arryType' => "xsd:#{type}[#{options.length}]", 'xsi:type' => "ns1:#{type}Array" do
|
1504
1497
|
custom_data.each do |k, v|
|
1505
|
-
build_field_value soap, fields[k][1], v, fields[k][0] if fields.
|
1498
|
+
build_field_value soap, fields[k][1], v, fields[k][0] if fields.key?(k)
|
1506
1499
|
end
|
1507
1500
|
end
|
1508
1501
|
end
|
@@ -1526,7 +1519,7 @@ module ActiveMerchant #:nodoc:
|
|
1526
1519
|
url = test? ? test_url : live_url
|
1527
1520
|
|
1528
1521
|
begin
|
1529
|
-
soap = ssl_post(url, request,
|
1522
|
+
soap = ssl_post(url, request, 'Content-Type' => 'text/xml')
|
1530
1523
|
rescue ActiveMerchant::ResponseError => error
|
1531
1524
|
soap = error.response.body
|
1532
1525
|
end
|
@@ -1537,53 +1530,54 @@ module ActiveMerchant #:nodoc:
|
|
1537
1530
|
def build_response(action, soap)
|
1538
1531
|
response_params, success, message, authorization, avs, cvv = parse(action, soap)
|
1539
1532
|
|
1540
|
-
response_params
|
1533
|
+
response_params['soap_response'] = soap if @options[:soap_response]
|
1541
1534
|
|
1542
1535
|
Response.new(
|
1543
1536
|
success,
|
1544
1537
|
message,
|
1545
1538
|
response_params,
|
1546
|
-
:
|
1547
|
-
:
|
1548
|
-
:
|
1549
|
-
:
|
1539
|
+
test: test?,
|
1540
|
+
authorization: authorization,
|
1541
|
+
avs_result: avs_from(avs),
|
1542
|
+
cvv_result: cvv
|
1550
1543
|
)
|
1551
1544
|
end
|
1552
1545
|
|
1553
1546
|
def avs_from(avs)
|
1554
|
-
avs_params = { :
|
1555
|
-
avs_params
|
1547
|
+
avs_params = { code: avs }
|
1548
|
+
avs_params[:message] = AVS_CUSTOM_MESSAGES[avs] if AVS_CUSTOM_MESSAGES.key?(avs)
|
1556
1549
|
avs_params
|
1557
1550
|
end
|
1558
1551
|
|
1559
1552
|
def parse(action, soap)
|
1560
1553
|
xml = REXML::Document.new(soap)
|
1561
|
-
root = REXML::XPath.first(xml,
|
1562
|
-
response = root ? parse_element(root[0]) : { :
|
1554
|
+
root = REXML::XPath.first(xml, '//SOAP-ENV:Body')
|
1555
|
+
response = root ? parse_element(root[0]) : { response: soap }
|
1563
1556
|
|
1564
1557
|
success, message, authorization, avs, cvv = false, FAILURE_MESSAGE, nil, nil, nil
|
1565
1558
|
|
1566
|
-
fault =
|
1559
|
+
fault = !response || (response.length < 1) || response.has_key?('faultcode')
|
1567
1560
|
return [response, success, response['faultstring'], authorization, avs, cvv] if fault
|
1568
1561
|
|
1569
1562
|
if response.respond_to?(:[]) && p = response["#{action}_return"]
|
1570
1563
|
if p.respond_to?(:key?) && p.key?('result_code')
|
1571
|
-
success = p['result_code'] == 'A'
|
1564
|
+
success = p['result_code'] == 'A'
|
1572
1565
|
authorization = p['ref_num']
|
1573
1566
|
avs = AVS_RESULTS[p['avs_result_code']]
|
1574
1567
|
cvv = p['card_code_result_code']
|
1575
1568
|
else
|
1576
1569
|
success = true
|
1577
1570
|
end
|
1578
|
-
message =
|
1579
|
-
|
1580
|
-
|
1581
|
-
|
1582
|
-
|
1583
|
-
|
1584
|
-
|
1585
|
-
|
1586
|
-
|
1571
|
+
message =
|
1572
|
+
case action
|
1573
|
+
when :get_customer_payment_methods
|
1574
|
+
p['item']
|
1575
|
+
when :get_transaction_custom
|
1576
|
+
items = p['item'].kind_of?(Array) ? p['item'] : [p['item']]
|
1577
|
+
items.inject({}) { |hash, item| hash[item['field']] = item['value']; hash }
|
1578
|
+
else
|
1579
|
+
p
|
1580
|
+
end
|
1587
1581
|
elsif response.respond_to?(:[]) && p = response[:response]
|
1588
1582
|
message = p # when response is html
|
1589
1583
|
end
|
@@ -1613,7 +1607,6 @@ module ActiveMerchant #:nodoc:
|
|
1613
1607
|
|
1614
1608
|
response
|
1615
1609
|
end
|
1616
|
-
|
1617
1610
|
end
|
1618
1611
|
end
|
1619
1612
|
end
|