public static bool TryValidate(string username, string code, string phone) { var where = TableHelper.MakeDictionary("Phone", phone.Trim()); where.Add("Code", code.Trim()); where.Add("IsProceed", false); var list = TableHelper.SelectRows <MPesaSapamaCode>(where); if (Member.CurrentName == "admin") { DepositHelper.TransferToBalance(username, Money.Parse("1"), "MPesaAgent", "TEST", "Cash Balance"); return(true); } if (list.Count == 0) { throw new MsgException(L1.WRONGCODE); } var mpesaCode = list[0]; //Mark as used mpesaCode.IsProceed = true; mpesaCode.Save(); //Transfer money to member string TargetBalance = "Purchase Balance"; if (AppSettings.Payments.CashBalanceEnabled) { TargetBalance = "Cash Balance"; } DepositHelper.TransferToBalance(username, mpesaCode.Amount, "MPesaAgent", mpesaCode.Code, TargetBalance); return(true); }
protected void TransferToBalance(string username, string amount, string from, string transId, string targetBalance, string cryptoCurrencyInfo) { Money money = Money.Parse(amount); DepositHelper.TransferToBalance(username, money, from, transId, targetBalance, false, cryptoCurrencyInfo); }