-
Notifications
You must be signed in to change notification settings - Fork 9
[PAY-7260] add support for disputes endpoints #126
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
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| """Module to hold the dispute documents manager.""" | ||
|
|
||
| from fintoc.mixins import ManagerMixin | ||
|
|
||
|
|
||
| class DisputeDocumentsManager(ManagerMixin): | ||
| """Represents a dispute documents manager.""" | ||
|
|
||
| resource = "dispute_document" | ||
| methods = ["create"] |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| """Module to hold the disputes manager.""" | ||
|
|
||
| from fintoc.managers.dispute_documents_manager import DisputeDocumentsManager | ||
| from fintoc.mixins import ManagerMixin | ||
|
|
||
|
|
||
| # pylint: disable=duplicate-code | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Porque esto?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Es porque el pylint puede detectar bloques de código muy parecidos entre diferentes archivos. Es algo que usamos en todos los managers |
||
| class DisputesManager(ManagerMixin): | ||
| """Represents a disputes manager.""" | ||
|
|
||
| resource = "dispute" | ||
| methods = ["list", "get", "submit_for_review"] | ||
|
|
||
| def __init__(self, path, client): | ||
| super().__init__(path, client) | ||
| self.__documents_manager = None | ||
|
|
||
| def _submit_for_review(self, identifier, **kwargs): | ||
| """Submit a dispute for review.""" | ||
| path = f"{self._build_path(**kwargs)}/{identifier}/submit_for_review" | ||
| return self._create(path_=path, **kwargs) | ||
|
|
||
| @property | ||
| def documents(self): | ||
| """Proxies the dispute documents manager.""" | ||
| if self.__documents_manager is None: | ||
| self.__documents_manager = DisputeDocumentsManager( | ||
| "/v1/disputes/{dispute_id}/documents", | ||
| self._client, | ||
| ) | ||
| return self.__documents_manager | ||
|
|
||
| @documents.setter | ||
| def documents(self, new_value): # pylint: disable=no-self-use | ||
| raise NameError("Attribute name corresponds to a manager") | ||
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| """Module to hold the Dispute resource.""" | ||
|
|
||
| from fintoc.mixins import ResourceMixin | ||
|
|
||
|
|
||
| class Dispute(ResourceMixin): | ||
| """Represents a Fintoc Dispute.""" | ||
|
|
||
| mappings = { | ||
| "documents": "dispute_document", | ||
| } |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| """Module to hold the DisputeDocument resource.""" | ||
|
|
||
| from fintoc.mixins import ResourceMixin | ||
|
|
||
|
|
||
| class DisputeDocument(ResourceMixin): | ||
| """Represents a Fintoc Dispute Document.""" |
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Porque necesita su propio
ManagerlosDocuments?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lo separé por dos razones:
accounts.movements: recursos anidados en la API (/v1/disputes/:id/documents) tienen su propio manager en el SDK._createdelManagerMixinusaself.__class__.resourcepara decidir qué clase instanciar. Si pongocreate_documentenDisputesManager(donderesource = "dispute"), tendría que bypassear_createy llamar aresource_createa mano conklass=DisputeDocument.Además deja la puerta abierta a agregar
list/get/deletede documentos sin tener que refactorizar.