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,277 @@
|
|
1
|
+
require 'rexml/document'
|
2
|
+
|
3
|
+
module ActiveMerchant #:nodoc:
|
4
|
+
module Billing #:nodoc:
|
5
|
+
# The National Australia Bank provide a payment gateway that seems to
|
6
|
+
# be a rebadged Securepay Australia service, though some differences exist.
|
7
|
+
class NabTransactGateway < Gateway
|
8
|
+
API_VERSION = 'xml-4.2'
|
9
|
+
PERIODIC_API_VERSION = "spxml-4.2"
|
10
|
+
|
11
|
+
class_attribute :test_periodic_url, :live_periodic_url
|
12
|
+
|
13
|
+
self.test_url = 'https://transact.nab.com.au/test/xmlapi/payment'
|
14
|
+
self.live_url = 'https://transact.nab.com.au/live/xmlapi/payment'
|
15
|
+
self.test_periodic_url = 'https://transact.nab.com.au/xmlapidemo/periodic'
|
16
|
+
self.live_periodic_url = 'https://transact.nab.com.au/xmlapi/periodic'
|
17
|
+
|
18
|
+
self.supported_countries = ['AU']
|
19
|
+
|
20
|
+
# The card types supported by the payment gateway
|
21
|
+
# Note that support for Diners, Amex, and JCB require extra
|
22
|
+
# steps in setting up your account, as detailed in the NAB Transact API
|
23
|
+
self.supported_cardtypes = [:visa, :master, :american_express, :diners_club, :jcb]
|
24
|
+
|
25
|
+
self.homepage_url = 'http://transact.nab.com.au'
|
26
|
+
self.display_name = 'NAB Transact'
|
27
|
+
|
28
|
+
cattr_accessor :request_timeout
|
29
|
+
self.request_timeout = 60
|
30
|
+
|
31
|
+
self.money_format = :cents
|
32
|
+
self.default_currency = 'AUD'
|
33
|
+
|
34
|
+
#Transactions currently accepted by NAB Transact XML API
|
35
|
+
TRANSACTIONS = {
|
36
|
+
:purchase => 0, #Standard Payment
|
37
|
+
:refund => 4, #Refund
|
38
|
+
:void => 6, #Client Reversal (Void)
|
39
|
+
:authorization => 10, #Preauthorise
|
40
|
+
:capture => 11 #Preauthorise Complete (Advice)
|
41
|
+
}
|
42
|
+
|
43
|
+
PERIODIC_TYPES = {
|
44
|
+
:addcrn => 5,
|
45
|
+
:editcrn => 5,
|
46
|
+
:deletecrn => 5,
|
47
|
+
:trigger => 8
|
48
|
+
}
|
49
|
+
|
50
|
+
SUCCESS_CODES = [ '00', '08', '11', '16', '77' ]
|
51
|
+
|
52
|
+
|
53
|
+
def initialize(options = {})
|
54
|
+
requires!(options, :login, :password)
|
55
|
+
super
|
56
|
+
end
|
57
|
+
|
58
|
+
def purchase(money, credit_card_or_stored_id, options = {})
|
59
|
+
if credit_card_or_stored_id.respond_to?(:number)
|
60
|
+
#Credit card for instant payment
|
61
|
+
commit :purchase, build_purchase_request(money, credit_card_or_stored_id, options)
|
62
|
+
else
|
63
|
+
#Triggered payment for an existing stored credit card
|
64
|
+
options[:billing_id] = credit_card_or_stored_id.to_s
|
65
|
+
commit_periodic build_periodic_item(:trigger, money, nil, options)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
def refund(money, authorization, options = {})
|
70
|
+
commit :refund, build_reference_request(money, authorization, options)
|
71
|
+
end
|
72
|
+
|
73
|
+
def authorize(money, credit_card, options = {})
|
74
|
+
commit :authorization, build_purchase_request(money, credit_card, options)
|
75
|
+
end
|
76
|
+
|
77
|
+
def capture(money, authorization, options = {})
|
78
|
+
commit :capture, build_reference_request(money, authorization, options)
|
79
|
+
end
|
80
|
+
|
81
|
+
def store(creditcard, options = {})
|
82
|
+
requires!(options, :billing_id, :amount)
|
83
|
+
commit_periodic(build_periodic_item(:addcrn, options[:amount], creditcard, options))
|
84
|
+
end
|
85
|
+
|
86
|
+
def unstore(identification, options = {})
|
87
|
+
options[:billing_id] = identification
|
88
|
+
commit_periodic(build_periodic_item(:deletecrn, options[:amount], nil, options))
|
89
|
+
end
|
90
|
+
|
91
|
+
private
|
92
|
+
|
93
|
+
def add_metadata(xml, options)
|
94
|
+
if options[:merchant_name] || options[:merchant_location]
|
95
|
+
xml.tag! 'metadata' do
|
96
|
+
xml.tag! 'meta', :name => 'ca_name', :value => options[:merchant_name] if options[:merchant_name]
|
97
|
+
xml.tag! 'meta', :name => 'ca_location', :value => options[:merchant_location] if options[:merchant_location]
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
def build_purchase_request(money, credit_card, options)
|
103
|
+
xml = Builder::XmlMarkup.new
|
104
|
+
xml.tag! 'amount', amount(money)
|
105
|
+
xml.tag! 'currency', options[:currency] || currency(money)
|
106
|
+
xml.tag! 'purchaseOrderNo', options[:order_id].to_s.gsub(/[ ']/, '')
|
107
|
+
|
108
|
+
xml.tag! 'CreditCardInfo' do
|
109
|
+
xml.tag! 'cardNumber', credit_card.number
|
110
|
+
xml.tag! 'expiryDate', expdate(credit_card)
|
111
|
+
xml.tag! 'cvv', credit_card.verification_value if credit_card.verification_value?
|
112
|
+
end
|
113
|
+
|
114
|
+
add_metadata(xml, options)
|
115
|
+
|
116
|
+
xml.target!
|
117
|
+
end
|
118
|
+
|
119
|
+
def build_reference_request(money, reference, options)
|
120
|
+
xml = Builder::XmlMarkup.new
|
121
|
+
|
122
|
+
transaction_id, order_id, preauth_id, original_amount = reference.split('*')
|
123
|
+
|
124
|
+
xml.tag! 'amount', (money ? amount(money) : original_amount)
|
125
|
+
xml.tag! 'currency', options[:currency] || currency(money)
|
126
|
+
xml.tag! 'txnID', transaction_id
|
127
|
+
xml.tag! 'purchaseOrderNo', order_id
|
128
|
+
xml.tag! 'preauthID', preauth_id
|
129
|
+
|
130
|
+
xml.target!
|
131
|
+
end
|
132
|
+
|
133
|
+
#Generate payment request XML
|
134
|
+
# - API is set to allow multiple Txn's but currentlu only allows one
|
135
|
+
# - txnSource = 23 - (XML)
|
136
|
+
def build_request(action, body)
|
137
|
+
xml = Builder::XmlMarkup.new
|
138
|
+
xml.instruct!
|
139
|
+
xml.tag! 'NABTransactMessage' do
|
140
|
+
xml.tag! 'MessageInfo' do
|
141
|
+
xml.tag! 'messageID', Utils.generate_unique_id.slice(0, 30)
|
142
|
+
xml.tag! 'messageTimestamp', generate_timestamp
|
143
|
+
xml.tag! 'timeoutValue', request_timeout
|
144
|
+
xml.tag! 'apiVersion', API_VERSION
|
145
|
+
end
|
146
|
+
|
147
|
+
xml.tag! 'MerchantInfo' do
|
148
|
+
xml.tag! 'merchantID', @options[:login]
|
149
|
+
xml.tag! 'password', @options[:password]
|
150
|
+
end
|
151
|
+
|
152
|
+
xml.tag! 'RequestType', 'Payment'
|
153
|
+
xml.tag! 'Payment' do
|
154
|
+
xml.tag! 'TxnList', "count" => 1 do
|
155
|
+
xml.tag! 'Txn', "ID" => 1 do
|
156
|
+
xml.tag! 'txnType', TRANSACTIONS[action]
|
157
|
+
xml.tag! 'txnSource', 23
|
158
|
+
xml << body
|
159
|
+
end
|
160
|
+
end
|
161
|
+
end
|
162
|
+
end
|
163
|
+
|
164
|
+
xml.target!
|
165
|
+
end
|
166
|
+
|
167
|
+
def build_periodic_item(action, money, credit_card, options)
|
168
|
+
xml = Builder::XmlMarkup.new
|
169
|
+
|
170
|
+
xml.tag! 'actionType', action.to_s
|
171
|
+
xml.tag! 'periodicType', PERIODIC_TYPES[action] if PERIODIC_TYPES[action]
|
172
|
+
xml.tag! 'currency', options[:currency] || currency(money)
|
173
|
+
xml.tag! 'crn', options[:billing_id]
|
174
|
+
|
175
|
+
if credit_card
|
176
|
+
xml.tag! 'CreditCardInfo' do
|
177
|
+
xml.tag! 'cardNumber', credit_card.number
|
178
|
+
xml.tag! 'expiryDate', expdate(credit_card)
|
179
|
+
xml.tag! 'cvv', credit_card.verification_value if credit_card.verification_value?
|
180
|
+
end
|
181
|
+
end
|
182
|
+
xml.tag! 'amount', amount(money)
|
183
|
+
|
184
|
+
xml.target!
|
185
|
+
end
|
186
|
+
|
187
|
+
def build_periodic_request(body)
|
188
|
+
xml = Builder::XmlMarkup.new
|
189
|
+
xml.instruct!
|
190
|
+
xml.tag! 'NABTransactMessage' do
|
191
|
+
xml.tag! 'MessageInfo' do
|
192
|
+
xml.tag! 'messageID', ActiveMerchant::Utils.generate_unique_id.slice(0, 30)
|
193
|
+
xml.tag! 'messageTimestamp', generate_timestamp
|
194
|
+
xml.tag! 'timeoutValue', request_timeout
|
195
|
+
xml.tag! 'apiVersion', PERIODIC_API_VERSION
|
196
|
+
end
|
197
|
+
|
198
|
+
xml.tag! 'MerchantInfo' do
|
199
|
+
xml.tag! 'merchantID', @options[:login]
|
200
|
+
xml.tag! 'password', @options[:password]
|
201
|
+
end
|
202
|
+
|
203
|
+
xml.tag! 'RequestType', 'Periodic'
|
204
|
+
xml.tag! 'Periodic' do
|
205
|
+
xml.tag! 'PeriodicList', "count" => 1 do
|
206
|
+
xml.tag! 'PeriodicItem', "ID" => 1 do
|
207
|
+
xml << body
|
208
|
+
end
|
209
|
+
end
|
210
|
+
end
|
211
|
+
end
|
212
|
+
|
213
|
+
xml.target!
|
214
|
+
end
|
215
|
+
|
216
|
+
def commit(action, request)
|
217
|
+
response = parse(ssl_post(test? ? self.test_url : self.live_url, build_request(action, request)))
|
218
|
+
|
219
|
+
Response.new(success?(response), message_from(response), response,
|
220
|
+
:test => test?,
|
221
|
+
:authorization => authorization_from(response)
|
222
|
+
)
|
223
|
+
end
|
224
|
+
|
225
|
+
def commit_periodic(request)
|
226
|
+
response = parse(ssl_post(test? ? self.test_periodic_url : self.live_periodic_url, build_periodic_request(request)))
|
227
|
+
Response.new(success?(response), message_from(response), response,
|
228
|
+
:test => test?,
|
229
|
+
:authorization => authorization_from(response)
|
230
|
+
)
|
231
|
+
end
|
232
|
+
|
233
|
+
def success?(response)
|
234
|
+
SUCCESS_CODES.include?(response[:response_code])
|
235
|
+
end
|
236
|
+
|
237
|
+
def authorization_from(response)
|
238
|
+
[response[:txn_id], response[:purchase_order_no], response[:preauth_id], response[:amount]].join('*')
|
239
|
+
end
|
240
|
+
|
241
|
+
def message_from(response)
|
242
|
+
response[:response_text] || response[:status_description]
|
243
|
+
end
|
244
|
+
|
245
|
+
def expdate(credit_card)
|
246
|
+
"#{format(credit_card.month, :two_digits)}/#{format(credit_card.year, :two_digits)}"
|
247
|
+
end
|
248
|
+
|
249
|
+
def parse(body)
|
250
|
+
xml = REXML::Document.new(body)
|
251
|
+
|
252
|
+
response = {}
|
253
|
+
|
254
|
+
xml.root.elements.to_a.each do |node|
|
255
|
+
parse_element(response, node)
|
256
|
+
end
|
257
|
+
|
258
|
+
response
|
259
|
+
end
|
260
|
+
|
261
|
+
def parse_element(response, node)
|
262
|
+
if node.has_elements?
|
263
|
+
node.elements.each{|element| parse_element(response, element) }
|
264
|
+
else
|
265
|
+
response[node.name.underscore.to_sym] = node.text
|
266
|
+
end
|
267
|
+
end
|
268
|
+
|
269
|
+
# YYYYDDMMHHNNSSKKK000sOOO
|
270
|
+
def generate_timestamp
|
271
|
+
time = Time.now.utc
|
272
|
+
time.strftime("%Y%d%m%H%M%S#{time.usec}+000")
|
273
|
+
end
|
274
|
+
|
275
|
+
end
|
276
|
+
end
|
277
|
+
end
|
@@ -0,0 +1,193 @@
|
|
1
|
+
module ActiveMerchant
|
2
|
+
module Billing
|
3
|
+
# Gateway for netregistry.com.au.
|
4
|
+
#
|
5
|
+
# Note that NetRegistry itself uses gateway service providers. At the
|
6
|
+
# time of this writing, there are at least two (Quest and Ingenico).
|
7
|
+
# This module has only been tested with Quest.
|
8
|
+
#
|
9
|
+
# Also note that NetRegistry does not offer a test mode, nor does it
|
10
|
+
# have support for the authorize/capture/void functionality by default
|
11
|
+
# (you may arrange for this as described in "Programming for
|
12
|
+
# NetRegistry's E-commerce Gateway." [http://rubyurl.com/hNG]), and no
|
13
|
+
# #void functionality is documented. As a result, the #authorize and
|
14
|
+
# #capture have not yet been tested through a live gateway, and #void
|
15
|
+
# will raise an error.
|
16
|
+
#
|
17
|
+
# If you have this functionality enabled, please consider contributing
|
18
|
+
# to ActiveMerchant by writing tests/code for these methods, and
|
19
|
+
# submitting a patch.
|
20
|
+
#
|
21
|
+
# In addition to the standard ActiveMerchant functionality, the
|
22
|
+
# response will contain a 'receipt' parameter
|
23
|
+
# (response.params['receipt']) if a receipt was issued by the gateway.
|
24
|
+
class NetRegistryGateway < Gateway
|
25
|
+
self.live_url = self.test_url = 'https://4tknox.au.com/cgi-bin/themerchant.au.com/ecom/external2.pl'
|
26
|
+
|
27
|
+
FILTERED_PARAMS = [ 'card_no', 'card_expiry', 'receipt_array' ]
|
28
|
+
|
29
|
+
self.supported_countries = ['AU']
|
30
|
+
|
31
|
+
# Note that support for Diners, Amex, and JCB require extra
|
32
|
+
# steps in setting up your account, as detailed in
|
33
|
+
# "Programming for NetRegistry's E-commerce Gateway."
|
34
|
+
# [http://rubyurl.com/hNG]
|
35
|
+
self.supported_cardtypes = [:visa, :master, :diners_club, :american_express, :jcb]
|
36
|
+
self.display_name = 'NetRegistry'
|
37
|
+
self.homepage_url = 'http://www.netregistry.com.au'
|
38
|
+
|
39
|
+
TRANSACTIONS = {
|
40
|
+
:authorization => 'preauth',
|
41
|
+
:purchase => 'purchase',
|
42
|
+
:capture => 'completion',
|
43
|
+
:status => 'status',
|
44
|
+
:refund => 'refund'
|
45
|
+
}
|
46
|
+
|
47
|
+
# Create a new NetRegistry gateway.
|
48
|
+
#
|
49
|
+
# Options :login and :password must be given.
|
50
|
+
def initialize(options = {})
|
51
|
+
requires!(options, :login, :password)
|
52
|
+
super
|
53
|
+
end
|
54
|
+
|
55
|
+
# Note that #authorize and #capture only work if your account
|
56
|
+
# vendor is St George, and if your account has been setup as
|
57
|
+
# described in "Programming for NetRegistry's E-commerce
|
58
|
+
# Gateway." [http://rubyurl.com/hNG]
|
59
|
+
def authorize(money, credit_card, options = {})
|
60
|
+
params = {
|
61
|
+
'AMOUNT' => amount(money),
|
62
|
+
'CCNUM' => credit_card.number,
|
63
|
+
'CCEXP' => expiry(credit_card)
|
64
|
+
}
|
65
|
+
add_request_details(params, options)
|
66
|
+
commit(:authorization, params)
|
67
|
+
end
|
68
|
+
|
69
|
+
# Note that #authorize and #capture only work if your account
|
70
|
+
# vendor is St George, and if your account has been setup as
|
71
|
+
# described in "Programming for NetRegistry's E-commerce
|
72
|
+
# Gateway." [http://rubyurl.com/hNG]
|
73
|
+
def capture(money, authorization, options = {})
|
74
|
+
requires!(options, :credit_card)
|
75
|
+
credit_card = options[:credit_card]
|
76
|
+
|
77
|
+
params = {
|
78
|
+
'PREAUTHNUM' => authorization,
|
79
|
+
'AMOUNT' => amount(money),
|
80
|
+
'CCNUM' => credit_card.number,
|
81
|
+
'CCEXP' => expiry(credit_card)
|
82
|
+
}
|
83
|
+
add_request_details(params, options)
|
84
|
+
commit(:capture, params)
|
85
|
+
end
|
86
|
+
|
87
|
+
def purchase(money, credit_card, options = {})
|
88
|
+
params = {
|
89
|
+
'AMOUNT' => amount(money),
|
90
|
+
'CCNUM' => credit_card.number,
|
91
|
+
'CCEXP' => expiry(credit_card)
|
92
|
+
}
|
93
|
+
add_request_details(params, options)
|
94
|
+
commit(:purchase, params)
|
95
|
+
end
|
96
|
+
|
97
|
+
def refund(money, identification, options = {})
|
98
|
+
params = {
|
99
|
+
'AMOUNT' => amount(money),
|
100
|
+
'TXNREF' => identification
|
101
|
+
}
|
102
|
+
add_request_details(params, options)
|
103
|
+
commit(:refund, params)
|
104
|
+
end
|
105
|
+
|
106
|
+
def credit(money, identification, options = {})
|
107
|
+
deprecated CREDIT_DEPRECATION_MESSAGE
|
108
|
+
refund(money, identification, options)
|
109
|
+
end
|
110
|
+
|
111
|
+
# Specific to NetRegistry.
|
112
|
+
#
|
113
|
+
# Run a 'status' command. This lets you view the status of a
|
114
|
+
# completed transaction.
|
115
|
+
#
|
116
|
+
def status(identification)
|
117
|
+
params = {
|
118
|
+
'TXNREF' => identification
|
119
|
+
}
|
120
|
+
|
121
|
+
commit(:status, params)
|
122
|
+
end
|
123
|
+
|
124
|
+
private
|
125
|
+
def add_request_details(params, options)
|
126
|
+
params['COMMENT'] = options[:description] unless options[:description].blank?
|
127
|
+
end
|
128
|
+
|
129
|
+
# Return the expiry for the given creditcard in the required
|
130
|
+
# format for a command.
|
131
|
+
def expiry(credit_card)
|
132
|
+
month = format(credit_card.month, :two_digits)
|
133
|
+
year = format(credit_card.year , :two_digits)
|
134
|
+
"#{month}/#{year}"
|
135
|
+
end
|
136
|
+
|
137
|
+
# Post the a request with the given parameters and return the
|
138
|
+
# response object.
|
139
|
+
#
|
140
|
+
# Login and password are added automatically, and the comment is
|
141
|
+
# omitted if nil.
|
142
|
+
def commit(action, params)
|
143
|
+
# get gateway response
|
144
|
+
response = parse( ssl_post(self.live_url, post_data(action, params)) )
|
145
|
+
|
146
|
+
Response.new(response['status'] == 'approved', message_from(response), response,
|
147
|
+
:authorization => authorization_from(response, action)
|
148
|
+
)
|
149
|
+
end
|
150
|
+
|
151
|
+
def post_data(action, params)
|
152
|
+
params['COMMAND'] = TRANSACTIONS[action]
|
153
|
+
params['LOGIN'] = "#{@options[:login]}/#{@options[:password]}"
|
154
|
+
URI.encode(params.map{|k,v| "#{k}=#{v}"}.join('&'))
|
155
|
+
end
|
156
|
+
|
157
|
+
def parse(response)
|
158
|
+
params = {}
|
159
|
+
|
160
|
+
lines = response.split("\n")
|
161
|
+
|
162
|
+
# Just incase there is no real response returned
|
163
|
+
params['status'] = lines[0]
|
164
|
+
params['response_text'] = lines[1]
|
165
|
+
|
166
|
+
started = false
|
167
|
+
lines.each do |line|
|
168
|
+
if started
|
169
|
+
key, val = line.chomp.split(/=/, 2)
|
170
|
+
params[key] = val unless FILTERED_PARAMS.include?(key)
|
171
|
+
end
|
172
|
+
|
173
|
+
started = line.chomp =~ /^\.$/ unless started
|
174
|
+
end
|
175
|
+
|
176
|
+
params
|
177
|
+
end
|
178
|
+
|
179
|
+
def message_from(response)
|
180
|
+
response['response_text']
|
181
|
+
end
|
182
|
+
|
183
|
+
def authorization_from(response, command)
|
184
|
+
case command
|
185
|
+
when :purchase
|
186
|
+
response['txn_ref']
|
187
|
+
when :authorization
|
188
|
+
response['transaction_no']
|
189
|
+
end
|
190
|
+
end
|
191
|
+
end
|
192
|
+
end
|
193
|
+
end
|
@@ -0,0 +1,181 @@
|
|
1
|
+
require 'digest/md5'
|
2
|
+
|
3
|
+
module ActiveMerchant #:nodoc:
|
4
|
+
module Billing #:nodoc:
|
5
|
+
class NetaxeptGateway < Gateway
|
6
|
+
self.test_url = 'https://epayment-test.bbs.no/'
|
7
|
+
self.live_url = 'https://epayment.bbs.no/'
|
8
|
+
|
9
|
+
# The countries the gateway supports merchants from as 2 digit ISO country codes
|
10
|
+
self.supported_countries = ['NO', 'DK', 'SE', 'FI']
|
11
|
+
|
12
|
+
# The card types supported by the payment gateway
|
13
|
+
self.supported_cardtypes = [:visa, :master, :american_express]
|
14
|
+
|
15
|
+
# The homepage URL of the gateway
|
16
|
+
self.homepage_url = 'http://www.betalingsterminal.no/Netthandel-forside/'
|
17
|
+
|
18
|
+
# The name of the gateway
|
19
|
+
self.display_name = 'BBS Netaxept'
|
20
|
+
|
21
|
+
self.money_format = :cents
|
22
|
+
|
23
|
+
self.default_currency = 'NOK'
|
24
|
+
|
25
|
+
def initialize(options = {})
|
26
|
+
requires!(options, :login, :password)
|
27
|
+
super
|
28
|
+
end
|
29
|
+
|
30
|
+
def purchase(money, creditcard, options = {})
|
31
|
+
requires!(options, :order_id)
|
32
|
+
|
33
|
+
MultiResponse.run do |r|
|
34
|
+
r.process{authorize(money, creditcard, options)}
|
35
|
+
r.process{capture(money, r.authorization, options)}
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def authorize(money, creditcard, options = {})
|
40
|
+
requires!(options, :order_id)
|
41
|
+
|
42
|
+
MultiResponse.run do |r|
|
43
|
+
r.process{setup_transaction(money, options)}
|
44
|
+
r.process{add_and_auth_credit_card(r.authorization, creditcard, options)}
|
45
|
+
r.process{query_transaction(r.authorization, options)}
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def capture(money, authorization, options = {})
|
50
|
+
post = {}
|
51
|
+
add_credentials(post, options)
|
52
|
+
add_authorization(post, authorization, money)
|
53
|
+
post[:operation] = "Capture"
|
54
|
+
commit("Netaxept/process.aspx", post)
|
55
|
+
end
|
56
|
+
|
57
|
+
def refund(money, authorization, options = {})
|
58
|
+
post = {}
|
59
|
+
add_credentials(post, options)
|
60
|
+
add_authorization(post, authorization, money)
|
61
|
+
post[:operation] = "Credit"
|
62
|
+
commit("Netaxept/process.aspx", post)
|
63
|
+
end
|
64
|
+
|
65
|
+
def void(authorization, options = {})
|
66
|
+
post = {}
|
67
|
+
add_credentials(post, options)
|
68
|
+
add_authorization(post, authorization)
|
69
|
+
post[:operation] = "Annul"
|
70
|
+
commit("Netaxept/process.aspx", post)
|
71
|
+
end
|
72
|
+
|
73
|
+
private
|
74
|
+
|
75
|
+
def setup_transaction(money, options)
|
76
|
+
post = {}
|
77
|
+
add_credentials(post, options)
|
78
|
+
add_order(post, money, options)
|
79
|
+
commit("Netaxept/Register.aspx", post)
|
80
|
+
end
|
81
|
+
|
82
|
+
def add_and_auth_credit_card(authorization, creditcard, options)
|
83
|
+
post = {}
|
84
|
+
add_credentials(post, options, false)
|
85
|
+
add_authorization(post, authorization)
|
86
|
+
add_creditcard(post, creditcard)
|
87
|
+
commit("terminal/default.aspx", post, false)
|
88
|
+
end
|
89
|
+
|
90
|
+
def query_transaction(authorization, options)
|
91
|
+
post = {}
|
92
|
+
add_credentials(post, options)
|
93
|
+
add_authorization(post, authorization)
|
94
|
+
commit("Netaxept/query.aspx", post)
|
95
|
+
end
|
96
|
+
|
97
|
+
def add_credentials(post, options, secure=true)
|
98
|
+
post[:merchantId] = @options[:login]
|
99
|
+
post[:token] = @options[:password] if secure
|
100
|
+
end
|
101
|
+
|
102
|
+
def add_authorization(post, authorization, money=nil)
|
103
|
+
post[:transactionId] = authorization
|
104
|
+
post[:transactionAmount] = amount(money) if money
|
105
|
+
end
|
106
|
+
|
107
|
+
def add_order(post, money, options)
|
108
|
+
post[:serviceType] = 'M'
|
109
|
+
post[:orderNumber] = options[:order_id]
|
110
|
+
post[:amount] = amount(money)
|
111
|
+
post[:currencyCode] = (options[:currency] || currency(money))
|
112
|
+
post[:autoAuth] = "true"
|
113
|
+
end
|
114
|
+
|
115
|
+
def add_creditcard(post, options)
|
116
|
+
post[:pan] = options.number
|
117
|
+
post[:expiryDate] = format(options.month, :two_digits) + format(options.year, :two_digits)
|
118
|
+
post[:securityCode] = options.verification_value
|
119
|
+
end
|
120
|
+
|
121
|
+
def commit(path, parameters, xml=true)
|
122
|
+
raw = parse(ssl_get(build_url(path, parameters)), xml)
|
123
|
+
|
124
|
+
success = false
|
125
|
+
authorization = (raw["TransactionId"] || parameters[:transactionId])
|
126
|
+
if raw[:container] =~ /Exception|Error/
|
127
|
+
message = (raw["Message"] || raw["Error"]["Message"])
|
128
|
+
elsif raw["Error"] && !raw["Error"].empty?
|
129
|
+
message = (raw["Error"]["ResponseText"] || raw["Error"]["ResponseCode"])
|
130
|
+
else
|
131
|
+
message = (raw["ResponseText"] || raw["ResponseCode"] || "OK")
|
132
|
+
success = true
|
133
|
+
end
|
134
|
+
|
135
|
+
Response.new(
|
136
|
+
success,
|
137
|
+
message,
|
138
|
+
raw,
|
139
|
+
:test => test?,
|
140
|
+
:authorization => authorization
|
141
|
+
)
|
142
|
+
end
|
143
|
+
|
144
|
+
def parse(result, expects_xml=true)
|
145
|
+
if expects_xml
|
146
|
+
doc = REXML::Document.new(result)
|
147
|
+
extract_xml(doc.root).merge(:container => doc.root.name)
|
148
|
+
else
|
149
|
+
{:result => result}
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
153
|
+
def extract_xml(element)
|
154
|
+
if element.has_elements?
|
155
|
+
hash = {}
|
156
|
+
element.elements.each do |e|
|
157
|
+
hash[e.name] = extract_xml(e)
|
158
|
+
end
|
159
|
+
hash
|
160
|
+
else
|
161
|
+
element.text
|
162
|
+
end
|
163
|
+
end
|
164
|
+
|
165
|
+
def build_url(base, parameters=nil)
|
166
|
+
url = (test? ? self.test_url : self.live_url).dup
|
167
|
+
url << base
|
168
|
+
if parameters
|
169
|
+
url << '?'
|
170
|
+
url << encode(parameters)
|
171
|
+
end
|
172
|
+
url
|
173
|
+
end
|
174
|
+
|
175
|
+
def encode(hash)
|
176
|
+
hash.collect{|(k,v)| "#{CGI.escape(k.to_s)}=#{CGI.escape(v.to_s)}"}.join('&')
|
177
|
+
end
|
178
|
+
end
|
179
|
+
end
|
180
|
+
end
|
181
|
+
|