This commit is contained in:
CHIEFSOFT\ameye
2023-07-21 21:40:25 -04:00
parent e9fe77560c
commit 870766ff19
4 changed files with 61 additions and 10 deletions
+24 -3
View File
@@ -744,18 +744,38 @@ long WrenchBoardMobileSendMoney(CVars in, CVars &out){
REQ_STRING(in, "uid", 3, 150, "(.*)");
REQ_STRING(in, "wallet_uid", 3, 150, "(.*)");
long mode = REQ_LONG(in, "mode", 1, -1);
REQ_STRING(in, "TerminatingCountryCode", 2, 5, "(.*)");
REQ_LONG(in, "amount", 1, -1);
// $in["TerminatingCountryCode"] = 'NG'; // NG - Nigeria
// LET CHECK IF YOU HAVE THE WALLET
CVars wl;
if ( load_db_record(wl, "SELECT w.*,c.country 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["transfer_limit"].Long() )
out["status_message"] = "tranfer_amount_limit_error";
return ret;
}
else
{
out["status_message"] = "wallet_not_found_error";
return ret;
}
switch(mode){
case WRENCH_EXISTING_ACCOUNT:
REQ_STRING(in, "recipient_uid", 3, 150, "(.*)");
if ( load_db_record(out, "SELECT id AS recipientid FROM sendmoney_recipient "
" WHERE uid ='%s' AND member_id = %lu AND status = 1",in["recipient_uid"].c_str(), in["member_id"].Long())> 0){
" WHERE uid ='%s' AND member_id = %lu AND status = 1 "
" AND country='%s' ",in["recipient_uid"].c_str(), in["member_id"].Long(),in["TerminatingCountryCode"].c_str())> 0){
in["recipientid"] = out["recipientid"]; in["recipientid"].set_valid( true );
in["bankid"] = out["recipientid"]; in["bankid"].set_valid( true );
}
else
{
out["status"] = "invalid_recipient";
out["status_message"] = "invalid_recipient_error";
return ret;
}
break;
@@ -783,7 +803,7 @@ long WrenchBoardMobileSendMoney(CVars in, CVars &out){
REQ_STRING(in, "sessionid", 2, 149, "(.*)");
OPTIONAL(in, "comment") REQ_STRING(in, "comment", 2, 149, "(.*)");
OPTIONAL(in, "loc") REQ_STRING(in, "loc", 3, 15, "(.*)");
REQ_LONG(in, "amount", 1, -1);
in["action"] = WRENCHBOARD_SMONEY_MEMBER;
@@ -809,6 +829,7 @@ long WrenchBoardMobileSendMoney(CVars in, CVars &out){
ret = smoney_calls(in, out);
if ( ret == PHP_API_OK){
out["sendmoney_message"] ="Completed - Estimated delivery time is 2 to 4 Hours.";
out["status_message"] = "complete_standard_processing";
ret = PHP_API_TRANSFER_COMPLETE;
}
+2 -1
View File
@@ -30,7 +30,8 @@ long WrenchReturnMemberBankAccount(CVars in, CVars &out) {
const PGresult *res;
res = pgsql_query("SELECT b.id bank_id,b.firstname||' '||b.lastname||' '||b.account_no||' '||k.name AS recipient,b.account_no,b.added "
res = pgsql_query("SELECT b.id bank_id,b.firstname||' '||b.lastname||' '||b.account_no||' '||k.name AS recipient,"
" b.account_no,b.added "
"FROM sendmoney_recipient b "
"LEFT JOIN bank_entity_codes k ON k.code=b.bank_code "
"WHERE b.member_id = %lu AND b.status=1 LIMIT %lu", in["member_id"].Long(),limit);
+32 -5
View File
@@ -82,7 +82,7 @@ long getUserRecipientCombo( CVars in, CVars &out ){
out["total_record"] = "0";
const PGresult *res;
res = pgsql_query("SELECT b.id,b.firstname||' '||b.lastname||' '||b.account_no||' '||k.name AS recipient, "
" b.account_no,b.country,b.added,b.uid AS recipient_uid ,b.uid ,k.name AS bank_name "
" b.account_no,b.country,b.added,b.uid AS recipient_uid ,b.uid ,k.name AS bank_name,k.uid AS bank_uid "
"FROM sendmoney_recipient b "
"LEFT JOIN bank_entity_codes k ON k.code=b.bank_code "
"WHERE b.member_id = %lu AND b.status=1",member_id);
@@ -123,6 +123,8 @@ long getUserRecipientCombo( CVars in, CVars &out ){
snprintf(vname, sizeof (vname), "bank_name_%05d", i);
out[vname] = rec["bank_name"];
snprintf(vname, sizeof (vname), "bank_uid_%05d", i);
out[vname] = rec["bank_uid"];
}
}
ret = PHP_API_OK;
@@ -430,19 +432,29 @@ long getBankCombo( CVars in, CVars &out ) {
$option_value = $this->optionValueObject($q->result(), "code", "name", $curVal);
*/
char vname[30];
char vname[30];
char extra_filter[60];
long ret = PHP_API_BAD_PARAM;
logfmt( logINFO, "getBankCombo()" );
out["result"] = "Yes i go to this back end";
try {
REQ_STRING(in, "country", 2, 25, "(.*)");
OPTIONAL(in, "country") REQ_STRING(in, "country", 2, 5, "(.*)");
if (in["country"]!=""){
snprintf(extra_filter, sizeof (extra_filter), " AND country ='%s' ", in["country"].c_str());
}
else{
snprintf(extra_filter, sizeof (extra_filter), " "); // make empty
}
out["total_record"] = "0";
const PGresult *res;
res = pgsql_query("SELECT code,name "
res = pgsql_query("SELECT code,name,uid,country "
"FROM bank_entity_codes "
"WHERE country ='%s' ORDER BY name ASC",in["country"].c_str());
"WHERE status = 1 %s ORDER BY name ASC",extra_filter);
if (res != NULL && pgsql_num_rows(res) > 0) {
out["total_record"] = pgsql_num_rows(res);
@@ -459,6 +471,12 @@ long getBankCombo( CVars in, CVars &out ) {
snprintf(vname, sizeof (vname), "name_%05d", i);
out[vname] = rec["name"];
snprintf(vname, sizeof (vname), "bank_uid_%05d", i);
out[vname] = rec["uid"];
snprintf(vname, sizeof (vname), "country_%05d", i);
out[vname] = rec["country"];
}
}
ret = PHP_API_OK;
@@ -470,3 +488,12 @@ long getBankCombo( CVars in, CVars &out ) {
logfmt( logINFO, "/getBankCombo()" );
return ret;
}
/*
wrenchboard=> SELECT * FROM bank_entity_codes;
country | channel | name | code | gid | status | bank_codes | uid
---------+---------+------------------------------------------------+------+-----+--------+------------+--------------------------------------
NG | INTERSW | Access Bank | 044 | 1 | 1 | ACC044 | a2c6c1a2-5cf2-4396-8630-50c47da15316
NG | INTERSW | Afri Bank | 014 | 2 | 1 | AFR014 | 5526cfce-3395-4375-9c43-7b6e94843701
NG | INTERSW | Citi Bank | 023 | 3 | 1 | CIT023 | a988b775-0fe7-4180-a7d9-d3492efe812d
NG | INTERSW | Diamond Bank | 063 | 4 | 1 | DIA063 | 3c8fc9a2-95d8-4cb9-811b-6eac9cac45c9
*/
+3 -1
View File
@@ -629,6 +629,7 @@ class ResultFormatter extends Model
"country" => $out["country_${key}"],
"added" => $out["added_${key}"],
"bank_name" => $out["bank_name_${key}"],
"bank_uid" => $out["bank_uid_${key}"],
);
}
@@ -646,7 +647,8 @@ class ResultFormatter extends Model
$res["result_list"][] = array(
"name" => $out["name_${key}"],
"code" => $out["code_${key}"],
"country" => 'NG',
"country" => $out["country_${key}"],
"bank_uid" => $out["bank_uid_${key}"],
);
}
break;