Merge branch 'fronkdev' into 'master'
Fixed getting ciftoken in userSetCif Preorder api EP See merge request fronk/thetool!273
This commit is contained in:
@@ -72,6 +72,7 @@ class Cif extends Modules\ApiControllerModule {
|
||||
return \mfResponse::NotFound(["message" => "Invalid ciftoken"]);
|
||||
}
|
||||
|
||||
/*
|
||||
$network = \NetworkModel::getFirst(["adb_netzgebiet_id" => $preorder->adb_hausnummer->netzgebiet->id]);
|
||||
if(!$network) {
|
||||
return \mfResponse::NotFound(["message" => "Invalid ciftoken"]);
|
||||
@@ -79,7 +80,7 @@ class Cif extends Modules\ApiControllerModule {
|
||||
|
||||
if($network->owner_id != $this->me->address_id && $preorder->partner_id != $this->me->address_id) {
|
||||
return \mfResponse::NotFound(["message" => "Invalid ciftoken"]);
|
||||
}
|
||||
}*/
|
||||
|
||||
$return = $preorder->getCifdataApiArray();
|
||||
|
||||
@@ -92,7 +93,17 @@ class Cif extends Modules\ApiControllerModule {
|
||||
public function userSetCif() {
|
||||
//return \mfResponse::InternalServerError();
|
||||
|
||||
if(!array_key_exists("ciftoken", $this->post) || !$this->post['ciftoken']) {
|
||||
$ciftoken = false;
|
||||
|
||||
if(array_key_exists("ciftoken", $this->post) && $this->post['ciftoken']) {
|
||||
$ciftoken = $this->post['ciftoken'];
|
||||
}
|
||||
|
||||
if(array_key_exists("ciftoken", $this->get) && $this->get['ciftoken']) {
|
||||
$ciftoken = $this->get['ciftoken'];
|
||||
}
|
||||
|
||||
if(!$ciftoken) {
|
||||
return \mfResponse::BadRequest(["message" => "ciftoken missing"]);
|
||||
}
|
||||
|
||||
@@ -100,6 +111,7 @@ class Cif extends Modules\ApiControllerModule {
|
||||
if(!$preorder) {
|
||||
return \mfResponse::NotFound(["message" => "Invalid ciftoken"]);
|
||||
}
|
||||
/*
|
||||
if(!$preorder->adb_hausnummer->netzgebiet_id) {
|
||||
return \mfResponse::NotFound(["message" => "Invalid ciftoken"]);
|
||||
}
|
||||
@@ -109,7 +121,7 @@ class Cif extends Modules\ApiControllerModule {
|
||||
}
|
||||
if($network->owner_id != $this->me->address_id && $preorder->partner_id != $this->me->address_id) {
|
||||
return \mfResponse::NotFound(["message" => "Invalid ciftoken"]);
|
||||
}
|
||||
}*/
|
||||
|
||||
// set status to 200
|
||||
if($preorder->status->code < 200) {
|
||||
|
||||
@@ -216,7 +216,7 @@ class mfBaseApicontroller {
|
||||
|
||||
private function getRequestBody() {
|
||||
$request_charset = "utf-8";
|
||||
if(preg_match('#application/json#i', $_SERVER["CONTENT_TYPE"])) {
|
||||
if(array_key_exists("CONTENT_TYPE", $_SERVER) && preg_match('#application/json#i', $_SERVER["CONTENT_TYPE"])) {
|
||||
// request body is JSON
|
||||
$request_body = file_get_contents('php://input');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user