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,261 @@
|
|
1
|
+
module ActiveMerchant #:nodoc:
|
2
|
+
module Billing #:nodoc:
|
3
|
+
class SecureNetGateway < Gateway
|
4
|
+
|
5
|
+
API_VERSION = "4.0"
|
6
|
+
|
7
|
+
TRANSACTIONS = {
|
8
|
+
:auth_only => "0000",
|
9
|
+
:auth_capture => "0100",
|
10
|
+
:prior_auth_capture => "0200",
|
11
|
+
:void => "0400",
|
12
|
+
:credit => "0500"
|
13
|
+
}
|
14
|
+
|
15
|
+
XML_ATTRIBUTES = {
|
16
|
+
'xmlns' => "http://gateway.securenet.com/API/Contracts",
|
17
|
+
'xmlns:i' => "http://www.w3.org/2001/XMLSchema-instance"
|
18
|
+
}
|
19
|
+
NIL_ATTRIBUTE = { 'i:nil' => "true" }
|
20
|
+
|
21
|
+
self.supported_countries = ['US']
|
22
|
+
self.supported_cardtypes = [:visa, :master, :american_express, :discover]
|
23
|
+
self.homepage_url = 'http://www.securenet.com/'
|
24
|
+
self.display_name = 'SecureNet'
|
25
|
+
|
26
|
+
self.test_url = 'https://certify.securenet.com/API/gateway.svc/webHttp/ProcessTransaction'
|
27
|
+
self.live_url = 'https://gateway.securenet.com/api/Gateway.svc/webHttp/ProcessTransaction'
|
28
|
+
|
29
|
+
APPROVED, DECLINED = 1, 2
|
30
|
+
|
31
|
+
CARD_CODE_ERRORS = %w( N S )
|
32
|
+
AVS_ERRORS = %w( A E N R W Z )
|
33
|
+
|
34
|
+
def initialize(options = {})
|
35
|
+
requires!(options, :login, :password)
|
36
|
+
super
|
37
|
+
end
|
38
|
+
|
39
|
+
def authorize(money, creditcard, options = {})
|
40
|
+
commit(build_sale_or_authorization(creditcard, options, :auth_only, money))
|
41
|
+
end
|
42
|
+
|
43
|
+
def purchase(money, creditcard, options = {})
|
44
|
+
commit(build_sale_or_authorization(creditcard, options, :auth_capture, money))
|
45
|
+
end
|
46
|
+
|
47
|
+
def capture(money, authorization, options = {})
|
48
|
+
commit(build_capture_refund_void(authorization, options, :prior_auth_capture, money))
|
49
|
+
end
|
50
|
+
|
51
|
+
def void(authorization, options = {})
|
52
|
+
commit(build_capture_refund_void(authorization, options, :void))
|
53
|
+
end
|
54
|
+
|
55
|
+
def refund(money, authorization, options = {})
|
56
|
+
commit(build_capture_refund_void(authorization, options, :credit, money))
|
57
|
+
end
|
58
|
+
|
59
|
+
def credit(money, authorization, options = {})
|
60
|
+
deprecated CREDIT_DEPRECATION_MESSAGE
|
61
|
+
refund(money, authorization, options)
|
62
|
+
end
|
63
|
+
|
64
|
+
|
65
|
+
private
|
66
|
+
def commit(request)
|
67
|
+
xml = build_request(request)
|
68
|
+
url = test? ? self.test_url : self.live_url
|
69
|
+
data = ssl_post(url, xml, "Content-Type" => "text/xml")
|
70
|
+
response = parse(data)
|
71
|
+
|
72
|
+
Response.new(success?(response), message_from(response), response,
|
73
|
+
:test => test?,
|
74
|
+
:authorization => build_authorization(response),
|
75
|
+
:avs_result => { :code => response[:avs_result_code] },
|
76
|
+
:cvv_result => response[:card_code_response_code]
|
77
|
+
)
|
78
|
+
end
|
79
|
+
|
80
|
+
def build_request(request)
|
81
|
+
xml = Builder::XmlMarkup.new
|
82
|
+
|
83
|
+
xml.instruct!
|
84
|
+
xml.tag!("TRANSACTION", XML_ATTRIBUTES) do
|
85
|
+
xml << request
|
86
|
+
end
|
87
|
+
|
88
|
+
xml.target!
|
89
|
+
end
|
90
|
+
|
91
|
+
def build_sale_or_authorization(creditcard, options, action, money)
|
92
|
+
xml = Builder::XmlMarkup.new
|
93
|
+
|
94
|
+
xml.tag! 'AMOUNT', amount(money)
|
95
|
+
add_credit_card(xml, creditcard)
|
96
|
+
add_required_params(xml, action, options)
|
97
|
+
add_address(xml, creditcard, options)
|
98
|
+
add_invoice(xml, options)
|
99
|
+
add_more_required_params(xml, options)
|
100
|
+
|
101
|
+
xml.target!
|
102
|
+
end
|
103
|
+
|
104
|
+
def build_capture_refund_void(authorization, options, action, money = nil)
|
105
|
+
xml = Builder::XmlMarkup.new
|
106
|
+
|
107
|
+
transaction_id, amount_in_ref, last_four = split_authorization(authorization)
|
108
|
+
|
109
|
+
xml.tag! 'AMOUNT', amount(money) || amount_in_ref
|
110
|
+
xml.tag!("CARD") do
|
111
|
+
xml.tag! 'CARDNUMBER', last_four
|
112
|
+
end
|
113
|
+
|
114
|
+
add_required_params(xml, action, options)
|
115
|
+
xml.tag! 'REF_TRANSID', transaction_id
|
116
|
+
add_more_required_params(xml, options)
|
117
|
+
|
118
|
+
xml.target!
|
119
|
+
end
|
120
|
+
|
121
|
+
def add_credit_card(xml, creditcard)
|
122
|
+
xml.tag!("CARD") do
|
123
|
+
xml.tag! 'CARDCODE', creditcard.verification_value if creditcard.verification_value?
|
124
|
+
xml.tag! 'CARDNUMBER', creditcard.number
|
125
|
+
xml.tag! 'EXPDATE', expdate(creditcard)
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
def expdate(creditcard)
|
130
|
+
year = sprintf("%.4i", creditcard.year)
|
131
|
+
month = sprintf("%.2i", creditcard.month)
|
132
|
+
|
133
|
+
"#{month}#{year[-2..-1]}"
|
134
|
+
end
|
135
|
+
|
136
|
+
def add_customer_data(xml, options)
|
137
|
+
if options.has_key? :customer
|
138
|
+
xml.tag! 'CUSTOMERID', options[:customer]
|
139
|
+
end
|
140
|
+
|
141
|
+
if options.has_key? :ip
|
142
|
+
xml.tag! 'CUSTOMERIP', options[:ip]
|
143
|
+
end
|
144
|
+
end
|
145
|
+
|
146
|
+
def add_address(xml, creditcard, options)
|
147
|
+
|
148
|
+
if address = options[:billing_address] || options[:address]
|
149
|
+
xml.tag!("CUSTOMER_BILL") do
|
150
|
+
xml.tag! 'ADDRESS', address[:address1].to_s
|
151
|
+
xml.tag! 'CITY', address[:city].to_s
|
152
|
+
xml.tag! 'COMPANY', address[:company].to_s
|
153
|
+
xml.tag! 'COUNTRY', address[:country].to_s
|
154
|
+
if options.has_key? :email
|
155
|
+
xml.tag! 'EMAIL', options[:email]
|
156
|
+
xml.tag! 'EMAILRECEIPT', 'FALSE'
|
157
|
+
end
|
158
|
+
xml.tag! 'FIRSTNAME', creditcard.first_name
|
159
|
+
xml.tag! 'LASTNAME', creditcard.last_name
|
160
|
+
xml.tag! 'PHONE', address[:phone].to_s
|
161
|
+
xml.tag! 'STATE', address[:state].blank? ? 'n/a' : address[:state]
|
162
|
+
xml.tag! 'ZIP', address[:zip].to_s
|
163
|
+
end
|
164
|
+
end
|
165
|
+
|
166
|
+
if address = options[:shipping_address]
|
167
|
+
xml.tag!("CUSTOMER_SHIP") do
|
168
|
+
xml.tag! 'ADDRESS', address[:address1].to_s
|
169
|
+
xml.tag! 'CITY', address[:city].to_s
|
170
|
+
xml.tag! 'COMPANY', address[:company].to_s
|
171
|
+
xml.tag! 'COUNTRY', address[:country].to_s
|
172
|
+
xml.tag! 'FIRSTNAME', address[:first_name].to_s
|
173
|
+
xml.tag! 'LASTNAME', address[:last_name].to_s
|
174
|
+
xml.tag! 'STATE', address[:state].blank? ? 'n/a' : address[:state]
|
175
|
+
xml.tag! 'ZIP', address[:zip].to_s
|
176
|
+
end
|
177
|
+
else
|
178
|
+
xml.tag!('CUSTOMER_SHIP', NIL_ATTRIBUTE) do
|
179
|
+
end
|
180
|
+
end
|
181
|
+
|
182
|
+
end
|
183
|
+
|
184
|
+
def add_invoice(xml, options)
|
185
|
+
xml.tag! 'INVOICEDESC', options[:description]
|
186
|
+
xml.tag! 'INVOICENUM', 'inv-8'
|
187
|
+
end
|
188
|
+
|
189
|
+
def add_merchant_key(xml, options)
|
190
|
+
xml.tag!("MERCHANT_KEY") do
|
191
|
+
xml.tag! 'GROUPID', 0
|
192
|
+
xml.tag! 'SECUREKEY', @options[:password]
|
193
|
+
xml.tag! 'SECURENETID', @options[:login]
|
194
|
+
end
|
195
|
+
end
|
196
|
+
|
197
|
+
def add_required_params(xml, action, options)
|
198
|
+
xml.tag! 'CODE', TRANSACTIONS[action]
|
199
|
+
add_customer_data(xml, options)
|
200
|
+
xml.tag! 'DCI', 0 # No duplicate checking will be done, except for ORDERID
|
201
|
+
xml.tag! 'INSTALLMENT_SEQUENCENUM', 1
|
202
|
+
add_merchant_key(xml, options)
|
203
|
+
xml.tag! 'METHOD', 'CC'
|
204
|
+
xml.tag! 'ORDERID', options[:order_id]
|
205
|
+
xml.tag! 'OVERRIDE_FROM', 0 # Docs say not required, but doesn't work without it
|
206
|
+
end
|
207
|
+
|
208
|
+
def add_more_required_params(xml, options)
|
209
|
+
xml.tag! 'RETAIL_LANENUM', '0'
|
210
|
+
xml.tag! 'TEST', 'TRUE' if test?
|
211
|
+
xml.tag! 'TOTAL_INSTALLMENTCOUNT', 0
|
212
|
+
xml.tag! 'TRANSACTION_SERVICE', 0
|
213
|
+
end
|
214
|
+
|
215
|
+
def success?(response)
|
216
|
+
response[:response_code].to_i == APPROVED
|
217
|
+
end
|
218
|
+
|
219
|
+
def message_from(response)
|
220
|
+
if response[:response_code].to_i == DECLINED
|
221
|
+
return CVVResult.messages[ response[:card_code_response_code] ] if CARD_CODE_ERRORS.include?(response[:card_code_response_code])
|
222
|
+
return AVSResult.messages[ response[:avs_result_code] ] if AVS_ERRORS.include?(response[:avs_result_code])
|
223
|
+
end
|
224
|
+
|
225
|
+
return response[:response_reason_text].nil? ? '' : response[:response_reason_text][0..-1]
|
226
|
+
end
|
227
|
+
|
228
|
+
def parse(xml)
|
229
|
+
response = {}
|
230
|
+
xml = REXML::Document.new(xml)
|
231
|
+
root = REXML::XPath.first(xml, "//GATEWAYRESPONSE")
|
232
|
+
if root
|
233
|
+
root.elements.to_a.each do |node|
|
234
|
+
recurring_parse_element(response, node)
|
235
|
+
end
|
236
|
+
end
|
237
|
+
|
238
|
+
response
|
239
|
+
end
|
240
|
+
|
241
|
+
def recurring_parse_element(response, node)
|
242
|
+
if node.has_elements?
|
243
|
+
node.elements.each{|e| recurring_parse_element(response, e) }
|
244
|
+
else
|
245
|
+
response[node.name.underscore.to_sym] = node.text
|
246
|
+
end
|
247
|
+
end
|
248
|
+
|
249
|
+
def split_authorization(authorization)
|
250
|
+
transaction_id, amount, last_four = authorization.split("|")
|
251
|
+
[transaction_id, amount, last_four]
|
252
|
+
end
|
253
|
+
|
254
|
+
def build_authorization(response)
|
255
|
+
[response[:transactionid], response[:transactionamount], response[:last4_digits]].join("|")
|
256
|
+
end
|
257
|
+
|
258
|
+
end
|
259
|
+
end
|
260
|
+
end
|
261
|
+
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/authorize_net'
|
2
|
+
|
3
|
+
module ActiveMerchant #:nodoc:
|
4
|
+
module Billing #:nodoc:
|
5
|
+
class SecurePayGateway < AuthorizeNetGateway
|
6
|
+
self.live_url = self.test_url = 'https://www.securepay.com/AuthSpayAdapter/process.aspx'
|
7
|
+
|
8
|
+
self.homepage_url = 'http://www.securepay.com/'
|
9
|
+
self.display_name = 'SecurePay'
|
10
|
+
|
11
|
+
# Limit support to purchase() for the time being
|
12
|
+
# JRuby chokes here
|
13
|
+
# undef_method :authorize, :capture, :void, :credit
|
14
|
+
|
15
|
+
undef_method :authorize
|
16
|
+
undef_method :capture
|
17
|
+
undef_method :void
|
18
|
+
undef_method :credit
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def split(response)
|
23
|
+
response.split(',')
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
@@ -0,0 +1,279 @@
|
|
1
|
+
require 'rexml/document'
|
2
|
+
|
3
|
+
module ActiveMerchant #:nodoc:
|
4
|
+
module Billing #:nodoc:
|
5
|
+
class SecurePayAuGateway < Gateway
|
6
|
+
API_VERSION = 'xml-4.2'
|
7
|
+
PERIODIC_API_VERSION = 'spxml-3.0'
|
8
|
+
|
9
|
+
class_attribute :test_periodic_url, :live_periodic_url
|
10
|
+
|
11
|
+
self.test_url = 'https://www.securepay.com.au/test/payment'
|
12
|
+
self.live_url = 'https://www.securepay.com.au/xmlapi/payment'
|
13
|
+
|
14
|
+
self.test_periodic_url = 'https://test.securepay.com.au/xmlapi/periodic'
|
15
|
+
self.live_periodic_url = 'https://api.securepay.com.au/xmlapi/periodic'
|
16
|
+
|
17
|
+
self.supported_countries = ['AU']
|
18
|
+
self.supported_cardtypes = [:visa, :master, :american_express, :diners_club, :jcb]
|
19
|
+
|
20
|
+
# The homepage URL of the gateway
|
21
|
+
self.homepage_url = 'http://securepay.com.au'
|
22
|
+
|
23
|
+
# The name of the gateway
|
24
|
+
self.display_name = 'SecurePay'
|
25
|
+
|
26
|
+
class_attribute :request_timeout
|
27
|
+
self.request_timeout = 60
|
28
|
+
|
29
|
+
self.money_format = :cents
|
30
|
+
self.default_currency = 'AUD'
|
31
|
+
|
32
|
+
# 0 Standard Payment
|
33
|
+
# 4 Refund
|
34
|
+
# 6 Client Reversal (Void)
|
35
|
+
# 10 Preauthorise
|
36
|
+
# 11 Preauth Complete (Advice)
|
37
|
+
TRANSACTIONS = {
|
38
|
+
:purchase => 0,
|
39
|
+
:authorization => 10,
|
40
|
+
:capture => 11,
|
41
|
+
:void => 6,
|
42
|
+
:refund => 4
|
43
|
+
}
|
44
|
+
|
45
|
+
PERIODIC_ACTIONS = {
|
46
|
+
:add_triggered => "add",
|
47
|
+
:remove_triggered => "delete",
|
48
|
+
:trigger => "trigger"
|
49
|
+
}
|
50
|
+
|
51
|
+
PERIODIC_TYPES = {
|
52
|
+
:add_triggered => 4,
|
53
|
+
:remove_triggered => nil,
|
54
|
+
:trigger => nil
|
55
|
+
}
|
56
|
+
|
57
|
+
SUCCESS_CODES = [ '00', '08', '11', '16', '77' ]
|
58
|
+
|
59
|
+
def initialize(options = {})
|
60
|
+
requires!(options, :login, :password)
|
61
|
+
super
|
62
|
+
end
|
63
|
+
|
64
|
+
def purchase(money, credit_card_or_stored_id, options = {})
|
65
|
+
if credit_card_or_stored_id.respond_to?(:number)
|
66
|
+
requires!(options, :order_id)
|
67
|
+
commit :purchase, build_purchase_request(money, credit_card_or_stored_id, options)
|
68
|
+
else
|
69
|
+
options[:billing_id] = credit_card_or_stored_id.to_s
|
70
|
+
commit_periodic(build_periodic_item(:trigger, money, nil, options))
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
def authorize(money, credit_card, options = {})
|
75
|
+
requires!(options, :order_id)
|
76
|
+
commit :authorization, build_purchase_request(money, credit_card, options)
|
77
|
+
end
|
78
|
+
|
79
|
+
def capture(money, reference, options = {})
|
80
|
+
commit :capture, build_reference_request(money, reference)
|
81
|
+
end
|
82
|
+
|
83
|
+
def refund(money, reference, options = {})
|
84
|
+
commit :refund, build_reference_request(money, reference)
|
85
|
+
end
|
86
|
+
|
87
|
+
def credit(money, reference, options = {})
|
88
|
+
deprecated CREDIT_DEPRECATION_MESSAGE
|
89
|
+
refund(money, reference)
|
90
|
+
end
|
91
|
+
|
92
|
+
def void(reference, options = {})
|
93
|
+
commit :void, build_reference_request(nil, reference)
|
94
|
+
end
|
95
|
+
|
96
|
+
def store(creditcard, options = {})
|
97
|
+
requires!(options, :billing_id, :amount)
|
98
|
+
commit_periodic(build_periodic_item(:add_triggered, options[:amount], creditcard, options))
|
99
|
+
end
|
100
|
+
|
101
|
+
def unstore(identification, options = {})
|
102
|
+
options[:billing_id] = identification
|
103
|
+
commit_periodic(build_periodic_item(:remove_triggered, options[:amount], nil, options))
|
104
|
+
end
|
105
|
+
|
106
|
+
private
|
107
|
+
|
108
|
+
def build_purchase_request(money, credit_card, options)
|
109
|
+
xml = Builder::XmlMarkup.new
|
110
|
+
|
111
|
+
xml.tag! 'amount', amount(money)
|
112
|
+
xml.tag! 'currency', options[:currency] || currency(money)
|
113
|
+
xml.tag! 'purchaseOrderNo', options[:order_id].to_s.gsub(/[ ']/, '')
|
114
|
+
|
115
|
+
xml.tag! 'CreditCardInfo' do
|
116
|
+
xml.tag! 'cardNumber', credit_card.number
|
117
|
+
xml.tag! 'expiryDate', expdate(credit_card)
|
118
|
+
xml.tag! 'cvv', credit_card.verification_value if credit_card.verification_value?
|
119
|
+
end
|
120
|
+
|
121
|
+
xml.target!
|
122
|
+
end
|
123
|
+
|
124
|
+
def build_reference_request(money, reference)
|
125
|
+
xml = Builder::XmlMarkup.new
|
126
|
+
|
127
|
+
transaction_id, order_id, preauth_id, original_amount = reference.split('*')
|
128
|
+
|
129
|
+
xml.tag! 'amount', (money ? amount(money) : original_amount)
|
130
|
+
xml.tag! 'currency', options[:currency] || currency(money)
|
131
|
+
xml.tag! 'txnID', transaction_id
|
132
|
+
xml.tag! 'purchaseOrderNo', order_id
|
133
|
+
xml.tag! 'preauthID', preauth_id
|
134
|
+
|
135
|
+
xml.target!
|
136
|
+
end
|
137
|
+
|
138
|
+
def build_request(action, body)
|
139
|
+
xml = Builder::XmlMarkup.new
|
140
|
+
xml.instruct!
|
141
|
+
xml.tag! 'SecurePayMessage' do
|
142
|
+
xml.tag! 'MessageInfo' do
|
143
|
+
xml.tag! 'messageID', ActiveMerchant::Utils.generate_unique_id.slice(0, 30)
|
144
|
+
xml.tag! 'messageTimestamp', generate_timestamp
|
145
|
+
xml.tag! 'timeoutValue', request_timeout
|
146
|
+
xml.tag! 'apiVersion', API_VERSION
|
147
|
+
end
|
148
|
+
|
149
|
+
xml.tag! 'MerchantInfo' do
|
150
|
+
xml.tag! 'merchantID', @options[:login]
|
151
|
+
xml.tag! 'password', @options[:password]
|
152
|
+
end
|
153
|
+
|
154
|
+
xml.tag! 'RequestType', 'Payment'
|
155
|
+
xml.tag! 'Payment' do
|
156
|
+
xml.tag! 'TxnList', "count" => 1 do
|
157
|
+
xml.tag! 'Txn', "ID" => 1 do
|
158
|
+
xml.tag! 'txnType', TRANSACTIONS[action]
|
159
|
+
xml.tag! 'txnSource', 23
|
160
|
+
xml << body
|
161
|
+
end
|
162
|
+
end
|
163
|
+
end
|
164
|
+
end
|
165
|
+
|
166
|
+
xml.target!
|
167
|
+
end
|
168
|
+
|
169
|
+
def commit(action, request)
|
170
|
+
response = parse(ssl_post(test? ? self.test_url : self.live_url, build_request(action, request)))
|
171
|
+
|
172
|
+
Response.new(success?(response), message_from(response), response,
|
173
|
+
:test => test?,
|
174
|
+
:authorization => authorization_from(response)
|
175
|
+
)
|
176
|
+
end
|
177
|
+
|
178
|
+
def build_periodic_item(action, money, credit_card, options)
|
179
|
+
xml = Builder::XmlMarkup.new
|
180
|
+
|
181
|
+
xml.tag! 'actionType', PERIODIC_ACTIONS[action]
|
182
|
+
xml.tag! 'clientID', options[:billing_id].to_s
|
183
|
+
|
184
|
+
if credit_card
|
185
|
+
xml.tag! 'CreditCardInfo' do
|
186
|
+
xml.tag! 'cardNumber', credit_card.number
|
187
|
+
xml.tag! 'expiryDate', expdate(credit_card)
|
188
|
+
xml.tag! 'cvv', credit_card.verification_value if credit_card.verification_value?
|
189
|
+
end
|
190
|
+
end
|
191
|
+
xml.tag! 'amount', amount(money)
|
192
|
+
xml.tag! 'periodicType', PERIODIC_TYPES[action] if PERIODIC_TYPES[action]
|
193
|
+
|
194
|
+
xml.target!
|
195
|
+
end
|
196
|
+
|
197
|
+
def build_periodic_request(body)
|
198
|
+
xml = Builder::XmlMarkup.new
|
199
|
+
xml.instruct!
|
200
|
+
xml.tag! 'SecurePayMessage' do
|
201
|
+
xml.tag! 'MessageInfo' do
|
202
|
+
xml.tag! 'messageID', ActiveMerchant::Utils.generate_unique_id.slice(0, 30)
|
203
|
+
xml.tag! 'messageTimestamp', generate_timestamp
|
204
|
+
xml.tag! 'timeoutValue', request_timeout
|
205
|
+
xml.tag! 'apiVersion', PERIODIC_API_VERSION
|
206
|
+
end
|
207
|
+
|
208
|
+
xml.tag! 'MerchantInfo' do
|
209
|
+
xml.tag! 'merchantID', @options[:login]
|
210
|
+
xml.tag! 'password', @options[:password]
|
211
|
+
end
|
212
|
+
|
213
|
+
xml.tag! 'RequestType', 'Periodic'
|
214
|
+
xml.tag! 'Periodic' do
|
215
|
+
xml.tag! 'PeriodicList', "count" => 1 do
|
216
|
+
xml.tag! 'PeriodicItem', "ID" => 1 do
|
217
|
+
xml << body
|
218
|
+
end
|
219
|
+
end
|
220
|
+
end
|
221
|
+
end
|
222
|
+
xml.target!
|
223
|
+
end
|
224
|
+
|
225
|
+
def commit_periodic(request)
|
226
|
+
my_request = build_periodic_request(request)
|
227
|
+
#puts my_request
|
228
|
+
response = parse(ssl_post(test? ? self.test_periodic_url : self.live_periodic_url, my_request))
|
229
|
+
|
230
|
+
Response.new(success?(response), message_from(response), response,
|
231
|
+
:test => test?,
|
232
|
+
:authorization => authorization_from(response)
|
233
|
+
)
|
234
|
+
end
|
235
|
+
|
236
|
+
def success?(response)
|
237
|
+
SUCCESS_CODES.include?(response[:response_code])
|
238
|
+
end
|
239
|
+
|
240
|
+
def authorization_from(response)
|
241
|
+
[response[:txn_id], response[:purchase_order_no], response[:preauth_id], response[:amount]].join('*')
|
242
|
+
end
|
243
|
+
|
244
|
+
def message_from(response)
|
245
|
+
response[:response_text] || response[:status_description]
|
246
|
+
end
|
247
|
+
|
248
|
+
def expdate(credit_card)
|
249
|
+
"#{format(credit_card.month, :two_digits)}/#{format(credit_card.year, :two_digits)}"
|
250
|
+
end
|
251
|
+
|
252
|
+
def parse(body)
|
253
|
+
xml = REXML::Document.new(body)
|
254
|
+
|
255
|
+
response = {}
|
256
|
+
|
257
|
+
xml.root.elements.to_a.each do |node|
|
258
|
+
parse_element(response, node)
|
259
|
+
end
|
260
|
+
|
261
|
+
response
|
262
|
+
end
|
263
|
+
|
264
|
+
def parse_element(response, node)
|
265
|
+
if node.has_elements?
|
266
|
+
node.elements.each{|element| parse_element(response, element) }
|
267
|
+
else
|
268
|
+
response[node.name.underscore.to_sym] = node.text
|
269
|
+
end
|
270
|
+
end
|
271
|
+
|
272
|
+
# YYYYDDMMHHNNSSKKK000sOOO
|
273
|
+
def generate_timestamp
|
274
|
+
time = Time.now.utc
|
275
|
+
time.strftime("%Y%d%m%H%M%S#{time.usec}+000")
|
276
|
+
end
|
277
|
+
end
|
278
|
+
end
|
279
|
+
end
|
@@ -0,0 +1,112 @@
|
|
1
|
+
module ActiveMerchant #:nodoc:
|
2
|
+
module Billing #:nodoc:
|
3
|
+
class SecurePayTechGateway < Gateway
|
4
|
+
class SecurePayTechPostData < PostData
|
5
|
+
self.required_fields = [ :OrderReference, :CardNumber, :CardExpiry, :CardHolderName, :CardType, :MerchantID, :MerchantKey, :Amount, :Currency ]
|
6
|
+
end
|
7
|
+
|
8
|
+
self.live_url = self.test_url = 'https://tx.securepaytech.com/web/HttpPostPurchase'
|
9
|
+
|
10
|
+
PAYMENT_GATEWAY_RESPONSES = {
|
11
|
+
1 => "Transaction OK",
|
12
|
+
2 => "Insufficient funds",
|
13
|
+
3 => "Card expired",
|
14
|
+
4 => "Card declined",
|
15
|
+
5 => "Server error",
|
16
|
+
6 => "Communications error",
|
17
|
+
7 => "Unsupported transaction type",
|
18
|
+
8 => "Bad or malformed request",
|
19
|
+
9 => "Invalid card number"
|
20
|
+
}
|
21
|
+
|
22
|
+
self.default_currency = 'NZD'
|
23
|
+
self.supported_countries = ['NZ']
|
24
|
+
self.supported_cardtypes = [:visa, :master, :american_express, :diners_club]
|
25
|
+
self.homepage_url = 'http://www.securepaytech.com/'
|
26
|
+
self.display_name = 'SecurePayTech'
|
27
|
+
|
28
|
+
def initialize(options = {})
|
29
|
+
requires!(options, :login, :password)
|
30
|
+
super
|
31
|
+
end
|
32
|
+
|
33
|
+
def purchase(money, creditcard, options = {})
|
34
|
+
post = SecurePayTechPostData.new
|
35
|
+
|
36
|
+
add_invoice(post, money, options)
|
37
|
+
add_creditcard(post, creditcard)
|
38
|
+
|
39
|
+
commit(:purchase, post)
|
40
|
+
end
|
41
|
+
|
42
|
+
private
|
43
|
+
|
44
|
+
def add_invoice(post, money, options)
|
45
|
+
post[:Amount] = amount(money)
|
46
|
+
post[:Currency] = options[:currency] || currency(money)
|
47
|
+
|
48
|
+
post[:OrderReference] = options[:order_id]
|
49
|
+
end
|
50
|
+
|
51
|
+
def add_creditcard(post, creditcard)
|
52
|
+
post[:CardNumber] = creditcard.number
|
53
|
+
post[:CardExpiry] = expdate(creditcard)
|
54
|
+
post[:CardHolderName] = creditcard.name
|
55
|
+
|
56
|
+
if creditcard.verification_value?
|
57
|
+
post[:EnableCSC] = true
|
58
|
+
post[:CSC] = creditcard.verification_value
|
59
|
+
end
|
60
|
+
|
61
|
+
# SPT will autodetect this
|
62
|
+
post[:CardType] = 0
|
63
|
+
end
|
64
|
+
|
65
|
+
def parse(body)
|
66
|
+
response = CGI.unescape(body).split(',')
|
67
|
+
|
68
|
+
result = {}
|
69
|
+
result[:result_code] = response[0].to_i
|
70
|
+
|
71
|
+
if response.length == 2
|
72
|
+
result[:fail_reason] = response[1]
|
73
|
+
else
|
74
|
+
result[:merchant_transaction_reference] = response[1]
|
75
|
+
result[:receipt_number] = response[2]
|
76
|
+
result[:transaction_number] = response[3]
|
77
|
+
result[:authorisation_id] = response[4]
|
78
|
+
result[:batch_number] = response[5]
|
79
|
+
end
|
80
|
+
|
81
|
+
result
|
82
|
+
end
|
83
|
+
|
84
|
+
def commit(action, post)
|
85
|
+
response = parse( ssl_post(self.live_url, post_data(action, post) ) )
|
86
|
+
|
87
|
+
Response.new(response[:result_code] == 1, message_from(response), response,
|
88
|
+
:test => test?,
|
89
|
+
:authorization => response[:merchant_transaction_reference]
|
90
|
+
)
|
91
|
+
end
|
92
|
+
|
93
|
+
def message_from(result)
|
94
|
+
PAYMENT_GATEWAY_RESPONSES[result[:result_code]]
|
95
|
+
end
|
96
|
+
|
97
|
+
def post_data(action, post)
|
98
|
+
post[:MerchantID] = @options[:login]
|
99
|
+
post[:MerchantKey] = @options[:password]
|
100
|
+
post.to_s
|
101
|
+
end
|
102
|
+
|
103
|
+
def expdate(creditcard)
|
104
|
+
year = sprintf("%.4i", creditcard.year)
|
105
|
+
month = sprintf("%.2i", creditcard.month)
|
106
|
+
|
107
|
+
"#{month}#{year[-2..-1]}"
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|