Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removing funds fails if they are not deallocated first #16

Closed
joseph-palmer opened this issue Apr 17, 2024 · 1 comment
Closed

Removing funds fails if they are not deallocated first #16

joseph-palmer opened this issue Apr 17, 2024 · 1 comment
Assignees

Comments

@joseph-palmer
Copy link
Contributor

(rctab-cli-py3.11) ➜ rctab-cli git:(main) rctab sub approve --subscription-id b6d9ddbc-5b78-4a25-8f6d-953f53e34d62 --ticket C2345-999 --amount -1200 --date-from 2024-04-02 --date-to 2024-09-30 --allocate

Failed with status code: 400. Details: {'detail': 'The amount of unallocated_budget budget (0.0) is less than the negative allocation (1200.0).'}
Aborted!
(rctab-cli-py3.11) ➜  rctab-cli git:(main) rctab sub allocate --subscription-id b6d9ddbc-5b78-4a25-8f6d-953f53e34d62 --ticket C2345-999 --amount -1200
{'status': 'success', 'detail': 'Allocated -1200.0 to -1200.0'}
(rctab-cli-py3.11) ➜  rctab-cli git:(main) rctab sub approve --subscription-id b6d9ddbc-5b78-4a25-8f6d-953f53e34d62 --ticket C2345-999 --amount -1200 --date-from 2024-04-02 --date-to 2024-09-30
{'status': 'success', 'detail': 'approval created'}
(rctab-cli-py3.11) ➜  rctab-cli git:(main)

I suspect the error with the first command combining approve and allocate for a negative amount fails because we usually approve the amount then allocate.

We should add a fix so that in the case of negative amounts, we run the allocate first THEN the approval.

Related to #12

@Iain-S Iain-S self-assigned this Apr 17, 2024
@Iain-S
Copy link
Contributor

Iain-S commented Apr 17, 2024

Yes, absolutely agree that we should reverse the order for -ve approvals. There's an issue on the API repo for this because that's where the fix will have to be done (although it shows up when using the CLI).

@Iain-S Iain-S closed this as completed Apr 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants