public async Task <ActionResult> FundTransfer(string TransID) { try { string decrptSlId = Decrypt.DecryptMe(TransID); long ValID = long.Parse(decrptSlId); var db = new DBContext(); var beneficiarydetails = await db.TBL_REMITTER_BENEFICIARY_INFO.FirstOrDefaultAsync(x => x.ID == ValID); MoneyTransferModelView objval = new MoneyTransferModelView() { RemitterId = beneficiarydetails.RemitterID, BeneficiaryID = beneficiarydetails.BeneficiaryID, RemitterMobileNo = beneficiarydetails.Mobile, BeneficiaryName = beneficiarydetails.BeneficiaryName, BeneficiaryAccount = beneficiarydetails.Account, BeneficiaryBankName = beneficiarydetails.BeneficiaryName, BeneficiaryIFSC = beneficiarydetails.IFSC }; return(View(objval)); } catch (Exception ex) { Logger.Error("Controller:- MerchantDMRDashboard(Merchant), method:- FundTransfer(GET) Line No:- 577", ex); throw ex; } }
public async Task <ActionResult> FundTransfer(MoneyTransferModelView objval) { try { const string agentId = "395Y36706"; var db = new DBContext(); var Mem_IDval = long.Parse(CurrentMerchant.MEM_ID.ToString()); var remitterid = Session["MerchantDMRId"].ToString(); if (objval.Amount > 0) { var remitterInfo = (from remitt in db.TBL_REMITTER_BENEFICIARY_INFO join dmrremitter in db.TBL_DMR_REMITTER_INFORMATION on remitt.RemitterID equals dmrremitter.RemitterID where remitt.MEM_ID == CurrentMerchant.MEM_ID select new { remitterMobile = remitt.Mobile }).FirstOrDefault(); ////var PaymentValidation1 = MoneyTransferAPI.BeneficiaryAccountVerification(objval.RemitterMobileNo, objval.BeneficiaryAccount, objval.BeneficiaryIFSC, agentId); var PaymentValidation = MoneyTransferAPI.FundTransfer(objval.RemitterMobileNo, objval.BeneficiaryID, agentId, objval.Amount.ToString(), objval.PaymentMode); string errorcode = string.IsNullOrEmpty(PaymentValidation.statuscode.Value) ? PaymentValidation.statuscode.Value : PaymentValidation.statuscode.Value;//res.res_code; //string errorcode = "TXN"; if (errorcode == "TXN") { var ipat_id = PaymentValidation.data.ipay_id; var ref_no = PaymentValidation.data.ref_no; TimeSpan timeval = new TimeSpan(); var opr_id = PaymentValidation.data.opr_id; var Name = PaymentValidation.data.name; var OpeningAmt = PaymentValidation.data.opening_bal; var amount = PaymentValidation.data.amount; var charged_amt = PaymentValidation.data.charged_amt; var locked_amt = PaymentValidation.data.locked_amt; var bank_alias = PaymentValidation.data.bank_alias; var msg = PaymentValidation.status.Value; var msgcode = PaymentValidation.statuscode.Value; TBL_DMR_FUND_TRANSFER_DETAILS objfund = new TBL_DMR_FUND_TRANSFER_DETAILS() { IPAY_ID = ipat_id, REF_NO = ref_no, OPR_ID = opr_id, NAME = Name, OPENING_BAL = Convert.ToDecimal(OpeningAmt), AMOUNT = Convert.ToDecimal(amount), CHARGED_AMT = Convert.ToDecimal(charged_amt), LOCKED_AMT = Convert.ToDecimal(locked_amt), BANK_ALIAS = bank_alias, STATUS = msg, STATUSCODE = msgcode, TXNDATE = DateTime.Now, BANKREFNO = "", REMARKS = "", MEM_ID = Mem_IDval, VERIFICATIONSTATUS = "", REFUNF_ALLOWED = 0, REMITTER_ID = remitterid }; db.TBL_DMR_FUND_TRANSFER_DETAILS.Add(objfund); await db.SaveChangesAsync(); var checkPaymentStatus = MoneyTransferAPI.FundTransferStatus(ipat_id.Value); string ipayval = ipat_id.Value; string checktransfer = string.IsNullOrEmpty(checkPaymentStatus.statuscode.Value) ? checkPaymentStatus.statuscode.Value : checkPaymentStatus.statuscode.Value;//res.res_code; if (checktransfer == "TXN") { var updatetransstatus = await db.TBL_DMR_FUND_TRANSFER_DETAILS.Where(x => x.IPAY_ID == ipayval).FirstOrDefaultAsync(); if (updatetransstatus != null) { updatetransstatus.VERIFICATIONSTATUS = checkPaymentStatus.status.Value; updatetransstatus.REQ_DATE = Convert.ToDateTime(checkPaymentStatus.data.req_dt.Value); updatetransstatus.NAME = checkPaymentStatus.data.beneficiary_name.Value; db.Entry(updatetransstatus).State = System.Data.Entity.EntityState.Modified; await db.SaveChangesAsync(); CommissionDistributionHelper objComm = new CommissionDistributionHelper(); string valueDMRComm = objComm.DistributeCommission(long.Parse(Mem_IDval.ToString()), "DMR", decimal.Parse(objval.Amount.ToString()), decimal.Parse(charged_amt.ToString()), decimal.Parse(OpeningAmt.ToString()), "DMI", "DMR"); } } ViewBag.message = checkPaymentStatus.status.Value; return(RedirectToAction("FundTransferSuccess", "MerchantDMRDashboard", new { area = "Merchant", TransID = Encrypt.EncryptMe(ipayval.ToString()) })); //return RedirectToAction("FundTransferSuccess", "MerchantDMRDashboard", new { area = "Merchant", TransID = "12345" }); } else { ViewBag.message = PaymentValidation.status; return(View()); } } else { ViewBag.message = "Enter Some Amount"; return(View()); } } catch (Exception ex) { Logger.Error("Controller:- MerchantDMRDashboard(Merchant), method:- FundTransfer(POST) Line No:- 674", ex); throw ex; } }