Snopp/Citycom Service Order Api
This commit is contained in:
@@ -56,6 +56,12 @@ class SnoppCitycom extends Modules\ApiControllerModule
|
||||
return \mfResponse::NotFound(["message" => "Home not found"]);
|
||||
}
|
||||
|
||||
// Home must have Status 300, else return deferred
|
||||
if($wohneinheit->status->code < 300) {
|
||||
return \mfResponse::Ok(["message" => "ONT not yet installed. Deferred", "activation_status" => "deferred"]);
|
||||
}
|
||||
|
||||
|
||||
$cc_home_id = \Citycom_OanApiHelper::hausnummerExtrefToCitycomId($wohneinheit->extref);
|
||||
$data["up"] = $bb_up;
|
||||
$data["down"] = $bb_down;
|
||||
@@ -63,6 +69,14 @@ class SnoppCitycom extends Modules\ApiControllerModule
|
||||
$data["execution_date"] = ($execution_date) ? $execution_date->format("Y-m-d") : false;
|
||||
$data["services"] = CITYCOM_OAN_API_SERVICES_FOR_ORDER;
|
||||
|
||||
// check if mgmt ctag is set
|
||||
// so we use the same ctag set for the real services
|
||||
$mgmt_ctag = \PreorderCtag::getFirstActive(["preorder_id" => $preorder->id, "service_type" => "mgmt"]);
|
||||
if($mgmt_ctag) {
|
||||
$data["ctag_range_search"] = $mgmt_ctag->ctag;
|
||||
}
|
||||
|
||||
|
||||
if($preorder->campaign->name == "Citycom - Graz") {
|
||||
$data["product_name"] = "Estmk Greenstream OAN $bb_down/$bb_up";
|
||||
}
|
||||
@@ -71,13 +85,18 @@ class SnoppCitycom extends Modules\ApiControllerModule
|
||||
$cc_api_client = new \Citycom_OanApiClient(CITYCOM_OAN_API_USER, CITYCOM_OAN_API_PASS);
|
||||
$cc_api = new \Citycom_OanApiHelper($cc_api_client);
|
||||
|
||||
// order Service at Citycom and set Preorder to 500 Finished
|
||||
$services = $cc_api->orderServices($preorder, $cc_home_id, $data);
|
||||
if(!$services) {
|
||||
return \mfResponse::InternalServerError(["message" => "Error activating service"]);
|
||||
}
|
||||
|
||||
$preorder->setNewStatusCode(500);
|
||||
$preorder->save();
|
||||
|
||||
return \mfResponse::Ok(["message" => "Services ordered successfully", "activation_status" => "active"]);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user