Jump to content

Upgrading/Downgrading a service via API


codym

Recommended Posts

On 6/11/2020 at 7:36 PM, Jono said:

try ServiceChanges::getItems().  I know it's deprecated but I believe it will get the results you want in a way that can be sent to node.

I see why ServiceChanges::getItems() endpoint was deprecated... it sucks. I can't really use it at all to calculate the prorated charges for a service change and create an invoice unless I write a bunch of regex to match descriptions for each possible configurable option. I'm not sure why this endpoint doesn't return actual line items with corresponding config options, must have been in use to have service changes in a pretty format for Blesta invoices huh?

Link to comment
Share on other sites

The other option here is to make a custom edit to your Blesta installation.  Something like ServiceChanges::getLineItems() that makes the line items, similar to the controller method AdminClients::makeLineItems()?

This seems to be a total pain so I'm thinking about how we can make this work better for API user in the future.

Link to comment
Share on other sites

I don't see a custom edit to the Blesta installation happening. Too much of a headache... especially when we upgrade in the future.

18 hours ago, Jono said:

This seems to be a total pain so I'm thinking about how we can make this work better for API user in the future.

You're totally right. The easiest way on dev side would be to fix the encoding on ServiceChanges::getPresenter(), since that should return everything needed so that I can manually create an invoice for a service upgrade/downgrade.
The easiest thing for the customer (me) would be for Services::edit() to automatically create a prorated invoice for the change. However, you said previously that is a purposeful design consideration. Possibly for admin functions? I'm not sure.
If that's the case, then having an endpoint we can hit that returns the prorated differences according to line item  (in JSON encoding) would be the most helpful. In that case, I could easily create a manual invoice from that using the Invoices::add() endpoint.

However, (as I haven't gotten this far in testing yet) I'm not sure if the subsequent recurring invoice (1 month after the edit) would include the service update (assuming the Services::edit() function is used to change the service). Again, that would all require testing and I'm not quite as experienced with this system as you.

Link to comment
Share on other sites

  • 1 month later...
On 6/15/2020 at 10:26 AM, Jono said:

The other option here is to make a custom edit to your Blesta installation.  Something like ServiceChanges::getLineItems() that makes the line items, similar to the controller method AdminClients::makeLineItems()?

This seems to be a total pain so I'm thinking about how we can make this work better for API user in the future.

Have there been any changes to this in the latest version of Blesta?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...