citycom oan: Fixed setting billing_date on CC service create and update
This commit is contained in:
@@ -129,9 +129,11 @@ class SnoppCitycom extends Modules\ApiControllerModule
|
|||||||
if($preorder->status->code < 500) {
|
if($preorder->status->code < 500) {
|
||||||
$preorder->setNewStatusCode(500);
|
$preorder->setNewStatusCode(500);
|
||||||
$preorder->save();
|
$preorder->save();
|
||||||
// update billing_date if nessecary
|
|
||||||
$cc_api->updateService($ctag->ext_id, ["billing_date" => (new \DateTime("now"))->format("Y-m-d")]);
|
|
||||||
}
|
}
|
||||||
|
// 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"]);
|
return \mfResponse::Ok(["message" => "Service active already", "activation_status" => "active"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -200,10 +202,10 @@ class SnoppCitycom extends Modules\ApiControllerModule
|
|||||||
if($preorder->status->code < 500) {
|
if($preorder->status->code < 500) {
|
||||||
$preorder->setNewStatusCode(500);
|
$preorder->setNewStatusCode(500);
|
||||||
$preorder->save();
|
$preorder->save();
|
||||||
|
|
||||||
// update billing date in citycom service
|
|
||||||
$cc_api->updateService($ctag->ext_id, ["billing_date" => (new \DateTime("now"))->format("Y-m-d")]);
|
|
||||||
}
|
}
|
||||||
|
// update billing date in citycom service
|
||||||
|
$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"]);
|
return \mfResponse::Ok(["message" => "Service active already", "activation_status" => "active"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -299,6 +299,8 @@ class Citycom_OanApiHelper {
|
|||||||
|
|
||||||
$service_data = [];
|
$service_data = [];
|
||||||
|
|
||||||
|
//var_dump($service);exit;
|
||||||
|
|
||||||
// update service if nesseccary
|
// update service if nesseccary
|
||||||
if(array_key_exists("product_name", $data) && $data["product_name"] && $service->product->name != $data["product_name"]) {
|
if(array_key_exists("product_name", $data) && $data["product_name"] && $service->product->name != $data["product_name"]) {
|
||||||
$product_data["up"] = $data["up"];
|
$product_data["up"] = $data["up"];
|
||||||
@@ -314,7 +316,7 @@ class Citycom_OanApiHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// update contact data
|
// update contact data
|
||||||
foreach(["company", "firstname", "lastname", "phone"] as $field) {
|
foreach(["company", "firstname", "lastname", "phone", "billing_date"] as $field) {
|
||||||
if(array_key_exists($field, $data) && $data[$field] && $service->$field != $data[$field]) {
|
if(array_key_exists($field, $data) && $data[$field] && $service->$field != $data[$field]) {
|
||||||
$service_data[$field] = $data[$field];
|
$service_data[$field] = $data[$field];
|
||||||
}
|
}
|
||||||
@@ -322,8 +324,9 @@ class Citycom_OanApiHelper {
|
|||||||
|
|
||||||
if(!count($service_data)) return true;
|
if(!count($service_data)) return true;
|
||||||
$result = $this->api->updateService($service->id, $service_data);
|
$result = $this->api->updateService($service->id, $service_data);
|
||||||
|
|
||||||
if($result) return true;
|
if($result) return true;
|
||||||
|
|
||||||
|
$this->log->warning(__METHOD__.": Update service ".$service->id." failed. Last error: {$this->api->lastError}");
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ foreach(PreordercampaignModel::search(["fulfillment" => "citycom_oan"]) as $camp
|
|||||||
"down" => 100,
|
"down" => 100,
|
||||||
"up" => 100,
|
"up" => 100,
|
||||||
"product_name" => "Estmk Greenstream OAN Default",
|
"product_name" => "Estmk Greenstream OAN Default",
|
||||||
"execution_date" => false,
|
"execution_date" => (new DateTime("+1 month"))->format("Y-m-d"),
|
||||||
"company" => $preorder->company,
|
"company" => $preorder->company,
|
||||||
"firstname" => $preorder->firstname,
|
"firstname" => $preorder->firstname,
|
||||||
"lastname" => $preorder->lastname,
|
"lastname" => $preorder->lastname,
|
||||||
|
|||||||
Reference in New Issue
Block a user