New wallet test

This commit is contained in:
CHIEFSOFT\ameye
2024-06-23 09:50:28 -04:00
parent 51962cebee
commit b319ae5ba4
+30 -1
View File
@@ -127,6 +127,7 @@ long test() {
Output2FILE::Stream() = oldFile;
return 0L;
}
long WrenchTestWalletCapability(CVars in, CVars &out);
long account_calls(CVars in, CVars &out) {
logfmt(logINFO, "account_calls()");
@@ -2405,7 +2406,27 @@ long WrenchFamilyCount(long member_id){
return active_family_count;
}
long WrenchTestWalletCapability(CVars in, CVars &out){
long ret = PHP_API_BAD_PARAM;
out["wallet_available_status"] = "WALLET_NOT_AVAILABLE";
out["wallet_country_status"] = "";
out["wallet_action_type"] = "";
if (in["country"] = '' ){
out["wallet_country_status"] = "USER_NEED_UPDATE_PROFILE_COUNTRY";
}
else{
ret = load_db_record(out, "SELECT id AS wallet_id, action_type FROM currency WHERE country ='%s'", in["country"].c_str());
if ( ret > 0 ){
out["wallet_available_status"] = "WALLET_AVAILABLE";
out["wallet_country_status"] = "USER_COUNTRY_WALLET_ENABLED";
out["wallet_action_type"] = out["action_type"];
}
else{
out["wallet_country_status"] = "USER_COUNTRY_NOT_WALLET_ENABLED";
}
}
return 0;
}
long LoginWrenchBoardAccount(CVars in, CVars &out) {
long ret = PHP_API_BAD_PARAM;
logfmt(logINFO, "LoginWrenchBoardAccount()");
@@ -2457,6 +2478,14 @@ long LoginWrenchBoardAccount(CVars in, CVars &out) {
pgsql_query("UPDATE members SET last_login = now() , loc='%s' WHERE id = %lu",loc, out["member_id"].Long());
account_email(ACCOUNT_LOGIN_ALERT, out, out); // ALERT CUSTOMER OF LOGIN
ret = PHP_LOGIN_OK;
CVars xout;
if ( WrenchTestWalletCapability(in, xout) == 0 ){
out["wallet_country_status"] = xout["wallet_country_status"];
out["wallet_available_status"] = xout["wallet_available_status"];
out["wallet_action_type"] = xout["wallet_action_type"];
}
in["member_id"] = out["member_id"];
in["member_id"].set_valid(true);
LoginWrenchBoardSetDashType(in, out);