This commit is contained in:
2022-08-08 07:32:09 -04:00
parent 7aa911b1f7
commit ea4f941637
2 changed files with 83 additions and 3 deletions
+5 -2
View File
@@ -393,12 +393,15 @@ long WrenchBoardCompleteBalanceTopup(CVars in, CVars &out){
REQ_STRING(in, "transaction_id", 2, 50, "(.*)");
REQ_LONG(in, "status", 1, -1);
res = pgsql_query("SELECT id AS trx_id FROM flutterwave_payments WHERE tx_ref = '%s' AND status=0",in["tx_ref"].c_str());
res = pgsql_query("SELECT id AS trx_id,member_id FROM flutterwave_payments WHERE tx_ref = '%s' AND status=0",in["tx_ref"].c_str());
if (res != NULL && pgsql_num_rows(res) > 0) {
map<const char*, const char*>f = pgsql_fetch_assoc(res, 0);
CVars rec;
map_to_cvars(f, rec);
in["member_id"] = rec["member_id"]; in["member_id"].set_valid( true );
in["trx_id"] = rec["trx_id"]; in["trx_id"].set_valid( true );
pgsql_exec("UPDATE flutterwave_payments SET transaction_id = '%s', " \
"status=%lu,updated=now() WHERE id = %lu AND status=0 AND " \
"tx_ref='%s'", in["transaction_id"].c_str(),in["status"].Long(),rec["trx_id"].Long(), in["tx_ref"].c_str());