wallet default
This commit is contained in:
@@ -838,9 +838,22 @@ Foreign-key constraints:
|
||||
REQ_STRING (in, "code", 4, 5, "(.*)");
|
||||
REQ_LONG( in, "dir", 1, -1 );
|
||||
REQ_LONG( in, "offer_id", 1, -1 );
|
||||
|
||||
|
||||
|
||||
long retDb2 = load_db_record( out, "SELECT jj.price,0 as fee,c.code AS currency FROM members_jobs_offer j "
|
||||
" LEFT JOIN members_jobs jj ON jj.id=j.job_id LEFT JOIN currency c ON c.country=jj.country WHERE j.id =%lu ",in["offer_id"].Long());
|
||||
if (retDb2 > 0)
|
||||
{ in["amount"] =out["price"]; in["amount"].set_valid( true ); // get this one LIVE
|
||||
in["fee"] =out["fee"]; in["fee"].set_valid( true ); // get this one LIVE
|
||||
}
|
||||
else
|
||||
{ out["status"] = "Invalid offer";
|
||||
return PHP_API_BAD_PARAM;
|
||||
}
|
||||
|
||||
|
||||
CVars vw;
|
||||
vw["currency"] = "NAIRA"; // this might become a variable based on the country
|
||||
vw["currency"] = out["currency"]; // ""NAIRA"; // this might become a variable based on the country
|
||||
vw["currency"].set_valid( true );
|
||||
long wallet_id = CheckWallet(in["member_id"].Long(),vw);
|
||||
|
||||
@@ -854,15 +867,7 @@ Foreign-key constraints:
|
||||
return PHP_API_BAD_PARAM;
|
||||
}
|
||||
|
||||
long retDb2 = load_db_record( out, "SELECT jj.price,0 as fee FROM members_jobs_offer j LEFT JOIN members_jobs jj ON jj.id=j.job_id WHERE j.id =%lu ",in["offer_id"].Long());
|
||||
if (retDb2)
|
||||
{ in["amount"] =out["price"]; in["amount"].set_valid( true ); // get this one LIVE
|
||||
in["fee"] =out["fee"]; in["fee"].set_valid( true ); // get this one LIVE
|
||||
}
|
||||
else
|
||||
{ out["status"] = "Invalid offer";
|
||||
return PHP_API_BAD_PARAM;
|
||||
}
|
||||
|
||||
long totalAmount = in["amount"].Long() + in["fee"].Long();
|
||||
if ( in["curr_balance"] < in["amount"].Long() + in["fee"].Long())
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user