-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* This is a way to solve it... * This one is clearer * Lint and test * Another lint * Fix test * Add another test just in case and its corresponding fix * To be clear * Add customized session * Bump versions * Adding issuer and funding_type * Adding card_activations * Rebase * Cassettes for everyone * Upgrade version * Upgrade version * Allow cuenca-validations * Conflict dependencies * card_activations model and version * Fix testt * Version * Adapting card_activations * Lint * Missing file * Version * cassettes and user_id optional * from_dict * Missing assert * Adding pin * Adding dacite as requirement * card_activations * Correct version * Revert file * Using card_uri instead of the card * Remove dacite * Fix cassette * Alex comments and cuenca-validations
- Loading branch information
Ricardo
authored
Mar 24, 2021
1 parent
cabf724
commit e26630d
Showing
19 changed files
with
814 additions
and
187 deletions.
There are no files selected for viewing
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
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,56 @@ | ||
import datetime as dt | ||
from dataclasses import dataclass | ||
from typing import ClassVar, Optional, cast | ||
|
||
from cuenca_validations.types.requests import CardActivationRequest | ||
|
||
from ..http import Session, session as global_session | ||
from .base import Creatable | ||
from .cards import Card | ||
from .resources import retrieve_uri | ||
|
||
|
||
@dataclass | ||
class CardActivation(Creatable): | ||
_resource: ClassVar = 'card_activations' | ||
|
||
created_at: dt.datetime | ||
user_id: str | ||
ip_address: str | ||
card_uri: Optional[str] | ||
succeeded: bool | ||
|
||
@classmethod | ||
def create( | ||
cls, | ||
number: str, | ||
exp_month: int, | ||
exp_year: int, | ||
cvv2: str, | ||
*, | ||
session: Session = global_session, | ||
) -> 'CardActivation': | ||
""" | ||
Associates a physical card with the current user | ||
:param number: Card number | ||
:param exp_month: | ||
:param exp_year: | ||
:param cvv2: | ||
""" | ||
req = CardActivationRequest( | ||
number=number, | ||
exp_month=exp_month, | ||
exp_year=exp_year, | ||
cvv2=cvv2, | ||
) | ||
return cast( | ||
'CardActivation', cls._create(session=session, **req.dict()) | ||
) | ||
|
||
@property | ||
def card(self) -> Optional[Card]: | ||
result = None | ||
if self.card_uri: | ||
result = cast(Card, retrieve_uri(self.card_uri)) | ||
return result |
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
__version__ = '0.7.0' | ||
__version__ = '0.7.1' | ||
CLIENT_VERSION = __version__ | ||
API_VERSION = '2020-03-19' |
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
requests==2.25.1 | ||
cuenca-validations==0.8.2 | ||
cuenca-validations==0.9.0 | ||
dataclasses>=0.7;python_version<"3.7" |
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
Oops, something went wrong.