citycom oan cleanup
This commit is contained in:
@@ -76,6 +76,13 @@ class SnoppCitycom extends Modules\ApiControllerModule
|
|||||||
return \mfResponse::Ok(["status" => $status]);
|
return \mfResponse::Ok(["status" => $status]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $req_id
|
||||||
|
* @return array
|
||||||
|
*
|
||||||
|
* Takes Order from SNOPP and updates CC service with correct product and
|
||||||
|
* if service is finished, updates billing_date of cc service and preorder status to 500
|
||||||
|
*/
|
||||||
public function orderService($req_id) {
|
public function orderService($req_id) {
|
||||||
if(!$req_id) {
|
if(!$req_id) {
|
||||||
return \mfResponse::BadRequest(["message" => "id missing"]);
|
return \mfResponse::BadRequest(["message" => "id missing"]);
|
||||||
@@ -125,19 +132,6 @@ class SnoppCitycom extends Modules\ApiControllerModule
|
|||||||
return \mfResponse::NotFound(["message" => "Home not found"]);
|
return \mfResponse::NotFound(["message" => "Home not found"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
if($ctag->ext_id && $ctag->ext_status == "finished") {
|
|
||||||
if($preorder->status->code < 500) {
|
|
||||||
$preorder->setNewStatusCode(500);
|
|
||||||
$preorder->save();
|
|
||||||
|
|
||||||
}
|
|
||||||
// update billing_date if nessecary
|
|
||||||
$this->log->debug(__METHOD__.": Updating billing_date for {$ctag->ext_name} (Preorder {$preorder->id} {$preorder->oaid})");
|
|
||||||
$cc_api->updateService($ctag->ext_id, ["billing_date" => (new \DateTime("now"))->format("Y-m-d")]);
|
|
||||||
return \mfResponse::Ok(["message" => "Service active already", "activation_status" => "active"]);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
$data["up"] = $bb_up;
|
$data["up"] = $bb_up;
|
||||||
$data["down"] = $bb_down;
|
$data["down"] = $bb_down;
|
||||||
@@ -156,7 +150,6 @@ class SnoppCitycom extends Modules\ApiControllerModule
|
|||||||
// updateService() only updates if values are changed.
|
// updateService() only updates if values are changed.
|
||||||
if(!$cc_api->updateService($ctag->ext_id, $data)) {
|
if(!$cc_api->updateService($ctag->ext_id, $data)) {
|
||||||
$this->log->error(__METHOD__.": Error updating service {$ctag->ext_id} for preorder {$preorder->id}");
|
$this->log->error(__METHOD__.": Error updating service {$ctag->ext_id} for preorder {$preorder->id}");
|
||||||
//return \mfResponse::InternalServerError(["message" => "Error activating service"]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// check if service is active, if not return deferred
|
// check if service is active, if not return deferred
|
||||||
|
|||||||
@@ -95,10 +95,6 @@ class Citycom_OanApiHelper {
|
|||||||
$phone = $data["phone"];
|
$phone = $data["phone"];
|
||||||
$mobile = $data["mobile"];
|
$mobile = $data["mobile"];
|
||||||
|
|
||||||
if(!$execution_date) {
|
|
||||||
$execution_date = date("Y-m-d");
|
|
||||||
}
|
|
||||||
|
|
||||||
$ctag_range_search = false;
|
$ctag_range_search = false;
|
||||||
|
|
||||||
if(array_key_exists("ctag_range_search", $data) && $data["ctag_range_search"]) {
|
if(array_key_exists("ctag_range_search", $data) && $data["ctag_range_search"]) {
|
||||||
@@ -192,7 +188,6 @@ class Citycom_OanApiHelper {
|
|||||||
"sublocation" => $sublocation_id,
|
"sublocation" => $sublocation_id,
|
||||||
"service_type" => $stype->id,
|
"service_type" => $stype->id,
|
||||||
"product" => $product_id,
|
"product" => $product_id,
|
||||||
"billing_date" => $execution_date,
|
|
||||||
"ctag" => $ctag,
|
"ctag" => $ctag,
|
||||||
"company" => $company,
|
"company" => $company,
|
||||||
"firstname" => $firstname,
|
"firstname" => $firstname,
|
||||||
@@ -200,10 +195,11 @@ class Citycom_OanApiHelper {
|
|||||||
"phone" => $phone,
|
"phone" => $phone,
|
||||||
"mobile" => $mobile,
|
"mobile" => $mobile,
|
||||||
];
|
];
|
||||||
|
if($execution_date) {
|
||||||
|
$service_data["billing_date"] = $execution_date;
|
||||||
|
}
|
||||||
|
|
||||||
//echo "Creating Service ".$stype->name." on sublocation $sublocation_id with product_id $product_id and ctag $ctag\n";
|
|
||||||
$this->log->info(__METHOD__.": Creating Service ".$stype->name." on sublocation $sublocation_id with product_id $product_id and ctag $ctag");
|
$this->log->info(__METHOD__.": Creating Service ".$stype->name." on sublocation $sublocation_id with product_id $product_id and ctag $ctag");
|
||||||
//continue;
|
|
||||||
|
|
||||||
// register new Service with Citycom
|
// register new Service with Citycom
|
||||||
$new_service = $this->api->createService($service_data);
|
$new_service = $this->api->createService($service_data);
|
||||||
@@ -214,28 +210,6 @@ class Citycom_OanApiHelper {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*$service_return[] = [
|
|
||||||
"service_number" => $new_service->service_number,
|
|
||||||
"sublocation_id" => $sublocation_id,
|
|
||||||
"service_type" => $ctag_service_type,
|
|
||||||
"ctag" => $ctag,
|
|
||||||
"ont" => [
|
|
||||||
"serial" => $new_service->ont->serial,
|
|
||||||
"fsan" => $new_service->ont->fsan,
|
|
||||||
],
|
|
||||||
];*/
|
|
||||||
|
|
||||||
/*$service_return[] = [
|
|
||||||
"sublocation_id" => $sublocation_id,
|
|
||||||
"service_number" => "30-fggreger-01",
|
|
||||||
"service_type" => $ctag_service_type,
|
|
||||||
"ctag" => $ctag,
|
|
||||||
"ont" => [
|
|
||||||
"serial" => "ONT123456",
|
|
||||||
"fsan" => "FSAN7890",
|
|
||||||
],
|
|
||||||
];*/
|
|
||||||
|
|
||||||
// save ctag
|
// save ctag
|
||||||
$ctag_data = $preorder_ctag_data;
|
$ctag_data = $preorder_ctag_data;
|
||||||
$ctag_data["ctag"] = $ctag;
|
$ctag_data["ctag"] = $ctag;
|
||||||
|
|||||||
@@ -67,9 +67,6 @@ foreach(PreordercampaignModel::search(["fulfillment" => "citycom_oan"]) as $camp
|
|||||||
$data["ctag_range_search"] = $existing_ctag->ctag;
|
$data["ctag_range_search"] = $existing_ctag->ctag;
|
||||||
}
|
}
|
||||||
|
|
||||||
//echo "{$preorder->id}\n";
|
|
||||||
//var_dump($data);exit;
|
|
||||||
|
|
||||||
$log->info(__FILE__.": Ordering Citycom services for preorder ".$preorder->id);
|
$log->info(__FILE__.": Ordering Citycom services for preorder ".$preorder->id);
|
||||||
if(!$cc_helper->orderServices($preorder, $sublocation_id, $data)) {
|
if(!$cc_helper->orderServices($preorder, $sublocation_id, $data)) {
|
||||||
$log->error(__FILE__.": Error ordering Citycom services for preorder ".$preorder->id);
|
$log->error(__FILE__.": Error ordering Citycom services for preorder ".$preorder->id);
|
||||||
|
|||||||
Reference in New Issue
Block a user