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,221 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), '..', 'check.rb')
|
2
|
+
module ActiveMerchant #:nodoc:
|
3
|
+
module Billing #:nodoc:
|
4
|
+
class InspireGateway < Gateway
|
5
|
+
self.live_url = self.test_url = 'https://secure.inspiregateway.net/api/transact.php'
|
6
|
+
|
7
|
+
self.supported_countries = ['US']
|
8
|
+
self.supported_cardtypes = [:visa, :master, :american_express]
|
9
|
+
self.homepage_url = 'http://www.inspiregateway.com'
|
10
|
+
self.display_name = 'Inspire Commerce'
|
11
|
+
|
12
|
+
# Creates a new InspireGateway
|
13
|
+
#
|
14
|
+
# The gateway requires that a valid login and password be passed
|
15
|
+
# in the +options+ hash.
|
16
|
+
#
|
17
|
+
# ==== Options
|
18
|
+
#
|
19
|
+
# * <tt>:login</tt> -- The Inspire Username.
|
20
|
+
# * <tt>:password</tt> -- The Inspire Passowrd.
|
21
|
+
# See the Inspire Integration Guide for details. (default: +false+)
|
22
|
+
def initialize(options = {})
|
23
|
+
requires!(options, :login, :password)
|
24
|
+
super
|
25
|
+
end
|
26
|
+
|
27
|
+
# Pass :store => true in the options to store the
|
28
|
+
# payment info at Inspire Gateway and get a generated
|
29
|
+
# customer_vault_id in the response.
|
30
|
+
# Pass :store => some_number_or_string to specify the
|
31
|
+
# customer_vault_id InspireGateway should use (make sure it's
|
32
|
+
# unique).
|
33
|
+
def authorize(money, creditcard, options = {})
|
34
|
+
post = {}
|
35
|
+
add_invoice(post, options)
|
36
|
+
add_payment_source(post, creditcard,options)
|
37
|
+
add_address(post, creditcard, options)
|
38
|
+
add_customer_data(post, options)
|
39
|
+
|
40
|
+
commit('auth', money, post)
|
41
|
+
end
|
42
|
+
|
43
|
+
def purchase(money, payment_source, options = {})
|
44
|
+
post = {}
|
45
|
+
add_invoice(post, options)
|
46
|
+
add_payment_source(post, payment_source, options)
|
47
|
+
add_address(post, payment_source, options)
|
48
|
+
add_customer_data(post, options)
|
49
|
+
|
50
|
+
commit('sale', money, post)
|
51
|
+
end
|
52
|
+
|
53
|
+
def capture(money, authorization, options = {})
|
54
|
+
post ={}
|
55
|
+
post[:transactionid] = authorization
|
56
|
+
commit('capture', money, post)
|
57
|
+
end
|
58
|
+
|
59
|
+
def void(authorization, options = {})
|
60
|
+
post ={}
|
61
|
+
post[:transactionid] = authorization
|
62
|
+
commit('void', nil, post)
|
63
|
+
end
|
64
|
+
|
65
|
+
# Update the values (such as CC expiration) stored at
|
66
|
+
# InspireGateway. The CC number must be supplied in the
|
67
|
+
# CreditCard object.
|
68
|
+
def update(vault_id, creditcard, options = {})
|
69
|
+
post = {}
|
70
|
+
post[:customer_vault] = "update_customer"
|
71
|
+
add_customer_vault_id(post, vault_id)
|
72
|
+
add_creditcard(post, creditcard, options)
|
73
|
+
add_address(post, creditcard, options)
|
74
|
+
add_customer_data(post, options)
|
75
|
+
|
76
|
+
commit(nil, nil, post)
|
77
|
+
end
|
78
|
+
|
79
|
+
def delete(vault_id)
|
80
|
+
post = {}
|
81
|
+
post[:customer_vault] = "delete_customer"
|
82
|
+
add_customer_vault_id(post, vault_id)
|
83
|
+
commit(nil, nil, post)
|
84
|
+
end
|
85
|
+
|
86
|
+
# To match the other stored-value gateways, like TrustCommerce,
|
87
|
+
# store and unstore need to be defined
|
88
|
+
def store(creditcard, options = {})
|
89
|
+
billing_id = options.delete(:billing_id).to_s || true
|
90
|
+
authorize(100, creditcard, options.merge(:store => billing_id))
|
91
|
+
end
|
92
|
+
|
93
|
+
alias_method :unstore, :delete
|
94
|
+
|
95
|
+
private
|
96
|
+
def add_customer_data(post, options)
|
97
|
+
if options.has_key? :email
|
98
|
+
post[:email] = options[:email]
|
99
|
+
end
|
100
|
+
|
101
|
+
if options.has_key? :ip
|
102
|
+
post[:ipaddress] = options[:ip]
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
def add_address(post, creditcard, options)
|
107
|
+
if address = options[:billing_address] || options[:address]
|
108
|
+
post[:address1] = address[:address1].to_s
|
109
|
+
post[:address2] = address[:address2].to_s unless address[:address2].blank?
|
110
|
+
post[:company] = address[:company].to_s
|
111
|
+
post[:phone] = address[:phone].to_s
|
112
|
+
post[:zip] = address[:zip].to_s
|
113
|
+
post[:city] = address[:city].to_s
|
114
|
+
post[:country] = address[:country].to_s
|
115
|
+
post[:state] = address[:state].blank? ? 'n/a' : address[:state]
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
def add_invoice(post, options)
|
120
|
+
post[:orderid] = options[:order_id].to_s.gsub(/[^\w.]/, '')
|
121
|
+
post[:orderdescription] = options[:description]
|
122
|
+
end
|
123
|
+
|
124
|
+
def add_payment_source(params, source, options={})
|
125
|
+
case determine_funding_source(source)
|
126
|
+
when :vault then add_customer_vault_id(params, source)
|
127
|
+
when :credit_card then add_creditcard(params, source, options)
|
128
|
+
when :check then add_check(params, source)
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
132
|
+
def add_customer_vault_id(params,vault_id)
|
133
|
+
params[:customer_vault_id] = vault_id
|
134
|
+
end
|
135
|
+
|
136
|
+
def add_creditcard(post, creditcard,options)
|
137
|
+
if options[:store]
|
138
|
+
post[:customer_vault] = "add_customer"
|
139
|
+
post[:customer_vault_id] = options[:store] unless options[:store] == true
|
140
|
+
end
|
141
|
+
post[:ccnumber] = creditcard.number
|
142
|
+
post[:cvv] = creditcard.verification_value if creditcard.verification_value?
|
143
|
+
post[:ccexp] = expdate(creditcard)
|
144
|
+
post[:firstname] = creditcard.first_name
|
145
|
+
post[:lastname] = creditcard.last_name
|
146
|
+
end
|
147
|
+
|
148
|
+
def add_check(post, check)
|
149
|
+
post[:payment] = 'check' # Set transaction to ACH
|
150
|
+
post[:checkname] = check.name # The name on the customer's Checking Account
|
151
|
+
post[:checkaba] = check.routing_number # The customer's bank routing number
|
152
|
+
post[:checkaccount] = check.account_number # The customer's account number
|
153
|
+
post[:account_holder_type] = check.account_holder_type # The customer's type of ACH account
|
154
|
+
post[:account_type] = check.account_type # The customer's type of ACH account
|
155
|
+
end
|
156
|
+
|
157
|
+
def parse(body)
|
158
|
+
results = {}
|
159
|
+
body.split(/&/).each do |pair|
|
160
|
+
key,val = pair.split(/=/)
|
161
|
+
results[key] = val
|
162
|
+
end
|
163
|
+
|
164
|
+
results
|
165
|
+
end
|
166
|
+
|
167
|
+
def commit(action, money, parameters)
|
168
|
+
parameters[:amount] = amount(money) if money
|
169
|
+
|
170
|
+
response = parse( ssl_post(self.live_url, post_data(action,parameters)) )
|
171
|
+
|
172
|
+
Response.new(response["response"] == "1", message_from(response), response,
|
173
|
+
:authorization => response["transactionid"],
|
174
|
+
:test => test?,
|
175
|
+
:cvv_result => response["cvvresponse"],
|
176
|
+
:avs_result => { :code => response["avsresponse"] }
|
177
|
+
)
|
178
|
+
|
179
|
+
end
|
180
|
+
|
181
|
+
def expdate(creditcard)
|
182
|
+
year = sprintf("%.4i", creditcard.year)
|
183
|
+
month = sprintf("%.2i", creditcard.month)
|
184
|
+
|
185
|
+
"#{month}#{year[-2..-1]}"
|
186
|
+
end
|
187
|
+
|
188
|
+
|
189
|
+
def message_from(response)
|
190
|
+
case response["responsetext"]
|
191
|
+
when "SUCCESS","Approved"
|
192
|
+
"This transaction has been approved"
|
193
|
+
when "DECLINE"
|
194
|
+
"This transaction has been declined"
|
195
|
+
else
|
196
|
+
response["responsetext"]
|
197
|
+
end
|
198
|
+
end
|
199
|
+
|
200
|
+
def post_data(action, parameters = {})
|
201
|
+
post = {}
|
202
|
+
post[:username] = @options[:login]
|
203
|
+
post[:password] = @options[:password]
|
204
|
+
post[:type] = action if action
|
205
|
+
|
206
|
+
request = post.merge(parameters).map {|key,value| "#{key}=#{CGI.escape(value.to_s)}"}.join("&")
|
207
|
+
request
|
208
|
+
end
|
209
|
+
|
210
|
+
def determine_funding_source(source)
|
211
|
+
case
|
212
|
+
when source.is_a?(String) then :vault
|
213
|
+
when CreditCard.card_companies.keys.include?(card_brand(source)) then :credit_card
|
214
|
+
when card_brand(source) == 'check' then :check
|
215
|
+
else raise ArgumentError, "Unsupported funding source provided"
|
216
|
+
end
|
217
|
+
end
|
218
|
+
end
|
219
|
+
end
|
220
|
+
end
|
221
|
+
|
@@ -0,0 +1,163 @@
|
|
1
|
+
module ActiveMerchant #:nodoc:
|
2
|
+
module Billing #:nodoc:
|
3
|
+
class InstapayGateway < Gateway
|
4
|
+
self.live_url = 'https://trans.instapaygateway.com/cgi-bin/process.cgi'
|
5
|
+
|
6
|
+
# The countries the gateway supports merchants from as 2 digit ISO country codes
|
7
|
+
self.supported_countries = ['US']
|
8
|
+
self.money_format = :dollars
|
9
|
+
self.default_currency = 'USD'
|
10
|
+
# The card types supported by the payment gateway
|
11
|
+
self.supported_cardtypes = [:visa, :master, :american_express, :discover]
|
12
|
+
|
13
|
+
# The homepage URL of the gateway
|
14
|
+
self.homepage_url = 'http://www.instapayllc.com'
|
15
|
+
|
16
|
+
# The name of the gateway
|
17
|
+
self.display_name = 'InstaPay'
|
18
|
+
|
19
|
+
SUCCESS = "Accepted"
|
20
|
+
SUCCESS_MESSAGE = "The transaction has been approved"
|
21
|
+
|
22
|
+
def initialize(options = {})
|
23
|
+
requires!(options, :login)
|
24
|
+
super
|
25
|
+
end
|
26
|
+
|
27
|
+
def authorize(money, creditcard, options = {})
|
28
|
+
post = {}
|
29
|
+
post[:authonly] = 1
|
30
|
+
add_amount(post, money)
|
31
|
+
add_invoice(post, options)
|
32
|
+
add_creditcard(post, creditcard)
|
33
|
+
add_address(post, options)
|
34
|
+
add_customer_data(post, options)
|
35
|
+
|
36
|
+
commit('ns_quicksale_cc', post)
|
37
|
+
end
|
38
|
+
|
39
|
+
def purchase(money, creditcard, options = {})
|
40
|
+
post = {}
|
41
|
+
add_amount(post, money)
|
42
|
+
add_invoice(post, options)
|
43
|
+
add_creditcard(post, creditcard)
|
44
|
+
add_address(post, options)
|
45
|
+
add_customer_data(post, options)
|
46
|
+
|
47
|
+
commit('ns_quicksale_cc', post)
|
48
|
+
end
|
49
|
+
|
50
|
+
def capture(money, authorization, options = {})
|
51
|
+
post = {}
|
52
|
+
add_amount(post, money)
|
53
|
+
add_reference(post, authorization)
|
54
|
+
commit('ns_quicksale_cc', post)
|
55
|
+
end
|
56
|
+
|
57
|
+
private
|
58
|
+
|
59
|
+
def add_amount(post, money)
|
60
|
+
post[:amount] = amount(money)
|
61
|
+
end
|
62
|
+
|
63
|
+
def add_reference(post, reference)
|
64
|
+
post[:postonly] = reference
|
65
|
+
end
|
66
|
+
|
67
|
+
def add_customer_data(post, options)
|
68
|
+
post[:ci_email] = options[:email]
|
69
|
+
post["ci_IP Address"] = options[:ip]
|
70
|
+
end
|
71
|
+
|
72
|
+
def add_address(post, options)
|
73
|
+
if address = options[:billing_address] || options[:address]
|
74
|
+
post[:ci_billaddr1] = address[:address1]
|
75
|
+
post[:ci_billaddr2] = address[:address2]
|
76
|
+
post[:ci_billcity] = address[:city]
|
77
|
+
post[:ci_billstate] = address[:state]
|
78
|
+
post[:ci_billzip] = address[:zip]
|
79
|
+
post[:ci_billcountry] = address[:country]
|
80
|
+
post[:ci_phone] = address[:phone]
|
81
|
+
end
|
82
|
+
|
83
|
+
if address = options[:shipping_address]
|
84
|
+
post[:ci_shipaddr1] = address[:address1]
|
85
|
+
post[:ci_shipaddr2] = address[:address2]
|
86
|
+
post[:ci_shipcity] = address[:city]
|
87
|
+
post[:ci_shipstate] = address[:state]
|
88
|
+
post[:ci_shipzip] = address[:zip]
|
89
|
+
post[:ci_shipcountry] = address[:country]
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
def add_invoice(post, options)
|
94
|
+
post[:merchantordernumber] = options[:order_id]
|
95
|
+
post[:ci_memo] = options[:description]
|
96
|
+
post[:pocustomerrefid] = options[:invoice]
|
97
|
+
end
|
98
|
+
|
99
|
+
def add_creditcard(post, creditcard)
|
100
|
+
post[:ccnum] = creditcard.number
|
101
|
+
post[:expmon] = format(creditcard.month, :two_digits)
|
102
|
+
post[:cvv2] = creditcard.verification_value if creditcard.verification_value?
|
103
|
+
post[:expyear] = creditcard.year
|
104
|
+
post[:ccname] = creditcard.name
|
105
|
+
end
|
106
|
+
|
107
|
+
def parse(body)
|
108
|
+
results = {}
|
109
|
+
fields = body.split("\r\n")
|
110
|
+
|
111
|
+
response = fields[1].split('=')
|
112
|
+
response_data = response[1].split(':')
|
113
|
+
|
114
|
+
if response[0] == SUCCESS
|
115
|
+
results[:success] = true
|
116
|
+
results[:message] = SUCCESS_MESSAGE
|
117
|
+
results[:transaction_type] = response_data[0]
|
118
|
+
results[:authorization_code] = response_data[1]
|
119
|
+
results[:reference_number] = response_data[2]
|
120
|
+
results[:batch_number] = response_data[3]
|
121
|
+
results[:transaction_id] = response_data[4]
|
122
|
+
results[:avs_result] = response_data[5]
|
123
|
+
results[:authorize_net] = response_data[6]
|
124
|
+
results[:cvv_result] = response_data[7]
|
125
|
+
else
|
126
|
+
results[:success] = false
|
127
|
+
results[:result] = response_data[0]
|
128
|
+
results[:response_code] = response_data[1]
|
129
|
+
results[:message] = response_data[2]
|
130
|
+
end
|
131
|
+
|
132
|
+
fields[1..-1].each do |pair|
|
133
|
+
key, value = pair.split('=')
|
134
|
+
results[key] = value
|
135
|
+
end
|
136
|
+
results
|
137
|
+
end
|
138
|
+
|
139
|
+
def commit(action, parameters)
|
140
|
+
data = ssl_post self.live_url, post_data(action, parameters)
|
141
|
+
response = parse(data)
|
142
|
+
|
143
|
+
Response.new(response[:success] , response[:message], response,
|
144
|
+
:authorization => response[:transaction_id],
|
145
|
+
:avs_result => { :code => response[:avs_result] },
|
146
|
+
:cvv_result => response[:cvv_result]
|
147
|
+
)
|
148
|
+
end
|
149
|
+
|
150
|
+
def post_data(action, parameters = {})
|
151
|
+
post = {}
|
152
|
+
post[:acctid] = @options[:login]
|
153
|
+
if(@options[:password])
|
154
|
+
post[:merchantpin] = @options[:password]
|
155
|
+
end
|
156
|
+
post[:action] = action
|
157
|
+
request = post.merge(parameters).collect { |key, value| "#{key}=#{CGI.escape(value.to_s)}" }.join("&")
|
158
|
+
request
|
159
|
+
end
|
160
|
+
end
|
161
|
+
end
|
162
|
+
end
|
163
|
+
|
@@ -0,0 +1,262 @@
|
|
1
|
+
module ActiveMerchant #:nodoc:
|
2
|
+
module Billing #:nodoc:
|
3
|
+
# For more information on the Iridium Gateway please download the
|
4
|
+
# documentation from their Merchant Management System.
|
5
|
+
#
|
6
|
+
# The login and password are not the username and password you use to
|
7
|
+
# login to the Iridium Merchant Management System. Instead, you will
|
8
|
+
# use the API username and password you were issued separately.
|
9
|
+
class IridiumGateway < Gateway
|
10
|
+
self.live_url = self.test_url = 'https://gw1.iridiumcorp.net/'
|
11
|
+
|
12
|
+
# The countries the gateway supports merchants from as 2 digit ISO country codes
|
13
|
+
self.supported_countries = ['GB', 'ES']
|
14
|
+
self.default_currency = 'EUR'
|
15
|
+
self.money_format = :cents
|
16
|
+
|
17
|
+
# The card types supported by the payment gateway
|
18
|
+
self.supported_cardtypes = [:visa, :master, :american_express, :discover, :maestro, :jcb, :solo, :diners_club]
|
19
|
+
|
20
|
+
# The homepage URL of the gateway
|
21
|
+
self.homepage_url = 'http://www.iridiumcorp.co.uk/'
|
22
|
+
|
23
|
+
# The name of the gateway
|
24
|
+
self.display_name = 'Iridium'
|
25
|
+
|
26
|
+
CURRENCY_CODES = {
|
27
|
+
"AUD" => '036',
|
28
|
+
"CAD" => '124',
|
29
|
+
"EUR" => '978',
|
30
|
+
"GBP" => '826',
|
31
|
+
"MXN" => '484',
|
32
|
+
"NZD" => '554',
|
33
|
+
"USD" => '840',
|
34
|
+
}
|
35
|
+
|
36
|
+
def initialize(options = {})
|
37
|
+
requires!(options, :login, :password)
|
38
|
+
super
|
39
|
+
end
|
40
|
+
|
41
|
+
def authorize(money, payment_source, options = {})
|
42
|
+
setup_address_hash(options)
|
43
|
+
|
44
|
+
if payment_source.respond_to?(:number)
|
45
|
+
commit(build_purchase_request('PREAUTH', money, payment_source, options), options)
|
46
|
+
else
|
47
|
+
commit(build_reference_request('PREAUTH', money, payment_source, options), options)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def purchase(money, payment_source, options = {})
|
52
|
+
setup_address_hash(options)
|
53
|
+
|
54
|
+
if payment_source.respond_to?(:number)
|
55
|
+
commit(build_purchase_request('SALE', money, payment_source, options), options)
|
56
|
+
else
|
57
|
+
commit(build_reference_request('SALE', money, payment_source, options), options)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
def capture(money, authorization, options = {})
|
62
|
+
commit(build_reference_request('COLLECTION', money, authorization, options), options)
|
63
|
+
end
|
64
|
+
|
65
|
+
def credit(money, authorization, options={})
|
66
|
+
deprecated CREDIT_DEPRECATION_MESSAGE
|
67
|
+
refund(money, authorization, options)
|
68
|
+
end
|
69
|
+
|
70
|
+
def refund(money, authorization, options={})
|
71
|
+
commit(build_reference_request('REFUND', money, authorization, options), options)
|
72
|
+
end
|
73
|
+
|
74
|
+
def void(authorization, options={})
|
75
|
+
commit(build_reference_request('VOID', nil, authorization, options), options)
|
76
|
+
end
|
77
|
+
|
78
|
+
private
|
79
|
+
|
80
|
+
def build_purchase_request(type, money, creditcard, options)
|
81
|
+
options.merge!(:action => 'CardDetailsTransaction')
|
82
|
+
build_request(options) do |xml|
|
83
|
+
add_purchase_data(xml, type, money, options)
|
84
|
+
add_creditcard(xml, creditcard)
|
85
|
+
add_customerdetails(xml, creditcard, options[:billing_address], options)
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
def build_reference_request(type, money, authorization, options)
|
90
|
+
options.merge!(:action => 'CrossReferenceTransaction')
|
91
|
+
order_id, cross_reference, auth_id = authorization.split(";")
|
92
|
+
build_request(options) do |xml|
|
93
|
+
if money
|
94
|
+
details = {'CurrencyCode' => currency_code(options[:currency] || default_currency), 'Amount' => amount(money)}
|
95
|
+
else
|
96
|
+
details = {'CurrencyCode' => currency_code(default_currency), 'Amount' => '0'}
|
97
|
+
end
|
98
|
+
xml.tag! 'TransactionDetails', details do
|
99
|
+
xml.tag! 'MessageDetails', {'TransactionType' => type, 'CrossReference' => cross_reference}
|
100
|
+
xml.tag! 'OrderID', (options[:order_id] || order_id)
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
def build_request(options)
|
106
|
+
requires!(options, :action)
|
107
|
+
xml = Builder::XmlMarkup.new :indent => 2
|
108
|
+
xml.instruct!(:xml, :version => '1.0', :encoding => 'utf-8')
|
109
|
+
xml.tag! 'soap:Envelope', { 'xmlns:soap' => 'http://schemas.xmlsoap.org/soap/envelope/',
|
110
|
+
'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
|
111
|
+
'xmlns:xsd' => 'http://www.w3.org/2001/XMLSchema'} do
|
112
|
+
xml.tag! 'soap:Body' do
|
113
|
+
xml.tag! options[:action], {'xmlns' => "https://www.thepaymentgateway.net/"} do
|
114
|
+
xml.tag! 'PaymentMessage' do
|
115
|
+
add_merchant_data(xml, options)
|
116
|
+
yield(xml)
|
117
|
+
end
|
118
|
+
end
|
119
|
+
end
|
120
|
+
end
|
121
|
+
xml.target!
|
122
|
+
end
|
123
|
+
|
124
|
+
def setup_address_hash(options)
|
125
|
+
options[:billing_address] = options[:billing_address] || options[:address] || {}
|
126
|
+
options[:shipping_address] = options[:shipping_address] || {}
|
127
|
+
end
|
128
|
+
|
129
|
+
def add_purchase_data(xml, type, money, options)
|
130
|
+
requires!(options, :order_id)
|
131
|
+
xml.tag! 'TransactionDetails', {'Amount' => amount(money), 'CurrencyCode' => currency_code(options[:currency] || currency(money))} do
|
132
|
+
xml.tag! 'MessageDetails', {'TransactionType' => type}
|
133
|
+
xml.tag! 'OrderID', options[:order_id]
|
134
|
+
xml.tag! 'TransactionControl' do
|
135
|
+
xml.tag! 'ThreeDSecureOverridePolicy', 'FALSE'
|
136
|
+
xml.tag! 'EchoAVSCheckResult', 'TRUE'
|
137
|
+
xml.tag! 'EchoCV2CheckResult', 'TRUE'
|
138
|
+
end
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
142
|
+
def add_customerdetails(xml, creditcard, address, options, shipTo = false)
|
143
|
+
xml.tag! 'CustomerDetails' do
|
144
|
+
if address
|
145
|
+
unless address[:country].blank?
|
146
|
+
country_code = Country.find(address[:country]).code(:numeric)
|
147
|
+
end
|
148
|
+
xml.tag! 'BillingAddress' do
|
149
|
+
xml.tag! 'Address1', address[:address1]
|
150
|
+
xml.tag! 'Address2', address[:address2]
|
151
|
+
xml.tag! 'City', address[:city]
|
152
|
+
xml.tag! 'State', address[:state]
|
153
|
+
xml.tag! 'PostCode', address[:zip]
|
154
|
+
xml.tag! 'CountryCode', country_code if country_code
|
155
|
+
end
|
156
|
+
xml.tag! 'PhoneNumber', address[:phone]
|
157
|
+
end
|
158
|
+
|
159
|
+
xml.tag! 'EmailAddress', options[:email]
|
160
|
+
xml.tag! 'CustomerIPAddress', options[:ip] || "127.0.0.1"
|
161
|
+
end
|
162
|
+
end
|
163
|
+
|
164
|
+
def add_creditcard(xml, creditcard)
|
165
|
+
xml.tag! 'CardDetails' do
|
166
|
+
xml.tag! 'CardName', creditcard.name
|
167
|
+
xml.tag! 'CV2', creditcard.verification_value if creditcard.verification_value
|
168
|
+
xml.tag! 'CardNumber', creditcard.number
|
169
|
+
xml.tag! 'ExpiryDate', { 'Month' => creditcard.month.to_s.rjust(2, "0"), 'Year' => creditcard.year.to_s[/\d\d$/] }
|
170
|
+
end
|
171
|
+
end
|
172
|
+
|
173
|
+
def add_merchant_data(xml, options)
|
174
|
+
xml.tag! 'MerchantAuthentication', {"MerchantID" => @options[:login], "Password" => @options[:password]}
|
175
|
+
end
|
176
|
+
|
177
|
+
def commit(request, options)
|
178
|
+
requires!(options, :action)
|
179
|
+
response = parse(ssl_post(test? ? self.test_url : self.live_url, request,
|
180
|
+
{"SOAPAction" => "https://www.thepaymentgateway.net/#{options[:action]}",
|
181
|
+
"Content-Type" => "text/xml; charset=utf-8" }))
|
182
|
+
|
183
|
+
success = response[:transaction_result][:status_code] == "0"
|
184
|
+
message = response[:transaction_result][:message]
|
185
|
+
authorization = success ? [ options[:order_id], response[:transaction_output_data][:cross_reference], response[:transaction_output_data][:auth_code] ].compact.join(";") : nil
|
186
|
+
|
187
|
+
Response.new(success, message, response,
|
188
|
+
:test => test?,
|
189
|
+
:authorization => authorization)
|
190
|
+
end
|
191
|
+
|
192
|
+
def parse(xml)
|
193
|
+
reply = {}
|
194
|
+
xml = REXML::Document.new(xml)
|
195
|
+
if (root = REXML::XPath.first(xml, "//CardDetailsTransactionResponse")) or
|
196
|
+
(root = REXML::XPath.first(xml, "//CrossReferenceTransactionResponse"))
|
197
|
+
root.elements.to_a.each do |node|
|
198
|
+
case node.name
|
199
|
+
when 'Message'
|
200
|
+
reply[:message] = reply(node.text)
|
201
|
+
else
|
202
|
+
parse_element(reply, node)
|
203
|
+
end
|
204
|
+
end
|
205
|
+
elsif root = REXML::XPath.first(xml, "//soap:Fault")
|
206
|
+
parse_element(reply, root)
|
207
|
+
reply[:message] = "#{reply[:faultcode]}: #{reply[:faultstring]}"
|
208
|
+
end
|
209
|
+
reply
|
210
|
+
end
|
211
|
+
|
212
|
+
def parse_element(reply, node)
|
213
|
+
case node.name
|
214
|
+
when "CrossReferenceTransactionResult"
|
215
|
+
reply[:transaction_result] = {}
|
216
|
+
node.attributes.each do |a,b|
|
217
|
+
reply[:transaction_result][a.underscore.to_sym] = b
|
218
|
+
end
|
219
|
+
node.elements.each{|e| parse_element(reply[:transaction_result], e) } if node.has_elements?
|
220
|
+
|
221
|
+
when "CardDetailsTransactionResult"
|
222
|
+
reply[:transaction_result] = {}
|
223
|
+
node.attributes.each do |a,b|
|
224
|
+
reply[:transaction_result][a.underscore.to_sym] = b
|
225
|
+
end
|
226
|
+
node.elements.each{|e| parse_element(reply[:transaction_result], e) } if node.has_elements?
|
227
|
+
|
228
|
+
when "TransactionOutputData"
|
229
|
+
reply[:transaction_output_data] = {}
|
230
|
+
node.attributes.each{|a,b| reply[:transaction_output_data][a.underscore.to_sym] = b }
|
231
|
+
node.elements.each{|e| parse_element(reply[:transaction_output_data], e) } if node.has_elements?
|
232
|
+
when "CustomVariables"
|
233
|
+
reply[:custom_variables] = {}
|
234
|
+
node.attributes.each{|a,b| reply[:custom_variables][a.underscore.to_sym] = b }
|
235
|
+
node.elements.each{|e| parse_element(reply[:custom_variables], e) } if node.has_elements?
|
236
|
+
when "GatewayEntryPoints"
|
237
|
+
reply[:gateway_entry_points] = {}
|
238
|
+
node.attributes.each{|a,b| reply[:gateway_entry_points][a.underscore.to_sym] = b }
|
239
|
+
node.elements.each{|e| parse_element(reply[:gateway_entry_points], e) } if node.has_elements?
|
240
|
+
else
|
241
|
+
k = node.name.underscore.to_sym
|
242
|
+
if node.has_elements?
|
243
|
+
reply[k] = {}
|
244
|
+
node.elements.each{|e| parse_element(reply[k], e) }
|
245
|
+
else
|
246
|
+
if node.has_attributes?
|
247
|
+
reply[k] = {}
|
248
|
+
node.attributes.each{|a,b| reply[k][a.underscore.to_sym] = b }
|
249
|
+
else
|
250
|
+
reply[k] = node.text
|
251
|
+
end
|
252
|
+
end
|
253
|
+
end
|
254
|
+
reply
|
255
|
+
end
|
256
|
+
|
257
|
+
def currency_code(currency)
|
258
|
+
CURRENCY_CODES[currency]
|
259
|
+
end
|
260
|
+
end
|
261
|
+
end
|
262
|
+
end
|