activemerchant 1.45.0 → 1.126.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG +2167 -2
- data/CONTRIBUTORS +57 -0
- data/README.md +62 -41
- data/lib/active_merchant/billing/avs_result.rb +25 -28
- data/lib/active_merchant/billing/base.rb +11 -35
- data/lib/active_merchant/billing/check.rb +28 -24
- data/lib/active_merchant/billing/compatibility.rb +10 -12
- data/lib/active_merchant/billing/credit_card.rb +141 -69
- data/lib/active_merchant/billing/credit_card_formatting.rb +4 -4
- data/lib/active_merchant/billing/credit_card_methods.rb +348 -52
- data/lib/active_merchant/billing/cvv_result.rb +0 -1
- data/lib/active_merchant/billing/gateway.rb +125 -61
- data/lib/active_merchant/billing/gateways/adyen.rb +633 -127
- data/lib/active_merchant/billing/gateways/airwallex.rb +341 -0
- data/lib/active_merchant/billing/gateways/allied_wallet.rb +205 -0
- data/lib/active_merchant/billing/gateways/authorize_net.rb +883 -195
- data/lib/active_merchant/billing/gateways/authorize_net_arb.rb +31 -24
- data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +104 -103
- data/lib/active_merchant/billing/gateways/axcessms.rb +179 -0
- 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 +24 -13
- data/lib/active_merchant/billing/gateways/barclaycard_smartpay.rb +397 -0
- 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 +143 -62
- data/lib/active_merchant/billing/gateways/beanstream.rb +45 -13
- data/lib/active_merchant/billing/gateways/beanstream_interac.rb +13 -10
- data/lib/active_merchant/billing/gateways/blue_pay.rb +549 -506
- data/lib/active_merchant/billing/gateways/blue_snap.rb +623 -0
- data/lib/active_merchant/billing/gateways/bogus.rb +82 -36
- data/lib/active_merchant/billing/gateways/borgun.rb +61 -40
- data/lib/active_merchant/billing/gateways/bpoint.rb +277 -0
- data/lib/active_merchant/billing/gateways/braintree/braintree_common.rb +21 -2
- data/lib/active_merchant/billing/gateways/braintree/token_nonce.rb +113 -0
- data/lib/active_merchant/billing/gateways/braintree.rb +3 -3
- data/lib/active_merchant/billing/gateways/braintree_blue.rb +592 -203
- data/lib/active_merchant/billing/gateways/braintree_orange.rb +3 -4
- data/lib/active_merchant/billing/gateways/bridge_pay.rb +116 -61
- data/lib/active_merchant/billing/gateways/cams.rb +230 -0
- data/lib/active_merchant/billing/gateways/card_connect.rb +320 -0
- data/lib/active_merchant/billing/gateways/card_save.rb +7 -9
- data/lib/active_merchant/billing/gateways/card_stream.rb +248 -97
- data/lib/active_merchant/billing/gateways/cardknox.rb +327 -0
- data/lib/active_merchant/billing/gateways/cardprocess.rb +256 -0
- data/lib/active_merchant/billing/gateways/cashnet.rb +70 -26
- data/lib/active_merchant/billing/gateways/cc5.rb +14 -17
- data/lib/active_merchant/billing/gateways/cecabank.rb +73 -53
- data/lib/active_merchant/billing/gateways/cenpos.rb +328 -0
- data/lib/active_merchant/billing/gateways/checkout.rb +32 -33
- data/lib/active_merchant/billing/gateways/checkout_v2.rb +340 -0
- data/lib/active_merchant/billing/gateways/citrus_pay.rb +21 -0
- data/lib/active_merchant/billing/gateways/clearhaus.rb +219 -0
- data/lib/active_merchant/billing/gateways/commercegate.rb +11 -12
- data/lib/active_merchant/billing/gateways/conekta.rb +55 -34
- data/lib/active_merchant/billing/gateways/creditcall.rb +272 -0
- data/lib/active_merchant/billing/gateways/credorax.rb +506 -0
- data/lib/active_merchant/billing/gateways/ct_payment.rb +269 -0
- data/lib/active_merchant/billing/gateways/culqi.rb +279 -0
- data/lib/active_merchant/billing/gateways/cyber_source.rb +637 -221
- data/lib/active_merchant/billing/gateways/d_local.rb +303 -0
- data/lib/active_merchant/billing/gateways/data_cash.rb +57 -355
- data/lib/active_merchant/billing/gateways/decidir.rb +347 -0
- data/lib/active_merchant/billing/gateways/decidir_plus.rb +344 -0
- data/lib/active_merchant/billing/gateways/dibs.rb +199 -0
- data/lib/active_merchant/billing/gateways/digitzs.rb +295 -0
- data/lib/active_merchant/billing/gateways/ebanx.rb +334 -0
- data/lib/active_merchant/billing/gateways/efsnet.rb +46 -50
- data/lib/active_merchant/billing/gateways/elavon.rb +377 -250
- data/lib/active_merchant/billing/gateways/element.rb +386 -0
- data/lib/active_merchant/billing/gateways/epay.rb +92 -71
- data/lib/active_merchant/billing/gateways/evo_ca.rb +13 -14
- data/lib/active_merchant/billing/gateways/eway.rb +85 -73
- data/lib/active_merchant/billing/gateways/eway_managed.rb +85 -87
- data/lib/active_merchant/billing/gateways/eway_rapid.rb +134 -80
- data/lib/active_merchant/billing/gateways/exact.rb +37 -36
- data/lib/active_merchant/billing/gateways/ezic.rb +195 -0
- data/lib/active_merchant/billing/gateways/fat_zebra.rb +124 -74
- data/lib/active_merchant/billing/gateways/federated_canada.rb +11 -13
- data/lib/active_merchant/billing/gateways/finansbank.rb +4 -5
- data/lib/active_merchant/billing/gateways/first_giving.rb +23 -23
- data/lib/active_merchant/billing/gateways/first_pay.rb +45 -23
- data/lib/active_merchant/billing/gateways/firstdata_e4.rb +184 -87
- data/lib/active_merchant/billing/gateways/firstdata_e4_v27.rb +505 -0
- data/lib/active_merchant/billing/gateways/flo2cash.rb +215 -0
- data/lib/active_merchant/billing/gateways/flo2cash_simple.rb +20 -0
- data/lib/active_merchant/billing/gateways/forte.rb +286 -0
- data/lib/active_merchant/billing/gateways/garanti.rb +31 -32
- data/lib/active_merchant/billing/gateways/global_collect.rb +507 -0
- data/lib/active_merchant/billing/gateways/global_transport.rb +25 -15
- data/lib/active_merchant/billing/gateways/hdfc.rb +55 -57
- data/lib/active_merchant/billing/gateways/hps.rb +252 -68
- data/lib/active_merchant/billing/gateways/iats_payments.rb +99 -38
- data/lib/active_merchant/billing/gateways/in_context_paypal_express.rb +15 -0
- data/lib/active_merchant/billing/gateways/inspire.rb +48 -48
- data/lib/active_merchant/billing/gateways/instapay.rb +10 -14
- data/lib/active_merchant/billing/gateways/ipg.rb +415 -0
- data/lib/active_merchant/billing/gateways/ipp.rb +176 -0
- data/lib/active_merchant/billing/gateways/iridium.rb +254 -244
- data/lib/active_merchant/billing/gateways/itransact.rb +14 -14
- data/lib/active_merchant/billing/gateways/iveri.rb +254 -0
- data/lib/active_merchant/billing/gateways/ixopay.rb +320 -0
- data/lib/active_merchant/billing/gateways/jetpay.rb +200 -80
- data/lib/active_merchant/billing/gateways/jetpay_v2.rb +432 -0
- data/lib/active_merchant/billing/gateways/komoju.rb +115 -0
- data/lib/active_merchant/billing/gateways/kushki.rb +277 -0
- data/lib/active_merchant/billing/gateways/latitude19.rb +412 -0
- data/lib/active_merchant/billing/gateways/linkpoint.rb +95 -85
- data/lib/active_merchant/billing/gateways/litle.rb +371 -94
- data/lib/active_merchant/billing/gateways/mastercard.rb +293 -0
- data/lib/active_merchant/billing/gateways/maxipago.rb +146 -123
- data/lib/active_merchant/billing/gateways/mercado_pago.rb +331 -0
- data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +47 -23
- data/lib/active_merchant/billing/gateways/merchant_one.rb +16 -20
- data/lib/active_merchant/billing/gateways/merchant_partners.rb +245 -0
- data/lib/active_merchant/billing/gateways/merchant_ware.rb +54 -60
- data/lib/active_merchant/billing/gateways/merchant_ware_version_four.rb +60 -44
- data/lib/active_merchant/billing/gateways/merchant_warrior.rb +76 -23
- data/lib/active_merchant/billing/gateways/mercury.rb +73 -54
- data/lib/active_merchant/billing/gateways/metrics_global.rb +33 -43
- data/lib/active_merchant/billing/gateways/micropayment.rb +182 -0
- data/lib/active_merchant/billing/gateways/migs/migs_codes.rb +7 -7
- data/lib/active_merchant/billing/gateways/migs.rb +101 -37
- data/lib/active_merchant/billing/gateways/mit.rb +260 -0
- data/lib/active_merchant/billing/gateways/modern_payments.rb +3 -3
- data/lib/active_merchant/billing/gateways/modern_payments_cim.rb +30 -34
- data/lib/active_merchant/billing/gateways/moka.rb +290 -0
- data/lib/active_merchant/billing/gateways/monei.rb +422 -0
- data/lib/active_merchant/billing/gateways/moneris.rb +236 -72
- data/lib/active_merchant/billing/gateways/money_movers.rb +11 -13
- data/lib/active_merchant/billing/gateways/mundipagg.rb +363 -0
- data/lib/active_merchant/billing/gateways/nab_transact.rb +87 -68
- data/lib/active_merchant/billing/gateways/ncr_secure_pay.rb +163 -0
- 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 +376 -0
- data/lib/active_merchant/billing/gateways/netbilling.rb +82 -43
- 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 +279 -174
- data/lib/active_merchant/billing/gateways/ogone.rb +96 -50
- data/lib/active_merchant/billing/gateways/omise.rb +323 -0
- data/lib/active_merchant/billing/gateways/openpay.rb +58 -23
- data/lib/active_merchant/billing/gateways/opp.rb +394 -0
- data/lib/active_merchant/billing/gateways/optimal_payment.rb +87 -69
- data/lib/active_merchant/billing/gateways/orbital/orbital_soft_descriptors.rb +5 -7
- data/lib/active_merchant/billing/gateways/orbital.rb +771 -328
- data/lib/active_merchant/billing/gateways/pac_net_raven.rb +31 -32
- data/lib/active_merchant/billing/gateways/pagarme.rb +239 -0
- 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 +245 -0
- data/lib/active_merchant/billing/gateways/pay_gate_xml.rb +84 -68
- data/lib/active_merchant/billing/gateways/pay_hub.rb +213 -0
- data/lib/active_merchant/billing/gateways/pay_junction.rb +37 -37
- data/lib/active_merchant/billing/gateways/pay_junction_v2.rb +206 -0
- data/lib/active_merchant/billing/gateways/pay_secure.rb +15 -17
- data/lib/active_merchant/billing/gateways/pay_trace.rb +404 -0
- data/lib/active_merchant/billing/gateways/paybox_direct.rb +85 -49
- data/lib/active_merchant/billing/gateways/payeezy.rb +458 -0
- data/lib/active_merchant/billing/gateways/payex.rb +39 -42
- data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +67 -41
- 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 +215 -46
- data/lib/active_merchant/billing/gateways/payflow_express.rb +64 -68
- data/lib/active_merchant/billing/gateways/payflow_express_uk.rb +2 -3
- data/lib/active_merchant/billing/gateways/payflow_uk.rb +5 -6
- data/lib/active_merchant/billing/gateways/payment_express.rb +78 -58
- data/lib/active_merchant/billing/gateways/paymentez.rb +353 -0
- data/lib/active_merchant/billing/gateways/paymill.rb +163 -75
- data/lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb +55 -7
- data/lib/active_merchant/billing/gateways/paypal/paypal_recurring_api.rb +1 -1
- data/lib/active_merchant/billing/gateways/paypal.rb +37 -18
- data/lib/active_merchant/billing/gateways/paypal_ca.rb +2 -2
- data/lib/active_merchant/billing/gateways/paypal_digital_goods.rb +5 -5
- data/lib/active_merchant/billing/gateways/paypal_express.rb +12 -6
- data/lib/active_merchant/billing/gateways/paypal_express_common.rb +3 -3
- data/lib/active_merchant/billing/gateways/paysafe.rb +412 -0
- data/lib/active_merchant/billing/gateways/payscout.rb +10 -13
- data/lib/active_merchant/billing/gateways/paystation.rb +96 -91
- data/lib/active_merchant/billing/gateways/payu_in.rb +249 -0
- data/lib/active_merchant/billing/gateways/payu_latam.rb +479 -0
- 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 +113 -37
- data/lib/active_merchant/billing/gateways/plugnpay.rb +82 -82
- data/lib/active_merchant/billing/gateways/priority.rb +369 -0
- data/lib/active_merchant/billing/gateways/pro_pay.rb +325 -0
- data/lib/active_merchant/billing/gateways/psigate.rb +55 -44
- data/lib/active_merchant/billing/gateways/psl_card.rb +32 -40
- data/lib/active_merchant/billing/gateways/qbms.rb +86 -76
- data/lib/active_merchant/billing/gateways/quantum.rb +21 -23
- data/lib/active_merchant/billing/gateways/quickbooks.rb +377 -0
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_common.rb +184 -0
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb +297 -0
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_v4to7.rb +226 -0
- data/lib/active_merchant/billing/gateways/quickpay.rb +10 -353
- data/lib/active_merchant/billing/gateways/qvalent.rb +305 -0
- data/lib/active_merchant/billing/gateways/rapyd.rb +258 -0
- data/lib/active_merchant/billing/gateways/realex.rb +154 -52
- data/lib/active_merchant/billing/gateways/redsys.rb +488 -161
- data/lib/active_merchant/billing/gateways/s5.rb +247 -0
- data/lib/active_merchant/billing/gateways/safe_charge.rb +298 -0
- data/lib/active_merchant/billing/gateways/sage.rb +404 -133
- data/lib/active_merchant/billing/gateways/sage_pay.rb +145 -109
- data/lib/active_merchant/billing/gateways/sallie_mae.rb +13 -15
- data/lib/active_merchant/billing/gateways/secure_net.rb +62 -54
- data/lib/active_merchant/billing/gateways/secure_pay.rb +32 -42
- data/lib/active_merchant/billing/gateways/secure_pay_au.rb +36 -27
- data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +14 -16
- data/lib/active_merchant/billing/gateways/securion_pay.rb +265 -0
- data/lib/active_merchant/billing/gateways/simetrik.rb +362 -0
- data/lib/active_merchant/billing/gateways/skip_jack.rb +52 -54
- 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 +108 -43
- data/lib/active_merchant/billing/gateways/stripe.rb +536 -120
- data/lib/active_merchant/billing/gateways/stripe_payment_intents.rb +516 -0
- data/lib/active_merchant/billing/gateways/swipe_checkout.rb +19 -25
- data/lib/active_merchant/billing/gateways/telr.rb +273 -0
- data/lib/active_merchant/billing/gateways/tns.rb +16 -217
- data/lib/active_merchant/billing/gateways/trans_first.rb +148 -34
- data/lib/active_merchant/billing/gateways/trans_first_transaction_express.rb +612 -0
- data/lib/active_merchant/billing/gateways/transact_pro.rb +222 -0
- 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 +221 -0
- data/lib/active_merchant/billing/gateways/trust_commerce.rb +162 -89
- data/lib/active_merchant/billing/gateways/usa_epay.rb +5 -6
- data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +332 -236
- data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +185 -72
- data/lib/active_merchant/billing/gateways/vanco.rb +294 -0
- data/lib/active_merchant/billing/gateways/verifi.rb +52 -53
- data/lib/active_merchant/billing/gateways/viaklix.rb +19 -31
- data/lib/active_merchant/billing/gateways/visanet_peru.rb +250 -0
- data/lib/active_merchant/billing/gateways/vpos.rb +220 -0
- data/lib/active_merchant/billing/gateways/webpay.rb +9 -9
- data/lib/active_merchant/billing/gateways/wepay.rb +108 -62
- data/lib/active_merchant/billing/gateways/wirecard.rb +52 -43
- data/lib/active_merchant/billing/gateways/wompi.rb +193 -0
- data/lib/active_merchant/billing/gateways/world_net.rb +345 -0
- data/lib/active_merchant/billing/gateways/worldpay.rb +725 -121
- data/lib/active_merchant/billing/gateways/worldpay_online_payments.rb +208 -0
- data/lib/active_merchant/billing/gateways/worldpay_us.rb +79 -39
- data/lib/active_merchant/billing/gateways.rb +8 -11
- data/lib/active_merchant/billing/model.rb +2 -2
- data/lib/active_merchant/billing/network_tokenization_credit_card.rb +39 -0
- data/lib/active_merchant/billing/payment_token.rb +1 -1
- data/lib/active_merchant/billing/rails.rb +1 -1
- data/lib/active_merchant/billing/response.rb +19 -13
- data/lib/active_merchant/billing/three_d_secure_eci_mapper.rb +27 -0
- data/lib/active_merchant/billing.rb +3 -0
- data/lib/active_merchant/connection.rb +196 -0
- data/lib/active_merchant/country.rb +13 -8
- data/lib/active_merchant/errors.rb +6 -0
- data/lib/active_merchant/net_http_ssl_connection.rb +11 -0
- data/lib/active_merchant/network_connection_retries.rb +78 -0
- data/lib/active_merchant/post_data.rb +26 -0
- data/lib/active_merchant/posts_data.rb +92 -0
- data/lib/active_merchant/version.rb +1 -1
- data/lib/active_merchant.rb +14 -59
- data/lib/activemerchant.rb +1 -1
- data/lib/certs/cacert.pem +3214 -0
- data/lib/support/gateway_support.rb +8 -10
- data/lib/support/outbound_hosts.rb +13 -10
- data/lib/support/ssl_verify.rb +9 -14
- data/lib/support/ssl_version.rb +86 -0
- metadata +136 -94
- checksums.yaml.gz.sig +0 -1
- data/lib/active_merchant/billing/gateways/app55.rb +0 -176
- data/lib/active_merchant/billing/gateways/barclays_epdq.rb +0 -314
- data/lib/active_merchant/billing/gateways/certo_direct.rb +0 -278
- 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 -291
- data/lib/active_merchant/billing/gateways/sage/sage_bankcard.rb +0 -87
- data/lib/active_merchant/billing/gateways/sage/sage_core.rb +0 -114
- data/lib/active_merchant/billing/gateways/sage/sage_vault.rb +0 -149
- data/lib/active_merchant/billing/gateways/sage/sage_virtual_check.rb +0 -102
- data/lib/active_merchant/billing/gateways/vindicia.rb +0 -385
- data/lib/active_merchant/offsite_payments_shim.rb +0 -19
- data.tar.gz.sig +0 -0
- metadata.gz.sig +0 -0
@@ -5,7 +5,7 @@ module ActiveMerchant #:nodoc:
|
|
5
5
|
module Billing #:nodoc:
|
6
6
|
# ==== USA ePay Advanced SOAP Interface
|
7
7
|
#
|
8
|
-
# This class
|
8
|
+
# This class encapsulates USA ePay's Advanced SOAP Interface. The Advanced Soap Interface allows
|
9
9
|
# standard transactions, storing customer information, and recurring billing. Storing sensitive
|
10
10
|
# information on USA ePay's servers can help with PCI DSS compliance, since customer and card data
|
11
11
|
# do not need to be stored locally.
|
@@ -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,147 +70,181 @@ 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
|
-
|
81
|
-
:
|
82
|
-
:
|
83
|
-
:
|
84
|
-
:
|
85
|
-
# Recurring Billing
|
86
|
-
:enabled => [:boolean, 'Enabled'],
|
87
|
-
:schedule => [:string, 'Schedule'],
|
88
|
-
:number_left => [:integer, 'NumLeft'],
|
89
|
-
:currency => [:string, 'Currency'],
|
90
|
-
:description => [:string, 'Description'],
|
91
|
-
:order_id => [:string, 'OrderID'],
|
92
|
-
:user => [:string, 'User'],
|
93
|
-
:source => [:string, 'Source'],
|
94
|
-
:send_receipt => [:boolean, 'SendReceipt'],
|
95
|
-
:receipt_note => [:string, 'ReceiptNote'],
|
96
|
-
# Point of Sale
|
97
|
-
:price_tier => [:string, 'PriceTier'],
|
98
|
-
:tax_class => [:string, 'TaxClass'],
|
99
|
-
:lookup_code => [:string, 'LookupCode']
|
80
|
+
CUSTOMER_PROFILE_OPTIONS = {
|
81
|
+
id: [:string, 'CustomerID'], # merchant assigned number
|
82
|
+
notes: [:string, 'Notes'],
|
83
|
+
data: [:string, 'CustomData'],
|
84
|
+
url: [:string, 'URL']
|
100
85
|
} #:nodoc:
|
101
86
|
|
102
|
-
|
103
|
-
:
|
104
|
-
:
|
105
|
-
:
|
106
|
-
:
|
107
|
-
:
|
108
|
-
:
|
109
|
-
:
|
110
|
-
:
|
111
|
-
:
|
112
|
-
:
|
113
|
-
:fax => [:string, 'Fax'],
|
114
|
-
:company => [:string, 'Company']
|
87
|
+
CUSTOMER_RECURRING_BILLING_OPTIONS = {
|
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']
|
115
98
|
} #:nodoc:
|
116
99
|
|
100
|
+
CUSTOMER_POINT_OF_SALE_OPTIONS = {
|
101
|
+
price_tier: [:string, 'PriceTier'],
|
102
|
+
tax_class: [:string, 'TaxClass'],
|
103
|
+
lookup_code: [:string, 'LookupCode']
|
104
|
+
} #:nodoc:
|
105
|
+
|
106
|
+
CUSTOMER_OPTIONS = [
|
107
|
+
CUSTOMER_PROFILE_OPTIONS,
|
108
|
+
CUSTOMER_RECURRING_BILLING_OPTIONS,
|
109
|
+
CUSTOMER_POINT_OF_SALE_OPTIONS
|
110
|
+
].inject(:merge) #:nodoc:
|
111
|
+
|
112
|
+
COMMON_ADDRESS_OPTIONS = {
|
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
|
+
} #:nodoc:
|
124
|
+
|
125
|
+
ADDRESS_OPTIONS = [
|
126
|
+
COMMON_ADDRESS_OPTIONS,
|
127
|
+
{
|
128
|
+
address1: [:string, 'Street'],
|
129
|
+
address2: [:string, 'Street2']
|
130
|
+
}
|
131
|
+
].inject(:merge) #:nodoc
|
132
|
+
|
133
|
+
CUSTOMER_UPDATE_DATA_FIELDS = [
|
134
|
+
CUSTOMER_PROFILE_OPTIONS,
|
135
|
+
CUSTOMER_RECURRING_BILLING_OPTIONS,
|
136
|
+
COMMON_ADDRESS_OPTIONS,
|
137
|
+
{
|
138
|
+
address1: [:string, 'Address'],
|
139
|
+
address2: [:string, 'Address2']
|
140
|
+
},
|
141
|
+
{
|
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
|
+
}
|
149
|
+
].inject(:merge) #:nodoc
|
150
|
+
|
117
151
|
CUSTOMER_TRANSACTION_REQUEST_OPTIONS = {
|
118
|
-
:
|
119
|
-
:
|
120
|
-
:
|
121
|
-
:
|
122
|
-
:
|
123
|
-
:
|
124
|
-
:
|
125
|
-
:
|
126
|
-
:
|
127
|
-
:
|
128
|
-
:
|
129
|
-
:
|
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']
|
130
164
|
} #:nodoc:
|
131
165
|
|
132
166
|
TRANSACTION_REQUEST_OBJECT_OPTIONS = {
|
133
|
-
:
|
134
|
-
:
|
135
|
-
:
|
136
|
-
:
|
137
|
-
:
|
138
|
-
:
|
139
|
-
:
|
140
|
-
:
|
141
|
-
:
|
142
|
-
:
|
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']
|
143
177
|
} #:nodoc:
|
144
178
|
|
145
179
|
TRANSACTION_DETAIL_OPTIONS = {
|
146
|
-
:
|
147
|
-
:
|
148
|
-
:
|
149
|
-
:
|
150
|
-
:
|
151
|
-
:
|
152
|
-
:
|
153
|
-
:
|
154
|
-
:
|
155
|
-
:
|
156
|
-
:
|
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']
|
157
191
|
} #:nodoc:
|
158
192
|
|
159
193
|
TRANSACTION_DETAIL_MONEY_OPTIONS = {
|
160
|
-
:
|
161
|
-
:
|
162
|
-
:
|
163
|
-
:
|
164
|
-
:
|
165
|
-
:
|
166
|
-
:
|
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']
|
167
201
|
} #:nodoc:
|
168
202
|
|
169
203
|
CREDIT_CARD_DATA_OPTIONS = {
|
170
|
-
:
|
171
|
-
:
|
172
|
-
:
|
173
|
-
:
|
174
|
-
:
|
175
|
-
:
|
176
|
-
:
|
177
|
-
:
|
178
|
-
:
|
179
|
-
:
|
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']
|
180
214
|
} #:nodoc:
|
181
215
|
|
182
216
|
CHECK_DATA_OPTIONS = {
|
183
|
-
:
|
184
|
-
:
|
185
|
-
:
|
186
|
-
:
|
187
|
-
:
|
188
|
-
:
|
189
|
-
:
|
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']
|
190
224
|
} #:nodoc:
|
191
225
|
|
192
226
|
RECURRING_BILLING_OPTIONS = {
|
193
|
-
:
|
194
|
-
:
|
195
|
-
:
|
227
|
+
schedule: [:string, 'Schedule'],
|
228
|
+
number_left: [:integer, 'NumLeft'],
|
229
|
+
enabled: [:boolean, 'Enabled']
|
196
230
|
} #:nodoc:
|
197
231
|
|
198
232
|
AVS_RESULTS = {
|
199
|
-
'Y' => %w(
|
200
|
-
'Z' => %w(
|
201
|
-
'A' => %w(
|
202
|
-
'N' => %w(
|
203
|
-
'X' => %w(
|
204
|
-
'W' => %w(
|
205
|
-
'XXW' => %w(
|
206
|
-
'XXU' => %w(
|
207
|
-
'R' => %w(
|
208
|
-
'S' => %w(
|
209
|
-
'XXE' => %w(
|
210
|
-
'G' => %w(
|
211
|
-
'B' => %w(
|
212
|
-
'D' => %w(
|
213
|
-
'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)
|
214
248
|
}.inject({}) do |map, (type, codes)|
|
215
249
|
codes.each { |code| map[code] = type }
|
216
250
|
map
|
@@ -238,8 +272,8 @@ module ActiveMerchant #:nodoc:
|
|
238
272
|
requires!(options, :login, :password)
|
239
273
|
|
240
274
|
if options[:software_id]
|
241
|
-
self.live_url = "#{LIVE_URL_BASE}#{options[:software_id]
|
242
|
-
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]}"
|
243
277
|
else
|
244
278
|
self.live_url = options[:live_url].to_s
|
245
279
|
self.test_url = options[:test_url].to_s if options[:test_url]
|
@@ -255,43 +289,43 @@ module ActiveMerchant #:nodoc:
|
|
255
289
|
#
|
256
290
|
# Note: See run_transaction for additional options.
|
257
291
|
#
|
258
|
-
def purchase(money, creditcard, options={})
|
259
|
-
run_sale(options.merge!(:
|
292
|
+
def purchase(money, creditcard, options = {})
|
293
|
+
run_sale(options.merge!(amount: money, payment_method: creditcard))
|
260
294
|
end
|
261
295
|
|
262
296
|
# Authorize an amount on a credit card or account.
|
263
297
|
#
|
264
298
|
# Note: See run_transaction for additional options.
|
265
299
|
#
|
266
|
-
def authorize(money, creditcard, options={})
|
267
|
-
run_auth_only(options.merge!(:
|
300
|
+
def authorize(money, creditcard, options = {})
|
301
|
+
run_auth_only(options.merge!(amount: money, payment_method: creditcard))
|
268
302
|
end
|
269
303
|
|
270
304
|
# Capture an authorized transaction.
|
271
305
|
#
|
272
306
|
# Note: See run_transaction for additional options.
|
273
307
|
#
|
274
|
-
def capture(money, identification, options={})
|
275
|
-
capture_transaction(options.merge!(:
|
308
|
+
def capture(money, identification, options = {})
|
309
|
+
capture_transaction(options.merge!(amount: money, reference_number: identification))
|
276
310
|
end
|
277
311
|
|
278
312
|
# Void a previous transaction that has not been settled.
|
279
313
|
#
|
280
314
|
# Note: See run_transaction for additional options.
|
281
315
|
#
|
282
|
-
def void(identification, options={})
|
283
|
-
void_transaction(options.merge!(:
|
316
|
+
def void(identification, options = {})
|
317
|
+
void_transaction(options.merge!(reference_number: identification))
|
284
318
|
end
|
285
319
|
|
286
320
|
# Refund a previous transaction.
|
287
321
|
#
|
288
322
|
# Note: See run_transaction for additional options.
|
289
323
|
#
|
290
|
-
def refund(money, identification, options={})
|
291
|
-
refund_transaction(options.merge!(:
|
324
|
+
def refund(money, identification, options = {})
|
325
|
+
refund_transaction(options.merge!(amount: money, reference_number: identification))
|
292
326
|
end
|
293
327
|
|
294
|
-
def credit(money, identification, options={})
|
328
|
+
def credit(money, identification, options = {})
|
295
329
|
ActiveMerchant.deprecated CREDIT_DEPRECATION_MESSAGE
|
296
330
|
refund(money, identification, options)
|
297
331
|
end
|
@@ -334,7 +368,7 @@ module ActiveMerchant #:nodoc:
|
|
334
368
|
# ==== Response
|
335
369
|
# * <tt>#message</tt> -- customer number assigned by gateway
|
336
370
|
#
|
337
|
-
def add_customer(options={})
|
371
|
+
def add_customer(options = {})
|
338
372
|
request = build_request(__method__, options)
|
339
373
|
commit(__method__, request)
|
340
374
|
end
|
@@ -347,8 +381,57 @@ module ActiveMerchant #:nodoc:
|
|
347
381
|
# ==== Options
|
348
382
|
# * Same as add_customer
|
349
383
|
#
|
350
|
-
def update_customer(options={})
|
384
|
+
def update_customer(options = {})
|
385
|
+
requires! options, :customer_number
|
386
|
+
|
387
|
+
request = build_request(__method__, options)
|
388
|
+
commit(__method__, request)
|
389
|
+
end
|
390
|
+
|
391
|
+
# Update a customer by replacing only the provided fields.
|
392
|
+
#
|
393
|
+
# ==== Required
|
394
|
+
# * <tt>:customer_number</tt> -- customer to update
|
395
|
+
# * <tt>:update_data</tt> -- FieldValue array of fields to retrieve
|
396
|
+
# * <tt>:first_name</tt>
|
397
|
+
# * <tt>:last_name</tt>
|
398
|
+
# * <tt>:id</tt>
|
399
|
+
# * <tt>:company</tt>
|
400
|
+
# * <tt>:address</tt>
|
401
|
+
# * <tt>:address2</tt>
|
402
|
+
# * <tt>:city</tt>
|
403
|
+
# * <tt>:state</tt>
|
404
|
+
# * <tt>:zip</tt>
|
405
|
+
# * <tt>:country</tt>
|
406
|
+
# * <tt>:phone</tt>
|
407
|
+
# * <tt>:fax</tt>
|
408
|
+
# * <tt>:email</tt>
|
409
|
+
# * <tt>:url</tt>
|
410
|
+
# * <tt>:receipt_note</tt>
|
411
|
+
# * <tt>:send_receipt</tt>
|
412
|
+
# * <tt>:notes</tt>
|
413
|
+
# * <tt>:description</tt>
|
414
|
+
# * <tt>:order_id</tt>
|
415
|
+
# * <tt>:enabled</tt>
|
416
|
+
# * <tt>:schedule</tt>
|
417
|
+
# * <tt>:next</tt>
|
418
|
+
# * <tt>:num_left</tt>
|
419
|
+
# * <tt>:amount</tt>
|
420
|
+
# * <tt>:custom_data</tt>
|
421
|
+
# * <tt>:source</tt>
|
422
|
+
# * <tt>:user</tt>
|
423
|
+
# * <tt>:card_number</tt>
|
424
|
+
# * <tt>:card_exp</tt>
|
425
|
+
# * <tt>:account</tt>
|
426
|
+
# * <tt>:routing</tt>
|
427
|
+
# * <tt>:check_format</tt> or <tt>:record_type</tt>
|
428
|
+
#
|
429
|
+
# ==== Response
|
430
|
+
# * <tt>#message</tt> -- boolean; Returns true if successful. Exception thrown all failures.
|
431
|
+
#
|
432
|
+
def quick_update_customer(options = {})
|
351
433
|
requires! options, :customer_number
|
434
|
+
requires! options, :update_data
|
352
435
|
|
353
436
|
request = build_request(__method__, options)
|
354
437
|
commit(__method__, request)
|
@@ -361,7 +444,7 @@ module ActiveMerchant #:nodoc:
|
|
361
444
|
# ==== Required
|
362
445
|
# * <tt>:customer_number</tt>
|
363
446
|
#
|
364
|
-
def enable_customer(options={})
|
447
|
+
def enable_customer(options = {})
|
365
448
|
requires! options, :customer_number
|
366
449
|
|
367
450
|
request = build_request(__method__, options)
|
@@ -373,7 +456,7 @@ module ActiveMerchant #:nodoc:
|
|
373
456
|
# ==== Required
|
374
457
|
# * <tt>:customer_number</tt>
|
375
458
|
#
|
376
|
-
def disable_customer(options={})
|
459
|
+
def disable_customer(options = {})
|
377
460
|
requires! options, :customer_number
|
378
461
|
|
379
462
|
request = build_request(__method__, options)
|
@@ -396,14 +479,14 @@ module ActiveMerchant #:nodoc:
|
|
396
479
|
# ==== Response
|
397
480
|
# * <tt>#message</tt> -- method_id of new customer payment method
|
398
481
|
#
|
399
|
-
def add_customer_payment_method(options={})
|
482
|
+
def add_customer_payment_method(options = {})
|
400
483
|
requires! options, :customer_number
|
401
484
|
|
402
485
|
request = build_request(__method__, options)
|
403
486
|
commit(__method__, request)
|
404
487
|
end
|
405
488
|
|
406
|
-
#
|
489
|
+
# Retrieve all of the payment methods belonging to a customer
|
407
490
|
#
|
408
491
|
# ==== Required
|
409
492
|
# * <tt>:customer_number</tt>
|
@@ -411,14 +494,14 @@ module ActiveMerchant #:nodoc:
|
|
411
494
|
# ==== Response
|
412
495
|
# * <tt>#message</tt> -- either a single hash or an array of hashes of payment methods
|
413
496
|
#
|
414
|
-
def get_customer_payment_methods(options={})
|
497
|
+
def get_customer_payment_methods(options = {})
|
415
498
|
requires! options, :customer_number
|
416
499
|
|
417
500
|
request = build_request(__method__, options)
|
418
501
|
commit(__method__, request)
|
419
502
|
end
|
420
503
|
|
421
|
-
#
|
504
|
+
# Retrieve one of the payment methods belonging to a customer
|
422
505
|
#
|
423
506
|
# ==== Required
|
424
507
|
# * <tt>:customer_number</tt>
|
@@ -427,7 +510,7 @@ module ActiveMerchant #:nodoc:
|
|
427
510
|
# ==== Response
|
428
511
|
# * <tt>#message</tt> -- hash of payment method
|
429
512
|
#
|
430
|
-
def get_customer_payment_method(options={})
|
513
|
+
def get_customer_payment_method(options = {})
|
431
514
|
requires! options, :customer_number, :method_id
|
432
515
|
|
433
516
|
request = build_request(__method__, options)
|
@@ -448,7 +531,7 @@ module ActiveMerchant #:nodoc:
|
|
448
531
|
# ==== Response
|
449
532
|
# * <tt>#message</tt> -- hash of payment method
|
450
533
|
#
|
451
|
-
def update_customer_payment_method(options={})
|
534
|
+
def update_customer_payment_method(options = {})
|
452
535
|
requires! options, :method_id
|
453
536
|
|
454
537
|
request = build_request(__method__, options)
|
@@ -461,7 +544,7 @@ module ActiveMerchant #:nodoc:
|
|
461
544
|
# * <tt>:customer_number</tt>
|
462
545
|
# * <tt>:method_id</tt>
|
463
546
|
#
|
464
|
-
def delete_customer_payment_method(options={})
|
547
|
+
def delete_customer_payment_method(options = {})
|
465
548
|
requires! options, :customer_number, :method_id
|
466
549
|
|
467
550
|
request = build_request(__method__, options)
|
@@ -473,7 +556,7 @@ module ActiveMerchant #:nodoc:
|
|
473
556
|
# ==== Required
|
474
557
|
# * <tt>:customer_number</tt>
|
475
558
|
#
|
476
|
-
def delete_customer(options={})
|
559
|
+
def delete_customer(options = {})
|
477
560
|
requires! options, :customer_number
|
478
561
|
|
479
562
|
request = build_request(__method__, options)
|
@@ -524,7 +607,7 @@ module ActiveMerchant #:nodoc:
|
|
524
607
|
# ==== Response
|
525
608
|
# * <tt>#message</tt> -- transaction response hash
|
526
609
|
#
|
527
|
-
def run_customer_transaction(options={})
|
610
|
+
def run_customer_transaction(options = {})
|
528
611
|
requires! options, :customer_number, :command, :amount
|
529
612
|
|
530
613
|
request = build_request(__method__, options)
|
@@ -588,14 +671,14 @@ module ActiveMerchant #:nodoc:
|
|
588
671
|
# ==== Response
|
589
672
|
# * <tt>#message</tt> -- transaction response hash
|
590
673
|
#
|
591
|
-
def run_transaction(options={})
|
674
|
+
def run_transaction(options = {})
|
592
675
|
request = build_request(__method__, options)
|
593
676
|
commit(__method__, request)
|
594
677
|
end
|
595
678
|
|
596
|
-
TRANSACTION_METHODS = [
|
597
|
-
|
598
|
-
|
679
|
+
TRANSACTION_METHODS = %i[
|
680
|
+
run_sale run_auth_only run_credit
|
681
|
+
run_check_sale run_check_credit
|
599
682
|
] #:nodoc:
|
600
683
|
|
601
684
|
TRANSACTION_METHODS.each do |method|
|
@@ -616,7 +699,7 @@ module ActiveMerchant #:nodoc:
|
|
616
699
|
# ==== Response
|
617
700
|
# * <tt>#message</tt> -- transaction response hash
|
618
701
|
#
|
619
|
-
def post_auth(options={})
|
702
|
+
def post_auth(options = {})
|
620
703
|
requires! options, :authorization_code
|
621
704
|
|
622
705
|
request = build_request(__method__, options)
|
@@ -638,7 +721,7 @@ module ActiveMerchant #:nodoc:
|
|
638
721
|
# ==== Response
|
639
722
|
# * <tt>#message</tt> -- transaction response hash
|
640
723
|
#
|
641
|
-
def capture_transaction(options={})
|
724
|
+
def capture_transaction(options = {})
|
642
725
|
requires! options, :reference_number
|
643
726
|
|
644
727
|
request = build_request(__method__, options)
|
@@ -655,7 +738,7 @@ module ActiveMerchant #:nodoc:
|
|
655
738
|
# ==== Response
|
656
739
|
# * <tt>#message</tt> -- transaction response hash
|
657
740
|
#
|
658
|
-
def void_transaction(options={})
|
741
|
+
def void_transaction(options = {})
|
659
742
|
requires! options, :reference_number
|
660
743
|
|
661
744
|
request = build_request(__method__, options)
|
@@ -674,7 +757,7 @@ module ActiveMerchant #:nodoc:
|
|
674
757
|
# ==== Response
|
675
758
|
# * <tt>#message</tt> -- transaction response hash
|
676
759
|
#
|
677
|
-
def refund_transaction(options={})
|
760
|
+
def refund_transaction(options = {})
|
678
761
|
requires! options, :reference_number, :amount
|
679
762
|
|
680
763
|
request = build_request(__method__, options)
|
@@ -694,7 +777,7 @@ module ActiveMerchant #:nodoc:
|
|
694
777
|
# ==== Response
|
695
778
|
# * <tt>#message</tt> -- transaction response hash
|
696
779
|
#
|
697
|
-
def override_transaction(options={})
|
780
|
+
def override_transaction(options = {})
|
698
781
|
requires! options, :reference_number
|
699
782
|
|
700
783
|
request = build_request(__method__, options)
|
@@ -737,7 +820,7 @@ module ActiveMerchant #:nodoc:
|
|
737
820
|
# ==== Response
|
738
821
|
# * <tt>#message</tt> -- transaction response hash
|
739
822
|
#
|
740
|
-
def run_quick_sale(options={})
|
823
|
+
def run_quick_sale(options = {})
|
741
824
|
requires! options, :reference_number, :amount
|
742
825
|
|
743
826
|
request = build_request(__method__, options)
|
@@ -775,7 +858,7 @@ module ActiveMerchant #:nodoc:
|
|
775
858
|
# ==== Response
|
776
859
|
# * <tt>#message</tt> -- transaction response hash
|
777
860
|
#
|
778
|
-
def run_quick_credit(options={})
|
861
|
+
def run_quick_credit(options = {})
|
779
862
|
requires! options, :reference_number
|
780
863
|
|
781
864
|
request = build_request(__method__, options)
|
@@ -792,7 +875,7 @@ module ActiveMerchant #:nodoc:
|
|
792
875
|
# ==== Response
|
793
876
|
# * <tt>#message</tt> -- transaction hash
|
794
877
|
#
|
795
|
-
def get_transaction(options={})
|
878
|
+
def get_transaction(options = {})
|
796
879
|
requires! options, :reference_number
|
797
880
|
|
798
881
|
request = build_request(__method__, options)
|
@@ -809,7 +892,7 @@ module ActiveMerchant #:nodoc:
|
|
809
892
|
# * <tt>response.message</tt> -- message of the referenced transaction
|
810
893
|
# * <tt>response.authorization</tt> -- same as :reference_number in options
|
811
894
|
#
|
812
|
-
def get_transaction_status(options={})
|
895
|
+
def get_transaction_status(options = {})
|
813
896
|
requires! options, :reference_number
|
814
897
|
|
815
898
|
request = build_request(__method__, options)
|
@@ -907,7 +990,7 @@ module ActiveMerchant #:nodoc:
|
|
907
990
|
# ==== Response
|
908
991
|
# * <tt>#message</tt> -- hash; keys are the field values
|
909
992
|
#
|
910
|
-
def get_transaction_custom(options={})
|
993
|
+
def get_transaction_custom(options = {})
|
911
994
|
requires! options, :reference_number, :fields
|
912
995
|
|
913
996
|
request = build_request(__method__, options)
|
@@ -922,7 +1005,7 @@ module ActiveMerchant #:nodoc:
|
|
922
1005
|
# ==== Response
|
923
1006
|
# * <tt>#message</tt> -- check trace hash
|
924
1007
|
#
|
925
|
-
def get_check_trace(options={})
|
1008
|
+
def get_check_trace(options = {})
|
926
1009
|
requires! options, :reference_number
|
927
1010
|
|
928
1011
|
request = build_request(__method__, options)
|
@@ -948,15 +1031,15 @@ module ActiveMerchant #:nodoc:
|
|
948
1031
|
# Build soap header, etc.
|
949
1032
|
def build_request(action, options = {})
|
950
1033
|
soap = Builder::XmlMarkup.new
|
951
|
-
soap.instruct!(:xml, :
|
952
|
-
soap.tag!
|
1034
|
+
soap.instruct!(:xml, version: '1.0', encoding: 'utf-8')
|
1035
|
+
soap.tag! 'SOAP-ENV:Envelope',
|
953
1036
|
'xmlns:SOAP-ENV' => 'http://schemas.xmlsoap.org/soap/envelope/',
|
954
1037
|
'xmlns:ns1' => 'urn:usaepay',
|
955
1038
|
'xmlns:xsd' => 'http://www.w3.org/2001/XMLSchema',
|
956
1039
|
'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
|
957
1040
|
'xmlns:SOAP-ENC' => 'http://schemas.xmlsoap.org/soap/encoding/',
|
958
1041
|
'SOAP-ENV:encodingStyle' => 'http://schemas.xmlsoap.org/soap/encoding/' do
|
959
|
-
soap.tag!
|
1042
|
+
soap.tag! 'SOAP-ENV:Body' do
|
960
1043
|
send("build_#{action}", soap, options)
|
961
1044
|
end
|
962
1045
|
end
|
@@ -975,9 +1058,9 @@ module ActiveMerchant #:nodoc:
|
|
975
1058
|
soap.Token 'xsi:type' => 'ns1:ueSecurityToken' do
|
976
1059
|
build_tag soap, :string, 'ClientIP', options[:client_ip]
|
977
1060
|
soap.PinHash 'xsi:type' => 'ns1:ueHash' do
|
978
|
-
build_tag soap, :string,
|
979
|
-
build_tag soap, :string,
|
980
|
-
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'
|
981
1064
|
end
|
982
1065
|
build_tag soap, :string, 'SourceKey', @options[:login]
|
983
1066
|
end
|
@@ -986,16 +1069,16 @@ module ActiveMerchant #:nodoc:
|
|
986
1069
|
# Customer ======================================================
|
987
1070
|
|
988
1071
|
def build_add_customer(soap, options)
|
989
|
-
soap.tag!
|
1072
|
+
soap.tag! 'ns1:addCustomer' do
|
990
1073
|
build_token soap, options
|
991
1074
|
build_customer_data soap, options
|
992
1075
|
build_tag soap, :double, 'Amount', amount(options[:amount])
|
993
1076
|
build_tag soap, :double, 'Tax', amount(options[:tax])
|
994
|
-
build_tag soap, :string, 'Next', options[:next].strftime(
|
1077
|
+
build_tag soap, :string, 'Next', options[:next].strftime('%Y-%m-%d') if options[:next]
|
995
1078
|
end
|
996
1079
|
end
|
997
1080
|
|
998
|
-
def build_customer(soap, options, type, add_customer_data=false)
|
1081
|
+
def build_customer(soap, options, type, add_customer_data = false)
|
999
1082
|
soap.tag! "ns1:#{type}" do
|
1000
1083
|
build_token soap, options
|
1001
1084
|
build_tag soap, :integer, 'CustNum', options[:customer_number]
|
@@ -1019,8 +1102,16 @@ module ActiveMerchant #:nodoc:
|
|
1019
1102
|
build_customer(soap, options, 'deleteCustomer')
|
1020
1103
|
end
|
1021
1104
|
|
1105
|
+
def build_quick_update_customer(soap, options)
|
1106
|
+
soap.tag! 'ns1:quickUpdateCustomer' do
|
1107
|
+
build_token soap, options
|
1108
|
+
build_tag soap, :integer, 'CustNum', options[:customer_number]
|
1109
|
+
build_field_value_array soap, 'UpdateData', 'FieldValue', options[:update_data], CUSTOMER_UPDATE_DATA_FIELDS
|
1110
|
+
end
|
1111
|
+
end
|
1112
|
+
|
1022
1113
|
def build_add_customer_payment_method(soap, options)
|
1023
|
-
soap.tag!
|
1114
|
+
soap.tag! 'ns1:addCustomerPaymentMethod' do
|
1024
1115
|
build_token soap, options
|
1025
1116
|
build_tag soap, :integer, 'CustNum', options[:customer_number]
|
1026
1117
|
build_customer_payment_methods soap, options
|
@@ -1050,7 +1141,7 @@ module ActiveMerchant #:nodoc:
|
|
1050
1141
|
end
|
1051
1142
|
|
1052
1143
|
def build_delete_customer_payment_method(soap, options)
|
1053
|
-
soap.tag!
|
1144
|
+
soap.tag! 'ns1:deleteCustomerPaymentMethod' do
|
1054
1145
|
build_token soap, options
|
1055
1146
|
build_tag soap, :integer, 'Custnum', options[:customer_number]
|
1056
1147
|
build_tag soap, :integer, 'PaymentMethodID', options[:method_id]
|
@@ -1058,7 +1149,7 @@ module ActiveMerchant #:nodoc:
|
|
1058
1149
|
end
|
1059
1150
|
|
1060
1151
|
def build_run_customer_transaction(soap, options)
|
1061
|
-
soap.tag!
|
1152
|
+
soap.tag! 'ns1:runCustomerTransaction' do
|
1062
1153
|
build_token soap, options
|
1063
1154
|
build_tag soap, :integer, 'CustNum', options[:customer_number]
|
1064
1155
|
build_tag soap, :integer, 'PaymentMethodID', options[:method_id] || 0
|
@@ -1135,21 +1226,21 @@ module ActiveMerchant #:nodoc:
|
|
1135
1226
|
end
|
1136
1227
|
|
1137
1228
|
def build_get_transaction(soap, options)
|
1138
|
-
soap.tag!
|
1229
|
+
soap.tag! 'ns1:getTransaction' do
|
1139
1230
|
build_token soap, options
|
1140
1231
|
build_tag soap, :integer, 'RefNum', options[:reference_number]
|
1141
1232
|
end
|
1142
1233
|
end
|
1143
1234
|
|
1144
1235
|
def build_get_transaction_status(soap, options)
|
1145
|
-
soap.tag!
|
1236
|
+
soap.tag! 'ns1:getTransactionStatus' do
|
1146
1237
|
build_token soap, options
|
1147
1238
|
build_tag soap, :integer, 'RefNum', options[:reference_number]
|
1148
1239
|
end
|
1149
1240
|
end
|
1150
1241
|
|
1151
1242
|
def build_get_transaction_custom(soap, options)
|
1152
|
-
soap.tag!
|
1243
|
+
soap.tag! 'ns1:getTransactionCustom' do
|
1153
1244
|
build_token soap, options
|
1154
1245
|
build_tag soap, :integer, 'RefNum', options[:reference_number]
|
1155
1246
|
build_transaction_field_array soap, options
|
@@ -1157,14 +1248,14 @@ module ActiveMerchant #:nodoc:
|
|
1157
1248
|
end
|
1158
1249
|
|
1159
1250
|
def build_get_check_trace(soap, options)
|
1160
|
-
soap.tag!
|
1251
|
+
soap.tag! 'ns1:getCheckTrace' do
|
1161
1252
|
build_token soap, options
|
1162
1253
|
build_tag soap, :integer, 'RefNum', options[:reference_number]
|
1163
1254
|
end
|
1164
1255
|
end
|
1165
1256
|
|
1166
1257
|
def build_capture_transaction(soap, options)
|
1167
|
-
soap.tag!
|
1258
|
+
soap.tag! 'ns1:captureTransaction' do
|
1168
1259
|
build_token soap, options
|
1169
1260
|
build_tag soap, :integer, 'RefNum', options[:reference_number]
|
1170
1261
|
build_tag soap, :double, 'Amount', amount(options[:amount])
|
@@ -1172,14 +1263,14 @@ module ActiveMerchant #:nodoc:
|
|
1172
1263
|
end
|
1173
1264
|
|
1174
1265
|
def build_void_transaction(soap, options)
|
1175
|
-
soap.tag!
|
1266
|
+
soap.tag! 'ns1:voidTransaction' do
|
1176
1267
|
build_token soap, options
|
1177
1268
|
build_tag soap, :integer, 'RefNum', options[:reference_number]
|
1178
1269
|
end
|
1179
1270
|
end
|
1180
1271
|
|
1181
1272
|
def build_refund_transaction(soap, options)
|
1182
|
-
soap.tag!
|
1273
|
+
soap.tag! 'ns1:refundTransaction' do
|
1183
1274
|
build_token soap, options
|
1184
1275
|
build_tag soap, :integer, 'RefNum', options[:reference_number]
|
1185
1276
|
build_tag soap, :integer, 'Amount', amount(options[:amount])
|
@@ -1187,7 +1278,7 @@ module ActiveMerchant #:nodoc:
|
|
1187
1278
|
end
|
1188
1279
|
|
1189
1280
|
def build_override_transaction(soap, options)
|
1190
|
-
soap.tag!
|
1281
|
+
soap.tag! 'ns1:overrideTransaction' do
|
1191
1282
|
build_token soap, options
|
1192
1283
|
build_tag soap, :integer, 'RefNum', options[:reference_number]
|
1193
1284
|
build_tag soap, :string, 'Reason', options[:reason]
|
@@ -1197,7 +1288,7 @@ module ActiveMerchant #:nodoc:
|
|
1197
1288
|
# Account =======================================================
|
1198
1289
|
|
1199
1290
|
def build_get_account_details(soap, options)
|
1200
|
-
soap.tag!
|
1291
|
+
soap.tag! 'ns1:getAccountDetails' do
|
1201
1292
|
build_token soap, options
|
1202
1293
|
end
|
1203
1294
|
end
|
@@ -1206,7 +1297,7 @@ module ActiveMerchant #:nodoc:
|
|
1206
1297
|
|
1207
1298
|
def build_customer_data(soap, options)
|
1208
1299
|
soap.CustomerData 'xsi:type' => 'ns1:CustomerObject' do
|
1209
|
-
CUSTOMER_OPTIONS.each do |k,v|
|
1300
|
+
CUSTOMER_OPTIONS.each do |k, v|
|
1210
1301
|
build_tag soap, v[0], v[1], options[k]
|
1211
1302
|
end
|
1212
1303
|
build_billing_address soap, options
|
@@ -1219,7 +1310,7 @@ module ActiveMerchant #:nodoc:
|
|
1219
1310
|
if options[:payment_methods]
|
1220
1311
|
length = options[:payment_methods].length
|
1221
1312
|
soap.PaymentMethods 'SOAP-ENC:arrayType' => "ns1:PaymentMethod[#{length}]",
|
1222
|
-
|
1313
|
+
'xsi:type' => 'ns1:PaymentMethodArray' do
|
1223
1314
|
build_customer_payment_methods soap, options
|
1224
1315
|
end
|
1225
1316
|
end
|
@@ -1245,7 +1336,7 @@ module ActiveMerchant #:nodoc:
|
|
1245
1336
|
when payment_method[:method].kind_of?(ActiveMerchant::Billing::CreditCard)
|
1246
1337
|
build_tag soap, :string, 'CardNumber', payment_method[:method].number
|
1247
1338
|
build_tag soap, :string, 'CardExpiration',
|
1248
|
-
"#{
|
1339
|
+
"#{'%02d' % payment_method[:method].month}#{payment_method[:method].year.to_s[-2..-1]}"
|
1249
1340
|
if options[:billing_address]
|
1250
1341
|
build_tag soap, :string, 'AvsStreet', options[:billing_address][:address1]
|
1251
1342
|
build_tag soap, :string, 'AvsZip', options[:billing_address][:zip]
|
@@ -1254,9 +1345,7 @@ module ActiveMerchant #:nodoc:
|
|
1254
1345
|
when payment_method[:method].kind_of?(ActiveMerchant::Billing::Check)
|
1255
1346
|
build_tag soap, :string, 'Account', payment_method[:method].account_number
|
1256
1347
|
build_tag soap, :string, 'Routing', payment_method[:method].routing_number
|
1257
|
-
unless payment_method[:method].account_type.nil?
|
1258
|
-
build_tag soap, :string, 'AccountType', payment_method[:method].account_type.capitalize
|
1259
|
-
end
|
1348
|
+
build_tag soap, :string, 'AccountType', payment_method[:method].account_type.capitalize unless payment_method[:method].account_type.nil?
|
1260
1349
|
build_tag soap, :string, 'DriversLicense', options[:drivers_license]
|
1261
1350
|
build_tag soap, :string, 'DriversLicenseState', options[:drivers_license_state]
|
1262
1351
|
build_tag soap, :string, 'RecordType', options[:record_type]
|
@@ -1266,7 +1355,7 @@ module ActiveMerchant #:nodoc:
|
|
1266
1355
|
def build_customer_payment_methods(soap, options)
|
1267
1356
|
payment_methods, tag_name = extract_methods_and_tag(options)
|
1268
1357
|
payment_methods.each do |payment_method|
|
1269
|
-
soap.tag! tag_name, 'xsi:type' =>
|
1358
|
+
soap.tag! tag_name, 'xsi:type' => 'ns1:PaymentMethod' do
|
1270
1359
|
build_tag soap, :integer, 'MethodID', payment_method[:method_id]
|
1271
1360
|
build_tag soap, :string, 'MethodType', payment_method[:type]
|
1272
1361
|
build_tag soap, :string, 'MethodName', payment_method[:name]
|
@@ -1277,9 +1366,9 @@ module ActiveMerchant #:nodoc:
|
|
1277
1366
|
end
|
1278
1367
|
|
1279
1368
|
def build_customer_transaction(soap, options)
|
1280
|
-
soap.Parameters 'xsi:type' =>
|
1369
|
+
soap.Parameters 'xsi:type' => 'ns1:CustomerTransactionRequest' do
|
1281
1370
|
build_transaction_detail soap, options
|
1282
|
-
CUSTOMER_TRANSACTION_REQUEST_OPTIONS.each do |k,v|
|
1371
|
+
CUSTOMER_TRANSACTION_REQUEST_OPTIONS.each do |k, v|
|
1283
1372
|
build_tag soap, v[0], v[1], options[k]
|
1284
1373
|
end
|
1285
1374
|
build_custom_fields soap, options
|
@@ -1289,13 +1378,14 @@ module ActiveMerchant #:nodoc:
|
|
1289
1378
|
|
1290
1379
|
# Transaction Helpers ===========================================
|
1291
1380
|
|
1292
|
-
def build_transaction_request_object(soap, options, name='Params')
|
1293
|
-
soap.tag! name, 'xsi:type' =>
|
1294
|
-
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|
|
1295
1384
|
build_tag soap, v[0], v[1], options[k]
|
1296
1385
|
end
|
1297
1386
|
case
|
1298
|
-
when options[:payment_method]
|
1387
|
+
when options[:payment_method].nil?
|
1388
|
+
nil
|
1299
1389
|
when options[:payment_method].kind_of?(ActiveMerchant::Billing::CreditCard)
|
1300
1390
|
build_credit_card_data soap, options
|
1301
1391
|
when options[:payment_method].kind_of?(ActiveMerchant::Billing::Check)
|
@@ -1313,18 +1403,18 @@ module ActiveMerchant #:nodoc:
|
|
1313
1403
|
end
|
1314
1404
|
|
1315
1405
|
def build_transaction_detail(soap, options)
|
1316
|
-
soap.Details 'xsi:type' =>
|
1317
|
-
TRANSACTION_DETAIL_OPTIONS.each do |k,v|
|
1406
|
+
soap.Details 'xsi:type' => 'ns1:TransactionDetail' do
|
1407
|
+
TRANSACTION_DETAIL_OPTIONS.each do |k, v|
|
1318
1408
|
build_tag soap, v[0], v[1], options[k]
|
1319
1409
|
end
|
1320
|
-
TRANSACTION_DETAIL_MONEY_OPTIONS.each do |k,v|
|
1410
|
+
TRANSACTION_DETAIL_MONEY_OPTIONS.each do |k, v|
|
1321
1411
|
build_tag soap, v[0], v[1], amount(options[k])
|
1322
1412
|
end
|
1323
1413
|
end
|
1324
1414
|
end
|
1325
1415
|
|
1326
1416
|
def build_credit_card_data(soap, options)
|
1327
|
-
soap.CreditCardData 'xsi:type' =>
|
1417
|
+
soap.CreditCardData 'xsi:type' => 'ns1:CreditCardData' do
|
1328
1418
|
build_tag soap, :string, 'CardNumber', options[:payment_method].number
|
1329
1419
|
build_tag soap, :string, 'CardExpiration', build_card_expiration(options)
|
1330
1420
|
if options[:billing_address]
|
@@ -1333,7 +1423,7 @@ module ActiveMerchant #:nodoc:
|
|
1333
1423
|
end
|
1334
1424
|
build_tag soap, :string, 'CardCode', options[:payment_method].verification_value
|
1335
1425
|
build_tag soap, :boolean, 'CardPresent', options[:card_present] || false
|
1336
|
-
CREDIT_CARD_DATA_OPTIONS.each do |k,v|
|
1426
|
+
CREDIT_CARD_DATA_OPTIONS.each do |k, v|
|
1337
1427
|
build_tag soap, v[0], v[1], options[k]
|
1338
1428
|
end
|
1339
1429
|
end
|
@@ -1342,18 +1432,16 @@ module ActiveMerchant #:nodoc:
|
|
1342
1432
|
def build_card_expiration(options)
|
1343
1433
|
month = options[:payment_method].month
|
1344
1434
|
year = options[:payment_method].year
|
1345
|
-
unless month.nil? || year.nil?
|
1346
|
-
"#{"%02d" % month}#{year.to_s[-2..-1]}"
|
1347
|
-
end
|
1435
|
+
"#{'%02d' % month}#{year.to_s[-2..-1]}" unless month.nil? || year.nil?
|
1348
1436
|
end
|
1349
1437
|
|
1350
1438
|
def build_check_data(soap, options)
|
1351
|
-
soap.CheckData 'xsi:type' =>
|
1439
|
+
soap.CheckData 'xsi:type' => 'ns1:CheckData' do
|
1352
1440
|
build_tag soap, :integer, 'CheckNumber', options[:payment_method].number
|
1353
1441
|
build_tag soap, :string, 'Account', options[:payment_method].account_number
|
1354
1442
|
build_tag soap, :string, 'Routing', options[:payment_method].routing_number
|
1355
1443
|
build_tag soap, :string, 'AccountType', options[:payment_method].account_type.capitalize
|
1356
|
-
CHECK_DATA_OPTIONS.each do |k,v|
|
1444
|
+
CHECK_DATA_OPTIONS.each do |k, v|
|
1357
1445
|
build_tag soap, v[0], v[1], options[k]
|
1358
1446
|
end
|
1359
1447
|
end
|
@@ -1361,11 +1449,11 @@ module ActiveMerchant #:nodoc:
|
|
1361
1449
|
|
1362
1450
|
def build_recurring_billing(soap, options)
|
1363
1451
|
if options[:recurring]
|
1364
|
-
soap.RecurringBilling 'xsi:type' =>
|
1452
|
+
soap.RecurringBilling 'xsi:type' => 'ns1:RecurringBilling' do
|
1365
1453
|
build_tag soap, :double, 'Amount', amount(options[:recurring][:amount])
|
1366
|
-
build_tag soap, :string, 'Next', options[:recurring][:next].strftime(
|
1367
|
-
build_tag soap, :string, 'Expire', options[:recurring][:expire].strftime(
|
1368
|
-
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|
|
1369
1457
|
build_tag soap, v[0], v[1], options[:recurring][k]
|
1370
1458
|
end
|
1371
1459
|
end
|
@@ -1384,12 +1472,9 @@ module ActiveMerchant #:nodoc:
|
|
1384
1472
|
|
1385
1473
|
def build_billing_address(soap, options)
|
1386
1474
|
if options[:billing_address]
|
1387
|
-
if options[:billing_address][:name]
|
1388
|
-
|
1389
|
-
|
1390
|
-
end
|
1391
|
-
soap.BillingAddress 'xsi:type' => "ns1:Address" do
|
1392
|
-
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|
|
1393
1478
|
build_tag soap, v[0], v[1], options[:billing_address][k]
|
1394
1479
|
end
|
1395
1480
|
end
|
@@ -1398,18 +1483,30 @@ module ActiveMerchant #:nodoc:
|
|
1398
1483
|
|
1399
1484
|
def build_shipping_address(soap, options)
|
1400
1485
|
if options[:shipping_address]
|
1401
|
-
if options[:shipping_address][:name]
|
1402
|
-
|
1403
|
-
|
1404
|
-
end
|
1405
|
-
soap.ShippingAddress 'xsi:type' => "ns1:Address" do
|
1406
|
-
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|
|
1407
1489
|
build_tag soap, v[0], v[1], options[:shipping_address][k]
|
1408
1490
|
end
|
1409
1491
|
end
|
1410
1492
|
end
|
1411
1493
|
end
|
1412
1494
|
|
1495
|
+
def build_field_value_array(soap, tag_name, type, custom_data, fields)
|
1496
|
+
soap.tag! tag_name, 'SOAP-ENC:arryType' => "xsd:#{type}[#{options.length}]", 'xsi:type' => "ns1:#{type}Array" do
|
1497
|
+
custom_data.each do |k, v|
|
1498
|
+
build_field_value soap, fields[k][1], v, fields[k][0] if fields.key?(k)
|
1499
|
+
end
|
1500
|
+
end
|
1501
|
+
end
|
1502
|
+
|
1503
|
+
def build_field_value(soap, field, value, value_type)
|
1504
|
+
soap.FieldValue 'xsi:type' => 'ns1:FieldValue' do
|
1505
|
+
build_tag soap, :string, 'Field', field
|
1506
|
+
build_tag soap, value_type, 'Value', value
|
1507
|
+
end
|
1508
|
+
end
|
1509
|
+
|
1413
1510
|
def build_line_items(soap, options) # TODO
|
1414
1511
|
end
|
1415
1512
|
|
@@ -1422,7 +1519,7 @@ module ActiveMerchant #:nodoc:
|
|
1422
1519
|
url = test? ? test_url : live_url
|
1423
1520
|
|
1424
1521
|
begin
|
1425
|
-
soap = ssl_post(url, request,
|
1522
|
+
soap = ssl_post(url, request, 'Content-Type' => 'text/xml')
|
1426
1523
|
rescue ActiveMerchant::ResponseError => error
|
1427
1524
|
soap = error.response.body
|
1428
1525
|
end
|
@@ -1433,53 +1530,54 @@ module ActiveMerchant #:nodoc:
|
|
1433
1530
|
def build_response(action, soap)
|
1434
1531
|
response_params, success, message, authorization, avs, cvv = parse(action, soap)
|
1435
1532
|
|
1436
|
-
response_params
|
1533
|
+
response_params['soap_response'] = soap if @options[:soap_response]
|
1437
1534
|
|
1438
1535
|
Response.new(
|
1439
1536
|
success,
|
1440
1537
|
message,
|
1441
1538
|
response_params,
|
1442
|
-
:
|
1443
|
-
:
|
1444
|
-
:
|
1445
|
-
:
|
1539
|
+
test: test?,
|
1540
|
+
authorization: authorization,
|
1541
|
+
avs_result: avs_from(avs),
|
1542
|
+
cvv_result: cvv
|
1446
1543
|
)
|
1447
1544
|
end
|
1448
1545
|
|
1449
1546
|
def avs_from(avs)
|
1450
|
-
avs_params = { :
|
1451
|
-
avs_params
|
1547
|
+
avs_params = { code: avs }
|
1548
|
+
avs_params[:message] = AVS_CUSTOM_MESSAGES[avs] if AVS_CUSTOM_MESSAGES.key?(avs)
|
1452
1549
|
avs_params
|
1453
1550
|
end
|
1454
1551
|
|
1455
1552
|
def parse(action, soap)
|
1456
1553
|
xml = REXML::Document.new(soap)
|
1457
|
-
root = REXML::XPath.first(xml,
|
1458
|
-
response = root ? parse_element(root[0]) : { :
|
1554
|
+
root = REXML::XPath.first(xml, '//SOAP-ENV:Body')
|
1555
|
+
response = root ? parse_element(root[0]) : { response: soap }
|
1459
1556
|
|
1460
1557
|
success, message, authorization, avs, cvv = false, FAILURE_MESSAGE, nil, nil, nil
|
1461
1558
|
|
1462
|
-
fault =
|
1559
|
+
fault = !response || (response.length < 1) || response.has_key?('faultcode')
|
1463
1560
|
return [response, success, response['faultstring'], authorization, avs, cvv] if fault
|
1464
1561
|
|
1465
1562
|
if response.respond_to?(:[]) && p = response["#{action}_return"]
|
1466
1563
|
if p.respond_to?(:key?) && p.key?('result_code')
|
1467
|
-
success = p['result_code'] == 'A'
|
1564
|
+
success = p['result_code'] == 'A'
|
1468
1565
|
authorization = p['ref_num']
|
1469
1566
|
avs = AVS_RESULTS[p['avs_result_code']]
|
1470
1567
|
cvv = p['card_code_result_code']
|
1471
1568
|
else
|
1472
1569
|
success = true
|
1473
1570
|
end
|
1474
|
-
message =
|
1475
|
-
|
1476
|
-
|
1477
|
-
|
1478
|
-
|
1479
|
-
|
1480
|
-
|
1481
|
-
|
1482
|
-
|
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
|
1483
1581
|
elsif response.respond_to?(:[]) && p = response[:response]
|
1484
1582
|
message = p # when response is html
|
1485
1583
|
end
|
@@ -1509,8 +1607,6 @@ module ActiveMerchant #:nodoc:
|
|
1509
1607
|
|
1510
1608
|
response
|
1511
1609
|
end
|
1512
|
-
|
1513
1610
|
end
|
1514
1611
|
end
|
1515
1612
|
end
|
1516
|
-
|