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