-2

im implementing payumoney payment gateway to my project, i have downloaded the nodejs files provided by them and created folder called payment, in that i have checkout html and check out Controller and one more controller called payment controller witch is given by the provider. when i click pay from checout page its navigating to home page, why im not able to navigate to payumoney gateway page?

my paymentController.js

`app.controller('paymentController', function ($scope, $rootScope, $http, $state, $location, NgMap, NavigatorGeolocation, GeoCoder, $filter,
    alertService, $localStorage, Restangular, fareService, ownerService, customerService, franchiseService, generalService, tieupService) {

var payumoney = require('payumoney-node');
payumoney.setKeys("key", "salt", "auth/key=");

payumoney.isProdMode(true);

var payuServerUrl = "http://192.168.0.100:3000";

exports.payu = function(req, res) {
    var params = req.body;
    params.txnid = (randomstring.generate({ length: 15, charset: 'numeric' }));
    params.surl = payuServerUrl + "/payu/success";
    params.furl = payuServerUrl + "/payu/fail";

    payumoney.makePayment(params, function(error, response) {
        if (error) {
            // Some error
        } else {
            // Payment redirection link
            res.status(200).json({ paymentUrl: response });
        }
    });

};

exports.paySuccess = function(req, res) {
    waterfall([
        function(callback) {
            var paymentResponse = {
                status: req.body.status,
                txnid: req.body.txnid,
                amount: req.body.amount,
                addedon: req.body.addedon,
                productinfo: req.body.productinfo,
                reason: req.body.reason,
                payuMoneyId: req.body.payuMoneyId,
                paymentGateway: 'PayUMoney'
            };

            var savePaymentResponse = new paymentHistoryModel(paymentResponse);
            savePaymentResponse.save(function(error, result) {
                callback(null);
            });
        },
        function(callback) {
            feesPaymentModel.update({ _id: req.body.udf1 }, {
                $set: {
                    paymentStatus: "completed",
                    paymentDate: req.body.addedon,
                    paymentGateway: 'PayUMoney'
                }
            }, function(error, result) {
                callback(null);

            });
        }

    ], function(error, callback) {
        res.redirect('/payment/success');
    });

};


exports.payFail = function(req, res) {
    var paymentResponse = {
        status: req.body.status,
        txnid: req.body.txnid,
        amount: req.body.amount,
        addedon: req.body.addedon,
        productinfo: req.body.productinfo,
        reason: req.body.reason,
        payuMoneyId: req.body.payuMoneyId,
        paymentGateway: 'PayUMoney'
    };

    var savePaymentResponse = new paymentHistoryModel(paymentResponse);
    savePaymentResponse.save(function(error, result) {
        res.redirect('/payment/failed');
    });
};

});

`

It is navigating me to home page

New contributor
user43192 is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

put on hold as off-topic by Nicolas Raoul Jan 11 at 15:37

This question appears to be off-topic. The users who voted to close gave this specific reason:

If this question can be reworded to fit the rules in the help center, please edit the question.