diff --git a/checkout_sdk/oauth_access_token.py b/checkout_sdk/oauth_access_token.py index d6bde6c5..efdea318 100644 --- a/checkout_sdk/oauth_access_token.py +++ b/checkout_sdk/oauth_access_token.py @@ -5,10 +5,12 @@ class OAuthAccessToken: token: str + token_type: str expiration_date: datetime - def __init__(self, token: str, expiration_date: datetime): + def __init__(self, token: str, token_type: str, expiration_date: datetime): self.token = token + self.token_type = token_type self.expiration_date = expiration_date def is_valid(self): diff --git a/checkout_sdk/oauth_credentials.py b/checkout_sdk/oauth_credentials.py index 3cbd21f0..924c7a96 100644 --- a/checkout_sdk/oauth_credentials.py +++ b/checkout_sdk/oauth_credentials.py @@ -64,6 +64,8 @@ def get_access_token(self): data = { 'grant_type': 'client_credentials', + 'client_id': self.__client_id, + 'client_secret': self.__client_secret, 'scope': str.join(' ', self.__scopes) } @@ -84,6 +86,7 @@ def get_access_token(self): response_json = response.json() self.__access_token = OAuthAccessToken(token=response_json['access_token'], + token_type=response_json['token_type'], expiration_date=datetime.now() + timedelta( seconds=response_json['expires_in'])) return self.__access_token diff --git a/checkout_sdk/payments/contexts/contexts.py b/checkout_sdk/payments/contexts/contexts.py index 06668bc0..63cbf8d9 100644 --- a/checkout_sdk/payments/contexts/contexts.py +++ b/checkout_sdk/payments/contexts/contexts.py @@ -55,7 +55,7 @@ class PaymentContextsProcessing: locale: str shipping_preference: ShippingPreference user_action: UserAction - partner_customer_risk_data: PaymentContextsPartnerCustomerRiskData + partner_customer_risk_data: list # payment.contexts.PaymentContextsPartnerCustomerRiskData airline_data: list # payment.contexts.PaymentContextsAirlineData diff --git a/checkout_sdk/transfers/transfers.py b/checkout_sdk/transfers/transfers.py index b79a0c81..884a265b 100644 --- a/checkout_sdk/transfers/transfers.py +++ b/checkout_sdk/transfers/transfers.py @@ -1,5 +1,7 @@ from enum import Enum +from checkout_sdk.common.enums import Currency + class TransferType(str, Enum): COMMISSION = 'commission' @@ -10,6 +12,7 @@ class TransferType(str, Enum): class TransferSource: id: str amount: int + currency: Currency class TransferDestination: diff --git a/checkout_sdk/transfers/transfers_client.py b/checkout_sdk/transfers/transfers_client.py index 9f93e313..c7eca474 100644 --- a/checkout_sdk/transfers/transfers_client.py +++ b/checkout_sdk/transfers/transfers_client.py @@ -16,7 +16,7 @@ def __init__(self, api_client: ApiClient, configuration=configuration, authorization_type=AuthorizationType.SECRET_KEY_OR_OAUTH) - def initiate_transfer_of_funds(self, create_transfer_request: CreateTransferRequest, idempotency_key: str = None): + def initiate_transfer_of_funds(self, create_transfer_request: CreateTransferRequest, idempotency_key: str): return self._api_client.post(self.__TRANSFERS_PATH, self._sdk_authorization(), create_transfer_request, idempotency_key) diff --git a/tests/oauth_integration_test.py b/tests/oauth_integration_test.py index 406ee5a1..75a6393d 100644 --- a/tests/oauth_integration_test.py +++ b/tests/oauth_integration_test.py @@ -14,7 +14,6 @@ def test_should_create_customer_with_oauth(oauth_api): customer_response = oauth_api.customers.create(customer_request) assert_response(customer_response, 'id') - return customer_response.id def test_should_fail_init_authorization_invalid_credentials(): diff --git a/tests/transfers/transfers_integration_test.py b/tests/transfers/transfers_integration_test.py index c8422964..bd4b3fc3 100644 --- a/tests/transfers/transfers_integration_test.py +++ b/tests/transfers/transfers_integration_test.py @@ -1,5 +1,6 @@ from __future__ import absolute_import +from checkout_sdk.common.enums import Currency from checkout_sdk.exception import CheckoutApiException from checkout_sdk.transfers.transfers import CreateTransferRequest, TransferDestination, TransferSource, TransferType from tests.checkout_test_utils import assert_response, new_idempotency_key @@ -9,6 +10,7 @@ def test_should_initiate_transfer_of_funds_idempotently(oauth_api): transfer_source = TransferSource() transfer_source.id = 'ent_kidtcgc3ge5unf4a5i6enhnr5m' transfer_source.amount = 100 + transfer_source.currency = Currency.GBP transfer_destination = TransferDestination() transfer_destination.id = 'ent_w4jelhppmfiufdnatam37wrfc4' @@ -23,6 +25,9 @@ def test_should_initiate_transfer_of_funds_idempotently(oauth_api): response = oauth_api.transfers.initiate_transfer_of_funds(transfer_request, idempotency_key) assert_response(response, 'id', 'status') + response2 = oauth_api.transfers.retrieve_a_transfer(response.id) + assert_response(response2, 'id', 'status', 'source', 'destination') + try: oauth_api.transfers.initiate_transfer_of_funds(transfer_request, idempotency_key) except CheckoutApiException as err: