public ActionResult ReceivePaymentNotification(string MerchantTxnId, string GatewayTxnId)
        {
            //check MerchantTxnId in our db first
            var dbRes = _iLoad.CheckTrnasactionExistence(MerchantTxnId, GatewayTxnId);

            if (dbRes.Code == ResponseCode.Success)
            {
                string apiusername  = ApplicationUtilities.GetAppConfigValue("apiusername");
                string apipasssword = ApplicationUtilities.GetAppConfigValue("apipasssword");
                string apisecretkey = ApplicationUtilities.GetAppConfigValue("apisecretkey");
                string merchantname = ApplicationUtilities.GetAppConfigValue("merchantname");
                string merchantid   = ApplicationUtilities.GetAppConfigValue("merchantid");
                try
                {
                    MiddleServiceRequest serviceCall = new MiddleServiceRequest("cgpay", apiusername, apipasssword, apisecretkey);
                    var resp = serviceCall.GetTransactionDetail(merchantid, merchantname, MerchantTxnId);

                    if (resp.code == "0")
                    {
                        var transactionModel       = ApplicationUtilities.MapObject <CheckTransactionResponse>(resp.data);
                        LoadBalanceCommon lBalance = new LoadBalanceCommon()
                        {
                            pmt_gateway_id     = "",
                            pmt_gateway_txn_id = GatewayTxnId,
                            gateway_status     = transactionModel.Status,
                            gateway_process_id = "",
                            action_user        = "******",
                            action_ip          = ApplicationUtilities.GetIP(),
                            bank_name          = transactionModel.Institution,
                            payment_mode       = transactionModel.Instrument,
                            pmt_txn_id         = MerchantTxnId,
                            amount             = transactionModel.Amount,
                            service_charge     = transactionModel.ServiceCharge
                        };
                        _iLoad.UpdateTransaction(lBalance);
                    }
                }
                catch (Exception ex)
                {
                    string msg = ex.Message;
                    throw;
                }
            }
            Response.Write("Received");
            Response.End();
            return(View());



            // then check if transaction is already updated by merchanttxnid and gatewaytxnid



            //if transaction exists or already received or txn not found
            //return "Received";
            //
        }
Exemple #2
0
        public ActionResult ReceivePaymentNotification(string MerchantTxnId, string GatewayTxnId)
        {
            //check MerchantTxnId in our db first
            var dbRes = _iLoad.CheckTrnasactionExistence(MerchantTxnId, GatewayTxnId);

            if (dbRes.Code == 0)
            {
                ewallet.application.Models.OnePG.CommonResponse resp = MakeHttpRequest.InvokeCheckTransactionStatus("1", "anujApi", MerchantTxnId, "anujApi", "Anuj@123", "AnujSecert");
                if (resp.code == "0")
                {
                    var transactionModel       = ApplicationUtilities.MapObject <CheckTransactionResponse>(resp.data);
                    LoadBalanceCommon lBalance = new LoadBalanceCommon()
                    {
                        pmt_gateway_id     = "",
                        pmt_gateway_txn_id = GatewayTxnId,
                        gateway_status     = transactionModel.Status,
                        gateway_process_id = "",
                        action_user        = "******",
                        action_ip          = ApplicationUtilities.GetIP(),
                        bank_name          = transactionModel.Institution,
                        payment_mode       = transactionModel.Instrument,
                        pmt_txn_id         = MerchantTxnId
                    };
                    _iLoad.UpdateTransaction(lBalance);
                }
            }

            // then check if transaction is already updated by merchanttxnid and gatewaytxnid

            //if transaction exists or already received or txn not found
            //return "Received";


            //
            Response.Write("Received");
            Response.End();
            return(View());
        }