Skip to content

Update the CloudWorkspaceHandler to retrieve credit balance from billing vendor #8507

Description

@lmossman

Tell us about the problem you're trying to solve

This is a ticket within the Integrate backend with billing vendor Epic

At this point in the epic, we should be tracking credit usage within the billing vendor, and we should have validated that there are no inconsistencies between the balances in our system and the billing vendor's system.

Therefore, it is now time to make our Cloud UI retrieve credit balances from the billing vendor instead of from our cloud db, effectively deprecating our home-grown credit management logic.

Describe the solution you’d like

The CloudWorkspaceHandler's buildCloudWorkspaceRead endpoint should make an API request to the billing vendor to retrieve the remaining credit balance, rather than retrieving it from the CloudWorkspace record itself.

If the billing vendor returns multiple balances for the customer (e.g. balances that have different expiry times), these should be combined to produce the overall remaining credit balance for the CloudWorkspace.

If the billing vendor API call fails, this should be handled gracefully by the app (i.e. the CloudWorkspaceHandler should return some default blank or zero value), so that vendor downtimes do not cause errors in the webapp.

This logic should be added to the same billing vendor-specific module created in #8496

Describe the alternative you’ve considered or used

Additional context

Are you willing to submit a PR?

Metadata

Metadata

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions