tanga_activemerchant 1.37.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG +1202 -0
- data/CONTRIBUTORS +414 -0
- data/MIT-LICENSE +20 -0
- data/README.md +221 -0
- data/gem-public_cert.pem +20 -0
- data/lib/active_merchant/billing/avs_result.rb +98 -0
- data/lib/active_merchant/billing/base.rb +57 -0
- data/lib/active_merchant/billing/check.rb +69 -0
- data/lib/active_merchant/billing/credit_card.rb +283 -0
- data/lib/active_merchant/billing/credit_card_formatting.rb +21 -0
- data/lib/active_merchant/billing/credit_card_methods.rb +143 -0
- data/lib/active_merchant/billing/cvv_result.rb +38 -0
- data/lib/active_merchant/billing/expiry_date.rb +34 -0
- data/lib/active_merchant/billing/gateway.rb +181 -0
- data/lib/active_merchant/billing/gateways/authorize_net.rb +725 -0
- data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +956 -0
- data/lib/active_merchant/billing/gateways/balanced.rb +468 -0
- data/lib/active_merchant/billing/gateways/banwire.rb +105 -0
- data/lib/active_merchant/billing/gateways/barclays_epdq.rb +314 -0
- data/lib/active_merchant/billing/gateways/barclays_epdq_extra_plus.rb +15 -0
- data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +393 -0
- data/lib/active_merchant/billing/gateways/beanstream.rb +169 -0
- data/lib/active_merchant/billing/gateways/beanstream_interac.rb +54 -0
- data/lib/active_merchant/billing/gateways/blue_pay.rb +501 -0
- data/lib/active_merchant/billing/gateways/bogus.rb +142 -0
- data/lib/active_merchant/billing/gateways/braintree/braintree_common.rb +9 -0
- data/lib/active_merchant/billing/gateways/braintree.rb +19 -0
- data/lib/active_merchant/billing/gateways/braintree_blue.rb +401 -0
- data/lib/active_merchant/billing/gateways/braintree_orange.rb +19 -0
- data/lib/active_merchant/billing/gateways/card_save.rb +23 -0
- data/lib/active_merchant/billing/gateways/card_stream.rb +225 -0
- data/lib/active_merchant/billing/gateways/card_stream_modern.rb +155 -0
- data/lib/active_merchant/billing/gateways/cc5.rb +156 -0
- data/lib/active_merchant/billing/gateways/certo_direct.rb +277 -0
- data/lib/active_merchant/billing/gateways/cyber_source.rb +639 -0
- data/lib/active_merchant/billing/gateways/data_cash.rb +591 -0
- data/lib/active_merchant/billing/gateways/efsnet.rb +230 -0
- data/lib/active_merchant/billing/gateways/elavon.rb +312 -0
- data/lib/active_merchant/billing/gateways/epay.rb +275 -0
- data/lib/active_merchant/billing/gateways/evo_ca.rb +308 -0
- data/lib/active_merchant/billing/gateways/eway.rb +225 -0
- data/lib/active_merchant/billing/gateways/eway_managed.rb +291 -0
- data/lib/active_merchant/billing/gateways/eway_rapid.rb +320 -0
- data/lib/active_merchant/billing/gateways/exact.rb +218 -0
- data/lib/active_merchant/billing/gateways/fat_zebra.rb +173 -0
- data/lib/active_merchant/billing/gateways/federated_canada.rb +167 -0
- data/lib/active_merchant/billing/gateways/finansbank.rb +22 -0
- data/lib/active_merchant/billing/gateways/first_pay.rb +176 -0
- data/lib/active_merchant/billing/gateways/firstdata_e4.rb +314 -0
- data/lib/active_merchant/billing/gateways/garanti.rb +257 -0
- data/lib/active_merchant/billing/gateways/hdfc.rb +207 -0
- data/lib/active_merchant/billing/gateways/iats_payments.rb +35 -0
- data/lib/active_merchant/billing/gateways/ideal/ideal_base.rb +249 -0
- data/lib/active_merchant/billing/gateways/ideal/ideal_rabobank.pem +13 -0
- data/lib/active_merchant/billing/gateways/ideal/ideal_response.rb +29 -0
- data/lib/active_merchant/billing/gateways/ideal_rabobank.rb +66 -0
- data/lib/active_merchant/billing/gateways/inspire.rb +221 -0
- data/lib/active_merchant/billing/gateways/instapay.rb +163 -0
- data/lib/active_merchant/billing/gateways/iridium.rb +262 -0
- data/lib/active_merchant/billing/gateways/itransact.rb +448 -0
- data/lib/active_merchant/billing/gateways/jetpay.rb +275 -0
- data/lib/active_merchant/billing/gateways/linkpoint.rb +447 -0
- data/lib/active_merchant/billing/gateways/litle.rb +554 -0
- data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +176 -0
- data/lib/active_merchant/billing/gateways/merchant_one.rb +115 -0
- data/lib/active_merchant/billing/gateways/merchant_ware.rb +322 -0
- data/lib/active_merchant/billing/gateways/merchant_ware_version_four.rb +275 -0
- data/lib/active_merchant/billing/gateways/merchant_warrior.rb +191 -0
- data/lib/active_merchant/billing/gateways/mercury.rb +311 -0
- data/lib/active_merchant/billing/gateways/metrics_global.rb +322 -0
- data/lib/active_merchant/billing/gateways/migs/migs_codes.rb +100 -0
- data/lib/active_merchant/billing/gateways/migs.rb +265 -0
- data/lib/active_merchant/billing/gateways/modern_payments.rb +37 -0
- data/lib/active_merchant/billing/gateways/modern_payments_cim.rb +219 -0
- data/lib/active_merchant/billing/gateways/moneris.rb +244 -0
- data/lib/active_merchant/billing/gateways/moneris_us.rb +208 -0
- data/lib/active_merchant/billing/gateways/nab_transact.rb +277 -0
- data/lib/active_merchant/billing/gateways/net_registry.rb +193 -0
- data/lib/active_merchant/billing/gateways/netaxept.rb +181 -0
- data/lib/active_merchant/billing/gateways/netbilling.rb +197 -0
- data/lib/active_merchant/billing/gateways/netpay.rb +223 -0
- data/lib/active_merchant/billing/gateways/nmi.rb +20 -0
- data/lib/active_merchant/billing/gateways/ogone.rb +421 -0
- data/lib/active_merchant/billing/gateways/optimal_payment.rb +297 -0
- data/lib/active_merchant/billing/gateways/orbital/avs_result.rb +93 -0
- data/lib/active_merchant/billing/gateways/orbital/orbital_soft_descriptors.rb +46 -0
- data/lib/active_merchant/billing/gateways/orbital.rb +633 -0
- data/lib/active_merchant/billing/gateways/pay_gate_xml.rb +261 -0
- data/lib/active_merchant/billing/gateways/pay_junction.rb +396 -0
- data/lib/active_merchant/billing/gateways/pay_secure.rb +119 -0
- data/lib/active_merchant/billing/gateways/paybox_direct.rb +196 -0
- data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +209 -0
- data/lib/active_merchant/billing/gateways/payflow/payflow_express_response.rb +39 -0
- data/lib/active_merchant/billing/gateways/payflow/payflow_response.rb +13 -0
- data/lib/active_merchant/billing/gateways/payflow.rb +268 -0
- data/lib/active_merchant/billing/gateways/payflow_express.rb +224 -0
- data/lib/active_merchant/billing/gateways/payflow_express_uk.rb +15 -0
- data/lib/active_merchant/billing/gateways/payflow_uk.rb +21 -0
- data/lib/active_merchant/billing/gateways/payment_express.rb +353 -0
- data/lib/active_merchant/billing/gateways/paymill.rb +179 -0
- data/lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb +670 -0
- data/lib/active_merchant/billing/gateways/paypal/paypal_express_response.rb +61 -0
- data/lib/active_merchant/billing/gateways/paypal/paypal_recurring_api.rb +248 -0
- data/lib/active_merchant/billing/gateways/paypal.rb +106 -0
- data/lib/active_merchant/billing/gateways/paypal_ca.rb +13 -0
- data/lib/active_merchant/billing/gateways/paypal_digital_goods.rb +43 -0
- data/lib/active_merchant/billing/gateways/paypal_express.rb +239 -0
- data/lib/active_merchant/billing/gateways/paypal_express_common.rb +30 -0
- data/lib/active_merchant/billing/gateways/paystation.rb +199 -0
- data/lib/active_merchant/billing/gateways/payway.rb +207 -0
- data/lib/active_merchant/billing/gateways/pin.rb +165 -0
- data/lib/active_merchant/billing/gateways/plugnpay.rb +294 -0
- data/lib/active_merchant/billing/gateways/psigate.rb +227 -0
- data/lib/active_merchant/billing/gateways/psl_card.rb +303 -0
- data/lib/active_merchant/billing/gateways/qbms.rb +292 -0
- data/lib/active_merchant/billing/gateways/quantum.rb +276 -0
- data/lib/active_merchant/billing/gateways/quickpay.rb +335 -0
- data/lib/active_merchant/billing/gateways/realex.rb +303 -0
- data/lib/active_merchant/billing/gateways/redsys.rb +394 -0
- data/lib/active_merchant/billing/gateways/sage/sage_bankcard.rb +93 -0
- data/lib/active_merchant/billing/gateways/sage/sage_core.rb +114 -0
- data/lib/active_merchant/billing/gateways/sage/sage_virtual_check.rb +102 -0
- data/lib/active_merchant/billing/gateways/sage.rb +152 -0
- data/lib/active_merchant/billing/gateways/sage_pay.rb +324 -0
- data/lib/active_merchant/billing/gateways/sallie_mae.rb +143 -0
- data/lib/active_merchant/billing/gateways/samurai.rb +118 -0
- data/lib/active_merchant/billing/gateways/secure_net.rb +261 -0
- data/lib/active_merchant/billing/gateways/secure_pay.rb +28 -0
- data/lib/active_merchant/billing/gateways/secure_pay_au.rb +279 -0
- data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +112 -0
- data/lib/active_merchant/billing/gateways/skip_jack.rb +453 -0
- data/lib/active_merchant/billing/gateways/smart_ps.rb +272 -0
- data/lib/active_merchant/billing/gateways/spreedly_core.rb +233 -0
- data/lib/active_merchant/billing/gateways/stripe.rb +316 -0
- data/lib/active_merchant/billing/gateways/trans_first.rb +126 -0
- data/lib/active_merchant/billing/gateways/transax.rb +23 -0
- data/lib/active_merchant/billing/gateways/transnational.rb +239 -0
- data/lib/active_merchant/billing/gateways/trust_commerce.rb +421 -0
- data/lib/active_merchant/billing/gateways/usa_epay.rb +25 -0
- data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +1501 -0
- data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +201 -0
- data/lib/active_merchant/billing/gateways/verifi.rb +232 -0
- data/lib/active_merchant/billing/gateways/viaklix.rb +189 -0
- data/lib/active_merchant/billing/gateways/vindicia.rb +361 -0
- data/lib/active_merchant/billing/gateways/webpay.rb +57 -0
- data/lib/active_merchant/billing/gateways/wirecard.rb +313 -0
- data/lib/active_merchant/billing/gateways/worldpay.rb +303 -0
- data/lib/active_merchant/billing/gateways.rb +17 -0
- data/lib/active_merchant/billing/integrations/a1agregator/helper.rb +31 -0
- data/lib/active_merchant/billing/integrations/a1agregator/notification.rb +186 -0
- data/lib/active_merchant/billing/integrations/a1agregator/status.rb +38 -0
- data/lib/active_merchant/billing/integrations/a1agregator.rb +26 -0
- data/lib/active_merchant/billing/integrations/action_view_helper.rb +73 -0
- data/lib/active_merchant/billing/integrations/authorize_net_sim/helper.rb +229 -0
- data/lib/active_merchant/billing/integrations/authorize_net_sim/notification.rb +340 -0
- data/lib/active_merchant/billing/integrations/authorize_net_sim.rb +38 -0
- data/lib/active_merchant/billing/integrations/bogus/helper.rb +17 -0
- data/lib/active_merchant/billing/integrations/bogus/notification.rb +11 -0
- data/lib/active_merchant/billing/integrations/bogus/return.rb +10 -0
- data/lib/active_merchant/billing/integrations/bogus.rb +23 -0
- data/lib/active_merchant/billing/integrations/chronopay/helper.rb +120 -0
- data/lib/active_merchant/billing/integrations/chronopay/notification.rb +158 -0
- data/lib/active_merchant/billing/integrations/chronopay/return.rb +10 -0
- data/lib/active_merchant/billing/integrations/chronopay.rb +23 -0
- data/lib/active_merchant/billing/integrations/direc_pay/helper.rb +200 -0
- data/lib/active_merchant/billing/integrations/direc_pay/notification.rb +76 -0
- data/lib/active_merchant/billing/integrations/direc_pay/return.rb +32 -0
- data/lib/active_merchant/billing/integrations/direc_pay/status.rb +37 -0
- data/lib/active_merchant/billing/integrations/direc_pay.rb +41 -0
- data/lib/active_merchant/billing/integrations/directebanking/helper.rb +90 -0
- data/lib/active_merchant/billing/integrations/directebanking/notification.rb +120 -0
- data/lib/active_merchant/billing/integrations/directebanking/return.rb +11 -0
- data/lib/active_merchant/billing/integrations/directebanking.rb +47 -0
- data/lib/active_merchant/billing/integrations/dotpay/helper.rb +77 -0
- data/lib/active_merchant/billing/integrations/dotpay/notification.rb +86 -0
- data/lib/active_merchant/billing/integrations/dotpay/return.rb +11 -0
- data/lib/active_merchant/billing/integrations/dotpay.rb +22 -0
- data/lib/active_merchant/billing/integrations/dwolla/common.rb +23 -0
- data/lib/active_merchant/billing/integrations/dwolla/helper.rb +43 -0
- data/lib/active_merchant/billing/integrations/dwolla/notification.rb +64 -0
- data/lib/active_merchant/billing/integrations/dwolla/return.rb +49 -0
- data/lib/active_merchant/billing/integrations/dwolla.rb +23 -0
- data/lib/active_merchant/billing/integrations/e_payment_plans/helper.rb +34 -0
- data/lib/active_merchant/billing/integrations/e_payment_plans/notification.rb +84 -0
- data/lib/active_merchant/billing/integrations/e_payment_plans.rb +48 -0
- data/lib/active_merchant/billing/integrations/easy_pay/common.rb +40 -0
- data/lib/active_merchant/billing/integrations/easy_pay/helper.rb +36 -0
- data/lib/active_merchant/billing/integrations/easy_pay/notification.rb +59 -0
- data/lib/active_merchant/billing/integrations/easy_pay.rb +30 -0
- data/lib/active_merchant/billing/integrations/epay/helper.rb +55 -0
- data/lib/active_merchant/billing/integrations/epay/notification.rb +110 -0
- data/lib/active_merchant/billing/integrations/epay.rb +21 -0
- data/lib/active_merchant/billing/integrations/first_data/helper.rb +61 -0
- data/lib/active_merchant/billing/integrations/first_data/notification.rb +56 -0
- data/lib/active_merchant/billing/integrations/first_data.rb +38 -0
- data/lib/active_merchant/billing/integrations/gestpay/common.rb +42 -0
- data/lib/active_merchant/billing/integrations/gestpay/helper.rb +70 -0
- data/lib/active_merchant/billing/integrations/gestpay/notification.rb +85 -0
- data/lib/active_merchant/billing/integrations/gestpay/return.rb +10 -0
- data/lib/active_merchant/billing/integrations/gestpay.rb +25 -0
- data/lib/active_merchant/billing/integrations/helper.rb +117 -0
- data/lib/active_merchant/billing/integrations/hi_trust/helper.rb +58 -0
- data/lib/active_merchant/billing/integrations/hi_trust/notification.rb +59 -0
- data/lib/active_merchant/billing/integrations/hi_trust/return.rb +67 -0
- data/lib/active_merchant/billing/integrations/hi_trust.rb +27 -0
- data/lib/active_merchant/billing/integrations/ipay88/helper.rb +114 -0
- data/lib/active_merchant/billing/integrations/ipay88/return.rb +95 -0
- data/lib/active_merchant/billing/integrations/ipay88.rb +19 -0
- data/lib/active_merchant/billing/integrations/liqpay/helper.rb +43 -0
- data/lib/active_merchant/billing/integrations/liqpay/notification.rb +89 -0
- data/lib/active_merchant/billing/integrations/liqpay/return.rb +83 -0
- data/lib/active_merchant/billing/integrations/liqpay.rb +30 -0
- data/lib/active_merchant/billing/integrations/maksuturva/helper.rb +119 -0
- data/lib/active_merchant/billing/integrations/maksuturva/notification.rb +48 -0
- data/lib/active_merchant/billing/integrations/maksuturva.rb +86 -0
- data/lib/active_merchant/billing/integrations/moneybookers/helper.rb +75 -0
- data/lib/active_merchant/billing/integrations/moneybookers/notification.rb +129 -0
- data/lib/active_merchant/billing/integrations/moneybookers.rb +26 -0
- data/lib/active_merchant/billing/integrations/nochex/helper.rb +68 -0
- data/lib/active_merchant/billing/integrations/nochex/notification.rb +94 -0
- data/lib/active_merchant/billing/integrations/nochex/return.rb +10 -0
- data/lib/active_merchant/billing/integrations/nochex.rb +88 -0
- data/lib/active_merchant/billing/integrations/notification.rb +71 -0
- data/lib/active_merchant/billing/integrations/paxum/common.rb +24 -0
- data/lib/active_merchant/billing/integrations/paxum/helper.rb +42 -0
- data/lib/active_merchant/billing/integrations/paxum/notification.rb +33 -0
- data/lib/active_merchant/billing/integrations/paxum.rb +44 -0
- data/lib/active_merchant/billing/integrations/pay_fast/common.rb +42 -0
- data/lib/active_merchant/billing/integrations/pay_fast/helper.rb +50 -0
- data/lib/active_merchant/billing/integrations/pay_fast/notification.rb +134 -0
- data/lib/active_merchant/billing/integrations/pay_fast/return.rb +10 -0
- data/lib/active_merchant/billing/integrations/pay_fast.rb +70 -0
- data/lib/active_merchant/billing/integrations/payflow_link/helper.rb +116 -0
- data/lib/active_merchant/billing/integrations/payflow_link/notification.rb +78 -0
- data/lib/active_merchant/billing/integrations/payflow_link.rb +21 -0
- data/lib/active_merchant/billing/integrations/paypal/helper.rb +119 -0
- data/lib/active_merchant/billing/integrations/paypal/notification.rb +227 -0
- data/lib/active_merchant/billing/integrations/paypal/return.rb +10 -0
- data/lib/active_merchant/billing/integrations/paypal.rb +39 -0
- data/lib/active_merchant/billing/integrations/paypal_payments_advanced/helper.rb +15 -0
- data/lib/active_merchant/billing/integrations/paypal_payments_advanced.rb +20 -0
- data/lib/active_merchant/billing/integrations/paysbuy/helper.rb +15 -0
- data/lib/active_merchant/billing/integrations/paysbuy/notification.rb +28 -0
- data/lib/active_merchant/billing/integrations/paysbuy.rb +36 -0
- data/lib/active_merchant/billing/integrations/payu_in/helper.rb +74 -0
- data/lib/active_merchant/billing/integrations/payu_in/notification.rb +165 -0
- data/lib/active_merchant/billing/integrations/payu_in/return.rb +36 -0
- data/lib/active_merchant/billing/integrations/payu_in.rb +43 -0
- data/lib/active_merchant/billing/integrations/platron/helper.rb +32 -0
- data/lib/active_merchant/billing/integrations/platron/notification.rb +113 -0
- data/lib/active_merchant/billing/integrations/platron.rb +28 -0
- data/lib/active_merchant/billing/integrations/pxpay/helper.rb +112 -0
- data/lib/active_merchant/billing/integrations/pxpay/notification.rb +157 -0
- data/lib/active_merchant/billing/integrations/pxpay/return.rb +25 -0
- data/lib/active_merchant/billing/integrations/pxpay.rb +31 -0
- data/lib/active_merchant/billing/integrations/quickpay/helper.rb +74 -0
- data/lib/active_merchant/billing/integrations/quickpay/notification.rb +137 -0
- data/lib/active_merchant/billing/integrations/quickpay.rb +21 -0
- data/lib/active_merchant/billing/integrations/rbkmoney/helper.rb +23 -0
- data/lib/active_merchant/billing/integrations/rbkmoney/notification.rb +91 -0
- data/lib/active_merchant/billing/integrations/rbkmoney.rb +17 -0
- data/lib/active_merchant/billing/integrations/return.rb +42 -0
- data/lib/active_merchant/billing/integrations/robokassa/common.rb +19 -0
- data/lib/active_merchant/billing/integrations/robokassa/helper.rb +50 -0
- data/lib/active_merchant/billing/integrations/robokassa/notification.rb +55 -0
- data/lib/active_merchant/billing/integrations/robokassa/return.rb +17 -0
- data/lib/active_merchant/billing/integrations/robokassa.rb +49 -0
- data/lib/active_merchant/billing/integrations/sage_pay_form/encryption.rb +33 -0
- data/lib/active_merchant/billing/integrations/sage_pay_form/helper.rb +136 -0
- data/lib/active_merchant/billing/integrations/sage_pay_form/notification.rb +210 -0
- data/lib/active_merchant/billing/integrations/sage_pay_form/return.rb +31 -0
- data/lib/active_merchant/billing/integrations/sage_pay_form.rb +37 -0
- data/lib/active_merchant/billing/integrations/two_checkout/helper.rb +91 -0
- data/lib/active_merchant/billing/integrations/two_checkout/notification.rb +139 -0
- data/lib/active_merchant/billing/integrations/two_checkout/return.rb +17 -0
- data/lib/active_merchant/billing/integrations/two_checkout.rb +44 -0
- data/lib/active_merchant/billing/integrations/valitor/helper.rb +86 -0
- data/lib/active_merchant/billing/integrations/valitor/notification.rb +13 -0
- data/lib/active_merchant/billing/integrations/valitor/response_fields.rb +97 -0
- data/lib/active_merchant/billing/integrations/valitor/return.rb +13 -0
- data/lib/active_merchant/billing/integrations/valitor.rb +33 -0
- data/lib/active_merchant/billing/integrations/verkkomaksut/helper.rb +88 -0
- data/lib/active_merchant/billing/integrations/verkkomaksut/notification.rb +59 -0
- data/lib/active_merchant/billing/integrations/verkkomaksut.rb +20 -0
- data/lib/active_merchant/billing/integrations/web_pay/common.rb +50 -0
- data/lib/active_merchant/billing/integrations/web_pay/helper.rb +68 -0
- data/lib/active_merchant/billing/integrations/web_pay/notification.rb +51 -0
- data/lib/active_merchant/billing/integrations/web_pay.rb +45 -0
- data/lib/active_merchant/billing/integrations/webmoney/common.rb +17 -0
- data/lib/active_merchant/billing/integrations/webmoney/helper.rb +40 -0
- data/lib/active_merchant/billing/integrations/webmoney/notification.rb +47 -0
- data/lib/active_merchant/billing/integrations/webmoney.rb +43 -0
- data/lib/active_merchant/billing/integrations/world_pay/helper.rb +101 -0
- data/lib/active_merchant/billing/integrations/world_pay/notification.rb +160 -0
- data/lib/active_merchant/billing/integrations/world_pay.rb +34 -0
- data/lib/active_merchant/billing/integrations.rb +17 -0
- data/lib/active_merchant/billing/response.rb +77 -0
- data/lib/active_merchant/billing.rb +9 -0
- data/lib/active_merchant/version.rb +3 -0
- data/lib/active_merchant.rb +63 -0
- data/lib/activemerchant.rb +1 -0
- data/lib/support/gateway_support.rb +65 -0
- data/lib/support/outbound_hosts.rb +25 -0
- data/lib/support/ssl_verify.rb +93 -0
- metadata +506 -0
@@ -0,0 +1,176 @@
|
|
1
|
+
module ActiveMerchant #:nodoc:
|
2
|
+
module Billing #:nodoc:
|
3
|
+
class MerchantESolutionsGateway < Gateway
|
4
|
+
self.test_url = 'https://cert.merchante-solutions.com/mes-api/tridentApi'
|
5
|
+
self.live_url = 'https://api.merchante-solutions.com/mes-api/tridentApi'
|
6
|
+
|
7
|
+
# The countries the gateway supports merchants from as 2 digit ISO country codes
|
8
|
+
self.supported_countries = ['US']
|
9
|
+
|
10
|
+
# The card types supported by the payment gateway
|
11
|
+
self.supported_cardtypes = [:visa, :master, :american_express, :discover, :jcb]
|
12
|
+
|
13
|
+
# The homepage URL of the gateway
|
14
|
+
self.homepage_url = 'http://www.merchante-solutions.com/'
|
15
|
+
|
16
|
+
# The name of the gateway
|
17
|
+
self.display_name = 'Merchant e-Solutions'
|
18
|
+
|
19
|
+
def initialize(options = {})
|
20
|
+
requires!(options, :login, :password)
|
21
|
+
super
|
22
|
+
end
|
23
|
+
|
24
|
+
def authorize(money, creditcard_or_card_id, options = {})
|
25
|
+
post = {}
|
26
|
+
post[:client_reference_number] = options[:customer] if options.has_key?(:customer)
|
27
|
+
post[:moto_ecommerce_ind] = options[:moto_ecommerce_ind] if options.has_key?(:moto_ecommerce_ind)
|
28
|
+
add_invoice(post, options)
|
29
|
+
add_payment_source(post, creditcard_or_card_id, options)
|
30
|
+
add_address(post, options)
|
31
|
+
commit('P', money, post)
|
32
|
+
end
|
33
|
+
|
34
|
+
def purchase(money, creditcard_or_card_id, options = {})
|
35
|
+
post = {}
|
36
|
+
post[:client_reference_number] = options[:customer] if options.has_key?(:customer)
|
37
|
+
post[:moto_ecommerce_ind] = options[:moto_ecommerce_ind] if options.has_key?(:moto_ecommerce_ind)
|
38
|
+
add_invoice(post, options)
|
39
|
+
add_payment_source(post, creditcard_or_card_id, options)
|
40
|
+
add_address(post, options)
|
41
|
+
commit('D', money, post)
|
42
|
+
end
|
43
|
+
|
44
|
+
def capture(money, transaction_id, options = {})
|
45
|
+
post ={}
|
46
|
+
post[:transaction_id] = transaction_id
|
47
|
+
post[:client_reference_number] = options[:customer] if options.has_key?(:customer)
|
48
|
+
commit('S', money, post)
|
49
|
+
end
|
50
|
+
|
51
|
+
def store(creditcard, options = {})
|
52
|
+
post = {}
|
53
|
+
post[:client_reference_number] = options[:customer] if options.has_key?(:customer)
|
54
|
+
add_creditcard(post, creditcard, options)
|
55
|
+
commit('T', nil, post)
|
56
|
+
end
|
57
|
+
|
58
|
+
def unstore(card_id, options = {})
|
59
|
+
post = {}
|
60
|
+
post[:client_reference_number] = options[:customer] if options.has_key?(:customer)
|
61
|
+
post[:card_id] = card_id
|
62
|
+
commit('X', nil, post)
|
63
|
+
end
|
64
|
+
|
65
|
+
def refund(money, identification, options = {})
|
66
|
+
post = {}
|
67
|
+
post[:transaction_id] = identification
|
68
|
+
post[:client_reference_number] = options[:customer] if options.has_key?(:customer)
|
69
|
+
options.delete(:customer)
|
70
|
+
options.delete(:billing_address)
|
71
|
+
commit('U', money, options.merge(post))
|
72
|
+
end
|
73
|
+
|
74
|
+
def credit(money, creditcard_or_card_id, options = {})
|
75
|
+
post = {}
|
76
|
+
post[:client_reference_number] = options[:customer] if options.has_key?(:customer)
|
77
|
+
add_invoice(post, options)
|
78
|
+
add_payment_source(post, creditcard_or_card_id, options)
|
79
|
+
commit('C', money, post)
|
80
|
+
end
|
81
|
+
|
82
|
+
def void(transaction_id, options = {})
|
83
|
+
post = {}
|
84
|
+
post[:transaction_id] = transaction_id
|
85
|
+
post[:client_reference_number] = options[:customer] if options.has_key?(:customer)
|
86
|
+
options.delete(:customer)
|
87
|
+
options.delete(:billing_address)
|
88
|
+
commit('V', nil, options.merge(post))
|
89
|
+
end
|
90
|
+
|
91
|
+
private
|
92
|
+
|
93
|
+
def add_address(post, options)
|
94
|
+
if address = options[:billing_address] || options[:address]
|
95
|
+
post[:cardholder_street_address] = address[:address1].to_s.gsub(/[^\w.]/, '+')
|
96
|
+
post[:cardholder_zip] = address[:zip].to_s
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
def add_invoice(post, options)
|
101
|
+
if options.has_key? :order_id
|
102
|
+
post[:invoice_number] = options[:order_id].to_s.gsub(/[^\w.]/, '')
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
def add_payment_source(post, creditcard_or_card_id, options)
|
107
|
+
if creditcard_or_card_id.is_a?(String)
|
108
|
+
# using stored card
|
109
|
+
post[:card_id] = creditcard_or_card_id
|
110
|
+
post[:card_exp_date] = options[:expiration_date] if options[:expiration_date]
|
111
|
+
else
|
112
|
+
# card info is provided
|
113
|
+
add_creditcard(post, creditcard_or_card_id, options)
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
def add_creditcard(post, creditcard, options)
|
118
|
+
post[:card_number] = creditcard.number
|
119
|
+
post[:cvv2] = creditcard.verification_value if creditcard.verification_value?
|
120
|
+
post[:card_exp_date] = expdate(creditcard)
|
121
|
+
end
|
122
|
+
|
123
|
+
def parse(body)
|
124
|
+
results = {}
|
125
|
+
body.split(/&/).each do |pair|
|
126
|
+
key,val = pair.split(/=/)
|
127
|
+
results[key] = val
|
128
|
+
end
|
129
|
+
results
|
130
|
+
end
|
131
|
+
|
132
|
+
def commit(action, money, parameters)
|
133
|
+
url = test? ? self.test_url : self.live_url
|
134
|
+
parameters[:transaction_amount] = amount(money) if money unless action == 'V'
|
135
|
+
|
136
|
+
|
137
|
+
response = begin
|
138
|
+
parse( ssl_post(url, post_data(action,parameters)) )
|
139
|
+
rescue ActiveMerchant::ResponseError => e
|
140
|
+
{ "error_code" => "404", "auth_response_text" => e.to_s }
|
141
|
+
end
|
142
|
+
|
143
|
+
Response.new(response["error_code"] == "000", message_from(response), response,
|
144
|
+
:authorization => response["transaction_id"],
|
145
|
+
:test => test?,
|
146
|
+
:cvv_result => response["cvv2_result"],
|
147
|
+
:avs_result => { :code => response["avs_result"] }
|
148
|
+
)
|
149
|
+
end
|
150
|
+
|
151
|
+
def expdate(creditcard)
|
152
|
+
year = sprintf("%.4i", creditcard.year)
|
153
|
+
month = sprintf("%.2i", creditcard.month)
|
154
|
+
"#{month}#{year[-2..-1]}"
|
155
|
+
end
|
156
|
+
|
157
|
+
def message_from(response)
|
158
|
+
if response["error_code"] == "000"
|
159
|
+
"This transaction has been approved"
|
160
|
+
else
|
161
|
+
response["auth_response_text"]
|
162
|
+
end
|
163
|
+
end
|
164
|
+
|
165
|
+
def post_data(action, parameters = {})
|
166
|
+
post = {}
|
167
|
+
post[:profile_id] = @options[:login]
|
168
|
+
post[:profile_key] = @options[:password]
|
169
|
+
post[:transaction_type] = action if action
|
170
|
+
|
171
|
+
request = post.merge(parameters).map {|key,value| "#{key}=#{CGI.escape(value.to_s)}"}.join("&")
|
172
|
+
request
|
173
|
+
end
|
174
|
+
end
|
175
|
+
end
|
176
|
+
end
|
@@ -0,0 +1,115 @@
|
|
1
|
+
require "cgi"
|
2
|
+
|
3
|
+
module ActiveMerchant #:nodoc:
|
4
|
+
module Billing #:nodoc:
|
5
|
+
class MerchantOneGateway < Gateway
|
6
|
+
|
7
|
+
class MerchantOneSslConnection < ActiveMerchant::Connection
|
8
|
+
def configure_ssl(http)
|
9
|
+
super(http)
|
10
|
+
http.use_ssl = true
|
11
|
+
http.ssl_version = :SSLv3
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
BASE_URL = 'https://secure.merchantonegateway.com/api/transact.php'
|
16
|
+
|
17
|
+
self.supported_countries = ['US']
|
18
|
+
self.supported_cardtypes = [:visa, :master, :american_express, :discover]
|
19
|
+
self.homepage_url = 'http://merchantone.com/'
|
20
|
+
self.display_name = 'Merchant One Gateway'
|
21
|
+
self.money_format = :dollars
|
22
|
+
|
23
|
+
def initialize(options = {})
|
24
|
+
requires!(options, :username, :password)
|
25
|
+
super
|
26
|
+
end
|
27
|
+
|
28
|
+
def authorize(money, creditcard, options = {})
|
29
|
+
post = {}
|
30
|
+
add_customer_data(post, options)
|
31
|
+
add_creditcard(post, creditcard)
|
32
|
+
add_address(post, creditcard, options)
|
33
|
+
add_customer_data(post, options)
|
34
|
+
add_amount(post, money, options)
|
35
|
+
commit('auth', money, post)
|
36
|
+
end
|
37
|
+
|
38
|
+
def purchase(money, creditcard, options = {})
|
39
|
+
post = {}
|
40
|
+
add_customer_data(post, options)
|
41
|
+
add_creditcard(post, creditcard)
|
42
|
+
add_address(post, creditcard, options)
|
43
|
+
add_customer_data(post, options)
|
44
|
+
add_amount(post, money, options)
|
45
|
+
commit('sale', money, post)
|
46
|
+
end
|
47
|
+
|
48
|
+
def capture(money, authorization, options = {})
|
49
|
+
post = {}
|
50
|
+
post.merge!(:transactionid => authorization)
|
51
|
+
add_amount(post, money, options)
|
52
|
+
commit('capture', money, post)
|
53
|
+
end
|
54
|
+
|
55
|
+
def new_connection(endpoint)
|
56
|
+
MerchantOneSslConnection.new(endpoint)
|
57
|
+
end
|
58
|
+
|
59
|
+
private
|
60
|
+
|
61
|
+
def add_customer_data(post, options)
|
62
|
+
post['firstname'] = options[:billing_address][:first_name]
|
63
|
+
post['lastname'] = options[:billing_address][:last_name]
|
64
|
+
end
|
65
|
+
|
66
|
+
def add_amount(post, money, options)
|
67
|
+
post['amount'] = amount(money)
|
68
|
+
end
|
69
|
+
|
70
|
+
def add_address(post, creditcard, options)
|
71
|
+
post['address1'] = options[:billing_address][:address1]
|
72
|
+
post['city'] = options[:billing_address][:city]
|
73
|
+
post['state'] = options[:billing_address][:state]
|
74
|
+
post['zip'] = options[:billing_address][:zip]
|
75
|
+
post['country'] = options[:billing_address][:country]
|
76
|
+
end
|
77
|
+
|
78
|
+
def add_creditcard(post, creditcard)
|
79
|
+
post['cvv'] = creditcard.verification_value
|
80
|
+
post['ccnumber'] = creditcard.number
|
81
|
+
post['ccexp'] = "#{sprintf("%02d", creditcard.month)}#{"#{creditcard.year}"[-2, 2]}"
|
82
|
+
end
|
83
|
+
|
84
|
+
def commit(action, money, parameters={})
|
85
|
+
parameters['username'] = @options[:username]
|
86
|
+
parameters['password'] = @options[:password]
|
87
|
+
parse(ssl_post(BASE_URL,post_data(action, parameters)))
|
88
|
+
end
|
89
|
+
|
90
|
+
def post_data(action, parameters = {})
|
91
|
+
parameters.merge!({:type => action})
|
92
|
+
ret = ""
|
93
|
+
for key in parameters.keys
|
94
|
+
ret += "#{key}=#{CGI.escape(parameters[key].to_s)}"
|
95
|
+
if key != parameters.keys.last
|
96
|
+
ret += "&"
|
97
|
+
end
|
98
|
+
end
|
99
|
+
ret.to_s
|
100
|
+
end
|
101
|
+
|
102
|
+
def parse(data)
|
103
|
+
responses = CGI.parse(data).inject({}){|h,(k, v)| h[k] = v.first; h}
|
104
|
+
Response.new(
|
105
|
+
(responses["response"].to_i == 1),
|
106
|
+
responses["responsetext"],
|
107
|
+
responses,
|
108
|
+
:test => test?,
|
109
|
+
:authorization => responses["transactionid"]
|
110
|
+
)
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
@@ -0,0 +1,322 @@
|
|
1
|
+
module ActiveMerchant #:nodoc:
|
2
|
+
module Billing #:nodoc:
|
3
|
+
class MerchantWareGateway < Gateway
|
4
|
+
class_attribute :v4_live_url
|
5
|
+
|
6
|
+
self.live_url = self.test_url = 'https://ps1.merchantware.net/MerchantWARE/ws/RetailTransaction/TXRetail.asmx'
|
7
|
+
self.v4_live_url = 'https://ps1.merchantware.net/Merchantware/ws/RetailTransaction/v4/Credit.asmx'
|
8
|
+
|
9
|
+
self.supported_countries = ['US']
|
10
|
+
self.supported_cardtypes = [:visa, :master, :american_express, :discover]
|
11
|
+
self.homepage_url = 'http://merchantwarehouse.com/merchantware'
|
12
|
+
self.display_name = 'MerchantWARE'
|
13
|
+
|
14
|
+
ENV_NAMESPACES = { "xmlns:xsi" => "http://www.w3.org/2001/XMLSchema-instance",
|
15
|
+
"xmlns:xsd" => "http://www.w3.org/2001/XMLSchema",
|
16
|
+
"xmlns:env" => "http://schemas.xmlsoap.org/soap/envelope/"
|
17
|
+
}
|
18
|
+
ENV_NAMESPACES_V4 = { "xmlns:xsi" => "http://www.w3.org/2001/XMLSchema-instance",
|
19
|
+
"xmlns:xsd" => "http://www.w3.org/2001/XMLSchema",
|
20
|
+
"xmlns:soap" => "http://schemas.xmlsoap.org/soap/envelope/"
|
21
|
+
}
|
22
|
+
|
23
|
+
TX_NAMESPACE = "http://merchantwarehouse.com/MerchantWARE/Client/TransactionRetail"
|
24
|
+
TX_NAMESPACE_V4 = "http://schemas.merchantwarehouse.com/merchantware/40/Credit/"
|
25
|
+
|
26
|
+
ACTIONS = {
|
27
|
+
:purchase => "IssueKeyedSale",
|
28
|
+
:authorize => "IssueKeyedPreAuth",
|
29
|
+
:capture => "IssuePostAuth",
|
30
|
+
:void => "VoidPreAuthorization",
|
31
|
+
:credit => "IssueKeyedRefund",
|
32
|
+
:reference_credit => "IssueRefundByReference"
|
33
|
+
}
|
34
|
+
|
35
|
+
# Creates a new MerchantWareGateway
|
36
|
+
#
|
37
|
+
# The gateway requires that a valid login, password, and name be passed
|
38
|
+
# in the +options+ hash.
|
39
|
+
#
|
40
|
+
# ==== Options
|
41
|
+
#
|
42
|
+
# * <tt>:login</tt> - The MerchantWARE SiteID.
|
43
|
+
# * <tt>:password</tt> - The MerchantWARE Key.
|
44
|
+
# * <tt>:name</tt> - The MerchantWARE Name.
|
45
|
+
def initialize(options = {})
|
46
|
+
requires!(options, :login, :password, :name)
|
47
|
+
super
|
48
|
+
end
|
49
|
+
|
50
|
+
# Authorize a credit card for a given amount.
|
51
|
+
#
|
52
|
+
# ==== Parameters
|
53
|
+
# * <tt>money</tt> - The amount to be authorized as an Integer value in cents.
|
54
|
+
# * <tt>credit_card</tt> - The CreditCard details for the transaction.
|
55
|
+
# * <tt>options</tt>
|
56
|
+
# * <tt>:order_id</tt> - A unique reference for this order (required).
|
57
|
+
# * <tt>:billing_address</tt> - The billing address for the cardholder.
|
58
|
+
def authorize(money, credit_card, options = {})
|
59
|
+
request = build_purchase_request(:authorize, money, credit_card, options)
|
60
|
+
commit(:authorize, request)
|
61
|
+
end
|
62
|
+
|
63
|
+
# Authorize and immediately capture funds from a credit card.
|
64
|
+
#
|
65
|
+
# ==== Parameters
|
66
|
+
# * <tt>money</tt> - The amount to be authorized as anInteger value in cents.
|
67
|
+
# * <tt>credit_card</tt> - The CreditCard details for the transaction.
|
68
|
+
# * <tt>options</tt>
|
69
|
+
# * <tt>:order_id</tt> - A unique reference for this order (required).
|
70
|
+
# * <tt>:billing_address</tt> - The billing address for the cardholder.
|
71
|
+
def purchase(money, credit_card, options = {})
|
72
|
+
request = build_purchase_request(:purchase, money, credit_card, options)
|
73
|
+
commit(:purchase, request)
|
74
|
+
end
|
75
|
+
|
76
|
+
# Capture authorized funds from a credit card.
|
77
|
+
#
|
78
|
+
# ==== Parameters
|
79
|
+
# * <tt>money</tt> - The amount to be captured as anInteger value in cents.
|
80
|
+
# * <tt>authorization</tt> - The authorization string returned from the initial authorization.
|
81
|
+
def capture(money, authorization, options = {})
|
82
|
+
request = build_capture_request(:capture, money, authorization, options)
|
83
|
+
commit(:capture, request)
|
84
|
+
end
|
85
|
+
|
86
|
+
# Void a transaction.
|
87
|
+
#
|
88
|
+
# ==== Parameters
|
89
|
+
# * <tt>authorization</tt> - The authorization string returned from the initial authorization or purchase.
|
90
|
+
def void(authorization, options = {})
|
91
|
+
reference, options[:order_id] = split_reference(authorization)
|
92
|
+
request = v4_soap_request(:void) do |xml|
|
93
|
+
add_reference_token(xml, reference)
|
94
|
+
end
|
95
|
+
commit(:void, request, true)
|
96
|
+
end
|
97
|
+
|
98
|
+
# Refund an amount back a cardholder
|
99
|
+
#
|
100
|
+
# ==== Parameters
|
101
|
+
#
|
102
|
+
# * <tt>money</tt> - The amount to be refunded as an Integer value in cents.
|
103
|
+
# * <tt>identification</tt> - The credit card you want to refund or the authorization for the existing transaction you are refunding.
|
104
|
+
# * <tt>options</tt>
|
105
|
+
# * <tt>:order_id</tt> - A unique reference for this order (required when performing a non-referenced credit)
|
106
|
+
def credit(money, identification, options = {})
|
107
|
+
if identification.is_a?(String)
|
108
|
+
deprecated CREDIT_DEPRECATION_MESSAGE
|
109
|
+
refund(money, identification, options)
|
110
|
+
else
|
111
|
+
perform_credit(money, identification, options)
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
def refund(money, reference, options = {})
|
116
|
+
perform_reference_credit(money, reference, options)
|
117
|
+
end
|
118
|
+
|
119
|
+
private
|
120
|
+
|
121
|
+
def soap_request(action)
|
122
|
+
xml = Builder::XmlMarkup.new :indent => 2
|
123
|
+
xml.instruct!
|
124
|
+
xml.tag! "env:Envelope", ENV_NAMESPACES do
|
125
|
+
xml.tag! "env:Body" do
|
126
|
+
xml.tag! ACTIONS[action], "xmlns" => TX_NAMESPACE do
|
127
|
+
add_credentials(xml)
|
128
|
+
yield xml
|
129
|
+
end
|
130
|
+
end
|
131
|
+
end
|
132
|
+
xml.target!
|
133
|
+
end
|
134
|
+
|
135
|
+
def v4_soap_request(action)
|
136
|
+
xml = Builder::XmlMarkup.new :indent => 2
|
137
|
+
xml.instruct!
|
138
|
+
xml.tag! "soap:Envelope", ENV_NAMESPACES_V4 do
|
139
|
+
xml.tag! "soap:Body" do
|
140
|
+
xml.tag! ACTIONS[:void], "xmlns" => TX_NAMESPACE_V4 do
|
141
|
+
xml.tag! "merchantName", @options[:name]
|
142
|
+
xml.tag! "merchantSiteId", @options[:login]
|
143
|
+
xml.tag! "merchantKey", @options[:password]
|
144
|
+
yield xml
|
145
|
+
end
|
146
|
+
end
|
147
|
+
end
|
148
|
+
xml.target!
|
149
|
+
end
|
150
|
+
|
151
|
+
def build_purchase_request(action, money, credit_card, options)
|
152
|
+
requires!(options, :order_id)
|
153
|
+
|
154
|
+
request = soap_request(action) do |xml|
|
155
|
+
add_invoice(xml, options)
|
156
|
+
add_amount(xml, money)
|
157
|
+
add_credit_card(xml, credit_card)
|
158
|
+
add_address(xml, options)
|
159
|
+
end
|
160
|
+
end
|
161
|
+
|
162
|
+
def build_capture_request(action, money, identification, options)
|
163
|
+
reference, options[:order_id] = split_reference(identification)
|
164
|
+
|
165
|
+
request = soap_request(action) do |xml|
|
166
|
+
add_reference(xml, reference)
|
167
|
+
add_invoice(xml, options)
|
168
|
+
add_amount(xml, money)
|
169
|
+
end
|
170
|
+
end
|
171
|
+
|
172
|
+
def perform_reference_credit(money, identification, options)
|
173
|
+
reference, options[:order_id] = split_reference(identification)
|
174
|
+
|
175
|
+
request = soap_request(:reference_credit) do |xml|
|
176
|
+
add_reference(xml, reference)
|
177
|
+
add_invoice(xml, options)
|
178
|
+
add_amount(xml, money, "strOverrideAmount")
|
179
|
+
end
|
180
|
+
|
181
|
+
commit(:reference_credit, request)
|
182
|
+
end
|
183
|
+
|
184
|
+
def perform_credit(money, credit_card, options)
|
185
|
+
requires!(options, :order_id)
|
186
|
+
|
187
|
+
request = soap_request(:credit) do |xml|
|
188
|
+
add_invoice(xml, options)
|
189
|
+
add_amount(xml, money)
|
190
|
+
add_credit_card(xml, credit_card)
|
191
|
+
end
|
192
|
+
|
193
|
+
commit(:credit, request)
|
194
|
+
end
|
195
|
+
|
196
|
+
def add_credentials(xml)
|
197
|
+
xml.tag! "strSiteId", @options[:login]
|
198
|
+
xml.tag! "strKey", @options[:password]
|
199
|
+
xml.tag! "strName", @options[:name]
|
200
|
+
end
|
201
|
+
|
202
|
+
def expdate(credit_card)
|
203
|
+
year = sprintf("%.4i", credit_card.year)
|
204
|
+
month = sprintf("%.2i", credit_card.month)
|
205
|
+
|
206
|
+
"#{month}#{year[-2..-1]}"
|
207
|
+
end
|
208
|
+
|
209
|
+
def add_invoice(xml, options)
|
210
|
+
xml.tag! "strOrderNumber", options[:order_id].to_s.gsub(/[^\w]/, '').slice(0, 25)
|
211
|
+
end
|
212
|
+
|
213
|
+
def add_amount(xml, money, tag = "strAmount")
|
214
|
+
xml.tag! tag, amount(money)
|
215
|
+
end
|
216
|
+
|
217
|
+
def add_reference(xml, reference)
|
218
|
+
xml.tag! "strReferenceCode", reference
|
219
|
+
end
|
220
|
+
|
221
|
+
def add_reference_token(xml, reference)
|
222
|
+
xml.tag! "token", reference
|
223
|
+
end
|
224
|
+
|
225
|
+
def add_address(xml, options)
|
226
|
+
if address = options[:billing_address] || options[:address]
|
227
|
+
xml.tag! "strAVSStreetAddress", address[:address1]
|
228
|
+
xml.tag! "strAVSZipCode", address[:zip]
|
229
|
+
end
|
230
|
+
end
|
231
|
+
|
232
|
+
def add_credit_card(xml, credit_card)
|
233
|
+
xml.tag! "strPAN", credit_card.number
|
234
|
+
xml.tag! "strExpDate", expdate(credit_card)
|
235
|
+
xml.tag! "strCardHolder", credit_card.name
|
236
|
+
xml.tag! "strCVCode", credit_card.verification_value if credit_card.verification_value?
|
237
|
+
end
|
238
|
+
|
239
|
+
def split_reference(reference)
|
240
|
+
reference.to_s.split(";")
|
241
|
+
end
|
242
|
+
|
243
|
+
def parse(action, data)
|
244
|
+
response = {}
|
245
|
+
xml = REXML::Document.new(data)
|
246
|
+
|
247
|
+
root = REXML::XPath.first(xml, "//#{ACTIONS[action]}Response/#{ACTIONS[action]}Result")
|
248
|
+
|
249
|
+
root.elements.each do |element|
|
250
|
+
response[element.name] = element.text
|
251
|
+
end
|
252
|
+
|
253
|
+
status, code, message = response["ApprovalStatus"].split(";")
|
254
|
+
response[:status] = status
|
255
|
+
|
256
|
+
if response[:success] = status == "APPROVED"
|
257
|
+
response[:message] = status
|
258
|
+
else
|
259
|
+
response[:message] = message
|
260
|
+
response[:failure_code] = code
|
261
|
+
end
|
262
|
+
|
263
|
+
response
|
264
|
+
end
|
265
|
+
|
266
|
+
def parse_error(http_response)
|
267
|
+
response = {}
|
268
|
+
response[:http_code] = http_response.code
|
269
|
+
response[:http_message] = http_response.message
|
270
|
+
response[:success] = false
|
271
|
+
|
272
|
+
document = REXML::Document.new(http_response.body)
|
273
|
+
|
274
|
+
node = REXML::XPath.first(document, "//soap:Fault")
|
275
|
+
|
276
|
+
node.elements.each do |element|
|
277
|
+
response[element.name] = element.text
|
278
|
+
end
|
279
|
+
|
280
|
+
response[:message] = response["faultstring"].to_s.gsub("\n", " ")
|
281
|
+
response
|
282
|
+
rescue REXML::ParseException => e
|
283
|
+
response[:http_body] = http_response.body
|
284
|
+
response[:message] = "Failed to parse the failed response"
|
285
|
+
response
|
286
|
+
end
|
287
|
+
|
288
|
+
def soap_action(action, v4 = false)
|
289
|
+
v4 ? "#{TX_NAMESPACE_V4}#{ACTIONS[action]}" : "#{TX_NAMESPACE}/#{ACTIONS[action]}"
|
290
|
+
end
|
291
|
+
|
292
|
+
def url(v4 = false)
|
293
|
+
v4 ? v4_live_url : live_url
|
294
|
+
end
|
295
|
+
|
296
|
+
def commit(action, request, v4 = false)
|
297
|
+
begin
|
298
|
+
data = ssl_post(url(v4), request,
|
299
|
+
"Content-Type" => 'text/xml; charset=utf-8',
|
300
|
+
"SOAPAction" => soap_action(action, v4)
|
301
|
+
)
|
302
|
+
response = parse(action, data)
|
303
|
+
rescue ActiveMerchant::ResponseError => e
|
304
|
+
response = parse_error(e.response)
|
305
|
+
end
|
306
|
+
|
307
|
+
Response.new(response[:success], response[:message], response,
|
308
|
+
:test => test?,
|
309
|
+
:authorization => authorization_from(response),
|
310
|
+
:avs_result => { :code => response["AVSResponse"] },
|
311
|
+
:cvv_result => response["CVResponse"]
|
312
|
+
)
|
313
|
+
end
|
314
|
+
|
315
|
+
def authorization_from(response)
|
316
|
+
if response[:success]
|
317
|
+
[ response["ReferenceID"], response["OrderNumber"] ].join(";")
|
318
|
+
end
|
319
|
+
end
|
320
|
+
end
|
321
|
+
end
|
322
|
+
end
|