crons new

This commit is contained in:
CHIEFSOFT\ameye
2023-12-01 19:16:49 -05:00
parent 860d5bfa29
commit cfa263f435
3 changed files with 58 additions and 24 deletions
+8 -3
View File
@@ -641,6 +641,7 @@ long WrenchFlutterCreditHook(CVars in, CVars &out) {
xn["amount"] = cc["amount"]; xn["amount"].set_valid(true); xn["amount"] = cc["amount"]; xn["amount"].set_valid(true);
xn["currency"] = cc["currency"]; xn["currency"].set_valid(true); xn["currency"] = cc["currency"]; xn["currency"].set_valid(true);
xn["transaction_id"] = xx["txRef"]; xn["transaction_id"].set_valid(true); xn["transaction_id"] = xx["txRef"]; xn["transaction_id"].set_valid(true);
logfmt(logINFO, "WrenchBoardStartBalanceTopup() start ***** ");
long trx_id = WrenchBoardStartBalanceTopup(xn, out); long trx_id = WrenchBoardStartBalanceTopup(xn, out);
if ( trx_id > 0 ){ if ( trx_id > 0 ){
CVars tx; CVars tx;
@@ -649,8 +650,12 @@ long WrenchFlutterCreditHook(CVars in, CVars &out) {
tx["tx_ref"] = xx["txRef"]; tx["tx_ref"].set_valid(true); tx["tx_ref"] = xx["txRef"]; tx["tx_ref"].set_valid(true);
tx["transaction_id"] = xx["txRef"]; tx["transaction_id"].set_valid(true); tx["transaction_id"] = xx["txRef"]; tx["transaction_id"].set_valid(true);
tx["flutterwave_payments_id"] = trx_id; tx["flutterwave_payments_id"].set_valid(true); tx["flutterwave_payments_id"] = trx_id; tx["flutterwave_payments_id"].set_valid(true);
logfmt(logINFO, "WrenchBoardCompleteBalanceTopup() call ***** ");
long credit_id = WrenchBoardCompleteBalanceTopup(tx, out); long credit_id = WrenchBoardCompleteBalanceTopup(tx, out);
if (credit_id > 0 ){
ret = PHP_API_OK;
out["log_status"] = "completed";
}
} }
} }
@@ -662,7 +667,7 @@ long WrenchFlutterCreditHook(CVars in, CVars &out) {
} catch (bad_parameter) { } catch (bad_parameter) {
out["log_status"] = "Something went wrong"; out["log_status"] = "Something went wrong";
} }
logfmt(logINFO, "WrenchFlutterCreditHook()"); logfmt(logINFO, "/out WrenchFlutterCreditHook()");
return ret; return ret;
} }
+3
View File
@@ -220,7 +220,10 @@ $routes->post('/en/wrench/hooks/v1/stripes', 'WrenchHooks::stripes');
// cron jobs ------------ ===== ------------ // cron jobs ------------ ===== ------------
$routes->post('/en/wrench/api/v1/cron', 'WrenchCrons::apigate'); $routes->post('/en/wrench/api/v1/cron', 'WrenchCrons::apigate');
$routes->get('/en/wrench/api/v1/cron', 'WrenchCrons::apigate'); $routes->get('/en/wrench/api/v1/cron', 'WrenchCrons::apigate');
$routes->get('/en/wrench/api/v1/cron_jobalerts', 'WrenchCrons::jobalerts');
$routes->get('/en/wrench/api/v1/cron_notifications', 'WrenchCrons::notifications');
$routes->get('/en/wrench/api/v1/bko', 'Bko::apigate'); $routes->get('/en/wrench/api/v1/bko', 'Bko::apigate');
$routes->post('/en/wrench/api/v1/bko', 'Bko::apigate'); $routes->post('/en/wrench/api/v1/bko', 'Bko::apigate');
+47 -21
View File
@@ -19,27 +19,6 @@ class WrenchCrons extends BaseController
$in['one_limit'] = 3; $in['one_limit'] = 3;
$ret['WRB_CRONJOB_SIGNUP_ALERT'] = $wrenchboard->wrenchboard_api($in, $out); $ret['WRB_CRONJOB_SIGNUP_ALERT'] = $wrenchboard->wrenchboard_api($in, $out);
$in['call_action'] = WRB_CRONJOB_JOBDUE_REMINDER;
$in['one_limit'] = 3;
$ret['WRB_CRONJOB_JOBDUE_REMINDER'] = $wrenchboard->wrenchboard_api($in, $out);
$in['call_action'] = WRB_CRONJOB_PENDOFFER_ALERT;
$in['one_limit'] = 3;
$ret['WRB_CRONJOB_PENDOFFER_ALERT'] = $wrenchboard->wrenchboard_api($in, $out);
$in['call_action'] = WRB_CRONJOB_JOBDUE_PAYMENTS;
$in['one_limit'] = 3;
$ret['WRB_CRONJOB_JOBDUE_PAYMENTS'] = $wrenchboard->wrenchboard_api($in, $out);
$in['call_action'] = WRB_CRONJOB_PASTDUE_ALERT;
$in['one_limit'] = 3;
$ret['WRB_CRONJOB_PASTDUE_ALERT'] = $wrenchboard->wrenchboard_api($in, $out);
$in['call_action'] = WRB_CRONJOB_OFFER_REFUND_ALERT;
$in['one_limit'] = 1;
$ret['WRB_CRONJOB_OFFER_REFUND_ALERT'] = $wrenchboard->wrenchboard_api($in, $out);
// $out['internal_return'] = $ret; // $out['internal_return'] = $ret;
$out = $ret; $out = $ret;
@@ -49,4 +28,51 @@ class WrenchCrons extends BaseController
return $this->response->setJson($out); return $this->response->setJson($out);
} }
//$routes->get('/en/wrench/api/v1/cron', 'WrenchCrons::apigate');
//$routes->get('/en/wrench/api/v1/cron_jobalerts', 'WrenchCrons::jobalerts');
//$routes->get('/en/wrench/api/v1/cron_notifications', 'WrenchCrons::notifications');
public function cron_notifications()
{
$in["action"] = WRB_JOB_CRONJOB;
$wrenchboard = new \App\Models\BackendModel();
$out=[];
log_message('critical', "WrenchCrons ===> 0001");
//$response = []; //json_decode($complete, true);
return $this->response->setJson($out);
}
public function jobalerts(){
$in["action"] =WRB_JOB_CRONJOB;
$wrenchboard = new \App\Models\BackendModel();
$in['call_action'] = WRB_CRONJOB_JOBDUE_REMINDER;
$in['one_limit'] = 3;
$ret['WRB_CRONJOB_JOBDUE_REMINDER'] = $wrenchboard->wrenchboard_api($in, $out);
$in['call_action'] = WRB_CRONJOB_PENDOFFER_ALERT;
$in['one_limit'] = 3;
$ret['WRB_CRONJOB_PENDOFFER_ALERT'] = $wrenchboard->wrenchboard_api($in, $out);
$in['call_action'] = WRB_CRONJOB_JOBDUE_PAYMENTS;
$in['one_limit'] = 3;
$ret['WRB_CRONJOB_JOBDUE_PAYMENTS'] = $wrenchboard->wrenchboard_api($in, $out);
$in['call_action'] = WRB_CRONJOB_PASTDUE_ALERT;
$in['one_limit'] = 3;
$ret['WRB_CRONJOB_PASTDUE_ALERT'] = $wrenchboard->wrenchboard_api($in, $out);
$in['call_action'] = WRB_CRONJOB_OFFER_REFUND_ALERT;
$in['one_limit'] = 1;
$ret['WRB_CRONJOB_OFFER_REFUND_ALERT'] = $wrenchboard->wrenchboard_api($in, $out);
// $out['internal_return'] = $ret;
$out = $ret;
log_message('critical', "WrenchCrons ===> 0001");
//$response = []; //json_decode($complete, true);
return $this->response->setJson($out);
}
} }