public string InsertPaymentInformation(PayUResponse ObjPayUResponse, string MonthNumber, int Year, string PayeeUid, int PayeeCode, int FeeCode, int FineCode)
        {
            DbParam[] param = new DbParam[]
            {
                new DbParam(userDetail.schooltenentId, typeof(System.String), "_schooltenentid"),
                new DbParam(PayeeUid, typeof(System.String), "_payeeuid"),
                new DbParam(MonthNumber, typeof(System.String), "_paymentformonth"),
                new DbParam(Year, typeof(System.Int32), "_foryear"),
                new DbParam(PayeeCode, typeof(System.String), "_PayeeCode"),
                new DbParam(FeeCode, typeof(System.Int32), "_feecode"),
                new DbParam(FineCode, typeof(System.Int32), "_finecode"),
                new DbParam(ObjPayUResponse.txnid, typeof(System.String), "_txnid"),
                new DbParam(ObjPayUResponse.status, typeof(System.String), "_status"),
                new DbParam(ObjPayUResponse.unmappedstatus, typeof(System.String), "_unmappedstatus"),
                new DbParam(ObjPayUResponse.mode, typeof(System.String), "_mode"),
                new DbParam(Convert.ToDouble(ObjPayUResponse.amount), typeof(System.Double), "_amountpaid"),
                new DbParam(ObjPayUResponse.field9, typeof(System.String), "_statusmessage"),
                new DbParam(ObjPayUResponse.payuMoneyId, typeof(System.String), "_payuMoneyId"),
                new DbParam(ObjPayUResponse.bankcode, typeof(System.String), "_bankcode"),
                new DbParam(ObjPayUResponse.bank_ref_num, typeof(System.String), "_bankreferenceno"),
                new DbParam(ObjPayUResponse.PG_TYPE, typeof(System.String), "_paymenttype")
            };
            var ReturnedState = db.ExecuteNonQuery("sp_paymentdetail_InsUpd", param, true);

            return(ReturnedState);
        }
Esempio n. 2
0
        public async Task <TransactionResult> ProcessResponse(PayUResponse response)
        {
            var log = new PaymentResponseLog()
            {
                LapResponseCode     = response.LapResponseCode,
                LapTransationState  = response.LapTransactionState,
                PolResponseCode     = response.PolResponseCode,
                PolTransactionState = response.PolTransactionState,
                ProcessDate         = DateTime.Now,
                TransactionId       = new Guid(response.ReferenceCode),
                TransactionState    = response.TransactionState.ToString(),
                RawData             = Newtonsoft.Json.JsonConvert.SerializeObject(response)
            };

            context.PaymentResponseLogs.Add(log);
            await context.SaveChangesAsync();

            var success = response.TransactionState == 4;

            var transactionResult = new TransactionResult()
            {
                Success = success,
                Pending = response.TransactionState == 7
            };

            if (success)
            {
                await ApproveTransaction(log.TransactionId);
            }
            return(transactionResult);
        }
        public IResponse <ApiResponse> SoldGoods(SoldItems ObjSoldItems)
        {
            PayUResponse ObjPayUResponse = null;
            string       TxnUid          = null;

            ObjPayUResponse = new PayUResponse();
            TxnUid          = accountService.TransactionIdExists(ObjSoldItems.ExistingClientUid, null, 3);
            if (TxnUid != null)
            {
                ObjSoldItems.TxnUid      = TxnUid;
                ObjSoldItems.TxnIdExists = 1;
            }
            else
            {
                ObjSoldItems.TxnIdExists = 0;
                TxnUid                 = accountService.Generatetxnid();
                ObjSoldItems           = sellGoodService.SoldGoodsService(ObjSoldItems);
                ObjPayUResponse        = new PayUResponse();
                ObjPayUResponse.txnid  = TxnUid;
                ObjSoldItems.TxnUid    = TxnUid;
                ObjPayUResponse.amount = ObjSoldItems.TotalAmount.ToString();
                string PaymentStatus = accountService.InsertPaymentInformation(ObjPayUResponse, null, 2018, ObjSoldItems.ExistingClientUid, 3, 0, 0);
            }

            ObjSoldItems.ObjClientDetail = sellGoodService.GetClientDetailByUid(ObjSoldItems.ExistingClientUid);
            return(null);// context.Stringify(ObjSoldItems);
        }
        public string FeesPayment(FeesPaymentDetail ObjFeesPaymentDetail)
        {
            PayUResponse ObjPayUResponse = null;
            string       TxnUid          = null;

            ObjPayUResponse = new PayUResponse();
            string PaymentForMonths = ObjFeesPaymentDetail.feesDetail.Select(x => x.ForMonth.ToString()).Aggregate((a, b) => a + "," + b);

            TxnUid = this.accountService.TransactionIdExists(ObjFeesPaymentDetail.ExistingClientUid, PaymentForMonths, 1);
            if (TxnUid != null)
            {
                ObjFeesPaymentDetail.TxnUid      = TxnUid;
                ObjFeesPaymentDetail.TxnIdExists = 1;
            }
            else
            {
                ObjFeesPaymentDetail.TxnIdExists = 0;
                TxnUid = accountService.Generatetxnid();
                if (ObjFeesPaymentDetail != null && ObjFeesPaymentDetail.feesDetail.Count > 0)
                {
                    StudentParentDetail ObjStudentParentDetail = accountService.GetStudentDetailByUid(ObjFeesPaymentDetail.ExistingClientUid);
                    if (ObjStudentParentDetail != null)
                    {
                        ObjFeesPaymentDetail   = accountService.FeesPaymentDataService(ObjFeesPaymentDetail, ObjStudentParentDetail);
                        ObjPayUResponse.txnid  = TxnUid;
                        ObjPayUResponse.amount = ObjFeesPaymentDetail.TotalAmount.ToString();
                        int    FineCode      = ObjFeesPaymentDetail.feesDetail.FirstOrDefault().FineCode;
                        int    FeeCode       = ObjFeesPaymentDetail.feesDetail.FirstOrDefault().FeeCode;
                        string PaymentStatus = accountService.InsertPaymentInformation(ObjPayUResponse, PaymentForMonths, ObjStudentParentDetail.AccedemicStartYear,
                                                                                       ObjFeesPaymentDetail.ExistingClientUid, ObjFeesPaymentDetail.PayeeCode, FeeCode, FineCode);
                    }
                    else
                    {
                        // unable to get parent detail
                    }
                }
            }

            return(JsonConvert.SerializeObject(ObjFeesPaymentDetail));
        }
        public async Task <IResponse <ApiResponse> > PayUReturnAction(FormCollection form)
        {
            try
            {
                PayUResponse ObjPayUResponse = new PayUResponse();
                if (form.Keys.Count > 0)
                {
                    ObjPayUResponse.mihpayid       = form["mihpayid"].ToString();
                    ObjPayUResponse.mode           = form["mode"].ToString();
                    ObjPayUResponse.status         = form["status"].ToString();
                    ObjPayUResponse.unmappedstatus = form["unmappedstatus"].ToString();
                    ObjPayUResponse.key            = form["key"].ToString();
                    ObjPayUResponse.txnid          = form["txnid"].ToString();
                    ObjPayUResponse.amount         = form["amount"].ToString();
                    ObjPayUResponse.addedon        = form["addedon"].ToString();
                    ObjPayUResponse.productinfo    = form["productinfo"].ToString();
                    ObjPayUResponse.firstname      = form["firstname"].ToString();
                    ObjPayUResponse.lastname       = form["lastname"].ToString();
                    ObjPayUResponse.address1       = form["address1"].ToString();
                    ObjPayUResponse.address2       = form["address2"].ToString();
                    ObjPayUResponse.city           = form["city"].ToString();
                    ObjPayUResponse.state          = form["state"].ToString();
                    ObjPayUResponse.country        = form["country"].ToString();
                    ObjPayUResponse.zipcode        = form["zipcode"].ToString();
                    ObjPayUResponse.email          = form["email"].ToString();
                    ObjPayUResponse.phone          = form["phone"].ToString();
                    ObjPayUResponse.udf1           = form["udf1"].ToString();
                    ObjPayUResponse.udf2           = form["udf2"].ToString();
                    ObjPayUResponse.udf3           = form["udf3"].ToString();
                    ObjPayUResponse.udf4           = form["udf4"].ToString();
                    ObjPayUResponse.udf5           = form["udf5"].ToString();
                    ObjPayUResponse.udf6           = form["udf6"].ToString();
                    ObjPayUResponse.udf7           = form["udf7"].ToString();
                    ObjPayUResponse.udf8           = form["udf8"].ToString();
                    ObjPayUResponse.udf9           = form["udf9"].ToString();
                    ObjPayUResponse.udf10          = form["udf10"].ToString();
                    ObjPayUResponse.hash           = form["hash"].ToString();
                    ObjPayUResponse.field1         = form["field1"].ToString();
                    ObjPayUResponse.field2         = form["field2"].ToString();
                    ObjPayUResponse.field3         = form["field3"].ToString();
                    ObjPayUResponse.field4         = form["field4"].ToString();
                    ObjPayUResponse.field5         = form["field5"].ToString();
                    ObjPayUResponse.field6         = form["field6"].ToString();
                    ObjPayUResponse.field7         = form["field7"].ToString();
                    ObjPayUResponse.field8         = form["field8"].ToString();
                    ObjPayUResponse.field9         = form["field9"].ToString();
                    ObjPayUResponse.PG_TYPE        = form["PG_TYPE"].ToString();
                    ObjPayUResponse.bank_ref_num   = form["bank_ref_num"].ToString();
                    ObjPayUResponse.bankcode       = form["bankcode"].ToString();
                    ObjPayUResponse.error          = form["error"].ToString();
                    ObjPayUResponse.error_Message  = form["error_Message"].ToString();
                    ObjPayUResponse.payuMoneyId    = form["payuMoneyId"].ToString();

                    string Msg           = ObjPayUResponse.status.ToLower() == "success" ? null : "Fail";
                    string PaymentStatus = ObjAccountService.InsertPaymentInformation(ObjPayUResponse, null, 0, null, 1, 0, 0);
                    await ObjAccountService.GetOTP(ObjPayUResponse.phone, ObjPayUResponse.amount, ObjPayUResponse.txnid, Msg);
                }
                return(null);// RedirectToAction("Payments");
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 6
0
        public async Task <ObjectResult> ReceiveResponse([FromBody] PayUResponse model)
        {
            var result = await service.ProcessResponse(model);

            return(Ok(result));
        }