wallet check
This commit is contained in:
@@ -412,6 +412,7 @@ long WRB_doServiceTransferComplete(CVars in, CVars &out) {
|
||||
|
||||
|
||||
in["action"].set_valid(false);
|
||||
REQ_STRING(in, "wallet_uid", 3, 150, "(.*)");
|
||||
REQ_STRING(in, "InitiatingEntityCode", 3, 3, "(.*)");
|
||||
REQ_LONG(in, "InitiatingAmount", 1, -1);
|
||||
REQ_LONG(in, "Fee", 1, -1);
|
||||
@@ -442,9 +443,28 @@ long WRB_doServiceTransferComplete(CVars in, CVars &out) {
|
||||
|
||||
long LongTotalCost = in["Fee"].Long() + in["TerminatingAmount"].Long() + 0;
|
||||
|
||||
if (sender["balance"].Long() < LongTotalCost) {
|
||||
throw new bad_parameter(out, "insufficient balance for transaction");
|
||||
// LETS DEAL WITH AMONT BALANCE HERE
|
||||
// LET CHECK IF YOU HAVE THE WALLET
|
||||
CVars wl;
|
||||
if ( load_db_record(wl, "SELECT w.*,c.country,w.amount from members_wallet w LEFT join currency c ON c.code=w.currency"
|
||||
" WHERE c.country='%s' AND w.member_id=%lu AND w.uid='%s' ",in["TerminatingCountryCode"].c_str(), in["member_id"].Long(),in["wallet_uid"].c_str())> 0){
|
||||
if (in["amount"].Long() > wl["amount"].Long() )
|
||||
{ out["status_message"] = "insufficient_balance_error";
|
||||
out["status_text"] = "insufficient balance for transaction";
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
out["status_message"] = "wallet_not_found_error";
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// if (sender["balance"].Long() < LongTotalCost) {
|
||||
// throw new bad_parameter(out, "insufficient balance for transaction");
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user