This repository has been archived by the owner on Sep 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* adiciona bank_account * fmt * sobe bdd's * fmt
- Loading branch information
1 parent
349b624
commit f46e4fb
Showing
8 changed files
with
114 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
This file contains 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,16 @@ | ||
from imopay_wrapper import ImopayWrapper | ||
|
||
|
||
client = ImopayWrapper() | ||
|
||
data = { | ||
"owner": "ID_DO_SELLER", | ||
"bank": "001", | ||
"type": "corrente", | ||
"number": "123123", | ||
"routing": "45678", | ||
} | ||
|
||
response = client.bank_account.create(data) | ||
|
||
print(response.data) |
This file contains 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 @@ | ||
from imopay_wrapper import ImopayWrapper | ||
|
||
|
||
client = ImopayWrapper() | ||
|
||
imopay_id = "foo" | ||
|
||
response = client.bank_account.destroy(imopay_id) | ||
|
||
print(response.data) |
This file contains 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 @@ | ||
from imopay_wrapper import ImopayWrapper | ||
|
||
|
||
client = ImopayWrapper() | ||
|
||
imopay_id = "foo" | ||
|
||
response = client.bank_account.retrieve(imopay_id) | ||
|
||
print(response.data) |
This file contains 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,18 @@ | ||
from dataclasses import dataclass | ||
|
||
from .base import BaseImopayObj | ||
from ..validators import validate_obj_attr_in_collection | ||
|
||
|
||
@dataclass | ||
class BankAccount(BaseImopayObj): | ||
owner: str | ||
bank: str | ||
number: str | ||
routing: str | ||
type: str | ||
|
||
VALID_TYPES = {"poupança", "corrente"} | ||
|
||
def _validate_type(self): | ||
validate_obj_attr_in_collection(self, "type", self.VALID_TYPES) |
This file contains 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 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,16 @@ | ||
from .base import BaseImopayWrapper, CreateMixin, RetrieveMixin, DestroyMixin | ||
from ..models.bank_account import BankAccount | ||
|
||
|
||
class BankAccountWrapper(BaseImopayWrapper, CreateMixin, RetrieveMixin, DestroyMixin): | ||
""" | ||
Wrapper para os métodos de contas bancárias | ||
""" | ||
|
||
@property | ||
def action(self): | ||
return "bank_accounts" | ||
|
||
@property | ||
def model(self): | ||
return BankAccount |
This file contains 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,42 @@ | ||
from ..utils import LocalImopayTestCase | ||
from imopay_wrapper import ImopayWrapper | ||
from imopay_wrapper.wrapper.base import CreateMixin, RetrieveMixin, DestroyMixin | ||
from imopay_wrapper.models.bank_account import BankAccount | ||
|
||
|
||
class BankAccountWrapperTestCase(LocalImopayTestCase): | ||
def setUp(self): | ||
self.client = ImopayWrapper().bank_account | ||
|
||
def test_mixins(self): | ||
""" | ||
Dado: | ||
- um client ImopayWrapper().bank_account | ||
Quando: | ||
- N/A | ||
Então: | ||
- client deve ser uma instância de (CreateMixin, RetrieveMixin, DestroyMixin) # noqa | ||
""" | ||
self.assertIsInstance(self.client, (CreateMixin, RetrieveMixin, DestroyMixin)) | ||
|
||
def test_model(self): | ||
""" | ||
Dado: | ||
- um client ImopayWrapper().bank_account | ||
Quando: | ||
- N/A | ||
Então: | ||
- client.model deve ser BankAccount | ||
""" | ||
self.assertEqual(self.client.model, BankAccount) | ||
|
||
def test_action(self): | ||
""" | ||
Dado: | ||
- um client ImopayWrapper().bank_account | ||
Quando: | ||
- N/A | ||
Então: | ||
- client.action deve ser 'bank_accounts' | ||
""" | ||
self.assertEqual(self.client.action, "bank_accounts") |