Flutter hook

This commit is contained in:
CHIEFSOFT\ameye
2023-07-28 08:13:29 -04:00
parent 697b971472
commit 683096e59a
4 changed files with 85 additions and 2 deletions
@@ -202,6 +202,8 @@ enum { PARTNER_STRIPE };
#define WRENCHBOARD_ACCOUNT_PENDJOB 11043
#define WRECNH_CREDIT_HOOKS_FULUTTER 11045
#define WRENCHBOARD_USER_GETBANKLIST 11050
#define WRENCHBOARD_USER_SENDMONEY 11051
#define WRENCHBOARD_USER_SENDJOBINT 11052
+34 -1
View File
@@ -124,6 +124,7 @@ long WrenchBoardDeleteAccount(CVars in, CVars &out);
long VerifyWrenchAccountLink(CVars in, CVars &out);
long LoginWrenchBoardAuxAccount(CVars in, CVars &out);
long WrenchDeleteUsersCCard(CVars in, CVars &out);
long WrenchFlutterCreditHook(CVars in, CVars &out);
long test() {
FILE* oldFile = Output2FILE::Stream();
@@ -356,7 +357,10 @@ long account_calls(CVars in, CVars &out) {
case WRENCHBOARD_USER_SENDJOBINT:
return WrenchBoardMobileSendJobInterest(in, out);
break;
break;
case WRECNH_CREDIT_HOOKS_FULUTTER:
return WrenchFlutterCreditHook(in, out);
break;
case WRENCHBOARD_USER_STARTCREDIT:
return WrenchStartPayment(in, out);
break;
@@ -466,6 +470,35 @@ long account_calls(CVars in, CVars &out) {
#define PHP_API_TRANSFER_COMPLETE 200
long WrenchFlutterCreditHook(CVars in, CVars &out) {
long ret = PHP_API_BAD_PARAM;
logfmt(logINFO, "WrenchFlutterCreditHook()");
try {
REQ_STRING(in, "txRef", 2, 50, "(.*)");
REQ_STRING(in, "flwRef", 2, 50, "(.*)");
CVars xx;
xx["event_type"] = in["event_type"]; xx["event_type"].set_valid(true);
xx["status"] = in["status"]; xx["status"].set_valid(true);
xx["txRef"] = in["txRef"]; xx["txRef"].set_valid(true);
xx["flwRef"] = in["flwRef"]; xx["flwRef"].set_valid(true);
xx["orderRef"] = in["orderRef"]; xx["orderRef"].set_valid(true);
xx["amount"] = in["amount"]; xx["amount"].set_valid(true);
xx["appfee"] = in["appfee"]; xx["appfee"].set_valid(true);
xx["AccountId"] = in["AccountId"]; xx["AccountId"].set_valid(true);
xx["customer_id"] = in["customer_id"]; xx["customer_id"].set_valid(true);
xx["fullName"] = in["fullName"]; xx["fullName"].set_valid(true);
xx["raw_result"] = in["raw_result"]; xx["raw_result"].set_valid(true);
out["hook_id"] = insert_db_record(DBS_VALID, "flutterwave_hooks", "flutterwave_hooks_id_seq", xx);
} catch (bad_parameter) {
out["log_status"] = "Something went wrong";
}
logfmt(logINFO, "WrenchFlutterCreditHook()");
return ret;
}
long WrenchDeleteUsersCCard(CVars in, CVars &out) {
logfmt(logINFO, "VerifyWrenchAccountLink()");
+2 -1
View File
@@ -213,8 +213,9 @@ define('WRENCHBOARD_LOG_MEMBER', 11040);
define('WRENCHBOARD_DELETE_RECACC', 11041);
define('WRENCHBOARD_SAVE_GALLERY', 11042);
define('WRENCHBOARD_ACCOUNT_PENDJOB', 11043 );
define('WRENCHBOARD_ACCOUNT_PENDJOB', 11043);
const WRECNH_CREDIT_HOOKS_FULUTTER = 11045;
define('WRENCHBOARD_USER_GETBANKLIST', 11050);
define('WRENCHBOARD_USER_SENDMONEY', 11051);
+47
View File
@@ -45,11 +45,58 @@ class WrenchHooks extends BaseController
log_message('critical', "WrenchHooks-CALL ********** RETURN *************** DATA".$in["customer"]["id"] );
log_message('critical', "WrenchHooks-CALL ********** RETURN *************** DATA".$in["customer"]["AccountId"] );
log_message('critical', "WrenchHooks-CALL ********** RETURN *************** DATA".$in["customer"]["fullName"] );
$data = [
"event_type" => $in["event.type"],
"status" => $in["status"],
"txRef" => $in["txRef"],
"flwRef" => $in["orderRef"],
"orderRef" => $in["orderRef"] ,
"amount" => $in["amount"]*100 ,
"appfee" => $in["appfee"]*100,
"customer_id" => $in["customer"]["id"],
"AccountId" => $in["customer"]["AccountId"],
"fullName" => $in["customer"]["fullName"],
"action" => WRECNH_CREDIT_HOOKS_FULUTTER,
"raw_result" => serialize($in),
];
if ( $data["action"] !='' ){
$wrenchboard = new \App\Models\BackendModel();
$ret = $wrenchboard->wrenchboard_api($data, $out);
$out['internal_return'] = $ret;
}
}
}
/*
CREATE TABLE flutterwave_hooks (
id SERIAL,
uid uuid DEFAULT uuid_generate_v4(),
event_type VARCHAR(25),
status VARCHAR(25),
txRef VARCHAR(50),
flwRef VARCHAR(50),
orderRef VARCHAR(50),
amount INT DEFAULT 0,
appfee INT DEFAULT 0,
customer_id VARCHAR(25),
AccountId VARCHAR(25),
fullName VARCHAR(50),
raw_result TEXT,
process_status INT DEFAULT 1,
added timestamp without time zone DEFAULT now(),
updated timestamp without time zone DEFAULT now()
);
ALTER TABLE ONLY flutterwave_hooks
ADD CONSTRAINT flutterwave_hooks_id_key UNIQUE (id);
*{
s:2:"id";i:4490321;
s:5:"txRef";s:13:"1690507667625";