-
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.
* init card transactions * fix init CardTransaction * tests card_transactions * fix tests, name val * generate new cassetes * comments of review * fix comment matin * ..http.utils.create_awaitable is only for python 3.6 * function in function * change get_event_loop to .run * use ThreadPoolExecutor * fix syntax * make format * lineal code * with with * update version cuenca-validations * version for pre release * version for pre release 1 * fix end * pre release version * update version final
- Loading branch information
Keryc Diaz
authored
Nov 6, 2020
1 parent
4293abc
commit dbd1eb3
Showing
11 changed files
with
497 additions
and
3 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,35 @@ | ||
from typing import ClassVar, List, Optional, cast | ||
|
||
from cuenca_validations.types import ( | ||
CardErrorType, | ||
CardNetwork, | ||
CardTransactionType, | ||
CardType, | ||
) | ||
from pydantic.dataclasses import dataclass | ||
|
||
from .base import Transaction | ||
from .resources import retrieve_uris | ||
|
||
|
||
@dataclass | ||
class CardTransaction(Transaction): | ||
_resource: ClassVar = 'card_transactions' | ||
|
||
type: CardTransactionType | ||
network: CardNetwork | ||
related_card_transaction_uris: List[str] | ||
card_id: str | ||
card_last4: str | ||
card_type: CardType | ||
metadata: dict | ||
error_type: Optional[CardErrorType] | ||
|
||
@property # type: ignore | ||
def related_card_transactions(self) -> Optional[List['CardTransaction']]: | ||
if not self.related_card_transaction_uris: | ||
return None | ||
return cast( | ||
List['CardTransaction'], | ||
retrieve_uris(self.related_card_transaction_uris), | ||
) |
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.3.8' | ||
__version__ = '0.3.9' | ||
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,4 +1,4 @@ | ||
requests==2.24.0 | ||
cuenca-validations==0.6.4 | ||
cuenca-validations==0.6.6 | ||
dataclasses>=0.7;python_version<"3.7" | ||
aws-requests-auth==0.4.3 |
104 changes: 104 additions & 0 deletions
104
tests/resources/cassettes/test_card_transaction_child_retrieve.yaml
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,104 @@ | ||
interactions: | ||
- request: | ||
body: null | ||
headers: | ||
Accept: | ||
- '*/*' | ||
Accept-Encoding: | ||
- gzip, deflate | ||
Authorization: | ||
- DUMMY | ||
Connection: | ||
- keep-alive | ||
User-Agent: | ||
- cuenca-python/0.3.6 | ||
X-Cuenca-Api-Version: | ||
- '2020-03-19' | ||
x-amz-content-sha256: | ||
- e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 | ||
x-amz-date: | ||
- 20201029T211344Z | ||
method: GET | ||
uri: https://sandbox.cuenca.com/card_transactions/CT002 | ||
response: | ||
body: | ||
string: '{"id":"CT002","created_at":"2020-10-29T18:04:37.414000","user_id":"US4PCNV8rLB2wqBfORzIAXUl","amount":300,"status":"created","descriptor":"Superama | ||
Michoacan","type":"refund","network":"visa","related_card_transaction_uris":["/card_transactions/CT001"],"card_id":"CA001","card_last4":"0359","card_type":"virtual","metadata":{"authorizer_number":null,"card_acceptor":null,"commission":null,"currency_code":"484","is_cvv":null,"pos_capabilty":null,"prosa_transaction_id":"38007","retrieval_reference":"444838149","track_data_method":null,"transaction_reference":null},"error_type":null}' | ||
headers: | ||
Connection: | ||
- keep-alive | ||
Content-Length: | ||
- '659' | ||
Content-Type: | ||
- application/json | ||
Date: | ||
- Thu, 29 Oct 2020 21:13:44 GMT | ||
Via: | ||
- 1.1 fef232a36f2d64e8401caff3be58f4fc.cloudfront.net (CloudFront) | ||
X-Amz-Cf-Id: | ||
- 4WuDXoq-_GWtMLx6kiNBPWtX2BpR211K3UJSdnbP24GiScNcXF2HlQ== | ||
X-Amz-Cf-Pop: | ||
- IAH50-C1 | ||
X-Amzn-Trace-Id: | ||
- Root=1-5f9b3088-54cfc3235bfff8a00655b709;Sampled=0 | ||
X-Cache: | ||
- Miss from cloudfront | ||
x-amz-apigw-id: | ||
- VMSFZGONoAMF7zA= | ||
x-amzn-RequestId: | ||
- 0d065a8f-9a36-47ec-88b1-1b3bfcb1e215 | ||
status: | ||
code: 200 | ||
message: OK | ||
- request: | ||
body: null | ||
headers: | ||
Accept: | ||
- '*/*' | ||
Accept-Encoding: | ||
- gzip, deflate | ||
Authorization: | ||
- DUMMY | ||
Connection: | ||
- keep-alive | ||
User-Agent: | ||
- cuenca-python/0.3.6 | ||
X-Cuenca-Api-Version: | ||
- '2020-03-19' | ||
x-amz-content-sha256: | ||
- e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 | ||
x-amz-date: | ||
- 20201029T211344Z | ||
method: GET | ||
uri: https://sandbox.cuenca.com/card_transactions/CT001 | ||
response: | ||
body: | ||
string: '{"id":"CT001","created_at":"2020-10-29T18:04:37.396000","user_id":"US4PCNV8rLB2wqBfORzIAXUl","amount":300,"status":"created","descriptor":"Superama | ||
Michoacan","type":"auth","network":"visa","related_card_transaction_uris":["/card_transactions/CT002","/card_transactions/CT2pnV82umR0FnxWsDwHBFq","/card_transactions/CTXoLAkUBeZY7arY4XyuaYp"],"card_id":"CA001","card_last4":"0359","card_type":"virtual","metadata":{"authorizer_number":null,"card_acceptor":null,"commission":null,"currency_code":"484","is_cvv":null,"pos_capabilty":null,"prosa_transaction_id":"36776","retrieval_reference":"691159329","track_data_method":null,"transaction_reference":null},"error_type":null}' | ||
headers: | ||
Connection: | ||
- keep-alive | ||
Content-Length: | ||
- '747' | ||
Content-Type: | ||
- application/json | ||
Date: | ||
- Thu, 29 Oct 2020 21:13:45 GMT | ||
Via: | ||
- 1.1 fef232a36f2d64e8401caff3be58f4fc.cloudfront.net (CloudFront) | ||
X-Amz-Cf-Id: | ||
- LIS9DTnDXufnad7kEAG_UcUfcFs7laqNSgFpJx5vwbGGeAXMACHszA== | ||
X-Amz-Cf-Pop: | ||
- IAH50-C1 | ||
X-Amzn-Trace-Id: | ||
- Root=1-5f9b3089-4586ce643d7ee31e3c819823;Sampled=0 | ||
X-Cache: | ||
- Miss from cloudfront | ||
x-amz-apigw-id: | ||
- VMSFbFGyIAMFcMQ= | ||
x-amzn-RequestId: | ||
- 99f43c26-2aea-4de7-b03d-9113ff28a3ed | ||
status: | ||
code: 200 | ||
message: OK | ||
version: 1 |
53 changes: 53 additions & 0 deletions
53
tests/resources/cassettes/test_card_transaction_expiration_retrieve.yaml
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,53 @@ | ||
interactions: | ||
- request: | ||
body: null | ||
headers: | ||
Accept: | ||
- '*/*' | ||
Accept-Encoding: | ||
- gzip, deflate | ||
Authorization: | ||
- DUMMY | ||
Connection: | ||
- keep-alive | ||
User-Agent: | ||
- cuenca-python/0.3.6 | ||
X-Cuenca-Api-Version: | ||
- '2020-03-19' | ||
x-amz-content-sha256: | ||
- e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 | ||
x-amz-date: | ||
- 20201029T211345Z | ||
method: GET | ||
uri: https://sandbox.cuenca.com/card_transactions/CT004 | ||
response: | ||
body: | ||
string: '{"id":"CT004","created_at":"2020-10-29T18:04:36.318000","user_id":"US4PCNV8rLB2wqBfORzIAXUl","amount":300,"status":"failed","descriptor":"Superama | ||
Michoacan","type":"expiration","network":"visa","related_card_transaction_uris":[],"card_id":"CA001","card_last4":"0359","card_type":"virtual","metadata":{"authorizer_number":null,"card_acceptor":null,"commission":null,"currency_code":"484","is_cvv":null,"pos_capabilty":null,"prosa_transaction_id":"68697","retrieval_reference":"899493694","track_data_method":null,"transaction_reference":null},"error_type":null}' | ||
headers: | ||
Connection: | ||
- keep-alive | ||
Content-Length: | ||
- '641' | ||
Content-Type: | ||
- application/json | ||
Date: | ||
- Thu, 29 Oct 2020 21:13:45 GMT | ||
Via: | ||
- 1.1 a75dce573e80f2f2d03981a80f910c42.cloudfront.net (CloudFront) | ||
X-Amz-Cf-Id: | ||
- c5u29_nf3YTSb7F-8JyhufTnieVVTDY59jXwr2jdJ3qcuEcSVEPO3A== | ||
X-Amz-Cf-Pop: | ||
- IAH50-C1 | ||
X-Amzn-Trace-Id: | ||
- Root=1-5f9b3089-501105c97ed0766d4d07559f;Sampled=0 | ||
X-Cache: | ||
- Miss from cloudfront | ||
x-amz-apigw-id: | ||
- VMSFiGpHIAMFlbw= | ||
x-amzn-RequestId: | ||
- 18ec27c1-e875-47ea-84aa-3b12bb4cb0b1 | ||
status: | ||
code: 200 | ||
message: OK | ||
version: 1 |
Oops, something went wrong.