Skip to content

Add enums for the values the API uses - #1

Merged
martian56 merged 1 commit into
mainfrom
feat/enums
Jul 22, 2026
Merged

Add enums for the values the API uses#1
martian56 merged 1 commit into
mainfrom
feat/enums

Conversation

@martian56

Copy link
Copy Markdown
Owner

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.py and the contract notes, so they match what the API actually sends rather than what the docs imply:

  • Status, CardStatus, InvoiceStatus, B2BStatus, OperationCode
  • Language (az, en, ru) and Currency (AZN, USD, EUR, RUB)

Currency also 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.

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.
@martian56
martian56 merged commit 9c367f2 into main Jul 22, 2026
6 checks passed
@martian56
martian56 deleted the feat/enums branch July 22, 2026 08:34
@martian56 martian56 self-assigned this Jul 22, 2026
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

Successfully merging this pull request may close these issues.

1 participant