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,227 @@
|
|
1
|
+
require 'net/http'
|
2
|
+
require 'time'
|
3
|
+
|
4
|
+
module ActiveMerchant #:nodoc:
|
5
|
+
module Billing #:nodoc:
|
6
|
+
module Integrations #:nodoc:
|
7
|
+
module Paypal
|
8
|
+
# Parser and handler for incoming Instant payment notifications from paypal.
|
9
|
+
# The Example shows a typical handler in a rails application. Note that this
|
10
|
+
# is an example, please read the Paypal API documentation for all the details
|
11
|
+
# on creating a safe payment controller.
|
12
|
+
#
|
13
|
+
# Example
|
14
|
+
#
|
15
|
+
# class BackendController < ApplicationController
|
16
|
+
# include ActiveMerchant::Billing::Integrations
|
17
|
+
#
|
18
|
+
# def paypal_ipn
|
19
|
+
# notify = Paypal::Notification.new(request.raw_post)
|
20
|
+
#
|
21
|
+
# if notify.masspay?
|
22
|
+
# masspay_items = notify.items
|
23
|
+
# end
|
24
|
+
#
|
25
|
+
# order = Order.find(notify.item_id)
|
26
|
+
#
|
27
|
+
# if notify.acknowledge
|
28
|
+
# begin
|
29
|
+
#
|
30
|
+
# if notify.complete? and order.total == notify.amount
|
31
|
+
# order.status = 'success'
|
32
|
+
#
|
33
|
+
# shop.ship(order)
|
34
|
+
# else
|
35
|
+
# logger.error("Failed to verify Paypal's notification, please investigate")
|
36
|
+
# end
|
37
|
+
#
|
38
|
+
# rescue => e
|
39
|
+
# order.status = 'failed'
|
40
|
+
# raise
|
41
|
+
# ensure
|
42
|
+
# order.save
|
43
|
+
# end
|
44
|
+
# end
|
45
|
+
#
|
46
|
+
# render :nothing
|
47
|
+
# end
|
48
|
+
# end
|
49
|
+
class Notification < ActiveMerchant::Billing::Integrations::Notification
|
50
|
+
include PostsData
|
51
|
+
|
52
|
+
def initialize(post, options = {})
|
53
|
+
super
|
54
|
+
extend MassPayNotification if masspay?
|
55
|
+
end
|
56
|
+
|
57
|
+
# Was the transaction complete?
|
58
|
+
def complete?
|
59
|
+
status == "Completed"
|
60
|
+
end
|
61
|
+
|
62
|
+
# Is it a masspay notification?
|
63
|
+
def masspay?
|
64
|
+
type == "masspay"
|
65
|
+
end
|
66
|
+
|
67
|
+
# When was this payment received by the client.
|
68
|
+
# sometimes it can happen that we get the notification much later.
|
69
|
+
# One possible scenario is that our web application was down. In this case paypal tries several
|
70
|
+
# times an hour to inform us about the notification
|
71
|
+
def received_at
|
72
|
+
parsed_time_fields = DateTime._strptime(params['payment_date'], "%H:%M:%S %b %d, %Y %Z")
|
73
|
+
Time.gm(
|
74
|
+
parsed_time_fields[:year],
|
75
|
+
parsed_time_fields[:mon],
|
76
|
+
parsed_time_fields[:mday],
|
77
|
+
parsed_time_fields[:hour],
|
78
|
+
parsed_time_fields[:min],
|
79
|
+
parsed_time_fields[:sec]
|
80
|
+
) + Time.zone_offset(parsed_time_fields[:zone])
|
81
|
+
end
|
82
|
+
|
83
|
+
# Status of transaction. List of possible values:
|
84
|
+
# <tt>Canceled-Reversal</tt>::
|
85
|
+
# <tt>Completed</tt>::
|
86
|
+
# <tt>Denied</tt>::
|
87
|
+
# <tt>Expired</tt>::
|
88
|
+
# <tt>Failed</tt>::
|
89
|
+
# <tt>In-Progress</tt>::
|
90
|
+
# <tt>Partially-Refunded</tt>::
|
91
|
+
# <tt>Pending</tt>::
|
92
|
+
# <tt>Processed</tt>::
|
93
|
+
# <tt>Refunded</tt>::
|
94
|
+
# <tt>Reversed</tt>::
|
95
|
+
# <tt>Voided</tt>::
|
96
|
+
def status
|
97
|
+
params['payment_status']
|
98
|
+
end
|
99
|
+
|
100
|
+
# Id of this transaction (paypal number)
|
101
|
+
def transaction_id
|
102
|
+
params['txn_id']
|
103
|
+
end
|
104
|
+
|
105
|
+
# What type of transaction are we dealing with?
|
106
|
+
# "cart" "send_money" "web_accept" are possible here.
|
107
|
+
def type
|
108
|
+
params['txn_type']
|
109
|
+
end
|
110
|
+
|
111
|
+
# the money amount we received in X.2 decimal.
|
112
|
+
def gross
|
113
|
+
params['mc_gross']
|
114
|
+
end
|
115
|
+
|
116
|
+
# the markup paypal charges for the transaction
|
117
|
+
def fee
|
118
|
+
params['mc_fee']
|
119
|
+
end
|
120
|
+
|
121
|
+
# What currency have we been dealing with
|
122
|
+
def currency
|
123
|
+
params['mc_currency']
|
124
|
+
end
|
125
|
+
|
126
|
+
# This is the item number which we submitted to paypal
|
127
|
+
# The custom field is also mapped to item_id because PayPal
|
128
|
+
# doesn't return item_number in dispute notifications
|
129
|
+
def item_id
|
130
|
+
params['item_number'] || params['custom']
|
131
|
+
end
|
132
|
+
|
133
|
+
# This is the invoice which you passed to paypal
|
134
|
+
def invoice
|
135
|
+
params['invoice']
|
136
|
+
end
|
137
|
+
|
138
|
+
# Was this a test transaction?
|
139
|
+
def test?
|
140
|
+
params['test_ipn'] == '1'
|
141
|
+
end
|
142
|
+
|
143
|
+
def account
|
144
|
+
params['business'] || params['receiver_email']
|
145
|
+
end
|
146
|
+
|
147
|
+
# Acknowledge the transaction to paypal. This method has to be called after a new
|
148
|
+
# ipn arrives. Paypal will verify that all the information we received are correct and will return a
|
149
|
+
# ok or a fail.
|
150
|
+
#
|
151
|
+
# Example:
|
152
|
+
#
|
153
|
+
# def paypal_ipn
|
154
|
+
# notify = PaypalNotification.new(request.raw_post)
|
155
|
+
#
|
156
|
+
# if notify.acknowledge
|
157
|
+
# ... process order ... if notify.complete?
|
158
|
+
# else
|
159
|
+
# ... log possible hacking attempt ...
|
160
|
+
# end
|
161
|
+
def acknowledge
|
162
|
+
payload = raw
|
163
|
+
|
164
|
+
response = ssl_post(Paypal.service_url + '?cmd=_notify-validate', payload,
|
165
|
+
'Content-Length' => "#{payload.size}",
|
166
|
+
'User-Agent' => "Active Merchant -- http://activemerchant.org"
|
167
|
+
)
|
168
|
+
|
169
|
+
raise StandardError.new("Faulty paypal result: #{response}") unless ["VERIFIED", "INVALID"].include?(response)
|
170
|
+
|
171
|
+
response == "VERIFIED"
|
172
|
+
end
|
173
|
+
end
|
174
|
+
|
175
|
+
module MassPayNotification
|
176
|
+
# Mass pay returns a collection of MassPay Items, so inspect items to get the values
|
177
|
+
def transaction_id
|
178
|
+
end
|
179
|
+
|
180
|
+
# Mass pay returns a collection of MassPay Items, so inspect items to get the values
|
181
|
+
def gross
|
182
|
+
end
|
183
|
+
|
184
|
+
# Mass pay returns a collection of MassPay Items, so inspect items to get the values
|
185
|
+
def fee
|
186
|
+
end
|
187
|
+
|
188
|
+
# Mass pay returns a collection of MassPay Items, so inspect items to get the values
|
189
|
+
def currency
|
190
|
+
end
|
191
|
+
|
192
|
+
# Mass pay returns a collection of MassPay Items, so inspect items to get the values
|
193
|
+
def item_id
|
194
|
+
end
|
195
|
+
|
196
|
+
# Mass pay returns a collection of MassPay Items, so inspect items to get the values
|
197
|
+
def account
|
198
|
+
end
|
199
|
+
|
200
|
+
# Collection of notification items returned for MassPay transactions
|
201
|
+
def items
|
202
|
+
@items ||= (1..number_of_mass_pay_items).map do |item_number|
|
203
|
+
MassPayItem.new(
|
204
|
+
params["masspay_txn_id_#{item_number}"],
|
205
|
+
params["mc_gross_#{item_number}"],
|
206
|
+
params["mc_fee_#{item_number}"],
|
207
|
+
params["mc_currency_#{item_number}"],
|
208
|
+
params["unique_id_#{item_number}"],
|
209
|
+
params["receiver_email_#{item_number}"],
|
210
|
+
params["status_#{item_number}"]
|
211
|
+
)
|
212
|
+
end
|
213
|
+
end
|
214
|
+
|
215
|
+
private
|
216
|
+
|
217
|
+
def number_of_mass_pay_items
|
218
|
+
@number_of_mass_pay_items ||= params.keys.select { |k| k.start_with? 'masspay_txn_id' }.size
|
219
|
+
end
|
220
|
+
end
|
221
|
+
|
222
|
+
class MassPayItem < Struct.new(:transaction_id, :gross, :fee, :currency, :item_id, :account, :status)
|
223
|
+
end
|
224
|
+
end
|
225
|
+
end
|
226
|
+
end
|
227
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
module ActiveMerchant #:nodoc:
|
2
|
+
module Billing #:nodoc:
|
3
|
+
module Integrations #:nodoc:
|
4
|
+
module Paypal
|
5
|
+
autoload :Return, 'active_merchant/billing/integrations/paypal/return.rb'
|
6
|
+
autoload :Helper, 'active_merchant/billing/integrations/paypal/helper.rb'
|
7
|
+
autoload :Notification, 'active_merchant/billing/integrations/paypal/notification.rb'
|
8
|
+
|
9
|
+
# Overwrite this if you want to change the Paypal test url
|
10
|
+
mattr_accessor :test_url
|
11
|
+
self.test_url = 'https://www.sandbox.paypal.com/cgi-bin/webscr'
|
12
|
+
|
13
|
+
# Overwrite this if you want to change the Paypal production url
|
14
|
+
mattr_accessor :production_url
|
15
|
+
self.production_url = 'https://www.paypal.com/cgi-bin/webscr'
|
16
|
+
|
17
|
+
def self.service_url
|
18
|
+
mode = ActiveMerchant::Billing::Base.integration_mode
|
19
|
+
case mode
|
20
|
+
when :production
|
21
|
+
self.production_url
|
22
|
+
when :test
|
23
|
+
self.test_url
|
24
|
+
else
|
25
|
+
raise StandardError, "Integration mode set to an invalid value: #{mode}"
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.notification(post, options = {})
|
30
|
+
Notification.new(post)
|
31
|
+
end
|
32
|
+
|
33
|
+
def self.return(query_string, options = {})
|
34
|
+
Return.new(query_string)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module ActiveMerchant
|
2
|
+
module Billing
|
3
|
+
module Integrations
|
4
|
+
module PaypalPaymentsAdvanced
|
5
|
+
class Helper < PayflowLink::Helper
|
6
|
+
|
7
|
+
def initialize(order, account, options)
|
8
|
+
super
|
9
|
+
add_field('partner', 'PayPal')
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module ActiveMerchant
|
2
|
+
module Billing
|
3
|
+
module Integrations
|
4
|
+
module PaypalPaymentsAdvanced
|
5
|
+
autoload :Helper, 'active_merchant/billing/integrations/paypal_payments_advanced/helper.rb'
|
6
|
+
|
7
|
+
mattr_accessor :service_url
|
8
|
+
self.service_url = 'https://payflowlink.paypal.com'
|
9
|
+
|
10
|
+
def self.notification(post, options = {})
|
11
|
+
PayflowLink::Notification.new(post)
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.return(query_string, options = {})
|
15
|
+
Return.new(query_string)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module ActiveMerchant #:nodoc:
|
2
|
+
module Billing #:nodoc:
|
3
|
+
module Integrations #:nodoc:
|
4
|
+
module Paysbuy
|
5
|
+
class Helper < ActiveMerchant::Billing::Integrations::Helper
|
6
|
+
mapping :account, 'biz'
|
7
|
+
mapping :amount, 'amt'
|
8
|
+
mapping :order, 'inv'
|
9
|
+
mapping :description, 'itm'
|
10
|
+
mapping :notify_url, 'postURL'
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module ActiveMerchant #:nodoc:
|
2
|
+
module Billing #:nodoc:
|
3
|
+
module Integrations #:nodoc:
|
4
|
+
module Paysbuy
|
5
|
+
class Notification < ActiveMerchant::Billing::Integrations::Notification
|
6
|
+
SUCCESS = '00'
|
7
|
+
FAIL = '99'
|
8
|
+
|
9
|
+
def complete?
|
10
|
+
status == 'Completed'
|
11
|
+
end
|
12
|
+
|
13
|
+
def item_id
|
14
|
+
params['result'][2..-1]
|
15
|
+
end
|
16
|
+
|
17
|
+
def status
|
18
|
+
params['result'][0..1] == SUCCESS ? 'Completed' : 'Failed'
|
19
|
+
end
|
20
|
+
|
21
|
+
def acknowledge
|
22
|
+
true
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
module ActiveMerchant #:nodoc:
|
2
|
+
module Billing #:nodoc:
|
3
|
+
module Integrations #:nodoc:
|
4
|
+
module Paysbuy
|
5
|
+
autoload :Helper, File.dirname(__FILE__) + '/paysbuy/helper.rb'
|
6
|
+
autoload :Notification, File.dirname(__FILE__) + '/paysbuy/notification.rb'
|
7
|
+
|
8
|
+
mattr_accessor :test_url
|
9
|
+
self.test_url = 'https://demo.paysbuy.com/paynow.aspx'
|
10
|
+
|
11
|
+
mattr_accessor :production_url
|
12
|
+
self.production_url = 'https://www.paysbuy.com/paynow.aspx'
|
13
|
+
|
14
|
+
def self.service_url
|
15
|
+
mode = ActiveMerchant::Billing::Base.integration_mode
|
16
|
+
case mode
|
17
|
+
when :production
|
18
|
+
self.production_url
|
19
|
+
when :test
|
20
|
+
self.test_url
|
21
|
+
else
|
22
|
+
raise StandardError, "Integration mode set to an invalid value: #{mode}"
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.helper(order, account, options = {})
|
27
|
+
Helper.new(order, account, options)
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.notification(query_string, options = {})
|
31
|
+
Notification.new(query_string, options)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,74 @@
|
|
1
|
+
module ActiveMerchant #:nodoc:
|
2
|
+
module Billing #:nodoc:
|
3
|
+
module Integrations #:nodoc:
|
4
|
+
module PayuIn
|
5
|
+
class Helper < ActiveMerchant::Billing::Integrations::Helper
|
6
|
+
|
7
|
+
mapping :amount, 'amount'
|
8
|
+
mapping :account, 'key'
|
9
|
+
mapping :order, 'txnid'
|
10
|
+
mapping :credential2, 'productinfo'
|
11
|
+
|
12
|
+
mapping :customer, :first_name => 'firstname',
|
13
|
+
:last_name => 'lastname',
|
14
|
+
:email => 'email',
|
15
|
+
:phone => 'phone'
|
16
|
+
|
17
|
+
mapping :billing_address, :city => 'city',
|
18
|
+
:address1 => 'address1',
|
19
|
+
:address2 => 'address2',
|
20
|
+
:state => 'state',
|
21
|
+
:zip => 'zip',
|
22
|
+
:country => 'country'
|
23
|
+
|
24
|
+
# Which tab you want to be open default on PayU
|
25
|
+
# CC (CreditCard) or NB (NetBanking)
|
26
|
+
mapping :mode, 'pg'
|
27
|
+
|
28
|
+
mapping :notify_url, 'notify_url'
|
29
|
+
mapping :return_url, ['surl', 'furl']
|
30
|
+
mapping :cancel_return_url, 'curl'
|
31
|
+
mapping :checksum, 'hash'
|
32
|
+
|
33
|
+
mapping :user_defined, { :var1 => 'udf1',
|
34
|
+
:var2 => 'udf2',
|
35
|
+
:var3 => 'udf3',
|
36
|
+
:var4 => 'udf4',
|
37
|
+
:var5 => 'udf5',
|
38
|
+
:var6 => 'udf6',
|
39
|
+
:var7 => 'udf7',
|
40
|
+
:var8 => 'udf8',
|
41
|
+
:var9 => 'udf9',
|
42
|
+
:var10 => 'udf10'
|
43
|
+
}
|
44
|
+
|
45
|
+
def initialize(order, account, options = {})
|
46
|
+
super
|
47
|
+
self.pg = 'CC'
|
48
|
+
end
|
49
|
+
|
50
|
+
def form_fields
|
51
|
+
@fields.merge(mappings[:checksum] => generate_checksum)
|
52
|
+
end
|
53
|
+
|
54
|
+
def generate_checksum( options = {} )
|
55
|
+
checksum_fields = [ :order, :amount, :credential2, { :customer => [ :first_name, :email ] },
|
56
|
+
{ :user_defined => [ :var1, :var2, :var3, :var4, :var5, :var6, :var7, :var8, :var9, :var10 ] } ]
|
57
|
+
checksum_payload_items = checksum_fields.inject( [] ) do | items, field |
|
58
|
+
if Hash === field then
|
59
|
+
key = field.keys.first
|
60
|
+
field[key].inject( items ){ |s,x| items.push( @fields[ mappings[key][x] ] ) }
|
61
|
+
else
|
62
|
+
items.push( @fields[ mappings[field] ] )
|
63
|
+
end
|
64
|
+
end
|
65
|
+
checksum_payload_items.push( options )
|
66
|
+
PayuIn.checksum(@fields["key"], @fields["productinfo"], *checksum_payload_items )
|
67
|
+
end
|
68
|
+
|
69
|
+
end
|
70
|
+
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
@@ -0,0 +1,165 @@
|
|
1
|
+
module ActiveMerchant #:nodoc:
|
2
|
+
module Billing #:nodoc:
|
3
|
+
module Integrations #:nodoc:
|
4
|
+
module PayuIn
|
5
|
+
class Notification < ActiveMerchant::Billing::Integrations::Notification
|
6
|
+
|
7
|
+
def initialize(post, options = {})
|
8
|
+
super(post, options)
|
9
|
+
@merchant_id = options[:credential1]
|
10
|
+
@secret_key = options[:credential2]
|
11
|
+
end
|
12
|
+
|
13
|
+
def complete?
|
14
|
+
status == "Completed"
|
15
|
+
end
|
16
|
+
|
17
|
+
def status
|
18
|
+
@status ||= if checksum_ok?
|
19
|
+
if transaction_id.blank?
|
20
|
+
'Invalid'
|
21
|
+
else
|
22
|
+
case transaction_status.downcase
|
23
|
+
when 'success' then 'Completed'
|
24
|
+
when 'failure' then 'Failed'
|
25
|
+
when 'pending' then 'Pending'
|
26
|
+
end
|
27
|
+
end
|
28
|
+
else
|
29
|
+
'Tampered'
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def invoice_ok?( order_id )
|
34
|
+
order_id.to_s == invoice.to_s
|
35
|
+
end
|
36
|
+
|
37
|
+
# Order amount should be equal to gross - discount
|
38
|
+
def amount_ok?( order_amount, order_discount = BigDecimal.new( '0.0' ) )
|
39
|
+
BigDecimal.new( gross ) == order_amount && BigDecimal.new( discount ) == order_discount
|
40
|
+
end
|
41
|
+
|
42
|
+
# Status of transaction return from the PayU. List of possible values:
|
43
|
+
# <tt>SUCCESS</tt>::
|
44
|
+
# <tt>PENDING</tt>::
|
45
|
+
# <tt>FAILURE</tt>::
|
46
|
+
def transaction_status
|
47
|
+
params['status']
|
48
|
+
end
|
49
|
+
|
50
|
+
# ID of this transaction (PayU.in number)
|
51
|
+
def transaction_id
|
52
|
+
params['mihpayid']
|
53
|
+
end
|
54
|
+
|
55
|
+
# Mode of Payment
|
56
|
+
#
|
57
|
+
# 'CC' for credit-card
|
58
|
+
# 'NB' for net-banking
|
59
|
+
# 'CD' for cheque or DD
|
60
|
+
# 'CO' for Cash Pickup
|
61
|
+
def type
|
62
|
+
params['mode']
|
63
|
+
end
|
64
|
+
|
65
|
+
# What currency have we been dealing with
|
66
|
+
def currency
|
67
|
+
'INR'
|
68
|
+
end
|
69
|
+
|
70
|
+
def item_id
|
71
|
+
params['txnid']
|
72
|
+
end
|
73
|
+
|
74
|
+
# This is the invoice which you passed to PayU.in
|
75
|
+
def invoice
|
76
|
+
params['txnid']
|
77
|
+
end
|
78
|
+
|
79
|
+
# Merchant Id provided by the PayU.in
|
80
|
+
def account
|
81
|
+
params['key']
|
82
|
+
end
|
83
|
+
|
84
|
+
# original amount send by merchant
|
85
|
+
def gross
|
86
|
+
params['amount']
|
87
|
+
end
|
88
|
+
|
89
|
+
# This is discount given to user - based on promotion set by merchants.
|
90
|
+
def discount
|
91
|
+
params['discount']
|
92
|
+
end
|
93
|
+
|
94
|
+
# Description offer for what PayU given the offer to user - based on promotion set by merchants.
|
95
|
+
def offer_description
|
96
|
+
params['offer']
|
97
|
+
end
|
98
|
+
|
99
|
+
# Information about the product as send by merchant
|
100
|
+
def product_info
|
101
|
+
params['productinfo']
|
102
|
+
end
|
103
|
+
|
104
|
+
# Email of the customer
|
105
|
+
def customer_email
|
106
|
+
params['email']
|
107
|
+
end
|
108
|
+
|
109
|
+
# Phone of the customer
|
110
|
+
def customer_phone
|
111
|
+
params['phone']
|
112
|
+
end
|
113
|
+
|
114
|
+
# Firstname of the customer
|
115
|
+
def customer_first_name
|
116
|
+
params['firstname']
|
117
|
+
end
|
118
|
+
|
119
|
+
# Lastname of the customer
|
120
|
+
def customer_last_name
|
121
|
+
params['lastname']
|
122
|
+
end
|
123
|
+
|
124
|
+
# Full address of the customer
|
125
|
+
def customer_address
|
126
|
+
{ :address1 => params['address1'], :address2 => params['address2'],
|
127
|
+
:city => params['city'], :state => params['state'],
|
128
|
+
:country => params['country'], :zipcode => params['zipcode'] }
|
129
|
+
end
|
130
|
+
|
131
|
+
def user_defined
|
132
|
+
return @user_defined if @user_defined
|
133
|
+
@user_defined = []
|
134
|
+
10.times{ |i| @user_defined.push( params[ "udf#{i+1}" ] ) }
|
135
|
+
@user_defined
|
136
|
+
end
|
137
|
+
|
138
|
+
def checksum
|
139
|
+
params['hash']
|
140
|
+
end
|
141
|
+
|
142
|
+
def message
|
143
|
+
@message || params['error']
|
144
|
+
end
|
145
|
+
|
146
|
+
def acknowledge
|
147
|
+
checksum_ok?
|
148
|
+
end
|
149
|
+
|
150
|
+
def checksum_ok?
|
151
|
+
fields = user_defined.dup.push( customer_email, customer_first_name, product_info, gross, invoice, :reverse => true )
|
152
|
+
fields.unshift( transaction_status )
|
153
|
+
unless PayuIn.checksum(@merchant_id, @secret_key, *fields ) == checksum
|
154
|
+
@message = 'Return checksum not matching the data provided'
|
155
|
+
return false
|
156
|
+
end
|
157
|
+
true
|
158
|
+
end
|
159
|
+
|
160
|
+
end
|
161
|
+
end
|
162
|
+
end
|
163
|
+
end
|
164
|
+
end
|
165
|
+
|
@@ -0,0 +1,36 @@
|
|
1
|
+
module ActiveMerchant #:nodoc:
|
2
|
+
module Billing #:nodoc:
|
3
|
+
module Integrations #:nodoc:
|
4
|
+
module PayuIn
|
5
|
+
class Return < ActiveMerchant::Billing::Integrations::Return
|
6
|
+
|
7
|
+
def initialize(query_string, options = {})
|
8
|
+
super
|
9
|
+
@notification = Notification.new(query_string, options)
|
10
|
+
end
|
11
|
+
|
12
|
+
def transaction_id
|
13
|
+
@notification.transaction_id
|
14
|
+
end
|
15
|
+
|
16
|
+
def status( order_id, order_amount )
|
17
|
+
if @notification.invoice_ok?( order_id ) && @notification.amount_ok?( BigDecimal.new(order_amount) )
|
18
|
+
@notification.status
|
19
|
+
else
|
20
|
+
'Mismatch'
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def success?
|
25
|
+
status( @params['txnid'], @params['amount'] ) == 'Completed'
|
26
|
+
end
|
27
|
+
|
28
|
+
def message
|
29
|
+
@notification.message
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|