Citycom: updateing CC service with billing_date when finishing orders
This commit is contained in:
@@ -81,6 +81,9 @@ class SnoppCitycom extends Modules\ApiControllerModule
|
|||||||
return \mfResponse::BadRequest(["message" => "id missing"]);
|
return \mfResponse::BadRequest(["message" => "id missing"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$cc_api_client = new \Citycom_OanApiClient(CITYCOM_OAN_API_USER, CITYCOM_OAN_API_PASS);
|
||||||
|
$cc_api = new \Citycom_OanApiHelper($cc_api_client);
|
||||||
|
|
||||||
$bb_up = $this->post["bb_up"];
|
$bb_up = $this->post["bb_up"];
|
||||||
$bb_down = $this->post["bb_down"];
|
$bb_down = $this->post["bb_down"];
|
||||||
$execution_date = false;
|
$execution_date = false;
|
||||||
@@ -126,6 +129,8 @@ 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")]);
|
||||||
}
|
}
|
||||||
return \mfResponse::Ok(["message" => "Service active already", "activation_status" => "active"]);
|
return \mfResponse::Ok(["message" => "Service active already", "activation_status" => "active"]);
|
||||||
}
|
}
|
||||||
@@ -180,8 +185,7 @@ class SnoppCitycom extends Modules\ApiControllerModule
|
|||||||
$data["product_name"] = "Estmk Greenstream OAN $bb_down/$bb_up";
|
$data["product_name"] = "Estmk Greenstream OAN $bb_down/$bb_up";
|
||||||
}
|
}
|
||||||
|
|
||||||
$cc_api_client = new \Citycom_OanApiClient(CITYCOM_OAN_API_USER, CITYCOM_OAN_API_PASS);
|
|
||||||
$cc_api = new \Citycom_OanApiHelper($cc_api_client);
|
|
||||||
|
|
||||||
// try to update product with bandwidth provided by snopp.
|
// try to update product with bandwidth provided by snopp.
|
||||||
// updateService() only updates if values are changed.
|
// updateService() only updates if values are changed.
|
||||||
@@ -196,6 +200,9 @@ 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")]);
|
||||||
}
|
}
|
||||||
return \mfResponse::Ok(["message" => "Service active already", "activation_status" => "active"]);
|
return \mfResponse::Ok(["message" => "Service active already", "activation_status" => "active"]);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user