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,633 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/orbital/orbital_soft_descriptors'
|
2
|
+
require File.dirname(__FILE__) + '/orbital/avs_result'
|
3
|
+
require "rexml/document"
|
4
|
+
|
5
|
+
module ActiveMerchant #:nodoc:
|
6
|
+
module Billing #:nodoc:
|
7
|
+
# For more information on Orbital, visit the {integration center}[http://download.chasepaymentech.com]
|
8
|
+
#
|
9
|
+
# ==== Authentication Options
|
10
|
+
#
|
11
|
+
# The Orbital Gateway supports two methods of authenticating incoming requests:
|
12
|
+
# Source IP authentication and Connection Username/Password authentication
|
13
|
+
#
|
14
|
+
# In addition, these IP addresses/Connection Usernames must be affiliated with the Merchant IDs
|
15
|
+
# for which the client should be submitting transactions.
|
16
|
+
#
|
17
|
+
# This does allow Third Party Hosting service organizations presenting on behalf of other
|
18
|
+
# merchants to submit transactions. However, each time a new customer is added, the
|
19
|
+
# merchant or Third-Party hosting organization needs to ensure that the new Merchant IDs
|
20
|
+
# or Chain IDs are affiliated with the hosting companies IPs or Connection Usernames.
|
21
|
+
#
|
22
|
+
# If the merchant expects to have more than one merchant account with the Orbital
|
23
|
+
# Gateway, it should have its IP addresses/Connection Usernames affiliated at the Chain
|
24
|
+
# level hierarchy within the Orbital Gateway. Each time a new merchant ID is added, as
|
25
|
+
# long as it is placed within the same Chain, it will simply work. Otherwise, the additional
|
26
|
+
# MIDs will need to be affiliated with the merchant IPs or Connection Usernames respectively.
|
27
|
+
# For example, we generally affiliate all Salem accounts [BIN 000001] with
|
28
|
+
# their Company Number [formerly called MA #] number so all MIDs or Divisions under that
|
29
|
+
# Company will automatically be affiliated.
|
30
|
+
|
31
|
+
class OrbitalGateway < Gateway
|
32
|
+
API_VERSION = "5.6"
|
33
|
+
|
34
|
+
POST_HEADERS = {
|
35
|
+
"MIME-Version" => "1.1",
|
36
|
+
"Content-Type" => "application/PTI56",
|
37
|
+
"Content-transfer-encoding" => "text",
|
38
|
+
"Request-number" => '1',
|
39
|
+
"Document-type" => "Request",
|
40
|
+
"Interface-Version" => "Ruby|ActiveMerchant|Proprietary Gateway"
|
41
|
+
}
|
42
|
+
|
43
|
+
SUCCESS, APPROVED = '0', '00'
|
44
|
+
|
45
|
+
class_attribute :secondary_test_url, :secondary_live_url
|
46
|
+
|
47
|
+
self.test_url = "https://orbitalvar1.paymentech.net/authorize"
|
48
|
+
self.secondary_test_url = "https://orbitalvar2.paymentech.net/authorize"
|
49
|
+
|
50
|
+
self.live_url = "https://orbital1.paymentech.net/authorize"
|
51
|
+
self.secondary_live_url = "https://orbital2.paymentech.net/authorize"
|
52
|
+
|
53
|
+
self.supported_countries = ["US", "CA"]
|
54
|
+
self.default_currency = "CAD"
|
55
|
+
self.supported_cardtypes = [:visa, :master, :american_express, :discover, :diners_club, :jcb]
|
56
|
+
|
57
|
+
self.display_name = 'Orbital Paymentech'
|
58
|
+
self.homepage_url = 'http://chasepaymentech.com/'
|
59
|
+
|
60
|
+
self.money_format = :cents
|
61
|
+
|
62
|
+
AVS_SUPPORTED_COUNTRIES = ['US', 'CA', 'UK', 'GB']
|
63
|
+
|
64
|
+
CURRENCY_CODES = {
|
65
|
+
"AUD" => '036',
|
66
|
+
"CAD" => '124',
|
67
|
+
"CZK" => '203',
|
68
|
+
"DKK" => '208',
|
69
|
+
"HKD" => '344',
|
70
|
+
"ICK" => '352',
|
71
|
+
"JPY" => '392',
|
72
|
+
"MXN" => '484',
|
73
|
+
"NZD" => '554',
|
74
|
+
"NOK" => '578',
|
75
|
+
"SGD" => '702',
|
76
|
+
"SEK" => '752',
|
77
|
+
"CHF" => '756',
|
78
|
+
"GBP" => '826',
|
79
|
+
"USD" => '840',
|
80
|
+
"EUR" => '978'
|
81
|
+
}
|
82
|
+
|
83
|
+
# INDUSTRY TYPES
|
84
|
+
ECOMMERCE_TRANSACTION = 'EC'
|
85
|
+
RECURRING_PAYMENT_TRANSACTION = 'RC'
|
86
|
+
MAIL_ORDER_TELEPHONE_ORDER_TRANSACTION = 'MO'
|
87
|
+
INTERACTIVE_VOICE_RESPONSE = 'IV'
|
88
|
+
# INTERACTIVE_VOICE_RESPONSE = 'IN'
|
89
|
+
|
90
|
+
# Auth Only No Capture
|
91
|
+
AUTH_ONLY = 'A'
|
92
|
+
# AC - Auth and Capture = 'AC'
|
93
|
+
AUTH_AND_CAPTURE = 'AC'
|
94
|
+
# F - Force Auth No Capture and no online authorization = 'F'
|
95
|
+
FORCE_AUTH_ONLY = 'F'
|
96
|
+
# FR - Force Auth No Capture and no online authorization = 'FR'
|
97
|
+
# FC - Force Auth and Capture no online authorization = 'FC'
|
98
|
+
FORCE_AUTH_AND_CAPTURE = 'FC'
|
99
|
+
# Refund and Capture no online authorization
|
100
|
+
REFUND = 'R'
|
101
|
+
|
102
|
+
# Tax Inds
|
103
|
+
TAX_NOT_PROVIDED = 0
|
104
|
+
TAX_INCLUDED = 1
|
105
|
+
NON_TAXABLE_TRANSACTION = 2
|
106
|
+
|
107
|
+
# Customer Profile Actions
|
108
|
+
CREATE = 'C'
|
109
|
+
RETRIEVE = 'R'
|
110
|
+
UPDATE = 'U'
|
111
|
+
DELETE = 'D'
|
112
|
+
|
113
|
+
RECURRING = 'R'
|
114
|
+
DEFERRED = 'D'
|
115
|
+
|
116
|
+
# Status
|
117
|
+
# Profile Status Flag
|
118
|
+
# This field is used to set the status of a Customer Profile.
|
119
|
+
ACTIVE = 'A'
|
120
|
+
INACTIVE = 'I'
|
121
|
+
MANUAL_SUSPEND = 'MS'
|
122
|
+
|
123
|
+
# CustomerProfileOrderOverrideInd
|
124
|
+
# Defines if any Order Data can be pre-populated from
|
125
|
+
# the Customer Reference Number (CustomerRefNum)
|
126
|
+
NO_MAPPING_TO_ORDER_DATA = 'NO'
|
127
|
+
USE_CRN_FOR_ORDER_ID = 'OI'
|
128
|
+
USE_CRN_FOR_COMMENTS = 'OD'
|
129
|
+
USE_CRN_FOR_ORDER_ID_AND_COMMENTS = 'OA'
|
130
|
+
|
131
|
+
# CustomerProfileFromOrderInd
|
132
|
+
# Method to use to Generate the Customer Profile Number
|
133
|
+
# When Customer Profile Action Type = Create, defines
|
134
|
+
# what the Customer Profile Number will be:
|
135
|
+
AUTO_GENERATE = 'A' # Auto-Generate the CustomerRefNum
|
136
|
+
USE_CUSTOMER_REF_NUM = 'S' # Use CustomerRefNum field
|
137
|
+
USE_ORDER_ID = 'O' # Use OrderID field
|
138
|
+
USE_COMMENTS = 'D' # Use Comments field
|
139
|
+
|
140
|
+
def initialize(options = {})
|
141
|
+
requires!(options, :merchant_id)
|
142
|
+
requires!(options, :login, :password) unless options[:ip_authentication]
|
143
|
+
super
|
144
|
+
end
|
145
|
+
|
146
|
+
# A – Authorization request
|
147
|
+
def authorize(money, creditcard, options = {})
|
148
|
+
order = build_new_order_xml(AUTH_ONLY, money, options) do |xml|
|
149
|
+
add_creditcard(xml, creditcard, options[:currency]) unless creditcard.nil? && options[:profile_txn]
|
150
|
+
add_address(xml, creditcard, options)
|
151
|
+
if @options[:customer_profiles]
|
152
|
+
add_customer_data(xml, options)
|
153
|
+
add_managed_billing(xml, options)
|
154
|
+
end
|
155
|
+
end
|
156
|
+
commit(order, :authorize, options[:trace_number])
|
157
|
+
end
|
158
|
+
|
159
|
+
# AC – Authorization and Capture
|
160
|
+
def purchase(money, creditcard, options = {})
|
161
|
+
order = build_new_order_xml(AUTH_AND_CAPTURE, money, options) do |xml|
|
162
|
+
add_creditcard(xml, creditcard, options[:currency]) unless creditcard.nil? && options[:profile_txn]
|
163
|
+
add_address(xml, creditcard, options)
|
164
|
+
if @options[:customer_profiles]
|
165
|
+
add_customer_data(xml, options)
|
166
|
+
add_managed_billing(xml, options)
|
167
|
+
end
|
168
|
+
end
|
169
|
+
commit(order, :purchase, options[:trace_number])
|
170
|
+
end
|
171
|
+
|
172
|
+
# MFC - Mark For Capture
|
173
|
+
def capture(money, authorization, options = {})
|
174
|
+
commit(build_mark_for_capture_xml(money, authorization, options), :capture)
|
175
|
+
end
|
176
|
+
|
177
|
+
# R – Refund request
|
178
|
+
def refund(money, authorization, options = {})
|
179
|
+
order = build_new_order_xml(REFUND, money, options.merge(:authorization => authorization)) do |xml|
|
180
|
+
add_refund(xml, options[:currency])
|
181
|
+
xml.tag! :CustomerRefNum, options[:customer_ref_num] if @options[:customer_profiles] && options[:profile_txn]
|
182
|
+
end
|
183
|
+
commit(order, :refund, options[:trace_number])
|
184
|
+
end
|
185
|
+
|
186
|
+
def credit(money, authorization, options= {})
|
187
|
+
deprecated CREDIT_DEPRECATION_MESSAGE
|
188
|
+
refund(money, authorization, options)
|
189
|
+
end
|
190
|
+
|
191
|
+
def void(authorization, options = {}, deprecated = {})
|
192
|
+
if(!options.kind_of?(Hash))
|
193
|
+
deprecated("Calling the void method with an amount parameter is deprecated and will be removed in a future version.")
|
194
|
+
return void(options, deprecated.merge(:amount => authorization))
|
195
|
+
end
|
196
|
+
|
197
|
+
order = build_void_request_xml(authorization, options)
|
198
|
+
commit(order, :void, options[:trace_number])
|
199
|
+
end
|
200
|
+
|
201
|
+
|
202
|
+
# ==== Customer Profiles
|
203
|
+
# :customer_ref_num should be set unless your happy with Orbital providing one
|
204
|
+
#
|
205
|
+
# :customer_profile_order_override_ind can be set to map
|
206
|
+
# the CustomerRefNum to OrderID or Comments. Defaults to 'NO' - no mapping
|
207
|
+
#
|
208
|
+
# 'NO' - No mapping to order data
|
209
|
+
# 'OI' - Use <CustomerRefNum> for <OrderID>
|
210
|
+
# 'OD' - Use <CustomerRefNum> for <Comments>
|
211
|
+
# 'OA' - Use <CustomerRefNum> for <OrderID> and <Comments>
|
212
|
+
#
|
213
|
+
# :order_default_description can be set optionally. 64 char max.
|
214
|
+
#
|
215
|
+
# :order_default_amount can be set optionally. integer as cents.
|
216
|
+
#
|
217
|
+
# :status defaults to Active
|
218
|
+
#
|
219
|
+
# 'A' - Active
|
220
|
+
# 'I' - Inactive
|
221
|
+
# 'MS' - Manual Suspend
|
222
|
+
|
223
|
+
def add_customer_profile(creditcard, options = {})
|
224
|
+
options.merge!(:customer_profile_action => CREATE)
|
225
|
+
order = build_customer_request_xml(creditcard, options)
|
226
|
+
commit(order, :add_customer_profile)
|
227
|
+
end
|
228
|
+
|
229
|
+
def update_customer_profile(creditcard, options = {})
|
230
|
+
options.merge!(:customer_profile_action => UPDATE)
|
231
|
+
order = build_customer_request_xml(creditcard, options)
|
232
|
+
commit(order, :update_customer_profile)
|
233
|
+
end
|
234
|
+
|
235
|
+
def retrieve_customer_profile(customer_ref_num)
|
236
|
+
options = {:customer_profile_action => RETRIEVE, :customer_ref_num => customer_ref_num}
|
237
|
+
order = build_customer_request_xml(nil, options)
|
238
|
+
commit(order, :retrieve_customer_profile)
|
239
|
+
end
|
240
|
+
|
241
|
+
def delete_customer_profile(customer_ref_num)
|
242
|
+
options = {:customer_profile_action => DELETE, :customer_ref_num => customer_ref_num}
|
243
|
+
order = build_customer_request_xml(nil, options)
|
244
|
+
commit(order, :delete_customer_profile)
|
245
|
+
end
|
246
|
+
|
247
|
+
private
|
248
|
+
|
249
|
+
def authorization_string(*args)
|
250
|
+
args.compact.join(";")
|
251
|
+
end
|
252
|
+
|
253
|
+
def split_authorization(authorization)
|
254
|
+
authorization.split(';')
|
255
|
+
end
|
256
|
+
|
257
|
+
def add_customer_data(xml, options)
|
258
|
+
if options[:profile_txn]
|
259
|
+
xml.tag! :CustomerRefNum, options[:customer_ref_num]
|
260
|
+
else
|
261
|
+
if options[:customer_ref_num]
|
262
|
+
xml.tag! :CustomerProfileFromOrderInd, USE_CUSTOMER_REF_NUM
|
263
|
+
xml.tag! :CustomerRefNum, options[:customer_ref_num]
|
264
|
+
else
|
265
|
+
xml.tag! :CustomerProfileFromOrderInd, AUTO_GENERATE
|
266
|
+
end
|
267
|
+
xml.tag! :CustomerProfileOrderOverrideInd, options[:customer_profile_order_override_ind] || NO_MAPPING_TO_ORDER_DATA
|
268
|
+
end
|
269
|
+
end
|
270
|
+
|
271
|
+
def add_soft_descriptors(xml, soft_desc)
|
272
|
+
xml.tag! :SDMerchantName, soft_desc.merchant_name if soft_desc.merchant_name
|
273
|
+
xml.tag! :SDProductDescription, soft_desc.product_description if soft_desc.product_description
|
274
|
+
xml.tag! :SDMerchantCity, soft_desc.merchant_city if soft_desc.merchant_city
|
275
|
+
xml.tag! :SDMerchantPhone, soft_desc.merchant_phone if soft_desc.merchant_phone
|
276
|
+
xml.tag! :SDMerchantURL, soft_desc.merchant_url if soft_desc.merchant_url
|
277
|
+
xml.tag! :SDMerchantEmail, soft_desc.merchant_email if soft_desc.merchant_email
|
278
|
+
end
|
279
|
+
|
280
|
+
def add_address(xml, creditcard, options)
|
281
|
+
if(address = (options[:billing_address] || options[:address]))
|
282
|
+
avs_supported = AVS_SUPPORTED_COUNTRIES.include?(address[:country].to_s)
|
283
|
+
|
284
|
+
if avs_supported
|
285
|
+
xml.tag! :AVSzip, (address[:zip] ? address[:zip].to_s[0..9] : nil)
|
286
|
+
xml.tag! :AVSaddress1, (address[:address1] ? address[:address1][0..29] : nil)
|
287
|
+
xml.tag! :AVSaddress2, (address[:address2] ? address[:address2][0..29] : nil)
|
288
|
+
xml.tag! :AVScity, (address[:city] ? address[:city][0..19] : nil)
|
289
|
+
xml.tag! :AVSstate, address[:state]
|
290
|
+
xml.tag! :AVSphoneNum, (address[:phone] ? address[:phone].scan(/\d/).join.to_s[0..13] : nil)
|
291
|
+
end
|
292
|
+
# can't look in billing address?
|
293
|
+
xml.tag! :AVSname, ((creditcard && creditcard.name) ? creditcard.name[0..29] : nil)
|
294
|
+
xml.tag! :AVScountryCode, (avs_supported ? address[:country] : '')
|
295
|
+
|
296
|
+
# Needs to come after AVScountryCode
|
297
|
+
add_destination_address(xml, address) if avs_supported
|
298
|
+
end
|
299
|
+
end
|
300
|
+
|
301
|
+
def add_destination_address(xml, address)
|
302
|
+
if address[:dest_zip]
|
303
|
+
xml.tag! :AVSDestzip, (address[:dest_zip] ? address[:dest_zip].to_s[0..9] : nil)
|
304
|
+
xml.tag! :AVSDestaddress1, (address[:dest_address1] ? address[:dest_address1][0..29] : nil)
|
305
|
+
xml.tag! :AVSDestaddress2, (address[:dest_address2] ? address[:dest_address2][0..29] : nil)
|
306
|
+
xml.tag! :AVSDestcity, (address[:dest_city] ? address[:dest_city][0..19] : nil)
|
307
|
+
xml.tag! :AVSDeststate, address[:dest_state]
|
308
|
+
xml.tag! :AVSDestphoneNum, (address[:dest_phone] ? address[:dest_phone].scan(/\d/).join.to_s[0..13] : nil)
|
309
|
+
|
310
|
+
xml.tag! :AVSDestname, (address[:dest_name] ? address[:dest_name][0..29] : nil)
|
311
|
+
xml.tag! :AVSDestcountryCode, address[:dest_country]
|
312
|
+
end
|
313
|
+
end
|
314
|
+
|
315
|
+
# For Profile requests
|
316
|
+
def add_customer_address(xml, options)
|
317
|
+
if(address = (options[:billing_address] || options[:address]))
|
318
|
+
xml.tag! :CustomerAddress1, (address[:address1] ? address[:address1][0..29] : nil)
|
319
|
+
xml.tag! :CustomerAddress2, (address[:address2] ? address[:address2][0..29] : nil)
|
320
|
+
xml.tag! :CustomerCity, (address[:city] ? address[:city][0..19] : nil)
|
321
|
+
xml.tag! :CustomerState, address[:state]
|
322
|
+
xml.tag! :CustomerZIP, (address[:zip] ? address[:zip].to_s[0..9] : nil)
|
323
|
+
xml.tag! :CustomerEmail, address[:email].to_s[0..49] if address[:email]
|
324
|
+
xml.tag! :CustomerPhone, (address[:phone] ? address[:phone].scan(/\d/).join.to_s : nil)
|
325
|
+
xml.tag! :CustomerCountryCode, (address[:country] ? address[:country][0..1] : nil)
|
326
|
+
end
|
327
|
+
end
|
328
|
+
|
329
|
+
def add_creditcard(xml, creditcard, currency=nil)
|
330
|
+
xml.tag! :AccountNum, creditcard.number
|
331
|
+
xml.tag! :Exp, expiry_date(creditcard)
|
332
|
+
|
333
|
+
xml.tag! :CurrencyCode, currency_code(currency)
|
334
|
+
xml.tag! :CurrencyExponent, '2' # Will need updating to support currencies such as the Yen.
|
335
|
+
|
336
|
+
# If you are trying to collect a Card Verification Number
|
337
|
+
# (CardSecVal) for a Visa or Discover transaction, pass one of these values:
|
338
|
+
# 1 Value is Present
|
339
|
+
# 2 Value on card but illegible
|
340
|
+
# 9 Cardholder states data not available
|
341
|
+
# If the transaction is not a Visa or Discover transaction:
|
342
|
+
# Null-fill this attribute OR
|
343
|
+
# Do not submit the attribute at all.
|
344
|
+
# - http://download.chasepaymentech.com/docs/orbital/orbital_gateway_xml_specification.pdf
|
345
|
+
if %w( visa discover ).include?(creditcard.brand)
|
346
|
+
xml.tag! :CardSecValInd, (creditcard.verification_value? ? '1' : '9')
|
347
|
+
end
|
348
|
+
xml.tag! :CardSecVal, creditcard.verification_value if creditcard.verification_value?
|
349
|
+
end
|
350
|
+
|
351
|
+
def add_refund(xml, currency=nil)
|
352
|
+
xml.tag! :AccountNum, nil
|
353
|
+
|
354
|
+
xml.tag! :CurrencyCode, currency_code(currency)
|
355
|
+
xml.tag! :CurrencyExponent, '2' # Will need updating to support currencies such as the Yen.
|
356
|
+
end
|
357
|
+
|
358
|
+
def add_managed_billing(xml, options)
|
359
|
+
if mb = options[:managed_billing]
|
360
|
+
# default to recurring (R). Other option is deferred (D).
|
361
|
+
xml.tag! :MBType, mb[:type] || RECURRING
|
362
|
+
# default to Customer Reference Number
|
363
|
+
xml.tag! :MBOrderIdGenerationMethod, mb[:order_id_generation_method] || 'IO'
|
364
|
+
# By default use MBRecurringEndDate, set to N.
|
365
|
+
# MMDDYYYY
|
366
|
+
xml.tag! :MBRecurringStartDate, mb[:start_date].scan(/\d/).join.to_s if mb[:start_date]
|
367
|
+
# MMDDYYYY
|
368
|
+
xml.tag! :MBRecurringEndDate, mb[:end_date].scan(/\d/).join.to_s if mb[:end_date]
|
369
|
+
# By default listen to any value set in MBRecurringEndDate.
|
370
|
+
xml.tag! :MBRecurringNoEndDateFlag, mb[:no_end_date_flag] || 'N' # 'Y' || 'N' (Yes or No).
|
371
|
+
xml.tag! :MBRecurringMaxBillings, mb[:max_billings] if mb[:max_billings]
|
372
|
+
xml.tag! :MBRecurringFrequency, mb[:frequency] if mb[:frequency]
|
373
|
+
xml.tag! :MBDeferredBillDate, mb[:deferred_bill_date] if mb[:deferred_bill_date]
|
374
|
+
xml.tag! :MBMicroPaymentMaxDollarValue, mb[:max_dollar_value] if mb[:max_dollar_value]
|
375
|
+
xml.tag! :MBMicroPaymentMaxBillingDays, mb[:max_billing_days] if mb[:max_billing_days]
|
376
|
+
xml.tag! :MBMicroPaymentMaxTransactions, mb[:max_transactions] if mb[:max_transactions]
|
377
|
+
end
|
378
|
+
end
|
379
|
+
|
380
|
+
def parse(body)
|
381
|
+
response = {}
|
382
|
+
xml = REXML::Document.new(body)
|
383
|
+
root = REXML::XPath.first(xml, "//Response") ||
|
384
|
+
REXML::XPath.first(xml, "//ErrorResponse")
|
385
|
+
if root
|
386
|
+
root.elements.to_a.each do |node|
|
387
|
+
recurring_parse_element(response, node)
|
388
|
+
end
|
389
|
+
end
|
390
|
+
response
|
391
|
+
end
|
392
|
+
|
393
|
+
def recurring_parse_element(response, node)
|
394
|
+
if node.has_elements?
|
395
|
+
node.elements.each{|e| recurring_parse_element(response, e) }
|
396
|
+
else
|
397
|
+
response[node.name.underscore.to_sym] = node.text
|
398
|
+
end
|
399
|
+
end
|
400
|
+
|
401
|
+
def commit(order, message_type, trace_number=nil)
|
402
|
+
headers = POST_HEADERS.merge("Content-length" => order.size.to_s)
|
403
|
+
headers.merge!( "Trace-number" => trace_number.to_s,
|
404
|
+
"Merchant-Id" => @options[:merchant_id] ) if @options[:retry_logic] && trace_number
|
405
|
+
request = lambda{|url| parse(ssl_post(url, order, headers))}
|
406
|
+
|
407
|
+
# Failover URL will be attempted in the event of a connection error
|
408
|
+
response = begin
|
409
|
+
request.call(remote_url)
|
410
|
+
rescue ConnectionError
|
411
|
+
request.call(remote_url(:secondary))
|
412
|
+
end
|
413
|
+
|
414
|
+
Response.new(success?(response, message_type), message_from(response), response,
|
415
|
+
{
|
416
|
+
:authorization => authorization_string(response[:tx_ref_num], response[:order_id]),
|
417
|
+
:test => self.test?,
|
418
|
+
:avs_result => OrbitalGateway::AVSResult.new(response[:avs_resp_code]),
|
419
|
+
:cvv_result => response[:cvv2_resp_code]
|
420
|
+
}
|
421
|
+
)
|
422
|
+
end
|
423
|
+
|
424
|
+
def remote_url(url=:primary)
|
425
|
+
if url == :primary
|
426
|
+
(self.test? ? self.test_url : self.live_url)
|
427
|
+
else
|
428
|
+
(self.test? ? self.secondary_test_url : self.secondary_live_url)
|
429
|
+
end
|
430
|
+
end
|
431
|
+
|
432
|
+
def success?(response, message_type)
|
433
|
+
if [:refund, :void].include?(message_type)
|
434
|
+
response[:proc_status] == SUCCESS
|
435
|
+
elsif response[:customer_profile_action]
|
436
|
+
response[:profile_proc_status] == SUCCESS
|
437
|
+
else
|
438
|
+
response[:proc_status] == SUCCESS &&
|
439
|
+
response[:resp_code] == APPROVED
|
440
|
+
end
|
441
|
+
end
|
442
|
+
|
443
|
+
def message_from(response)
|
444
|
+
response[:resp_msg] || response[:status_msg] || response[:customer_profile_message]
|
445
|
+
end
|
446
|
+
|
447
|
+
def ip_authentication?
|
448
|
+
@options[:ip_authentication] == true
|
449
|
+
end
|
450
|
+
|
451
|
+
def build_new_order_xml(action, money, parameters = {})
|
452
|
+
requires!(parameters, :order_id)
|
453
|
+
xml = xml_envelope
|
454
|
+
xml.tag! :Request do
|
455
|
+
xml.tag! :NewOrder do
|
456
|
+
add_xml_credentials(xml)
|
457
|
+
# EC - Ecommerce transaction
|
458
|
+
# RC - Recurring Payment transaction
|
459
|
+
# MO - Mail Order Telephone Order transaction
|
460
|
+
# IV - Interactive Voice Response
|
461
|
+
# IN - Interactive Voice Response
|
462
|
+
xml.tag! :IndustryType, parameters[:industry_type] || ECOMMERCE_TRANSACTION
|
463
|
+
# A - Auth Only No Capture
|
464
|
+
# AC - Auth and Capture
|
465
|
+
# F - Force Auth No Capture and no online authorization
|
466
|
+
# FR - Force Auth No Capture and no online authorization
|
467
|
+
# FC - Force Auth and Capture no online authorization
|
468
|
+
# R - Refund and Capture no online authorization
|
469
|
+
xml.tag! :MessageType, action
|
470
|
+
add_bin_merchant_and_terminal(xml, parameters)
|
471
|
+
|
472
|
+
yield xml if block_given?
|
473
|
+
|
474
|
+
xml.tag! :OrderID, format_order_id(parameters[:order_id])
|
475
|
+
xml.tag! :Amount, amount(money)
|
476
|
+
xml.tag! :Comments, parameters[:comments] if parameters[:comments]
|
477
|
+
|
478
|
+
# CustomerAni, AVSPhoneType and AVSDestPhoneType could be added here.
|
479
|
+
|
480
|
+
if parameters[:soft_descriptors].is_a?(OrbitalSoftDescriptors)
|
481
|
+
add_soft_descriptors(xml, parameters[:soft_descriptors])
|
482
|
+
end
|
483
|
+
|
484
|
+
set_recurring_ind(xml, parameters)
|
485
|
+
|
486
|
+
# Append Transaction Reference Number at the end for Refund transactions
|
487
|
+
if action == REFUND
|
488
|
+
tx_ref_num, _ = split_authorization(parameters[:authorization])
|
489
|
+
xml.tag! :TxRefNum, tx_ref_num
|
490
|
+
end
|
491
|
+
end
|
492
|
+
end
|
493
|
+
xml.target!
|
494
|
+
end
|
495
|
+
|
496
|
+
# For Canadian transactions on PNS Tampa on New Order
|
497
|
+
# RF - First Recurring Transaction
|
498
|
+
# RS - Subsequent Recurring Transactions
|
499
|
+
def set_recurring_ind(xml, parameters)
|
500
|
+
if parameters[:recurring_ind]
|
501
|
+
raise "RecurringInd must be set to either \"RF\" or \"RS\"" unless %w(RF RS).include?(parameters[:recurring_ind])
|
502
|
+
xml.tag! :RecurringInd, parameters[:recurring_ind]
|
503
|
+
end
|
504
|
+
end
|
505
|
+
|
506
|
+
def build_mark_for_capture_xml(money, authorization, parameters = {})
|
507
|
+
tx_ref_num, order_id = split_authorization(authorization)
|
508
|
+
xml = xml_envelope
|
509
|
+
xml.tag! :Request do
|
510
|
+
xml.tag! :MarkForCapture do
|
511
|
+
add_xml_credentials(xml)
|
512
|
+
xml.tag! :OrderID, format_order_id(order_id)
|
513
|
+
xml.tag! :Amount, amount(money)
|
514
|
+
add_bin_merchant_and_terminal(xml, parameters)
|
515
|
+
xml.tag! :TxRefNum, tx_ref_num
|
516
|
+
end
|
517
|
+
end
|
518
|
+
xml.target!
|
519
|
+
end
|
520
|
+
|
521
|
+
def build_void_request_xml(authorization, parameters = {})
|
522
|
+
tx_ref_num, order_id = split_authorization(authorization)
|
523
|
+
xml = xml_envelope
|
524
|
+
xml.tag! :Request do
|
525
|
+
xml.tag! :Reversal do
|
526
|
+
add_xml_credentials(xml)
|
527
|
+
xml.tag! :TxRefNum, tx_ref_num
|
528
|
+
xml.tag! :TxRefIdx, parameters[:transaction_index]
|
529
|
+
xml.tag! :AdjustedAmt, parameters[:amount] # setting adjusted amount to nil will void entire amount
|
530
|
+
xml.tag! :OrderID, format_order_id(order_id || parameters[:order_id])
|
531
|
+
add_bin_merchant_and_terminal(xml, parameters)
|
532
|
+
xml.tag! :ReversalRetryNumber, parameters[:reversal_retry_number] if parameters[:reversal_retry_number]
|
533
|
+
xml.tag! :OnlineReversalInd, parameters[:online_reversal_ind] if parameters[:online_reversal_ind]
|
534
|
+
end
|
535
|
+
end
|
536
|
+
xml.target!
|
537
|
+
end
|
538
|
+
|
539
|
+
def currency_code(currency)
|
540
|
+
CURRENCY_CODES[(currency || self.default_currency)].to_s
|
541
|
+
end
|
542
|
+
|
543
|
+
def expiry_date(credit_card)
|
544
|
+
"#{format(credit_card.month, :two_digits)}#{format(credit_card.year, :two_digits)}"
|
545
|
+
end
|
546
|
+
|
547
|
+
def bin
|
548
|
+
@options[:bin] || (salem_mid? ? '000001' : '000002')
|
549
|
+
end
|
550
|
+
|
551
|
+
def xml_envelope
|
552
|
+
xml = Builder::XmlMarkup.new(:indent => 2)
|
553
|
+
xml.instruct!(:xml, :version => '1.0', :encoding => 'UTF-8')
|
554
|
+
xml
|
555
|
+
end
|
556
|
+
|
557
|
+
def add_xml_credentials(xml)
|
558
|
+
unless ip_authentication?
|
559
|
+
xml.tag! :OrbitalConnectionUsername, @options[:login]
|
560
|
+
xml.tag! :OrbitalConnectionPassword, @options[:password]
|
561
|
+
end
|
562
|
+
end
|
563
|
+
|
564
|
+
def add_bin_merchant_and_terminal(xml, parameters)
|
565
|
+
xml.tag! :BIN, bin
|
566
|
+
xml.tag! :MerchantID, @options[:merchant_id]
|
567
|
+
xml.tag! :TerminalID, parameters[:terminal_id] || '001'
|
568
|
+
end
|
569
|
+
|
570
|
+
def salem_mid?
|
571
|
+
@options[:merchant_id].length == 6
|
572
|
+
end
|
573
|
+
|
574
|
+
# The valid characters include:
|
575
|
+
#
|
576
|
+
# 1. all letters and digits
|
577
|
+
# 2. - , $ @ & and a space character, though the space character cannot be the leading character
|
578
|
+
# 3. PINless Debit transactions can only use uppercase and lowercase alpha (A-Z, a-z) and numeric (0-9)
|
579
|
+
def format_order_id(order_id)
|
580
|
+
illegal_characters = /[^,$@\- \w]/
|
581
|
+
order_id = order_id.to_s.gsub(/\./, '-')
|
582
|
+
order_id.gsub!(illegal_characters, '')
|
583
|
+
order_id[0...22]
|
584
|
+
end
|
585
|
+
|
586
|
+
def build_customer_request_xml(creditcard, options = {})
|
587
|
+
xml = xml_envelope
|
588
|
+
xml.tag! :Request do
|
589
|
+
xml.tag! :Profile do
|
590
|
+
xml.tag! :OrbitalConnectionUsername, @options[:login] unless ip_authentication?
|
591
|
+
xml.tag! :OrbitalConnectionPassword, @options[:password] unless ip_authentication?
|
592
|
+
xml.tag! :CustomerBin, bin
|
593
|
+
xml.tag! :CustomerMerchantID, @options[:merchant_id]
|
594
|
+
xml.tag! :CustomerName, creditcard.name if creditcard
|
595
|
+
xml.tag! :CustomerRefNum, options[:customer_ref_num] if options[:customer_ref_num]
|
596
|
+
|
597
|
+
add_customer_address(xml, options)
|
598
|
+
|
599
|
+
xml.tag! :CustomerProfileAction, options[:customer_profile_action] # C, R, U, D
|
600
|
+
# NO No mapping to order data
|
601
|
+
# OI Use <CustomerRefNum> for <OrderID>
|
602
|
+
# OD Use <CustomerReferNum> for <Comments>
|
603
|
+
# OA Use <CustomerRefNum> for <OrderID> and <Comments>
|
604
|
+
xml.tag! :CustomerProfileOrderOverrideInd, options[:customer_profile_order_override_ind] || NO_MAPPING_TO_ORDER_DATA
|
605
|
+
|
606
|
+
if options[:customer_profile_action] == CREATE
|
607
|
+
# A Auto-Generate the CustomerRefNum
|
608
|
+
# S Use CustomerRefNum field
|
609
|
+
# O Use OrderID field
|
610
|
+
# D Use Comments field
|
611
|
+
xml.tag! :CustomerProfileFromOrderInd, (options[:customer_ref_num] ? USE_CUSTOMER_REF_NUM : AUTO_GENERATE)
|
612
|
+
end
|
613
|
+
|
614
|
+
xml.tag! :OrderDefaultDescription, options[:order_default_description][0..63] if options[:order_default_description]
|
615
|
+
xml.tag! :OrderDefaultAmount, options[:order_default_amount] if options[:order_default_amount]
|
616
|
+
|
617
|
+
if [CREATE, UPDATE].include? options[:customer_profile_action]
|
618
|
+
xml.tag! :CustomerAccountType, 'CC' # Only credit card supported
|
619
|
+
xml.tag! :Status, options[:status] || ACTIVE # Active
|
620
|
+
end
|
621
|
+
|
622
|
+
xml.tag! :CCAccountNum, creditcard.number if creditcard
|
623
|
+
xml.tag! :CCExpireDate, creditcard.expiry_date.expiration.strftime("%m%y") if creditcard
|
624
|
+
|
625
|
+
# This has to come after CCExpireDate.
|
626
|
+
add_managed_billing(xml, options)
|
627
|
+
end
|
628
|
+
end
|
629
|
+
xml.target!
|
630
|
+
end
|
631
|
+
end
|
632
|
+
end
|
633
|
+
end
|