MadaMzandu / uisp-ros-plugin

This is a follow up replacement for the previous Uisp api for mikrotik routers.
32 stars 9 forks source link

Client Service is deleted after unsuspension of service #12

Closed jimmanni closed 2 years ago

jimmanni commented 2 years ago

UISP version 1.4.2 For a client, with a switch assigned to the client site, created by the service assigned in UCRM, after the service is succesfully suspended( Mt is getting the profile change to the disabled one, as assigned in the API settings page), when trying to unsuspend the service of the client in the CRM (MT is getting the right profile as soon as the continue button is clicked) and after the successful unsuspension, some few seconds later, the service of the client in CRM is being deleted, as well as the secret in the MT.

MadaMzandu commented 2 years ago

Hi Is it possible to copy and paste the webhook request log for this failed action from CRM > Settings > Webhook > Request Logs.

thanks

jimmanni commented 2 years ago

image

It seems that after every unsupsension action there is a series of actions taking place (Unsuspend(requested)->Edit->Suspend->Edit->End->Archive). { "uuid": "24557eb6-f9f8-49ac-80ca-74e8f5bc4ab0", "changeType": "unsuspend", "entity": "service", "entityId": 13, "eventName": "service.suspend_cancel", "extraData": { "entity": { "id": 13, "prepaid": false, "clientId": 1, "status": 1, "name": "5U30D", "fullAddress": null, "street1": null, "street2": null, "city": null, "countryId": null, "stateId": null, "zipCode": null, "note": null, "addressGpsLat": null, "addressGpsLon": null, "servicePlanId": 2, "servicePlanPeriodId": 7, "price": 10, "hasIndividualPrice": false, "totalPrice": 10, "currencyCode": "EUR", "invoiceLabel": null, "contractId": null, "contractLengthType": 1, "minimumContractLengthMonths": null, "activeFrom": "2022-02-08T00:00:00+0200", "activeTo": null, "contractEndDate": null, "discountType": 0, "discountValue": null, "discountInvoiceLabel": "Discount", "discountFrom": null, "discountTo": null, "tax1Id": null, "tax2Id": null, "tax3Id": null, "invoicingStart": "2022-02-08T00:00:00+0200", "invoicingPeriodType": 1, "invoicingPeriodStartDay": 8, "nextInvoicingDayAdjustment": 0, "invoicingProratedSeparately": true, "invoicingSeparately": false, "sendEmailsAutomatically": null, "useCreditAutomatically": true, "servicePlanName": "5U30D", "servicePlanPrice": 10, "servicePlanPeriod": 1, "servicePlanType": "Internet", "downloadSpeed": 30, "uploadSpeed": 5, "hasOutage": false, "fccBlockId": null, "lastInvoicedDate": null, "unmsClientSiteId": "143d75d2-962d-406a-bb7c-268bf279377b", "attributes": [ { "id": "5bcc57a0-b5fd-4ac8-8784-646f1db1e410", "serviceId": 13, "customAttributeId": 20, "name": "service-pppoe-username", "key": "servicePppoeUsername", "value": "drodios", "clientZoneVisible": false }, { "id": "bcec7bb7-1e88-4202-acb3-aa7585be2b63", "serviceId": 13, "customAttributeId": 21, "name": "service-pppoe-password", "key": "servicePppoePassword", "value": "12345", "clientZoneVisible": false }, { "id": "88e31c71-8647-419e-9c74-516658a44e9a", "serviceId": 13, "customAttributeId": 22, "name": "service-router", "key": "serviceRouter", "value": "chr test", "clientZoneVisible": false } ], "addressData": null, "suspensionReasonId": null, "serviceChangeRequestId": null, "setupFeePrice": null, "earlyTerminationFeePrice": null, "downloadSpeedOverride": null, "uploadSpeedOverride": null, "trafficShapingOverrideEnd": null, "trafficShapingOverrideEnabled": false, "servicePlanGroupId": null }, "entityBeforeEdit": { "id": 13, "prepaid": false, "clientId": 1, "status": 3, "name": "5U30D", "fullAddress": null, "street1": null, "street2": null, "city": null, "countryId": null, "stateId": null, "zipCode": null, "note": null, "addressGpsLat": null, "addressGpsLon": null, "servicePlanId": 2, "servicePlanPeriodId": 7, "price": 10, "hasIndividualPrice": false, "totalPrice": 10, "currencyCode": "EUR", "invoiceLabel": null, "contractId": null, "contractLengthType": 1, "minimumContractLengthMonths": null, "activeFrom": "2022-02-08T00:00:00+0200", "activeTo": null, "contractEndDate": null, "discountType": 0, "discountValue": null, "discountInvoiceLabel": "Discount", "discountFrom": null, "discountTo": null, "tax1Id": null, "tax2Id": null, "tax3Id": null, "invoicingStart": "2022-02-08T00:00:00+0200", "invoicingPeriodType": 1, "invoicingPeriodStartDay": 8, "nextInvoicingDayAdjustment": 0, "invoicingProratedSeparately": true, "invoicingSeparately": false, "sendEmailsAutomatically": null, "useCreditAutomatically": true, "servicePlanName": "5U30D", "servicePlanPrice": 10, "servicePlanPeriod": 1, "servicePlanType": "Internet", "downloadSpeed": 30, "uploadSpeed": 5, "hasOutage": false, "fccBlockId": null, "lastInvoicedDate": null, "unmsClientSiteId": "143d75d2-962d-406a-bb7c-268bf279377b", "attributes": [ { "id": "5bcc57a0-b5fd-4ac8-8784-646f1db1e410", "serviceId": 13, "customAttributeId": 20, "name": "service-pppoe-username", "key": "servicePppoeUsername", "value": "drodios", "clientZoneVisible": false }, { "id": "bcec7bb7-1e88-4202-acb3-aa7585be2b63", "serviceId": 13, "customAttributeId": 21, "name": "service-pppoe-password", "key": "servicePppoePassword", "value": "12345", "clientZoneVisible": false }, { "id": "88e31c71-8647-419e-9c74-516658a44e9a", "serviceId": 13, "customAttributeId": 22, "name": "service-router", "key": "serviceRouter", "value": "chr test", "clientZoneVisible": false } ], "addressData": null, "suspensionReasonId": 1000, "serviceChangeRequestId": null, "setupFeePrice": null, "earlyTerminationFeePrice": null, "downloadSpeedOverride": null, "uploadSpeedOverride": null, "trafficShapingOverrideEnd": null, "trafficShapingOverrideEnabled": false, "servicePlanGroupId": null } } } Response body
Notice: Undefined property: stdClass::$disabled_routers in /data/ucrm/data/plugins/ros-plugin/lib/mt_profile.php on line 73

Notice: Undefined property: stdClass::$disabled_routers in /data/ucrm/data/plugins/ros-plugin/lib/mt_profile.php on line 73

Warning: Cannot modify header information - headers already sent by (output started at /data/ucrm/data/plugins/ros-plugin/lib/mt_profile.php:73) in /data/ucrm/data/plugins/ros-plugin/lib/api_router.php on line 97
{"status":"ok","message":"service for Dimitris Rodios was unsuspended","data":[]}

MadaMzandu commented 2 years ago

Thanks for the log will look at it an update you.

Do you have the unsuspend date fix enabled? That could be the problem because I think ubiquiti fixed this and is not required anymore.

jimmanni commented 2 years ago

No, thank YOU for this great plugin! Yes indeed it was enabled. Will try again later and come back with the results

MadaMzandu commented 2 years ago

I am glad you find the plugin useful. Please look out for the next release as it contains some important bug fixes. Should be ready sometime next week.

jimmanni commented 2 years ago

Disabling the unsuspended date fix settings in the API settings page, fixed the issue. Now the service stays active and not getting archived after unsuspension! Will do! Thank you for the immediate support!