Citycom: Checking and updating Services after creating mgmt Service
This commit is contained in:
@@ -50,8 +50,46 @@ foreach(PreordercampaignModel::search(["fulfillment" => "citycom_oan"]) as $camp
|
||||
];
|
||||
|
||||
$log->info(__METHOD__.": Ordering mgmt service for preorder ".$preorder->id);
|
||||
if(!$cc_helper->orderServices($preorder, $sublocation_id, $data)) {
|
||||
/*if(!$cc_helper->orderServices($preorder, $sublocation_id, $data)) {
|
||||
$log->error(__METHOD__.": Error ordering mgmt service for preorder ".$preorder->id);
|
||||
continue;
|
||||
}*/
|
||||
|
||||
// TODO check for new service @ citycom -> 230
|
||||
$cc_services = $cc->getServices();
|
||||
if(!$cc_services) {
|
||||
$log->error(__METHOD__.": Error getting services from Citycom Api");
|
||||
continue;
|
||||
}
|
||||
|
||||
foreach($cc_services as $cc_service) {
|
||||
if(!property_exists($cc_service, "location") || !$cc_service->location || !$cc_service->location->id) continue;
|
||||
if(!property_exists($cc_service->location, "sublocation") || !$cc_service->location->sublocation || !$cc_service->location->sublocation->id) continue;
|
||||
|
||||
if($cc_service->location->sublocation->id != $sublocation_id) continue;
|
||||
|
||||
// service is available -> set preorder status 230
|
||||
$preorder->setNewStatusCode(230);
|
||||
$preorder->save();
|
||||
|
||||
// update ctag data
|
||||
$valid_stypes = array_merge(CITYCOM_OAN_API_SERVICES_FOR_ORDER, CITYCOM_OAN_API_SERVICES_FOR_RESERVATION);
|
||||
$stypes = array_flip($valid_stypes);
|
||||
$stag = $preorder->adb_hausnummer->vlan_stag;
|
||||
if(!$stag) continue;
|
||||
|
||||
$ctag = \PreorderCtag::getFirstActive(["preorder_id" => $preorder->id, "stag" => $stag, "service_type" => $stypes[$cc_service->service_type]]);
|
||||
if($ctag && $ctag->ext_id != $cc_service->service_number) {
|
||||
$ctag->ext_id = $cc_service->service_number;
|
||||
$ctag->save();
|
||||
}
|
||||
if($ctag && $ctag->ext_status != $cc_service->state) {
|
||||
$ctag->ext_status = $cc_service->state;
|
||||
$ctag->save();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user