diff --git a/wrenchboard/src/shared_tool/account.cc b/wrenchboard/src/shared_tool/account.cc index 7ce3ab04..cbcfe90c 100644 --- a/wrenchboard/src/shared_tool/account.cc +++ b/wrenchboard/src/shared_tool/account.cc @@ -1739,7 +1739,7 @@ long LoginWrenchBoardFacebook(CVars in, CVars &out) { long retL = load_db_record(out, "SELECT uid, * FROM members WHERE LOWER(email)=LOWER('%s') AND password IS NOT NULL", in["email"].c_str()); if (retL > 0 && out["uid"] !="") { - out["status"] = "Email me be already registered, Try Login"; + out["status"] = "Email may be already registered, Try Login"; return PHP_API_BAD_PARAM; } @@ -1765,7 +1765,7 @@ long LoginWrenchBoardGoogle(CVars in, CVars &out) { long retL = load_db_record(out, "SELECT uid, * FROM members WHERE LOWER(email)=LOWER('%s') AND password IS NOT NULL", in["email"].c_str()); if (retL > 0 && out["uid"] !="") { - out["status"] = "Email me be already registered, Try Login"; + out["status"] = "Email may be already registered, Try Login"; return PHP_API_BAD_PARAM; } @@ -1791,7 +1791,7 @@ long LoginWrenchBoardApple(CVars in, CVars &out) { long retL = load_db_record(out, "SELECT uid, * FROM members WHERE LOWER(email)=LOWER('%s') AND password IS NOT NULL", in["email"].c_str()); if (retL > 0 && out["uid"] !="") { - out["status"] = "Email me be already registered, Try Login"; + out["status"] = "Email may be already registered, Try Login"; return PHP_API_BAD_PARAM; } res = LoginWrenchBoardExternal(in, out); diff --git a/www-api/app/Config/Routes.php b/www-api/app/Config/Routes.php index 9905e5f7..5a805ab4 100644 --- a/www-api/app/Config/Routes.php +++ b/www-api/app/Config/Routes.php @@ -44,6 +44,9 @@ $routes->get('/en/wrench/api/v1/test','Home::test'); $routes->post('/en/wrench/api/v1/authlogin', 'WrenchOauth::apigate'); $routes->post('/en/wrench/api/v1/authstart', 'WrenchOauth::apigate'); +$routes->post('/en/wrench/api/v1/startcredit', 'WrenchTransactions::apigate'); +$routes->post('/en/wrench/api/v1/confirmcredit', 'WrenchTransactions::apigate'); + $routes->post('/en/wrench/api/v1/faq', 'WrenchFaq::apigate'); $routes->post('/en/wrench/api/v1/faqdata', 'WrenchFaq::apigate'); diff --git a/www-api/app/Controllers/WrenchTransactions.php b/www-api/app/Controllers/WrenchTransactions.php new file mode 100644 index 00000000..d60ee9ab --- /dev/null +++ b/www-api/app/Controllers/WrenchTransactions.php @@ -0,0 +1,85 @@ + OPTIONS DIE*****" ); + die(); + } + + //$request = service('request'); + // what is the endpoint + $uri = urldecode(current_url(true)); + $findme = '?'; + $pos = strpos($uri, $findme); + if ($pos > 5) { + $uri = substr($uri, 0, $pos); + } + log_message('critical', "API-GATE URI -> ".$uri ); + $pieces = explode('/', $uri); + $psc = count($pieces); + + $endpoint = $psc > 0 ? $pieces[$psc - 1] : ''; + log_message('critical', "Enpoint-> ".$endpoint ); + + $endpoints = $this->endPointList(); + $out = array(); + $res1 = []; + if (array_key_exists($endpoint, $endpoints)) { + } else { + http_response_code(404); + // tell the user product does not exist + return json_encode([ + 'message' => 'Endpoint not found.', + 'URI' => $uri, + ]); + } + + // echo "EXYTACT INPUT DATA HERE"; + $raw_json = file_get_contents('php://input'); + $raw_array = json_decode($raw_json, true); + + $local_out =[]; + if ($_SERVER["REQUEST_METHOD"] == "POST") { // if upload lets modify all the data + if (isset($_FILES) && is_array($_FILES) && count($_FILES)>0) { + $raw_array = array_merge($_POST,$_FILES); + } + } + + if ($_SERVER['REQUEST_METHOD'] == 'GET') { + log_message('critical', "Enpoint LOC2 HERE -> ".$endpoint ); + $get_param = $_GET['reqData'] ?? null; + $raw_array = ($get_param!=null) ? json_decode($get_param, true):[]; + } + //$in = $raw_array; + log_message('critical', "wrenchboard_api-CALL RAW DATA".serialize($raw_array) ); + //-- move to another module start + + + $in["loc"] = $_SERVER["REMOTE_ADDR"]; + + + $response = []; + + return $this->response->setJson($response); + } + + +} \ No newline at end of file