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,101 @@
|
|
1
|
+
module ActiveMerchant #:nodoc:
|
2
|
+
module Billing #:nodoc:
|
3
|
+
module Integrations #:nodoc:
|
4
|
+
module WorldPay
|
5
|
+
class Helper < ActiveMerchant::Billing::Integrations::Helper
|
6
|
+
mapping :account, 'instId'
|
7
|
+
mapping :amount, 'amount'
|
8
|
+
mapping :order, 'cartId'
|
9
|
+
mapping :currency, 'currency'
|
10
|
+
|
11
|
+
mapping :customer, :email => 'email',
|
12
|
+
:phone => 'tel'
|
13
|
+
|
14
|
+
mapping :billing_address, :zip => 'postcode',
|
15
|
+
:country => 'country'
|
16
|
+
|
17
|
+
mapping :description, 'desc'
|
18
|
+
mapping :notify_url, 'MC_callback'
|
19
|
+
mapping :return_url, 'MC_return'
|
20
|
+
|
21
|
+
|
22
|
+
# WorldPay supports two different test modes - :always_succeed and :always_fail
|
23
|
+
def initialize(order, account, options = {})
|
24
|
+
super
|
25
|
+
|
26
|
+
if ActiveMerchant::Billing::Base.integration_mode == :test || options[:test]
|
27
|
+
test_mode = case options[:test]
|
28
|
+
when :always_fail
|
29
|
+
101
|
30
|
+
when false
|
31
|
+
0
|
32
|
+
else
|
33
|
+
100
|
34
|
+
end
|
35
|
+
add_field('testMode', test_mode.to_s)
|
36
|
+
elsif ActiveMerchant::Billing::Base.integration_mode == :always_succeed
|
37
|
+
add_field('testMode', '100')
|
38
|
+
elsif ActiveMerchant::Billing::Base.integration_mode == :always_fail
|
39
|
+
add_field('testMode', '101')
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
# WorldPay only supports a single address field so we
|
44
|
+
# have to concat together - lines are separated using
|
45
|
+
def billing_address(params={})
|
46
|
+
add_field(mappings[:billing_address][:zip], params[:zip])
|
47
|
+
add_field(mappings[:billing_address][:country], lookup_country_code(params[:country]))
|
48
|
+
|
49
|
+
address = [params[:address1], params[:address2], params[:city], params[:state]].compact
|
50
|
+
add_field('address', address.join(' '))
|
51
|
+
end
|
52
|
+
|
53
|
+
# WorldPay only supports a single name field so we have to concat
|
54
|
+
def customer(params={})
|
55
|
+
add_field(mappings[:customer][:email], params[:email])
|
56
|
+
add_field(mappings[:customer][:phone], params[:phone])
|
57
|
+
add_field('name', "#{params[:first_name]} #{params[:last_name]}")
|
58
|
+
end
|
59
|
+
|
60
|
+
# Support for a MD5 hash of selected fields to prevent tampering
|
61
|
+
# For futher information read the tech note at the address below:
|
62
|
+
# http://support.worldpay.com/kb/integration_guides/junior/integration/help/tech_notes/sjig_tn_009.html
|
63
|
+
def encrypt(secret, fields = [:amount, :currency, :account, :order])
|
64
|
+
signature_fields = fields.collect{ |field| mappings[field] }
|
65
|
+
add_field('signatureFields', signature_fields.join(':'))
|
66
|
+
|
67
|
+
field_values = fields.collect{ |field| form_fields[mappings[field]] }
|
68
|
+
signature = "#{secret}:#{field_values.join(':')}"
|
69
|
+
add_field('signature', Digest::MD5.hexdigest(signature))
|
70
|
+
end
|
71
|
+
|
72
|
+
# Add a time window for which the payment can be completed. Read the link below for how they work
|
73
|
+
# http://support.worldpay.com/kb/integration_guides/junior/integration/help/appendicies/sjig_10100.html
|
74
|
+
def valid_from(from_time)
|
75
|
+
add_field('authValidFrom', from_time.to_i.to_s + '000')
|
76
|
+
end
|
77
|
+
|
78
|
+
def valid_to(to_time)
|
79
|
+
add_field('authValidTo', to_time.to_i.to_s + '000')
|
80
|
+
end
|
81
|
+
|
82
|
+
# WorldPay supports the passing of custom parameters prefixed with the following:
|
83
|
+
# C_ : These parameters can be used in the response pages hosted on WorldPay's site
|
84
|
+
# M_ : These parameters are passed through to the callback script (if enabled)
|
85
|
+
# MC_ or CM_ : These parameters are availble both in the response and callback contexts
|
86
|
+
def response_params(params={})
|
87
|
+
params.each{|k,v| add_field("C_#{k}",v)}
|
88
|
+
end
|
89
|
+
|
90
|
+
def callback_params(params={})
|
91
|
+
params.each{|k,v| add_field("M_#{k}",v)}
|
92
|
+
end
|
93
|
+
|
94
|
+
def combined_params(params={})
|
95
|
+
params.each{|k,v| add_field("MC_#{k}",v)}
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
@@ -0,0 +1,160 @@
|
|
1
|
+
module ActiveMerchant #:nodoc:
|
2
|
+
module Billing #:nodoc:
|
3
|
+
module Integrations #:nodoc:
|
4
|
+
module WorldPay
|
5
|
+
class Notification < ActiveMerchant::Billing::Integrations::Notification
|
6
|
+
def complete?
|
7
|
+
status == 'Completed'
|
8
|
+
end
|
9
|
+
|
10
|
+
def account
|
11
|
+
params['instId']
|
12
|
+
end
|
13
|
+
|
14
|
+
def item_id
|
15
|
+
params['cartId']
|
16
|
+
end
|
17
|
+
|
18
|
+
def transaction_id
|
19
|
+
params['transId']
|
20
|
+
end
|
21
|
+
|
22
|
+
# Time this payment was received by the client in UTC time.
|
23
|
+
def received_at
|
24
|
+
Time.at(params['transTime'].to_i / 1000).utc
|
25
|
+
end
|
26
|
+
|
27
|
+
# Callback password set in the WorldPay CMS
|
28
|
+
def security_key
|
29
|
+
params['callbackPW']
|
30
|
+
end
|
31
|
+
|
32
|
+
# the money amount we received in X.2 decimal.
|
33
|
+
def gross
|
34
|
+
params['authAmount']
|
35
|
+
end
|
36
|
+
|
37
|
+
def currency
|
38
|
+
params['authCurrency']
|
39
|
+
end
|
40
|
+
|
41
|
+
# Was this a test transaction?
|
42
|
+
def test?
|
43
|
+
params.key?('testMode') && params['testMode'] != '0'
|
44
|
+
end
|
45
|
+
|
46
|
+
def status
|
47
|
+
params['transStatus'] == 'Y' ? 'Completed' : 'Cancelled'
|
48
|
+
end
|
49
|
+
|
50
|
+
def name
|
51
|
+
params['name']
|
52
|
+
end
|
53
|
+
|
54
|
+
def address
|
55
|
+
params['address']
|
56
|
+
end
|
57
|
+
|
58
|
+
def postcode
|
59
|
+
params['postcode']
|
60
|
+
end
|
61
|
+
|
62
|
+
def country
|
63
|
+
params['country']
|
64
|
+
end
|
65
|
+
|
66
|
+
def phone_number
|
67
|
+
params['tel']
|
68
|
+
end
|
69
|
+
|
70
|
+
def fax_number
|
71
|
+
params['fax']
|
72
|
+
end
|
73
|
+
|
74
|
+
def email_address
|
75
|
+
params['email']
|
76
|
+
end
|
77
|
+
|
78
|
+
def card_type
|
79
|
+
params['cardType']
|
80
|
+
end
|
81
|
+
|
82
|
+
# WorldPay extended fraud checks returned as a 4 character string
|
83
|
+
# 1st char: Credit card CVV check
|
84
|
+
# 2nd char: Postcode AVS check
|
85
|
+
# 3rd char: Address AVS check
|
86
|
+
# 4th char: Country comparison check
|
87
|
+
# Possible values are:
|
88
|
+
# :not_supported - 0
|
89
|
+
# :not_checked - 1
|
90
|
+
# :matched - 2
|
91
|
+
# :not_matched - 4
|
92
|
+
# :partial_match - 8
|
93
|
+
def cvv_status
|
94
|
+
return avs_value_to_symbol(params['AVS'][0].chr)
|
95
|
+
end
|
96
|
+
|
97
|
+
def postcode_status
|
98
|
+
return avs_value_to_symbol(params['AVS'][1].chr)
|
99
|
+
end
|
100
|
+
|
101
|
+
def address_status
|
102
|
+
return avs_value_to_symbol(params['AVS'][2].chr)
|
103
|
+
end
|
104
|
+
|
105
|
+
def country_status
|
106
|
+
return avs_value_to_symbol(params['AVS'][3].chr)
|
107
|
+
end
|
108
|
+
|
109
|
+
def acknowledge
|
110
|
+
return true
|
111
|
+
end
|
112
|
+
|
113
|
+
# WorldPay supports the passing of custom parameters through to the callback script
|
114
|
+
def custom_params
|
115
|
+
return @custom_params ||= read_custom_params
|
116
|
+
end
|
117
|
+
|
118
|
+
|
119
|
+
private
|
120
|
+
|
121
|
+
# Take the posted data and move the relevant data into a hash
|
122
|
+
def parse(post)
|
123
|
+
@raw = post
|
124
|
+
for line in post.split('&')
|
125
|
+
key, value = *line.scan( %r{^(\w+)\=(.*)$} ).flatten
|
126
|
+
params[key] = value
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
130
|
+
# Read the custom params into a hash
|
131
|
+
def read_custom_params
|
132
|
+
custom = {}
|
133
|
+
params.each do |key, value|
|
134
|
+
if /\A(M_|MC_|CM_)/ === key
|
135
|
+
custom[key.gsub(/\A(M_|MC_|CM_)/, '').to_sym] = value
|
136
|
+
end
|
137
|
+
end
|
138
|
+
custom
|
139
|
+
end
|
140
|
+
|
141
|
+
# Convert a AVS value to a symbol - see above for more about AVS
|
142
|
+
def avs_value_to_symbol(value)
|
143
|
+
case value.to_s
|
144
|
+
when '8'
|
145
|
+
:partial_match
|
146
|
+
when '4'
|
147
|
+
:no_match
|
148
|
+
when '2'
|
149
|
+
:matched
|
150
|
+
when '1'
|
151
|
+
:not_checked
|
152
|
+
else
|
153
|
+
:not_supported
|
154
|
+
end
|
155
|
+
end
|
156
|
+
end
|
157
|
+
end
|
158
|
+
end
|
159
|
+
end
|
160
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/world_pay/helper.rb'
|
2
|
+
require File.dirname(__FILE__) + '/world_pay/notification.rb'
|
3
|
+
|
4
|
+
module ActiveMerchant #:nodoc:
|
5
|
+
module Billing #:nodoc:
|
6
|
+
module Integrations #:nodoc:
|
7
|
+
module WorldPay
|
8
|
+
|
9
|
+
mattr_accessor :production_url, :test_url
|
10
|
+
self.production_url = 'https://secure.worldpay.com/wcc/purchase'
|
11
|
+
self.test_url = 'https://secure-test.worldpay.com/wcc/purchase'
|
12
|
+
|
13
|
+
def self.service_url
|
14
|
+
case ActiveMerchant::Billing::Base.integration_mode
|
15
|
+
when :production
|
16
|
+
self.production_url
|
17
|
+
when :test
|
18
|
+
self.test_url
|
19
|
+
else
|
20
|
+
raise StandardError, "Integration mode set to an invalid value: #{mode}"
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.notification(post, options = {})
|
25
|
+
Notification.new(post, options)
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.return(post, options = {})
|
29
|
+
Return.new(post, options)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module ActiveMerchant
|
2
|
+
module Billing
|
3
|
+
module Integrations
|
4
|
+
|
5
|
+
Dir[File.dirname(__FILE__) + '/integrations/*.rb'].each do |f|
|
6
|
+
|
7
|
+
# Get camelized class name
|
8
|
+
filename = File.basename(f, '.rb')
|
9
|
+
# Camelize the string to get the class name
|
10
|
+
gateway_class = filename.camelize.to_sym
|
11
|
+
|
12
|
+
# Register for autoloading
|
13
|
+
autoload gateway_class, f
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,77 @@
|
|
1
|
+
module ActiveMerchant #:nodoc:
|
2
|
+
module Billing #:nodoc:
|
3
|
+
class Error < ActiveMerchantError #:nodoc:
|
4
|
+
end
|
5
|
+
|
6
|
+
class Response
|
7
|
+
attr_reader :params, :message, :test, :authorization, :avs_result, :cvv_result
|
8
|
+
|
9
|
+
def success?
|
10
|
+
@success
|
11
|
+
end
|
12
|
+
|
13
|
+
def test?
|
14
|
+
@test
|
15
|
+
end
|
16
|
+
|
17
|
+
def fraud_review?
|
18
|
+
@fraud_review
|
19
|
+
end
|
20
|
+
|
21
|
+
def initialize(success, message, params = {}, options = {})
|
22
|
+
@success, @message, @params = success, message, params.stringify_keys
|
23
|
+
@test = options[:test] || false
|
24
|
+
@authorization = options[:authorization]
|
25
|
+
@fraud_review = options[:fraud_review]
|
26
|
+
|
27
|
+
@avs_result = if options[:avs_result].kind_of?(AVSResult)
|
28
|
+
options[:avs_result].to_hash
|
29
|
+
else
|
30
|
+
AVSResult.new(options[:avs_result]).to_hash
|
31
|
+
end
|
32
|
+
|
33
|
+
@cvv_result = if options[:cvv_result].kind_of?(CVVResult)
|
34
|
+
options[:cvv_result].to_hash
|
35
|
+
else
|
36
|
+
CVVResult.new(options[:cvv_result]).to_hash
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
class MultiResponse < Response
|
42
|
+
def self.run(&block)
|
43
|
+
new.tap(&block)
|
44
|
+
end
|
45
|
+
|
46
|
+
attr_reader :responses
|
47
|
+
|
48
|
+
def initialize
|
49
|
+
@responses = []
|
50
|
+
end
|
51
|
+
|
52
|
+
def process
|
53
|
+
self << yield if(responses.empty? || success?)
|
54
|
+
end
|
55
|
+
|
56
|
+
def <<(response)
|
57
|
+
if response.is_a?(MultiResponse)
|
58
|
+
response.responses.each{|r| @responses << r}
|
59
|
+
else
|
60
|
+
@responses << response
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
def success?
|
65
|
+
@responses.all?{|r| r.success?}
|
66
|
+
end
|
67
|
+
|
68
|
+
%w(params message test authorization avs_result cvv_result test? fraud_review?).each do |m|
|
69
|
+
class_eval %(
|
70
|
+
def #{m}
|
71
|
+
(@responses.empty? ? nil : @responses.last.#{m})
|
72
|
+
end
|
73
|
+
)
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
require 'active_merchant/billing/avs_result'
|
2
|
+
require 'active_merchant/billing/cvv_result'
|
3
|
+
require 'active_merchant/billing/credit_card_methods'
|
4
|
+
require 'active_merchant/billing/credit_card_formatting'
|
5
|
+
require 'active_merchant/billing/credit_card'
|
6
|
+
require 'active_merchant/billing/base'
|
7
|
+
require 'active_merchant/billing/check'
|
8
|
+
require 'active_merchant/billing/response'
|
9
|
+
require 'active_merchant/billing/gateways'
|
@@ -0,0 +1,63 @@
|
|
1
|
+
#--
|
2
|
+
# Copyright (c) 2005-2010 Tobias Luetke
|
3
|
+
#
|
4
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
5
|
+
# a copy of this software and associated documentation files (the
|
6
|
+
# "Software"), to deal in the Software without restriction, including
|
7
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
8
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
9
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
10
|
+
# the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be
|
13
|
+
# included in all copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
16
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
17
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
18
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
19
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
20
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
21
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
22
|
+
#++
|
23
|
+
|
24
|
+
require 'active_support'
|
25
|
+
require 'active_support/core_ext/string/inflections'
|
26
|
+
require 'active_support/core_ext/hash/indifferent_access'
|
27
|
+
require 'active_support/core_ext/hash/conversions'
|
28
|
+
require 'active_support/core_ext/object/conversions'
|
29
|
+
require 'active_support/core_ext/class/attribute'
|
30
|
+
require 'active_support/core_ext/class/attribute_accessors'
|
31
|
+
require 'active_support/core_ext/class/delegating_attributes'
|
32
|
+
require 'active_support/core_ext/module/attribute_accessors'
|
33
|
+
|
34
|
+
begin
|
35
|
+
require 'active_support/base64'
|
36
|
+
|
37
|
+
unless defined?(Base64)
|
38
|
+
Base64 = ActiveSupport::Base64
|
39
|
+
end
|
40
|
+
|
41
|
+
unless Base64.respond_to?(:strict_encode64)
|
42
|
+
def Base64.strict_encode64(v)
|
43
|
+
ActiveSupport::Base64.encode64s(v)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
rescue LoadError
|
47
|
+
require 'base64'
|
48
|
+
end
|
49
|
+
|
50
|
+
require 'securerandom'
|
51
|
+
require 'builder'
|
52
|
+
require 'cgi'
|
53
|
+
require 'rexml/document'
|
54
|
+
|
55
|
+
require 'active_utils'
|
56
|
+
require 'active_merchant/billing'
|
57
|
+
require 'active_merchant/version'
|
58
|
+
|
59
|
+
module ActiveMerchant #:nodoc:
|
60
|
+
module Billing #:nodoc:
|
61
|
+
autoload :Integrations, 'active_merchant/billing/integrations'
|
62
|
+
end
|
63
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'active_merchant'
|
@@ -0,0 +1,65 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'active_support'
|
3
|
+
require 'active_merchant'
|
4
|
+
|
5
|
+
|
6
|
+
class GatewaySupport #:nodoc:
|
7
|
+
ACTIONS = [:purchase, :authorize, :capture, :void, :credit, :recurring]
|
8
|
+
|
9
|
+
include ActiveMerchant::Billing
|
10
|
+
|
11
|
+
attr_reader :gateways
|
12
|
+
|
13
|
+
def initialize
|
14
|
+
Dir[File.expand_path(File.dirname(__FILE__) + '/../active_merchant/billing/gateways/*.rb')].each do |f|
|
15
|
+
filename = File.basename(f, '.rb')
|
16
|
+
gateway_name = filename + '_gateway'
|
17
|
+
begin
|
18
|
+
gateway_class = ('ActiveMerchant::Billing::' + gateway_name.camelize).constantize
|
19
|
+
rescue NameError
|
20
|
+
puts "Could not load gateway " + gateway_name.camelize + " from " + f + "."
|
21
|
+
end
|
22
|
+
end
|
23
|
+
@gateways = Gateway.implementations.sort_by(&:name)
|
24
|
+
@gateways.delete(ActiveMerchant::Billing::BogusGateway)
|
25
|
+
end
|
26
|
+
|
27
|
+
def each_gateway
|
28
|
+
@gateways.each{|g| yield g }
|
29
|
+
end
|
30
|
+
|
31
|
+
def features
|
32
|
+
width = 15
|
33
|
+
|
34
|
+
print "Name".center(width + 20)
|
35
|
+
ACTIONS.each{|f| print "#{f.to_s.capitalize.center(width)}" }
|
36
|
+
puts
|
37
|
+
|
38
|
+
each_gateway do |g|
|
39
|
+
print "#{g.display_name.ljust(width + 20)}"
|
40
|
+
ACTIONS.each do |f|
|
41
|
+
print "#{(g.instance_methods.include?(f.to_s) ? "Y" : "N").center(width)}"
|
42
|
+
end
|
43
|
+
puts
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
def to_rdoc
|
48
|
+
each_gateway do |g|
|
49
|
+
puts "* {#{g.display_name}}[#{g.homepage_url}] - #{g.supported_countries.join(', ')}"
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
def to_textile
|
54
|
+
each_gateway do |g|
|
55
|
+
puts %/ * "#{g.display_name}":#{g.homepage_url} [#{g.supported_countries.join(', ')}]/
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
def to_s
|
60
|
+
each_gateway do |g|
|
61
|
+
puts "#{g.display_name} - #{g.homepage_url} [#{g.supported_countries.join(', ')}]"
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'uri'
|
2
|
+
require 'set'
|
3
|
+
|
4
|
+
class OutboundHosts
|
5
|
+
def self.list
|
6
|
+
uris = Set.new
|
7
|
+
|
8
|
+
Dir['lib/**/*.rb'].each do |file|
|
9
|
+
content = File.read(file)
|
10
|
+
|
11
|
+
content.each_line do |line|
|
12
|
+
next if line =~ /homepage_url/
|
13
|
+
|
14
|
+
if line =~ /("|')(https:\/\/.*)("|')/
|
15
|
+
uri = URI.parse($2)
|
16
|
+
uris << [uri.host, uri.port]
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
uris.each do |uri|
|
22
|
+
puts "#{uri.first} #{uri.last}"
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,93 @@
|
|
1
|
+
require 'active_merchant'
|
2
|
+
require 'support/gateway_support'
|
3
|
+
|
4
|
+
class SSLVerify
|
5
|
+
|
6
|
+
def initialize
|
7
|
+
@gateways = GatewaySupport.new.gateways
|
8
|
+
end
|
9
|
+
|
10
|
+
def test_gateways
|
11
|
+
success, failed, missing, errored, disabled = [], [], [], [], []
|
12
|
+
|
13
|
+
puts "Verifying #{@gateways.count} SSL certificates\n\n"
|
14
|
+
|
15
|
+
@gateways.each do |g|
|
16
|
+
if !g.live_url
|
17
|
+
missing << g unless g.abstract_class
|
18
|
+
next
|
19
|
+
end
|
20
|
+
|
21
|
+
if !g.ssl_strict
|
22
|
+
disabled << g
|
23
|
+
end
|
24
|
+
|
25
|
+
uri = URI.parse(g.live_url)
|
26
|
+
result,message = ssl_verify_peer?(uri)
|
27
|
+
case result
|
28
|
+
when :success
|
29
|
+
print "."
|
30
|
+
success << g
|
31
|
+
when :fail
|
32
|
+
print "F"
|
33
|
+
failed << {:gateway => g, :message => message}
|
34
|
+
when :error
|
35
|
+
print "E"
|
36
|
+
errored << {:gateway => g, :message => message}
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
puts "\n\n\nFailed Gateways:"
|
41
|
+
failed.each do |f|
|
42
|
+
puts "#{f[:gateway].name} - #{f[:message]}"
|
43
|
+
end
|
44
|
+
|
45
|
+
puts "\n\nError Gateways:"
|
46
|
+
errored.each do |e|
|
47
|
+
puts "#{e[:gateway].name} - #{e[:message]}"
|
48
|
+
end
|
49
|
+
|
50
|
+
if missing.size > 0
|
51
|
+
puts "\n\nGateways missing live_url:"
|
52
|
+
missing.each do |m|
|
53
|
+
puts m.name
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
if disabled.size > 0
|
58
|
+
puts "\n\nGateways with ssl_strict=false:"
|
59
|
+
disabled.each do |d|
|
60
|
+
puts d.name
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
end
|
65
|
+
|
66
|
+
def try_host(http, path)
|
67
|
+
http.get(path)
|
68
|
+
rescue Net::HTTPBadResponse, EOFError, SocketError
|
69
|
+
http.post(path, "")
|
70
|
+
end
|
71
|
+
|
72
|
+
def ssl_verify_peer?(uri)
|
73
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
74
|
+
http.use_ssl = true
|
75
|
+
http.ca_file = File.dirname(__FILE__) + '/certs/cacert.pem'
|
76
|
+
http.verify_mode = OpenSSL::SSL::VERIFY_PEER
|
77
|
+
http.open_timeout = 60
|
78
|
+
http.read_timeout = 60
|
79
|
+
|
80
|
+
if uri.path.blank?
|
81
|
+
try_host(http, "/")
|
82
|
+
else
|
83
|
+
try_host(http, uri.path)
|
84
|
+
end
|
85
|
+
|
86
|
+
return :success
|
87
|
+
rescue OpenSSL::SSL::SSLError => ex
|
88
|
+
return :fail, ex.inspect
|
89
|
+
rescue Net::HTTPBadResponse, Errno::EHOSTUNREACH, Errno::ETIMEDOUT, EOFError, SocketError, Errno::ECONNREFUSED, Timeout::Error => ex
|
90
|
+
return :error, ex.inspect
|
91
|
+
end
|
92
|
+
|
93
|
+
end
|