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
+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
*/