Repository navigation
Conversation
Add TransactionStatus enum with the status values documented for the Webpay Plus API (INITIALIZED, AUTHORIZED, REVERSED, FAILED, NULLIFIED, PARTIALLY_NULLIFIED, CAPTURED). Members inherit from str, so they compare equal to the raw values returned by commit and status, which are left unchanged.
transbankDev
approved these changes
Oct 6, 2026
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.
Este aporte lo realiza @jowyto en nombre de la organización Capitalizarme, que usa
transbank-sdk(Webpay Plus) en producción.Closes #160
Cambios
transbank/common/transaction_status.pyconTransactionStatus(str, Enum)y los siete estados documentados para el campostatusen Confirmar una transacción y Obtener estado de una transacción:INITIALIZED,AUTHORIZED,REVERSED,FAILED,NULLIFIED,PARTIALLY_NULLIFIED,CAPTURED.IntegrationType(@unique).str(en lugar deStrEnum, que no existe en las versiones de Python anteriores a 3.11 que declarasetup.py). Por eso,TransactionStatus.AUTHORIZED == "AUTHORIZED"es verdadero, se serializa en JSON como string plano y se puede construir conTransactionStatus(response["status"]).__str__devuelve el valor, para que formatear un miembro déAUTHORIZEDy noTransactionStatus.AUTHORIZED.commit(),status(), los schemas,CHANGELOG.mdni la versión.Uso
Tests
Nuevo
tests/common/test_transaction_status.py. Cubre que los valores coinciden con la lista documentada, la igualdad constr,str()yjson.dumps, la construcción desde una respuesta de la API,ValueErrorpara un valor desconocido y que uncommitmockeado devuelve el mismo dict de antes.Antes del cambio: 75 passed. Después: