public int MemberRequestTopupWithCrypto(long MemberSrno, decimal TopupAmount, decimal Rate, string Currency, string TransactionHash) { try { var TopupRequest = new MstTopUp { MemberSrno = MemberSrno, TopupAmount = TopupAmount, Rate = Rate, WalletType = "CASH WALLET", Currency = Currency, TransactionHash = TransactionHash, Status = 0, RequestDate = DateTime.Now, TransactionType = 1 }; _db.MstTopUp.Add(TopupRequest); _db.SaveChanges(); return(Models_General.SUCC_CREATE_REQUEST_TOPUP); } catch (Exception ex) { var new_error = new LogErrorSystem { Title = "Member Request Topup With Crypto", Details = ex.Message + "/" + ex.StackTrace, Context = _accessor.ActionContext.HttpContext.Connection.RemoteIpAddress.ToString(), CreatedDateTime = DateTime.Now, }; _db.LogErrorSystem.Add(new_error); _db.SaveChanges(); return(Models_General.ERR_SERVER_BUSY_INTERNAL_ERROR); } }
public int BackResponseDepositPaymentGateway(string Merchant, string Reference, string Currency, string Amount, string Language, string Customer, string Datetime, string Note, string Key, string Status, string ID) { try { int result; var UserAccount = _db.MstUserAccount.Where(x => x.LoginId == Customer).FirstOrDefault(); var UserWallet = _db.MstUserWallet.Where(x => x.MemberSrno == UserAccount.MemberSrno).FirstOrDefault(); var CurrentSettings = _db.MstSettings.Where(x => x.SettingName == "NormalTurnover").FirstOrDefault(); var PaymentGatewayResponse = new LogResponsePaymentGateway { Merchant = Merchant, Reference = Reference, Currency = Currency, Amount = Convert.ToDecimal(Amount), Language = Language, Customer = Customer, Datetime = Datetime, Note = Note, Key = Key, Status = Status, Id = ID, CreatedDateTime = DateTime.Now, }; _db.LogResponsePaymentGateway.Add(PaymentGatewayResponse); if (Status == "000") { var user_topup_request_tracking = new LogUserTrackingWallet { MemberSrno = UserWallet.MemberSrno, WalletFrom = "PAYLAH88", WalletTo = "CASH WALLET", TransactionType = 12, PreviousAmount = UserWallet.CashCredit, TransactionAmount = Convert.ToDecimal(Amount), CurrentTotalAmount = UserWallet.CashCredit + Convert.ToDecimal(Amount), IsDeduct = false, Description = string.Format("User:{0} HAS TOPUP AMOUNT:{1} WITH {2} USING PAYLAH88 PAYMENT GATEWAY AT:{3}", Customer, Convert.ToDecimal(Amount), ID, DateTime.Now), CreatedDateTime = DateTime.Now, }; var log_topup = new LogTopup { MemberSrno = UserWallet.MemberSrno, WalletFrom = "PAYLAH88", WalletTo = "CASH WALLET", TransactionType = 12, PreviousAmount = UserWallet.CashCredit, TransactionAmount = Convert.ToDecimal(Amount), CurrentTotalAmount = UserWallet.CashCredit + Convert.ToDecimal(Amount), Description = string.Format("User:{0} HAS TOPUP AMOUNT:{1} USING PAYLAH88 PAYMENT GATEWAY AT:{2}", Customer, Convert.ToDecimal(Amount), DateTime.Now), CreatedDateTime = DateTime.Now, }; var TopupRequest = new MstTopUp { MemberSrno = UserWallet.MemberSrno, WalletType = "CASH WALLET", TopupAmount = Convert.ToDecimal(Amount), Currency = Currency, Status = 1, RequestDate = DateTime.Now, TransactionReferenceNumber = ID, TransactionType = 2, }; _db.LogUserTrackingWallet.Add(user_topup_request_tracking); _db.LogTopup.Add(log_topup); _db.MstTopUp.Add(TopupRequest); decimal finalturnover = Convert.ToDecimal(Amount) * int.Parse(CurrentSettings.SettingValue); UserWallet.CashCredit += Convert.ToDecimal(Amount); UserWallet.TurnoverAmount += finalturnover; result = Models_General.SUCC_PAYMENT; } else { result = Models_General.ERR_PAYMENT; } _db.SaveChanges(); return(result); } catch (Exception ex) { var new_error = new LogErrorSystem { Title = "Back Response Deposit Payment Gateway", Details = ex.Message + "/" + ex.StackTrace, Context = _accessor.ActionContext.HttpContext.Connection.RemoteIpAddress.ToString(), CreatedDateTime = DateTime.Now, }; _db.LogErrorSystem.Add(new_error); _db.SaveChanges(); return(Models_General.ERR_SERVER_BUSY_INTERNAL_ERROR); } }
public int MemberRequestTopupWithOnlineBanking(long MemberSrno, long AdminBankSrno, decimal TopupAmount, IFormFile TopupImageProof, string TransactionReferenceNumber, string WebPath, string BaseURL, string Currency) { try { var CurrentAdminBank = _db.MstAdminBank.Where(x => x.Srno == AdminBankSrno).FirstOrDefault(); if (CurrentAdminBank != null) { var CurrentMstBank = _db.MstBank.Where(x => x.Srno == CurrentAdminBank.BankSrno).FirstOrDefault(); if (CurrentMstBank != null) { var image_url = _image_services.SaveImage(TopupImageProof, WebPath, "TOPUP", BaseURL); if (!string.IsNullOrEmpty(image_url)) { var TopupRequest = new MstTopUp { MemberSrno = MemberSrno, WalletType = "CASH WALLET", TopupAmount = TopupAmount, TopupImageProof = image_url, TransactionReferenceNumber = TransactionReferenceNumber, Currency = Currency, Status = 0, RequestDate = DateTime.Now, BankCode = CurrentMstBank.BankCode, BankName = CurrentMstBank.BankName, BankAccountHolder = CurrentAdminBank.BankAccountHolder, BankAccountNumber = CurrentAdminBank.BankCardNo, TransactionType = 0 }; _db.MstTopUp.Add(TopupRequest); _db.SaveChanges(); return(Models_General.SUCC_CREATE_REQUEST_TOPUP); } else { return(Models_General.ERR_SERVER_BUSY_INTERNAL_ERROR); } } else { return(Models_General.ERR_BANK_INFO_NOT_MATCH); } } else { return(Models_General.ERR_ADMIN_BANK_NOT_FOUND); } } catch (Exception ex) { var new_error = new LogErrorSystem { Title = "Member Request Topup With Online Banking", Details = ex.Message + "/" + ex.StackTrace, Context = _accessor.ActionContext.HttpContext.Connection.RemoteIpAddress.ToString(), CreatedDateTime = DateTime.Now, }; _db.LogErrorSystem.Add(new_error); _db.SaveChanges(); return(Models_General.ERR_SERVER_BUSY_INTERNAL_ERROR); } }