Add enums for the values the API uses - #1
Merged
Merged
Conversation
Values come from the sandbox's own enum module and the contract notes, so they match what the API actually sends rather than what the docs imply. Currency records that checkout takes AZN, USD, EUR and RUB while split, pre-auth, refund, reverse, payout and wallet take AZN only. Raw strings still work everywhere, so nothing that already compiles breaks.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The SDK used bare strings everywhere:
"success","error","az","AZN". This adds proper enums and wires them into the client defaults and the status comparisons.Values come from the sandbox's own
models/enums.pyand the contract notes, so they match what the API actually sends rather than what the docs imply:Status,CardStatus,InvoiceStatus,B2BStatus,OperationCodeLanguage(az, en, ru) andCurrency(AZN, USD, EUR, RUB)Currencyalso records the split that is easy to miss: checkout takes all four, while split, pre-auth, refund, reverse, payout and wallet take AZN only.Raw strings are still accepted everywhere, so this is additive.
Verified against the sandbox container, not just unit tests. Two of the new tests assert that the statuses the sandbox actually returns are members of the enum, so the enum cannot drift away from the API unnoticed.