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
@@ -0,0 +1,612 @@
|
|
1
|
+
require 'nokogiri'
|
2
|
+
|
3
|
+
module ActiveMerchant #:nodoc:
|
4
|
+
module Billing #:nodoc:
|
5
|
+
class TransFirstTransactionExpressGateway < Gateway
|
6
|
+
self.display_name = 'TransFirst Transaction Express'
|
7
|
+
self.homepage_url = 'http://transactionexpress.com/'
|
8
|
+
|
9
|
+
self.test_url = 'https://ws.cert.transactionexpress.com/portal/merchantframework/MerchantWebServices-v1?wsdl'
|
10
|
+
self.live_url = 'https://ws.transactionexpress.com/portal/merchantframework/MerchantWebServices-v1?wsdl'
|
11
|
+
|
12
|
+
self.supported_countries = ['US']
|
13
|
+
self.default_currency = 'USD'
|
14
|
+
self.money_format = :cents
|
15
|
+
self.supported_cardtypes = %i[visa master american_express discover diners_club]
|
16
|
+
|
17
|
+
V1_NAMESPACE = 'http://postilion/realtime/merchantframework/xsd/v1/'
|
18
|
+
SOAPENV_NAMESPACE = 'http://schemas.xmlsoap.org/soap/envelope/'
|
19
|
+
AUTHORIZATION_FIELD_SEPARATOR = '|'
|
20
|
+
|
21
|
+
APPROVAL_CODES = %w(00 10)
|
22
|
+
|
23
|
+
RESPONSE_MESSAGES = {
|
24
|
+
'00' => 'Approved',
|
25
|
+
'01' => 'Refer to card issuer',
|
26
|
+
'02' => 'Refer to card issuer, special condition',
|
27
|
+
'03' => 'Invalid merchant',
|
28
|
+
'04' => 'Pick-up card',
|
29
|
+
'05' => 'Do not honor',
|
30
|
+
'06' => 'Error',
|
31
|
+
'07' => 'Pick-up card, special condition',
|
32
|
+
'08' => 'Honor with identification',
|
33
|
+
'09' => 'Request in progress',
|
34
|
+
'10' => 'Approved, partial authorization',
|
35
|
+
'11' => 'VIP Approval',
|
36
|
+
'12' => 'Invalid transaction',
|
37
|
+
'13' => 'Invalid amount',
|
38
|
+
'14' => 'Invalid card number',
|
39
|
+
'15' => 'No such issuer',
|
40
|
+
'16' => 'Approved, update track 3',
|
41
|
+
'17' => 'Customer cancellation',
|
42
|
+
'18' => 'Customer dispute',
|
43
|
+
'19' => 'Re-enter transaction',
|
44
|
+
'20' => 'Invalid response',
|
45
|
+
'21' => 'No action taken',
|
46
|
+
'22' => 'Suspected malfunction',
|
47
|
+
'23' => 'Unacceptable transaction fee',
|
48
|
+
'24' => 'File update not supported',
|
49
|
+
'25' => 'Unable to locate record',
|
50
|
+
'26' => 'Duplicate record',
|
51
|
+
'27' => 'File update field edit error',
|
52
|
+
'28' => 'File update file locked',
|
53
|
+
'29' => 'File update failed',
|
54
|
+
'30' => 'Format error',
|
55
|
+
'31' => 'Bank not supported',
|
56
|
+
'33' => 'Expired card, pick-up',
|
57
|
+
'34' => 'Suspected fraud, pick-up',
|
58
|
+
'35' => 'Contact acquirer, pick-up',
|
59
|
+
'36' => 'Restricted card, pick-up',
|
60
|
+
'37' => 'Call acquirer security, pick-up',
|
61
|
+
'38' => 'PIN tries exceeded, pick-up',
|
62
|
+
'39' => 'No credit account',
|
63
|
+
'40' => 'Function not supported',
|
64
|
+
'41' => 'Lost card, pick-up',
|
65
|
+
'42' => 'No universal account',
|
66
|
+
'43' => 'Stolen card, pick-up',
|
67
|
+
'44' => 'No investment account',
|
68
|
+
'45' => 'Account closed',
|
69
|
+
'46' => 'Identification required',
|
70
|
+
'47' => 'Identification cross-check required',
|
71
|
+
'48' => 'No customer record',
|
72
|
+
'49' => 'Reserved for future Realtime use',
|
73
|
+
'50' => 'Reserved for future Realtime use',
|
74
|
+
'51' => 'Not sufficient funds',
|
75
|
+
'52' => 'No checking account',
|
76
|
+
'53' => 'No savings account',
|
77
|
+
'54' => 'Expired card',
|
78
|
+
'55' => 'Incorrect PIN',
|
79
|
+
'56' => 'No card record',
|
80
|
+
'57' => 'Transaction not permitted to cardholder',
|
81
|
+
'58' => 'Transaction not permitted on terminal',
|
82
|
+
'59' => 'Suspected fraud',
|
83
|
+
'60' => 'Contact acquirer',
|
84
|
+
'61' => 'Exceeds withdrawal limit',
|
85
|
+
'62' => 'Restricted card',
|
86
|
+
'63' => 'Security violation',
|
87
|
+
'64' => 'Original amount incorrect',
|
88
|
+
'65' => 'Exceeds withdrawal frequency',
|
89
|
+
'66' => 'Call acquirer security',
|
90
|
+
'67' => 'Hard capture',
|
91
|
+
'68' => 'Response received too late',
|
92
|
+
'69' => 'Advice received too late (the response from a request was received too late )',
|
93
|
+
'70' => 'Reserved for future use',
|
94
|
+
'71' => 'Reserved for future Realtime use',
|
95
|
+
'72' => 'Reserved for future Realtime use',
|
96
|
+
'73' => 'Reserved for future Realtime use',
|
97
|
+
'74' => 'Reserved for future Realtime use',
|
98
|
+
'75' => 'PIN tries exceeded',
|
99
|
+
'76' => 'Reversal: Unable to locate previous message (no match on Retrieval Reference Number)/ Reserved for future Realtime use',
|
100
|
+
'77' => 'Previous message located for a repeat or reversal, but repeat or reversal data is inconsistent with original message/ Intervene, bank approval required',
|
101
|
+
'78' => 'Invalid/non-existent account – Decline (MasterCard specific)/ Intervene, bank approval required for partial amount',
|
102
|
+
'79' => 'Already reversed (by Switch)/ Reserved for client-specific use (declined)',
|
103
|
+
'80' => 'No financial Impact (Reserved for declined debit)/ Reserved for client-specific use (declined)',
|
104
|
+
'81' => 'PIN cryptographic error found by the Visa security module during PIN decryption/ Reserved for client-specific use (declined)',
|
105
|
+
'82' => 'Incorrect CVV/ Reserved for client-specific use (declined)',
|
106
|
+
'83' => 'Unable to verify PIN/ Reserved for client-specific use (declined)',
|
107
|
+
'84' => 'Invalid Authorization Life Cycle – Decline (MasterCard) or Duplicate Transaction Detected (Visa)/ Reserved for client-specific use (declined)',
|
108
|
+
'85' => 'No reason to decline a request for Account Number Verification or Address Verification/ Reserved for client-specific use (declined)',
|
109
|
+
'86' => 'Cannot verify PIN/ Reserved for client-specific use (declined)',
|
110
|
+
'87' => 'Reserved for client-specific use (declined)',
|
111
|
+
'88' => 'Reserved for client-specific use (declined)',
|
112
|
+
'89' => 'Reserved for client-specific use (declined)',
|
113
|
+
'90' => 'Cut-off in progress',
|
114
|
+
'91' => 'Issuer or switch inoperative',
|
115
|
+
'92' => 'Routing error',
|
116
|
+
'93' => 'Violation of law',
|
117
|
+
'94' => 'Duplicate Transmission (Integrated Debit and MasterCard)',
|
118
|
+
'95' => 'Reconcile error',
|
119
|
+
'96' => 'System malfunction',
|
120
|
+
'97' => 'Reserved for future Realtime use',
|
121
|
+
'98' => 'Exceeds cash limit',
|
122
|
+
'99' => 'Reserved for future Realtime use',
|
123
|
+
'1106' => 'Reserved for future Realtime use',
|
124
|
+
'0A' => 'Reserved for future Realtime use',
|
125
|
+
'A0' => 'Reserved for future Realtime use',
|
126
|
+
'A1' => 'ATC not incremented',
|
127
|
+
'A2' => 'ATC limit exceeded',
|
128
|
+
'A3' => 'ATC configuration error',
|
129
|
+
'A4' => 'CVR check failure',
|
130
|
+
'A5' => 'CVR configuration error',
|
131
|
+
'A6' => 'TVR check failure',
|
132
|
+
'A7' => 'TVR configuration error',
|
133
|
+
'A8' => 'Reserved for future Realtime use',
|
134
|
+
'B1' => 'Surcharge amount not permitted on Visa cards or EBT Food Stamps/ Reserved for future Realtime use',
|
135
|
+
'B2' => 'Surcharge amount not supported by debit network issuer/ Reserved for future Realtime use',
|
136
|
+
'C1' => 'Unacceptable PIN',
|
137
|
+
'C2' => 'PIN Change failed',
|
138
|
+
'C3' => 'PIN Unblock failed',
|
139
|
+
'D1' => 'MAC Error',
|
140
|
+
'E1' => 'Prepay error',
|
141
|
+
'N1' => 'Network Error within the TXP platform',
|
142
|
+
'N0' => 'Force STIP/ Reserved for client-specific use (declined)',
|
143
|
+
'N3' => 'Cash service not available/ Reserved for client-specific use (declined)',
|
144
|
+
'N4' => 'Cash request exceeds Issuer limit/ Reserved for client-specific use (declined)',
|
145
|
+
'N5' => 'Ineligible for re-submission/ Reserved for client-specific use (declined)',
|
146
|
+
'N7' => 'Decline for CVV2 failure/ Reserved for client-specific use (declined)',
|
147
|
+
'N8' => 'Transaction amount exceeds preauthorized approval amount/ Reserved for client-specific use (declined)',
|
148
|
+
'P0' => 'Approved; PVID code is missing, invalid, or has expired',
|
149
|
+
'P1' => 'Declined; PVID code is missing, invalid, or has expired/ Reserved for client-specific use (declined)',
|
150
|
+
'P2' => 'Invalid biller Information/ Reserved for client-specific use (declined)/ Reserved for client-specific use (declined)',
|
151
|
+
'R0' => 'The transaction was declined or returned, because the cardholder requested that payment of a specific recurring or installment payment transaction be stopped/ Reserved for client-specific use (declined)',
|
152
|
+
'R1' => 'The transaction was declined or returned, because the cardholder requested that payment of all recurring or installment payment transactions for a specific merchant account be stopped/ Reserved for client-specific use (declined)',
|
153
|
+
'Q1' => 'Card Authentication failed/ Reserved for client-specific use (declined)',
|
154
|
+
'XA' => 'Forward to Issuer/ Reserved for client-specific use (declined)',
|
155
|
+
'XD' => 'Forward to Issuer/ Reserved for client-specific use (declined)'
|
156
|
+
}
|
157
|
+
|
158
|
+
EXTENDED_RESPONSE_MESSAGES = {
|
159
|
+
'B40K' => 'Declined Post – Credit linked to unextracted settle transaction'
|
160
|
+
}
|
161
|
+
|
162
|
+
TRANSACTION_CODES = {
|
163
|
+
authorize: 0,
|
164
|
+
void_authorize: 2,
|
165
|
+
|
166
|
+
purchase: 1,
|
167
|
+
capture: 3,
|
168
|
+
void_purchase: 6,
|
169
|
+
void_capture: 6,
|
170
|
+
|
171
|
+
refund: 4,
|
172
|
+
credit: 5,
|
173
|
+
void_refund: 13,
|
174
|
+
void_credit: 13,
|
175
|
+
|
176
|
+
verify: 9,
|
177
|
+
|
178
|
+
purchase_echeck: 11,
|
179
|
+
refund_echeck: 16,
|
180
|
+
void_echeck: 16,
|
181
|
+
|
182
|
+
wallet_sale: 14
|
183
|
+
}
|
184
|
+
|
185
|
+
def initialize(options = {})
|
186
|
+
requires!(options, :gateway_id, :reg_key)
|
187
|
+
super
|
188
|
+
end
|
189
|
+
|
190
|
+
def purchase(amount, payment_method, options = {})
|
191
|
+
if credit_card?(payment_method)
|
192
|
+
action = :purchase
|
193
|
+
request = build_xml_transaction_request do |doc|
|
194
|
+
add_credit_card(doc, payment_method)
|
195
|
+
add_contact(doc, payment_method.name, options)
|
196
|
+
add_amount(doc, amount)
|
197
|
+
add_order_number(doc, options)
|
198
|
+
end
|
199
|
+
elsif echeck?(payment_method)
|
200
|
+
action = :purchase_echeck
|
201
|
+
request = build_xml_transaction_request do |doc|
|
202
|
+
add_echeck(doc, payment_method)
|
203
|
+
add_contact(doc, payment_method.name, options)
|
204
|
+
add_amount(doc, amount)
|
205
|
+
add_order_number(doc, options)
|
206
|
+
end
|
207
|
+
else
|
208
|
+
action = :wallet_sale
|
209
|
+
wallet_id = split_authorization(payment_method).last
|
210
|
+
request = build_xml_transaction_request do |doc|
|
211
|
+
add_amount(doc, amount)
|
212
|
+
add_wallet_id(doc, wallet_id)
|
213
|
+
end
|
214
|
+
end
|
215
|
+
|
216
|
+
commit(action, request)
|
217
|
+
end
|
218
|
+
|
219
|
+
def authorize(amount, payment_method, options = {})
|
220
|
+
if credit_card?(payment_method)
|
221
|
+
request = build_xml_transaction_request do |doc|
|
222
|
+
add_credit_card(doc, payment_method)
|
223
|
+
add_contact(doc, payment_method.name, options)
|
224
|
+
add_amount(doc, amount)
|
225
|
+
end
|
226
|
+
else
|
227
|
+
wallet_id = split_authorization(payment_method).last
|
228
|
+
request = build_xml_transaction_request do |doc|
|
229
|
+
add_amount(doc, amount)
|
230
|
+
add_wallet_id(doc, wallet_id)
|
231
|
+
end
|
232
|
+
end
|
233
|
+
|
234
|
+
commit(:authorize, request)
|
235
|
+
end
|
236
|
+
|
237
|
+
def capture(amount, authorization, options = {})
|
238
|
+
transaction_id = split_authorization(authorization)[1]
|
239
|
+
request = build_xml_transaction_request do |doc|
|
240
|
+
add_amount(doc, amount)
|
241
|
+
add_original_transaction_data(doc, transaction_id)
|
242
|
+
end
|
243
|
+
|
244
|
+
commit(:capture, request)
|
245
|
+
end
|
246
|
+
|
247
|
+
def void(authorization, options = {})
|
248
|
+
action, transaction_id = split_authorization(authorization)
|
249
|
+
|
250
|
+
request = build_xml_transaction_request do |doc|
|
251
|
+
add_original_transaction_data(doc, transaction_id)
|
252
|
+
end
|
253
|
+
|
254
|
+
commit(void_type(action), request)
|
255
|
+
end
|
256
|
+
|
257
|
+
def refund(amount, authorization, options = {})
|
258
|
+
action, transaction_id = split_authorization(authorization)
|
259
|
+
|
260
|
+
request = build_xml_transaction_request do |doc|
|
261
|
+
add_amount(doc, amount) unless action == 'purchase_echeck'
|
262
|
+
add_original_transaction_data(doc, transaction_id)
|
263
|
+
end
|
264
|
+
|
265
|
+
commit(refund_type(action), request)
|
266
|
+
end
|
267
|
+
|
268
|
+
def credit(amount, payment_method, options = {})
|
269
|
+
request = build_xml_transaction_request do |doc|
|
270
|
+
add_pan(doc, payment_method)
|
271
|
+
add_amount(doc, amount)
|
272
|
+
end
|
273
|
+
|
274
|
+
commit(:credit, request)
|
275
|
+
end
|
276
|
+
|
277
|
+
def verify(credit_card, options = {})
|
278
|
+
request = build_xml_transaction_request do |doc|
|
279
|
+
add_credit_card(doc, credit_card)
|
280
|
+
add_contact(doc, credit_card.name, options)
|
281
|
+
end
|
282
|
+
|
283
|
+
commit(:verify, request)
|
284
|
+
end
|
285
|
+
|
286
|
+
def store(payment_method, options = {})
|
287
|
+
store_customer_request = build_xml_payment_storage_request do |doc|
|
288
|
+
store_customer_details(doc, payment_method.name, options)
|
289
|
+
end
|
290
|
+
|
291
|
+
MultiResponse.run do |r|
|
292
|
+
r.process { commit(:store, store_customer_request) }
|
293
|
+
return r unless r.success? && r.params['custId']
|
294
|
+
|
295
|
+
customer_id = r.params['custId']
|
296
|
+
|
297
|
+
store_payment_method_request = build_xml_payment_storage_request do |doc|
|
298
|
+
doc['v1'].cust do
|
299
|
+
add_customer_id(doc, customer_id)
|
300
|
+
doc['v1'].pmt do
|
301
|
+
doc['v1'].type 0 # add
|
302
|
+
add_credit_card(doc, payment_method)
|
303
|
+
end
|
304
|
+
end
|
305
|
+
end
|
306
|
+
|
307
|
+
r.process { commit(:store, store_payment_method_request) }
|
308
|
+
end
|
309
|
+
end
|
310
|
+
|
311
|
+
def supports_scrubbing?
|
312
|
+
true
|
313
|
+
end
|
314
|
+
|
315
|
+
def scrub(transcript)
|
316
|
+
transcript.
|
317
|
+
gsub(%r((<[^>]+pan>)[^<]+(<))i, '\1[FILTERED]\2').
|
318
|
+
gsub(%r((<[^>]+sec>)[^<]+(<))i, '\1[FILTERED]\2').
|
319
|
+
gsub(%r((<[^>]+id>)[^<]+(<))i, '\1[FILTERED]\2').
|
320
|
+
gsub(%r((<[^>]+regKey>)[^<]+(<))i, '\1[FILTERED]\2').
|
321
|
+
gsub(%r((<[^>]+acctNr>)[^<]+(<))i, '\1[FILTERED]\2')
|
322
|
+
end
|
323
|
+
|
324
|
+
private
|
325
|
+
|
326
|
+
CURRENCY_CODES = Hash.new { |_h, k| raise ArgumentError.new("Unsupported currency: #{k}") }
|
327
|
+
CURRENCY_CODES['USD'] = '840'
|
328
|
+
|
329
|
+
def headers
|
330
|
+
{
|
331
|
+
'Content-Type' => 'text/xml'
|
332
|
+
}
|
333
|
+
end
|
334
|
+
|
335
|
+
def commit(action, request)
|
336
|
+
request = add_transaction_code_to_request(request, action)
|
337
|
+
|
338
|
+
raw_response =
|
339
|
+
begin
|
340
|
+
ssl_post(url, request, headers)
|
341
|
+
rescue ActiveMerchant::ResponseError => e
|
342
|
+
e.response.body
|
343
|
+
end
|
344
|
+
|
345
|
+
response = parse(raw_response)
|
346
|
+
|
347
|
+
succeeded = success_from(response)
|
348
|
+
|
349
|
+
Response.new(
|
350
|
+
succeeded,
|
351
|
+
message_from(succeeded, response),
|
352
|
+
response,
|
353
|
+
error_code: error_code_from(succeeded, response),
|
354
|
+
authorization: authorization_from(action, response),
|
355
|
+
avs_result: AVSResult.new(code: response['avsRslt']),
|
356
|
+
cvv_result: CVVResult.new(response['secRslt']),
|
357
|
+
test: test?
|
358
|
+
)
|
359
|
+
end
|
360
|
+
|
361
|
+
def url
|
362
|
+
test? ? test_url : live_url
|
363
|
+
end
|
364
|
+
|
365
|
+
def parse(xml)
|
366
|
+
response = {}
|
367
|
+
doc = Nokogiri::XML(xml).remove_namespaces!
|
368
|
+
|
369
|
+
doc.css('Envelope Body *').each do |node|
|
370
|
+
# node.name is more readable, but uniq_name is occasionally necessary
|
371
|
+
uniq_name = [node.parent.name, node.name].join('_')
|
372
|
+
response[uniq_name] = node.text
|
373
|
+
response[node.name] = node.text
|
374
|
+
end
|
375
|
+
|
376
|
+
response
|
377
|
+
end
|
378
|
+
|
379
|
+
def success_from(response)
|
380
|
+
fault = response['Fault']
|
381
|
+
approved_transaction = APPROVAL_CODES.include?(response['rspCode'])
|
382
|
+
found_contact = response['FndRecurrProfResponse']
|
383
|
+
|
384
|
+
return !fault && (approved_transaction || found_contact)
|
385
|
+
end
|
386
|
+
|
387
|
+
def error_code_from(succeeded, response)
|
388
|
+
return if succeeded
|
389
|
+
|
390
|
+
response['errorCode'] || response['rspCode']
|
391
|
+
end
|
392
|
+
|
393
|
+
def message_from(succeeded, response)
|
394
|
+
return 'Succeeded' if succeeded
|
395
|
+
|
396
|
+
if response['rspCode']
|
397
|
+
code = response['rspCode']
|
398
|
+
extended_code = response['extRspCode']
|
399
|
+
|
400
|
+
message = RESPONSE_MESSAGES[code]
|
401
|
+
extended = EXTENDED_RESPONSE_MESSAGES[extended_code]
|
402
|
+
ach_response = response['achResponse']
|
403
|
+
|
404
|
+
[message, extended, ach_response].compact.join('. ')
|
405
|
+
else
|
406
|
+
response['faultstring']
|
407
|
+
end
|
408
|
+
end
|
409
|
+
|
410
|
+
def authorization_from(action, response)
|
411
|
+
authorization = response['tranNr'] || response['pmtId']
|
412
|
+
|
413
|
+
# guard so we don't return something like "purchase|"
|
414
|
+
return unless authorization
|
415
|
+
|
416
|
+
[action, authorization].join(AUTHORIZATION_FIELD_SEPARATOR)
|
417
|
+
end
|
418
|
+
|
419
|
+
# -- helper methods ----------------------------------------------------
|
420
|
+
def credit_card?(payment_method)
|
421
|
+
payment_method.respond_to?(:verification_value)
|
422
|
+
end
|
423
|
+
|
424
|
+
def echeck?(payment_method)
|
425
|
+
payment_method.respond_to?(:routing_number)
|
426
|
+
end
|
427
|
+
|
428
|
+
def split_authorization(authorization)
|
429
|
+
authorization.split(AUTHORIZATION_FIELD_SEPARATOR)
|
430
|
+
end
|
431
|
+
|
432
|
+
def void_type(action)
|
433
|
+
action == 'purchase_echeck' ? :void_echeck : :"void_#{action}"
|
434
|
+
end
|
435
|
+
|
436
|
+
def refund_type(action)
|
437
|
+
action == 'purchase_echeck' ? :refund_echeck : :refund
|
438
|
+
end
|
439
|
+
|
440
|
+
# -- request methods ---------------------------------------------------
|
441
|
+
def build_xml_transaction_request
|
442
|
+
build_xml_request('SendTranRequest') do |doc|
|
443
|
+
yield doc
|
444
|
+
end
|
445
|
+
end
|
446
|
+
|
447
|
+
def build_xml_payment_storage_request
|
448
|
+
build_xml_request('UpdtRecurrProfRequest') do |doc|
|
449
|
+
yield doc
|
450
|
+
end
|
451
|
+
end
|
452
|
+
|
453
|
+
def build_xml_payment_update_request
|
454
|
+
merchant_product_type = 5 # credit card
|
455
|
+
build_xml_request('UpdtRecurrProfRequest', merchant_product_type) do |doc|
|
456
|
+
yield doc
|
457
|
+
end
|
458
|
+
end
|
459
|
+
|
460
|
+
def build_xml_payment_search_request
|
461
|
+
build_xml_request('FndRecurrProfRequest') do |doc|
|
462
|
+
yield doc
|
463
|
+
end
|
464
|
+
end
|
465
|
+
|
466
|
+
def build_xml_request(wrapper, merchant_product_type = nil)
|
467
|
+
Nokogiri::XML::Builder.new(encoding: 'UTF-8') do |xml|
|
468
|
+
xml['soapenv'].Envelope('xmlns:soapenv' => SOAPENV_NAMESPACE) do
|
469
|
+
xml['soapenv'].Body do
|
470
|
+
xml['v1'].send(wrapper, 'xmlns:v1' => V1_NAMESPACE) do
|
471
|
+
add_merchant(xml)
|
472
|
+
yield(xml)
|
473
|
+
end
|
474
|
+
end
|
475
|
+
end
|
476
|
+
end.doc.root.to_xml
|
477
|
+
end
|
478
|
+
|
479
|
+
def add_transaction_code_to_request(request, action)
|
480
|
+
# store requests don't get a transaction code
|
481
|
+
return request if action == :store
|
482
|
+
|
483
|
+
doc = Nokogiri::XML::Document.parse(request)
|
484
|
+
merc_nodeset = doc.xpath('//v1:merc', 'v1' => V1_NAMESPACE)
|
485
|
+
merc_nodeset.after "<tranCode>#{TRANSACTION_CODES[action]}</tranCode>"
|
486
|
+
doc.root.to_xml
|
487
|
+
end
|
488
|
+
|
489
|
+
def add_merchant(doc, product_type = nil)
|
490
|
+
doc['v1'].merc do
|
491
|
+
doc['v1'].id @options[:gateway_id]
|
492
|
+
doc['v1'].regKey @options[:reg_key]
|
493
|
+
doc['v1'].inType '1'
|
494
|
+
doc['v1'].prodType product_type if product_type
|
495
|
+
end
|
496
|
+
end
|
497
|
+
|
498
|
+
def add_amount(doc, money)
|
499
|
+
doc['v1'].reqAmt amount(money)
|
500
|
+
end
|
501
|
+
|
502
|
+
def add_order_number(doc, options)
|
503
|
+
return unless options[:order_id]
|
504
|
+
|
505
|
+
doc['v1'].authReq {
|
506
|
+
doc['v1'].ordNr options[:order_id]
|
507
|
+
}
|
508
|
+
end
|
509
|
+
|
510
|
+
def add_credit_card(doc, payment_method)
|
511
|
+
doc['v1'].card {
|
512
|
+
doc['v1'].pan payment_method.number
|
513
|
+
doc['v1'].sec payment_method.verification_value if payment_method.verification_value?
|
514
|
+
doc['v1'].xprDt expiration_date(payment_method)
|
515
|
+
}
|
516
|
+
end
|
517
|
+
|
518
|
+
def add_echeck(doc, payment_method)
|
519
|
+
doc['v1'].achEcheck {
|
520
|
+
doc['v1'].bankRtNr payment_method.routing_number
|
521
|
+
doc['v1'].acctNr payment_method.account_number
|
522
|
+
}
|
523
|
+
end
|
524
|
+
|
525
|
+
def expiration_date(payment_method)
|
526
|
+
yy = format(payment_method.year, :two_digits)
|
527
|
+
mm = format(payment_method.month, :two_digits)
|
528
|
+
yy + mm
|
529
|
+
end
|
530
|
+
|
531
|
+
def add_pan(doc, payment_method)
|
532
|
+
doc['v1'].card do
|
533
|
+
doc['v1'].pan payment_method.number
|
534
|
+
end
|
535
|
+
end
|
536
|
+
|
537
|
+
def add_contact(doc, fullname, options)
|
538
|
+
doc['v1'].contact do
|
539
|
+
doc['v1'].fullName fullname unless fullname.blank?
|
540
|
+
doc['v1'].coName options[:company_name] if options[:company_name]
|
541
|
+
doc['v1'].title options[:title] if options[:title]
|
542
|
+
|
543
|
+
if (billing_address = options[:billing_address])
|
544
|
+
if billing_address[:phone]
|
545
|
+
doc['v1'].phone do
|
546
|
+
doc['v1'].type(options[:phone_number_type] || '4')
|
547
|
+
doc['v1'].nr billing_address[:phone].gsub(/\D/, '')
|
548
|
+
end
|
549
|
+
end
|
550
|
+
doc['v1'].addrLn1 billing_address[:address1] if billing_address[:address1]
|
551
|
+
doc['v1'].addrLn2 billing_address[:address2] unless billing_address[:address2].blank?
|
552
|
+
doc['v1'].city billing_address[:city] if billing_address[:city]
|
553
|
+
doc['v1'].state billing_address[:state] if billing_address[:state]
|
554
|
+
doc['v1'].zipCode billing_address[:zip].delete('-') if billing_address[:zip]
|
555
|
+
doc['v1'].ctry 'US'
|
556
|
+
end
|
557
|
+
|
558
|
+
doc['v1'].email options[:email] if options[:email]
|
559
|
+
doc['v1'].type options[:contact_type] if options[:contact_type]
|
560
|
+
doc['v1'].stat options[:contact_stat] if options[:contact_stat]
|
561
|
+
|
562
|
+
if (shipping_address = options[:shipping_address])
|
563
|
+
doc['v1'].ship do
|
564
|
+
doc['v1'].fullName fullname unless fullname.blank?
|
565
|
+
doc['v1'].addrLn1 shipping_address[:address1] if shipping_address[:address1]
|
566
|
+
doc['v1'].addrLn2 shipping_address[:address2] unless shipping_address[:address2].blank?
|
567
|
+
doc['v1'].city shipping_address[:city] if shipping_address[:city]
|
568
|
+
doc['v1'].state shipping_address[:state] if shipping_address[:state]
|
569
|
+
doc['v1'].zipCode shipping_address[:zip].delete('-') if shipping_address[:zip]
|
570
|
+
doc['v1'].phone shipping_address[:phone].gsub(/\D/, '') if shipping_address[:phone]
|
571
|
+
doc['v1'].email shipping_address[:email] if shipping_address[:email]
|
572
|
+
end
|
573
|
+
end
|
574
|
+
end
|
575
|
+
end
|
576
|
+
|
577
|
+
def add_name(doc, payment_method)
|
578
|
+
doc['v1'].contact do
|
579
|
+
doc['v1'].fullName payment_method.name unless payment_method.name.blank?
|
580
|
+
end
|
581
|
+
end
|
582
|
+
|
583
|
+
def add_original_transaction_data(doc, authorization)
|
584
|
+
doc['v1'].origTranData do
|
585
|
+
doc['v1'].tranNr authorization
|
586
|
+
end
|
587
|
+
end
|
588
|
+
|
589
|
+
def store_customer_details(doc, fullname, options)
|
590
|
+
options[:contact_type] = 1 # recurring
|
591
|
+
options[:contact_stat] = 1 # active
|
592
|
+
|
593
|
+
doc['v1'].cust do
|
594
|
+
doc['v1'].type 0 # add
|
595
|
+
add_contact(doc, fullname, options)
|
596
|
+
end
|
597
|
+
end
|
598
|
+
|
599
|
+
def add_customer_id(doc, customer_id)
|
600
|
+
doc['v1'].contact do
|
601
|
+
doc['v1'].id customer_id
|
602
|
+
end
|
603
|
+
end
|
604
|
+
|
605
|
+
def add_wallet_id(doc, wallet_id)
|
606
|
+
doc['v1'].recurMan do
|
607
|
+
doc['v1'].id wallet_id
|
608
|
+
end
|
609
|
+
end
|
610
|
+
end
|
611
|
+
end
|
612
|
+
end
|