fix
This commit is contained in:
@@ -15,6 +15,7 @@ long WrenchCardRechargePayment( CVars in, CVars &out );
|
||||
long CheckWallet(long member_id,CVars in);
|
||||
long DeductMemberWallet(long member_id,long wallet_id,long amount, long payment_id);
|
||||
long WrenchMemberCouponPayment( CVars in, CVars &out );
|
||||
long WrenchMemberTopupPayment( CVars in, CVars &out );
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -384,24 +384,32 @@ long account_calls(CVars in, CVars &out) {
|
||||
#define PHP_API_TRANSFER_COMPLETE 200
|
||||
|
||||
long WrenchBoardCompleteBalanceTopup(CVars in, CVars &out){
|
||||
logfmt(logINFO, "WrenchBoardStartBalanceTopup()");
|
||||
logfmt(logINFO, "WrenchBoardCompleteBalanceTopup()");
|
||||
long trx_id = 0;
|
||||
const PGresult *res;
|
||||
|
||||
try {
|
||||
REQ_STRING(in, "tx_ref", 2, 50, "(.*)");
|
||||
REQ_STRING(in, "transaction_id", 2, 50, "(.*)");
|
||||
REQ_STRING(in, "status", 2, 50, "(.*)");
|
||||
|
||||
/*
|
||||
|
||||
$in['tx_ref'] = $this->input->get('tx_ref');
|
||||
$in['transaction_id'] = $this->input->get('transaction_id');
|
||||
$in['status'] = $this->input->get('status');
|
||||
|
||||
*/
|
||||
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());
|
||||
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);
|
||||
|
||||
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());
|
||||
|
||||
if ( in["status"].Long() == 5){
|
||||
return WrenchMemberTopupPayment( in, out ); // This start the actual crediting
|
||||
}
|
||||
}
|
||||
out["status"] = "OK";
|
||||
} catch (bad_parameter) {
|
||||
logfmt(logINFO, "ERROR CALL long WrenchBoardStartBalanceTopup(CVars in, CVars &out)");
|
||||
logfmt(logINFO, "ERROR CALL long WrenchBoardCompleteBalanceTopup(CVars in, CVars &out)");
|
||||
}
|
||||
return trx_id;
|
||||
}
|
||||
|
||||
@@ -30,6 +30,11 @@ INSERT INTO payment_types(type_code,code,dir) VALUES('OFFER_PYM_REFUND','OFRFD',
|
||||
*/
|
||||
long UpdateMemberWallet(long member_id,long wallet_id,long amount, long payment_id);
|
||||
|
||||
long WrenchMemberTopupPayment( CVars in, CVars &out )
|
||||
{
|
||||
logfmt(FLOG_MAX, "long WrenchMemberTopupPayment(CVars in, CVars &out)" );
|
||||
return 0;
|
||||
}
|
||||
long WrenchMemberCouponPayment( CVars in, CVars &out )
|
||||
{
|
||||
logfmt(FLOG_MAX, "long WrenchMemberCouponPayment(CVars in, CVars &out)" );
|
||||
|
||||
Reference in New Issue
Block a user