Esempio n. 1
0
        public ActionResult LandLinePayment(LandLinePaymentModel landmodel)
        {
            var validMobileNo = landlinenumbervalidation(landmodel.LandLineNo);

            if (validMobileNo.Code != "0")
            {
                ModelState.AddModelError("LandLineNo", validMobileNo.Message);
                return(View(landmodel));
            }

            MobileTopUpPaymentRequest mtpr = new MobileTopUpPaymentRequest()
            {
                action_user    = Session["UserName"].ToString(),
                product_id     = landmodel.ProductId,
                amount         = landmodel.Amount,
                subscriber_no  = landmodel.LandLineNo,
                quantity       = "",
                additonal_data = "",
                CardNo         = landmodel.CardNo,
                CardAmount     = landmodel.CardAmount
            };
            var response = _mtp.MobileTopUpPaymentRequest(mtpr);

            if (response.Code == 0)
            {
                var tranid  = response.Extra1;
                var amt     = landmodel.Amount.Contains(".") ? landmodel.Amount.Split('.')[0].ToString() : landmodel.Amount;
                var payment = _LLpay.DirectPayment(tranid);
                //var payment = _mpaymentPP.ConsumeService(clientModel.MobileNo, long.Parse(amt));
                bool failed = true;
                if (payment.GatewayName == "PAYPOINT")
                {
                    if (payment.Code == shared.Models.ResponseCode.Success)
                    {
                        var billNo     = payment.Extra1;
                        var refStan    = payment.Extra2;
                        var ppresponse = (PPResponse)payment.Data;
                        var data       = new MobileTopUpPaymentUpdateRequest();
                        data.action_user    = Session["UserName"].ToString();
                        data.transaction_id = response.Extra1;
                        data.additonal_data = Newtonsoft.Json.JsonConvert.SerializeObject(ppresponse);
                        data.amount         = landmodel.Amount;
                        data.bill_number    = billNo;
                        data.refstan        = refStan;
                        data.status_code    = ppresponse.Result;
                        data.remarks        = ppresponse.ResultMessage;
                        data.ip_address     = ApplicationUtilities.GetIP();
                        data.product_id     = landmodel.ProductId;
                        data.partner_txn_id = ppresponse.TransactionId;
                        response            = _mtp.MobileTopUpPaymentResponse(data);
                        failed = false;
                    }
                    else
                    {
                        var ppresponse = (PPResponse)payment.Data;
                        var data       = new MobileTopUpPaymentUpdateRequest();
                        data.action_user    = Session["UserName"].ToString();
                        data.transaction_id = response.Extra1;
                        data.additonal_data = Newtonsoft.Json.JsonConvert.SerializeObject(ppresponse);
                        data.amount         = landmodel.Amount;
                        data.status_code    = ((int)payment.Code).ToString();
                        data.remarks        = payment.Message;
                        data.ip_address     = ApplicationUtilities.GetIP();
                        data.product_id     = landmodel.ProductId;
                        response            = _mtp.MobileTopUpPaymentResponse(data);
                    }
                }
                if (payment.GatewayName == "PRABHUPAY")
                {
                    if (payment.Code == ResponseCode.Success)
                    {
                        var ppresponse = (prabhupay.service.data.ReturnTransaction)payment.Data;
                        var billNo     = ppresponse.TransactionId; //payment.Extra1;
                        var refStan    = ppresponse.TransactionId; //payment.Extra2;
                        var data       = new MobileTopUpPaymentUpdateRequest();
                        data.action_user    = Session["UserName"].ToString();
                        data.transaction_id = response.Extra1;
                        data.additonal_data = Newtonsoft.Json.JsonConvert.SerializeObject(ppresponse);
                        data.amount         = landmodel.Amount;
                        data.bill_number    = billNo;
                        data.refstan        = refStan;
                        data.status_code    = ppresponse.Code;
                        data.remarks        = ppresponse.Message;
                        data.ip_address     = ApplicationUtilities.GetIP();
                        data.product_id     = landmodel.ProductId;
                        data.partner_txn_id = ppresponse.TransactionId;
                        response            = _mtp.MobileTopUpPaymentResponse(data);
                        failed = false;
                    }
                    else if (payment.Code == ResponseCode.Exception)
                    {
                        var ppresponse = (prabhupay.service.data.ReturnTransaction)payment.Data;
                        var billNo     = ppresponse.TransactionId; //payment.Extra1;
                        var refStan    = ppresponse.TransactionId; //payment.Extra2;
                        var data       = new MobileTopUpPaymentUpdateRequest();
                        data.action_user    = Session["UserName"].ToString();
                        data.transaction_id = response.Extra1;
                        data.additonal_data = Newtonsoft.Json.JsonConvert.SerializeObject(ppresponse);
                        data.amount         = landmodel.Amount;
                        data.bill_number    = billNo;
                        data.refstan        = refStan;
                        data.status_code    = ppresponse.Code;
                        data.remarks        = ppresponse.Message;
                        data.ip_address     = ApplicationUtilities.GetIP();
                        data.product_id     = landmodel.ProductId;
                        data.partner_txn_id = ppresponse.TransactionId;
                        response            = _mtp.MobileTopUpPaymentResponse(data);
                        failed = false;
                    }
                    else
                    {
                        var ppresponse = (prabhupay.service.data.ReturnTransaction)payment.Data;
                        var data       = new MobileTopUpPaymentUpdateRequest();
                        data.action_user    = Session["UserName"].ToString();
                        data.transaction_id = response.Extra1;
                        data.additonal_data = Newtonsoft.Json.JsonConvert.SerializeObject(ppresponse);
                        data.amount         = landmodel.Amount;
                        data.status_code    = "999";
                        data.remarks        = payment.Message;
                        data.ip_address     = ApplicationUtilities.GetIP();
                        data.product_id     = landmodel.ProductId;
                        response            = _mtp.MobileTopUpPaymentResponse(data);
                    }
                }

                if (failed)
                {
                    response.Code    = shared.Models.ResponseCode.Failed;
                    response.Message = "Transaction Failed";
                }
                response.SetMessageInTempData(this, "LandLinePayment");
                if (failed)
                {
                    return(RedirectToAction("LandLinePayment"));
                }
                return(RedirectToAction("ResultPage", ControllerName, new { txnid = response.Extra1.EncryptParameter() }));
                //return RedirectToAction("MobileTopup");
            }
            response.SetMessageInTempData(this, "LandLinePayment");

            //if (Session["UserType"].ToString().ToLower() == "merchant")
            //    return RedirectToAction("MobileTopUp3");


            return(RedirectToAction("LandLinePayment"));
        }
Esempio n. 2
0
        public ActionResult NwscBillPayment(NwscBillInquiryResponseModel Response)
        {
            if (Response.EncryptedContent.DecryptParameter() != Response.TotalDueAmount + Response.TotalServiceCharge + Response.CustomerId + Response.OfficeCode)
            {
                this.ShowPopup(1, "Data Mismatch");
                return(RedirectToAction("NwscBillInquiry"));
            }
            NwscBillPaymentModel payment = new NwscBillPaymentModel();

            payment.CustomerId     = Response.CustomerId;
            payment.TotalDueAmount = Response.TotalDueAmount;
            payment.ServiceCharge  = Response.TotalServiceCharge;
            payment.OfficeCode     = Response.OfficeCode;


            var jstring = Newtonsoft.Json.JsonConvert.SerializeObject(payment);
            MobileTopUpPaymentRequest mtpr = new MobileTopUpPaymentRequest()
            {
                action_user    = Session["UserName"].ToString(),
                product_id     = Response.ProductId,
                amount         = payment.TotalDueAmount,
                subscriber_no  = payment.CustomerId,
                quantity       = "",
                additonal_data = jstring
            };
            var response = _mtp.MobileTopUpPaymentRequest(mtpr);

            if (response.Code == 0)
            {
                payment.TransactionId = response.Extra1;
                NwscBillPaymentCommon pcommon = payment.MapObject <NwscBillPaymentCommon>();

                var amt = payment.TotalDueAmount.Contains(".") ? payment.TotalDueAmount.Split('.')[0].ToString() : payment.TotalDueAmount;
                payment.TotalDueAmount = amt;
                var  paymentresponse = _nwsc.BillPayment(pcommon);
                bool failed          = true;
                if (paymentresponse.GatewayName == "PRABHUPAY")
                {
                    if (paymentresponse.Code == shared.Models.ResponseCode.Success)
                    {
                        var ppresponse = (prabhupay.service.data.ReturnTransaction)paymentresponse.Data;
                        var data       = new MobileTopUpPaymentUpdateRequest();
                        data.action_user    = Session["username"].ToString();
                        data.refstan        = ppresponse.TransactionId;
                        data.transaction_id = response.Extra1;
                        data.additonal_data = Newtonsoft.Json.JsonConvert.SerializeObject(ppresponse);
                        data.amount         = pcommon.TotalDueAmount;

                        data.status_code = ppresponse.Code;
                        data.remarks     = ppresponse.Message;
                        data.ip_address  = ApplicationUtilities.GetIP();
                        //data.product_id = pcommon.;
                        //data.partner_txn_id = ppresponse.TransactionId;
                        response = _mtp.MobileTopUpPaymentResponse(data);
                        failed   = false;
                        return(RedirectToAction("ResultPage", "NwscBillPayment", new { payment = ppresponse }));
                    }
                    else if (paymentresponse.Code == shared.Models.ResponseCode.Exception)
                    {
                        var ppresponse = (prabhupay.service.data.ReturnTransaction)paymentresponse.Data;
                        var data       = new MobileTopUpPaymentUpdateRequest();
                        data.action_user    = Session["username"].ToString();
                        data.transaction_id = response.Extra1;
                        data.refstan        = ppresponse.TransactionId;
                        data.additonal_data = Newtonsoft.Json.JsonConvert.SerializeObject(ppresponse);
                        data.amount         = pcommon.TotalDueAmount;

                        data.status_code = ppresponse.Code;
                        data.remarks     = ppresponse.Message;
                        data.ip_address  = ApplicationUtilities.GetIP();
                        //data.product_id = pcommon.;
                        data.partner_txn_id = ppresponse.TransactionId;
                        response            = _mtp.MobileTopUpPaymentResponse(data);
                        failed = false;
                        return(RedirectToAction("ResultPage", "NwscBillPayment", new { payment = ppresponse }));
                    }
                    else
                    {
                        var ppresponse = (prabhupay.service.data.ReturnTransaction)paymentresponse.Data;
                        var data       = new MobileTopUpPaymentUpdateRequest();
                        data.action_user    = Session["UserName"].ToString();
                        data.transaction_id = response.Extra1;
                        data.additonal_data = Newtonsoft.Json.JsonConvert.SerializeObject(ppresponse);
                        data.amount         = pcommon.TotalDueAmount;
                        data.status_code    = ((int)paymentresponse.Code).ToString();
                        data.remarks        = paymentresponse.Message;
                        data.ip_address     = ApplicationUtilities.GetIP();
                        //data.product_id = pcommon.ProductId;
                        response = _mtp.MobileTopUpPaymentResponse(data);
                    }

                    response.SetMessageInTempData(this, "NwscPayment");
                    if (failed)
                    {
                        NwscBillInquiryModel query = new NwscBillInquiryModel()
                        {
                            CustomerId = payment.CustomerId,
                            OfficeCode = payment.OfficeCode,
                        };
                        return(RedirectToAction("NwscBillInquiry", new { INQ = query }));
                    }
                }
            }
            response.SetMessageInTempData(this, "NEAPayment");
            NwscBillInquiryModel que = new NwscBillInquiryModel()
            {
                CustomerId = payment.CustomerId,
                OfficeCode = payment.OfficeCode,
            };

            return(RedirectToAction("NwscBillInquiry", new { INQ = que }));
        }
        public ActionResult NeaBillPayment(NeaBillPaymentModel NBP, string ActionType)
        {
            if (ActionType != "submitaction")
            {
                return(RedirectToAction("NeaBillInquiry"));
            }
            if (NBP.EncryptedContent.DecryptParameter() != NBP.ScNo + NBP.ConsumerId + NBP.BillAmount)
            {
                return(RedirectToAction("NeaBillInquiry"));
            }
            var jstring = Newtonsoft.Json.JsonConvert.SerializeObject(NBP);
            MobileTopUpPaymentRequest mtpr = new MobileTopUpPaymentRequest()
            {
                action_user    = Session["UserName"].ToString(),
                product_id     = NBP.ProductId,
                amount         = NBP.TotalPayingAmount,
                subscriber_no  = NBP.ScNo,
                quantity       = "",
                additonal_data = jstring
            };
            var response = _mtp.MobileTopUpPaymentRequest(mtpr);

            if (response.Code == 0)
            {
                NBP.TransactionId = response.Extra1;
                NeaBillPaymentCommon NPC = NBP.MapObject <NeaBillPaymentCommon>();
                var amt = NBP.PayableAmount.Contains(".") ? NBP.PayableAmount.Split('.')[0].ToString() : NBP.PayableAmount;
                NPC.PayableAmount = amt;
                var  payment = _nea.payment(NPC);
                bool failed  = true;
                if (payment.GatewayName == "PRABHUPAY")
                {
                    if (payment.Code == shared.Models.ResponseCode.Success)
                    {
                        var ppresponse = (prabhupay.service.data.ReturnTransaction)payment.Data;
                        var data       = new MobileTopUpPaymentUpdateRequest();
                        data.action_user    = Session["username"].ToString();
                        data.transaction_id = response.Extra1;
                        data.additonal_data = Newtonsoft.Json.JsonConvert.SerializeObject(ppresponse);
                        data.amount         = NPC.PayableAmount;

                        data.refstan        = ppresponse.TransactionId;
                        data.status_code    = ppresponse.Code;
                        data.remarks        = ppresponse.Message;
                        data.ip_address     = ApplicationUtilities.GetIP();
                        data.product_id     = NPC.ProductId;
                        data.partner_txn_id = ppresponse.TransactionId;
                        response            = _mtp.MobileTopUpPaymentResponse(data);
                        failed = false;
                        return(RedirectToAction("ResultPage", "NeaBillPayment", new { payment = ppresponse }));
                    }
                    else if (payment.Code == shared.Models.ResponseCode.Exception)
                    {
                        var ppresponse = (prabhupay.service.data.ReturnTransaction)payment.Data;
                        var data       = new MobileTopUpPaymentUpdateRequest();
                        data.action_user    = Session["username"].ToString();
                        data.transaction_id = response.Extra1;
                        data.additonal_data = Newtonsoft.Json.JsonConvert.SerializeObject(ppresponse);
                        data.amount         = NPC.PayableAmount;
                        data.refstan        = ppresponse.TransactionId;

                        data.status_code    = ppresponse.Code;
                        data.remarks        = ppresponse.Message;
                        data.ip_address     = ApplicationUtilities.GetIP();
                        data.product_id     = NPC.ProductId;
                        data.partner_txn_id = ppresponse.TransactionId;
                        response            = _mtp.MobileTopUpPaymentResponse(data);
                        failed = false;
                        return(RedirectToAction("ResultPage", "NeaBillPayment", new { payment = ppresponse }));
                    }
                    else
                    {
                        var ppresponse = (prabhupay.service.data.ReturnTransaction)payment.Data;
                        var data       = new MobileTopUpPaymentUpdateRequest();
                        data.action_user    = Session["UserName"].ToString();
                        data.transaction_id = response.Extra1;
                        data.additonal_data = Newtonsoft.Json.JsonConvert.SerializeObject(ppresponse);
                        data.amount         = NPC.PayableAmount;
                        data.status_code    = ((int)payment.Code).ToString();
                        data.remarks        = payment.Message;
                        data.ip_address     = ApplicationUtilities.GetIP();
                        data.product_id     = NPC.ProductId;
                        response            = _mtp.MobileTopUpPaymentResponse(data);
                    }
                }

                response.SetMessageInTempData(this, "NEAPayment");
                if (failed)
                {
                    NeaBillInquiryModel query = new NeaBillInquiryModel()
                    {
                        ConsumerId = NBP.ConsumerId,
                        OfficeCode = NBP.OfficeCode,
                        ScNo       = NBP.ScNo
                    };
                    return(RedirectToAction("NeaBillInquiry", new { INQ = query }));
                }
            }
            response.SetMessageInTempData(this, "NEAPayment");
            NeaBillInquiryModel que = new NeaBillInquiryModel()
            {
                ConsumerId = NBP.ConsumerId,
                OfficeCode = NBP.OfficeCode,
                ScNo       = NBP.ScNo
            };

            return(RedirectToAction("NeaBillInquiry", new { INQ = que }));
        }
        public ActionResult VianetBillPayment(VianetBillInquiryResponseModel Response)
        {
            if (Response.Encryptioncontent.DecryptParameter() != (Response.VianetCustomerId + Response.BillAmount))
            {
                this.ShowPopup(1, "Data Mismatch");
                return(RedirectToAction("VianetBillInquiry"));
            }
            if (string.IsNullOrEmpty(Response.BillAmount) && string.IsNullOrEmpty(Response.RenewalPlans))
            {
                this.ShowPopup(1, "Invalid Plan");
                return(View(Response));
            }
            VianetBillPaymentModel payment = new VianetBillPaymentModel();

            if (!string.IsNullOrEmpty(Response.RenewalPlans))
            {
                var plan      = Response.RenewalPlans;
                var plansplit = plan.Split('|');
                payment.VianetCustomerId = Response.VianetCustomerId;
                if (plansplit.Length == 2)
                {
                    payment.Amount = plansplit[0];
                    payment.PlanId = plansplit[1];
                }
                else
                {
                    this.ShowPopup(1, "Select Plan Invalid");
                    return(RedirectToAction("VianetBillInquiry"));
                }
            }
            else
            {
                payment.Amount = Response.BillAmount;
            }
            var jstring = Newtonsoft.Json.JsonConvert.SerializeObject(payment);
            MobileTopUpPaymentRequest mtpr = new MobileTopUpPaymentRequest()
            {
                action_user    = Session["UserName"].ToString(),
                product_id     = Response.ProductId.DecryptParameter(),
                amount         = payment.Amount,
                subscriber_no  = payment.VianetCustomerId,
                quantity       = "",
                additonal_data = jstring,
                CreatedIp      = ApplicationUtilities.GetIP()
            };
            var response = _mtp.MobileTopUpPaymentRequest(mtpr);

            if (response.Code == 0)
            {
                payment.TransactionId = response.Extra1;
                VianetBillPaymentCommon pcommon = new VianetBillPaymentCommon();
                var amt = payment.Amount.Contains(".") ? payment.Amount.Split('.')[0].ToString() : payment.Amount;
                payment.Amount = amt;
                pcommon        = payment.MapObject <VianetBillPaymentCommon>();
                var  paymentresponse = _vianet.BillPayment(pcommon);
                bool failed          = true;
                if (paymentresponse.GatewayName == "PRABHUPAY")
                {
                    if (paymentresponse.Code == shared.Models.ResponseCode.Success)
                    {
                        var ppresponse = (prabhupay.service.data.ReturnTransaction)paymentresponse.Data;
                        var data       = new MobileTopUpPaymentUpdateRequest();
                        data.action_user    = Session["username"].ToString();
                        data.refstan        = ppresponse.TransactionId;
                        data.transaction_id = response.Extra1;
                        data.additonal_data = Newtonsoft.Json.JsonConvert.SerializeObject(ppresponse);
                        data.amount         = pcommon.Amount;
                        data.status_code    = ppresponse.Code;
                        data.remarks        = ppresponse.Message;
                        data.ip_address     = ApplicationUtilities.GetIP();
                        response            = _mtp.MobileTopUpPaymentResponse(data);
                        failed = false;
                        //return RedirectToAction("ResultPage", "WorldLinkBillPayment", new { txnid = ppresponse });
                        return(RedirectToAction("ResultPage", "VianetBillPayment", new { txnid = response.Extra1.EncryptParameter() }));
                    }
                    else if (paymentresponse.Code == shared.Models.ResponseCode.Exception)
                    {
                        var ppresponse = (prabhupay.service.data.ReturnTransaction)paymentresponse.Data;
                        var data       = new MobileTopUpPaymentUpdateRequest();
                        data.action_user    = Session["username"].ToString();
                        data.transaction_id = response.Extra1;
                        data.refstan        = ppresponse.TransactionId;
                        data.additonal_data = Newtonsoft.Json.JsonConvert.SerializeObject(ppresponse);
                        data.amount         = pcommon.Amount;
                        data.status_code    = ppresponse.Code;
                        data.remarks        = ppresponse.Message;
                        data.ip_address     = ApplicationUtilities.GetIP();
                        //data.product_id = pcommon.;
                        data.partner_txn_id = ppresponse.TransactionId;
                        response            = _mtp.MobileTopUpPaymentResponse(data);
                        failed = false;
                        return(RedirectToAction("ResultPage", "VianetBillPayment", new { txnid = response.Extra1.EncryptParameter() }));
                    }
                    else
                    {
                        var ppresponse = (prabhupay.service.data.ReturnTransaction)paymentresponse.Data;
                        var data       = new MobileTopUpPaymentUpdateRequest();
                        data.action_user    = Session["UserName"].ToString();
                        data.transaction_id = response.Extra1;
                        data.additonal_data = Newtonsoft.Json.JsonConvert.SerializeObject(ppresponse);
                        data.amount         = pcommon.Amount;
                        data.status_code    = ((int)paymentresponse.Code).ToString();
                        data.remarks        = paymentresponse.Message;
                        data.ip_address     = ApplicationUtilities.GetIP();
                        //data.product_id = pcommon.ProductId;
                        response = _mtp.MobileTopUpPaymentResponse(data);
                    }

                    response.SetMessageInTempData(this, "VianetBillPayment");
                    if (failed)
                    {
                        VianetBillInquiryCommon query = new VianetBillInquiryCommon()
                        {
                            VianetCustomerId = payment.VianetCustomerId
                        };
                        return(RedirectToAction("VianetBillInquiry", new { wpm = query }));
                    }
                }
            }
            response.SetMessageInTempData(this, "VianetBillPayment");

            VianetBillInquiryCommon que = new VianetBillInquiryCommon()
            {
                VianetCustomerId = payment.VianetCustomerId
            };

            return(RedirectToAction("VianetBillInquiry", new { wpm = que }));
        }