Ejemplo n.º 1
0
        public CommonDbResponse BillPayment(WorldLinkBillPaymentCommon payment)
        {
            CommonDbResponse             response = new CommonDbResponse();
            Dictionary <string, string>  Data     = new Dictionary <string, string>();
            GatewaySwitchAbstractService factory  = GatewaySwitchAbstractFactory.Create("cgpay");

            factory.TransactionId = payment.TransactionId;
            Data.Add("PlanId", payment.PlanId);
            var fresponse = factory.ProcessTransactions(Data);

            if (!string.IsNullOrEmpty(fresponse.GatewayName))
            {
                response.GatewayName = fresponse.GatewayName;
                response.Message     = fresponse.Message;
                if (fresponse.GatewayName.ToUpper() == "PRABHUPAY")
                {
                    if (fresponse.Code == "000")
                    {
                        response.Code = ResponseCode.Success;
                        response.Data = fresponse.Data;
                    }
                    else if (fresponse.Code == "777")
                    {
                        response.Code = ResponseCode.Exception;
                        response.Data = fresponse.Data;
                    }
                    else
                    {
                        response.Code = ResponseCode.Failed;
                    }
                }
            }
            return(response);
        }
Ejemplo n.º 2
0
        public ActionResult WlinkBillPayment(WorldLinkBillInquiryResponseModel Response)
        {
            if (Response.Encryptioncontent.DecryptParameter() != (Response.WlinkUserName + Response.BillAmount))
            {
                this.ShowPopup(1, "Data Mismatch");
                return(RedirectToAction("WlinkBillInquiry"));
            }
            if (string.IsNullOrEmpty(Response.BillAmount) && string.IsNullOrEmpty(Response.RenewalPlans))
            {
                this.ShowPopup(1, "Invalid Plan");
                return(View(Response));
            }
            WorldLinkBillPaymentModel payment = new WorldLinkBillPaymentModel();

            if (!string.IsNullOrEmpty(Response.RenewalPlans))
            {
                var plan      = Response.RenewalPlans;
                var plansplit = plan.Split('|');
                payment.WlinkUserName = Response.WlinkUserName;
                if (plansplit.Length == 2)
                {
                    payment.Amount = plansplit[0];
                    payment.PlanId = plansplit[1];
                }
                else
                {
                    this.ShowPopup(1, "Select Plan Invalid");
                    return(RedirectToAction("WlinkBillInquiry"));
                }
            }
            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.WlinkUserName,
                quantity       = "",
                additonal_data = jstring,
                CreatedIp      = ApplicationUtilities.GetIP()
            };
            var response = _mtp.MobileTopUpPaymentRequest(mtpr);

            if (response.Code == 0)
            {
                payment.TransactionId = response.Extra1;
                WorldLinkBillPaymentCommon pcommon = new WorldLinkBillPaymentCommon();
                var amt = payment.Amount.Contains(".") ? payment.Amount.Split('.')[0].ToString() : payment.Amount;
                payment.Amount = amt;
                pcommon        = payment.MapObject <WorldLinkBillPaymentCommon>();
                var  paymentresponse = _wlink.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", "WorldLinkBillPayment", 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", "WorldLinkBillPayment", 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, "WorldLinkBillPayment");
                    if (failed)
                    {
                        WorldLinkBillInquiryCommon query = new WorldLinkBillInquiryCommon()
                        {
                            WlinkUserName = payment.WlinkUserName
                        };
                        return(RedirectToAction("WlinkBillInquiry", new { wpm = query }));
                    }
                }
            }
            response.SetMessageInTempData(this, "WorldLinkBillPayment");

            WorldLinkBillInquiryCommon que = new WorldLinkBillInquiryCommon()
            {
                WlinkUserName = payment.WlinkUserName
            };

            return(RedirectToAction("WlinkBillInquiry", new { wpm = que }));
        }
Ejemplo n.º 3
0
 public CommonDbResponse BillPayment(WorldLinkBillPaymentCommon payment)
 {
     return(repo.BillPayment(payment));
 }