private CommonDbResponse NWSCvalidation(NwscBillPaymentCommon payment) { CommonDbResponse response = new CommonDbResponse(); if (!Regex.IsMatch(payment.CustomerId, @"^\d+$")) { response.Code = ResponseCode.Failed; response.Message = "Please input valid Customer Number"; return(response); } else if (payment.CustomerId.Length < 1 || payment.CustomerId.Length > 7) { response.Code = ResponseCode.Failed; response.Message = "Please input valid length Customer Number"; return(response); } else { response.Code = ResponseCode.Success; return(response); } }
public CommonDbResponse BillPayment(NwscBillPaymentCommon payment) { CommonDbResponse response = new CommonDbResponse(); var checkvalidation = NWSCvalidation(payment); if (checkvalidation.Code != ResponseCode.Success) { response.Code = ResponseCode.Failed; response.Message = checkvalidation.Message; return(response); } Dictionary <string, string> Data = new Dictionary <string, string>(); Data.Add("OfficeCode", payment.OfficeCode); Data.Add("SCharge", payment.OfficeCode); GatewaySwitchAbstractService factory = GatewaySwitchAbstractFactory.Create("cgpay"); factory.TransactionId = payment.TransactionId; var fresponse = factory.ProcessTransactions(Data); 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); }
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 CommonDbResponse BillPayment(NwscBillPaymentCommon payment) { return(repo.BillPayment(payment)); }