Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions checkout_sdk/identities/entities.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
class AttemptAssetsQueryFilter:
skip: int
limit: int
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from checkout_sdk.authorization_type import AuthorizationType
from checkout_sdk.checkout_configuration import CheckoutConfiguration
from checkout_sdk.client import Client
from checkout_sdk.identities.entities import AttemptAssetsQueryFilter
from checkout_sdk.identities.faceauthentication.faceauthentication import (
FaceAuthenticationRequest, FaceAuthenticationAttemptRequest
)
Expand All @@ -13,6 +14,7 @@ class FaceAuthenticationClient(Client):
__FACE_AUTHENTICATIONS_PATH = 'face-authentications'
__ANONYMIZE_PATH = 'anonymize'
__ATTEMPTS_PATH = 'attempts'
__ASSETS_PATH = 'assets'

def __init__(self, api_client: ApiClient, configuration: CheckoutConfiguration):
super().__init__(api_client=api_client,
Expand Down Expand Up @@ -50,3 +52,11 @@ def get_face_authentication_attempt(self, face_authentication_id: str, attempt_i
self.build_path(self.__FACE_AUTHENTICATIONS_PATH, face_authentication_id, self.__ATTEMPTS_PATH,
attempt_id),
self._sdk_authorization())

def get_face_authentication_attempt_assets(self, face_authentication_id: str, attempt_id: str,
query: AttemptAssetsQueryFilter = None):
return self._api_client.get(
self.build_path(self.__FACE_AUTHENTICATIONS_PATH, face_authentication_id, self.__ATTEMPTS_PATH,
attempt_id, self.__ASSETS_PATH),
self._sdk_authorization(),
query)
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from checkout_sdk.authorization_type import AuthorizationType
from checkout_sdk.checkout_configuration import CheckoutConfiguration
from checkout_sdk.client import Client
from checkout_sdk.identities.entities import AttemptAssetsQueryFilter
from checkout_sdk.identities.identityverification.identityverification import (
IdentityVerificationRequest,
IdentityVerificationAndAttemptRequest,
Expand All @@ -17,6 +18,7 @@ class IdentityVerificationClient(Client):
__ANONYMIZE_PATH = 'anonymize'
__ATTEMPTS_PATH = 'attempts'
__PDF_REPORT_PATH = 'pdf-report'
__ASSETS_PATH = 'assets'

def __init__(self, api_client: ApiClient, configuration: CheckoutConfiguration):
super().__init__(api_client=api_client,
Expand Down Expand Up @@ -60,6 +62,14 @@ def get_identity_verification_attempt(self, identity_verification_id: str, attem
attempt_id),
self._sdk_authorization())

def get_identity_verification_attempt_assets(self, identity_verification_id: str, attempt_id: str,
query: AttemptAssetsQueryFilter = None):
return self._api_client.get(
self.build_path(self.__IDENTITY_VERIFICATIONS_PATH, identity_verification_id, self.__ATTEMPTS_PATH,
attempt_id, self.__ASSETS_PATH),
self._sdk_authorization(),
query)

def get_identity_verification_report(self, identity_verification_id: str):
return self._api_client.get(
self.build_path(self.__IDENTITY_VERIFICATIONS_PATH, identity_verification_id, self.__PDF_REPORT_PATH),
Expand Down
4 changes: 3 additions & 1 deletion checkout_sdk/payments/hosted/hosted_payments.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from checkout_sdk.common.common import CustomerRequest, CustomerRetry
from checkout_sdk.common.enums import Currency
from checkout_sdk.payments.payments import BillingDescriptor, PaymentInstruction, PaymentType, ShippingDetails, \
ThreeDsRequest, RiskRequest, PaymentRecipient, ProcessingSettings, PaymentSender
ThreeDsRequest, RiskRequest, PaymentRecipient, ProcessingSettings, PaymentSender, PaymentPlan, AuthorizationType
from checkout_sdk.payments.payments_previous import BillingInformation
from checkout_sdk.payments.sessions.sessions import SessionPaymentMethodConfiguration

Expand Down Expand Up @@ -40,3 +40,5 @@ class HostedPaymentsSessionRequest:
capture_on: datetime
instruction: PaymentInstruction
payment_method_configuration: SessionPaymentMethodConfiguration
payment_plan: PaymentPlan
authorization_type: AuthorizationType
4 changes: 3 additions & 1 deletion checkout_sdk/payments/links/payments_links.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from checkout_sdk.common.common import CustomerRequest, CustomerRetry
from checkout_sdk.common.enums import Currency
from checkout_sdk.payments.payments import BillingDescriptor, PaymentInstruction, PaymentType, ShippingDetails, \
ThreeDsRequest, RiskRequest, PaymentRecipient, ProcessingSettings, PaymentSender
ThreeDsRequest, RiskRequest, PaymentRecipient, ProcessingSettings, PaymentSender, PaymentPlan, AuthorizationType
from checkout_sdk.payments.payments_previous import BillingInformation
from checkout_sdk.payments.sessions.sessions import SessionPaymentMethodConfiguration

Expand Down Expand Up @@ -39,3 +39,5 @@ class PaymentLinkRequest:
capture_on: datetime
instruction: PaymentInstruction
payment_method_configuration: SessionPaymentMethodConfiguration
payment_plan: PaymentPlan
authorization_type: AuthorizationType
1 change: 1 addition & 0 deletions checkout_sdk/payments/payments.py
Original file line number Diff line number Diff line change
Expand Up @@ -620,6 +620,7 @@ class ProcessingSettings:
service_type: ServiceType
partner_code: str
processing_speed: str # 'fast' (only for unreferenced refunds / card payouts)
scheme_transaction_link_id: str


class ProductSubType (str, Enum):
Expand Down
4 changes: 3 additions & 1 deletion checkout_sdk/payments/sessions/sessions.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from checkout_sdk.common.enums import Currency
from checkout_sdk.payments.payments import PaymentType, BillingDescriptor, ShippingDetails, \
PaymentRecipient, ProcessingSettings, RiskRequest, ThreeDsRequest, PaymentSender
PaymentRecipient, ProcessingSettings, RiskRequest, ThreeDsRequest, PaymentSender, PaymentPlan, AuthorizationType
from checkout_sdk.sessions.sessions import SessionsBillingDescriptor


Expand Down Expand Up @@ -252,6 +252,8 @@ class PaymentSessionsRequest:
disabled_payment_methods: list # PaymentMethodsType
customer_retry: CustomerRetry
ip_address: str
authorization_type: AuthorizationType
payment_plan: PaymentPlan


class PaymentSessionWithPaymentRequest:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import pytest

from tests._assertions import assert_api_call
from checkout_sdk.identities.entities import AttemptAssetsQueryFilter
from checkout_sdk.identities.faceauthentication.faceauthentication import (
FaceAuthenticationRequest, FaceAuthenticationAttemptRequest
)
Expand Down Expand Up @@ -55,3 +56,12 @@ def test_should_get_face_authentication_attempt(self, mocker, client: FaceAuthen

assert client.get_face_authentication_attempt(_FAV_ID, _ATTEMPT_ID) == 'response'
assert_api_call(mock, f'face-authentications/{_FAV_ID}/attempts/{_ATTEMPT_ID}')

def test_should_get_face_authentication_attempt_assets(self, mocker, client: FaceAuthenticationClient):
mock = mocker.patch('checkout_sdk.api_client.ApiClient.get', return_value='response')
query = AttemptAssetsQueryFilter()
query.skip = 0
query.limit = 10

assert client.get_face_authentication_attempt_assets(_FAV_ID, _ATTEMPT_ID, query) == 'response'
assert_api_call(mock, f'face-authentications/{_FAV_ID}/attempts/{_ATTEMPT_ID}/assets')
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import pytest

from checkout_sdk.identities.entities import AttemptAssetsQueryFilter
from checkout_sdk.identities.faceauthentication.faceauthentication import (
FaceAuthenticationRequest, FaceAuthenticationAttemptRequest, ClientInformation
)
Expand Down Expand Up @@ -57,6 +58,19 @@ def test_should_get_face_authentication_attempt(default_api):
assert retrieved.id == created_attempt.id


@pytest.mark.skip(reason='Requires valid test environment setup')
def test_should_get_face_authentication_attempt_assets(default_api):
created = default_api.face_authentication.create_face_authentication(face_authentication_request())
created_attempt = default_api.face_authentication.create_face_authentication_attempt(
created.id, face_authentication_attempt_request())
query = AttemptAssetsQueryFilter()
query.skip = 0
query.limit = 10
assets = default_api.face_authentication.get_face_authentication_attempt_assets(
created.id, created_attempt.id, query)
assert_response(assets, 'http_metadata', 'total_count', 'data')


@pytest.mark.skip(reason='Requires valid test environment setup')
def test_should_perform_face_authentication_workflow(default_api):
created = default_api.face_authentication.create_face_authentication(face_authentication_request())
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import pytest

from tests._assertions import assert_api_call
from checkout_sdk.identities.entities import AttemptAssetsQueryFilter
from checkout_sdk.identities.identityverification.identityverification import (
IdentityVerificationRequest, IdentityVerificationAndAttemptRequest, IdentityVerificationAttemptRequest
)
Expand Down Expand Up @@ -64,3 +65,12 @@ def test_should_get_identity_verification_report(self, mocker, client: IdentityV

assert client.get_identity_verification_report('idv_12345') == 'response'
assert_api_call(mock, 'identity-verifications/idv_12345/pdf-report')

def test_should_get_identity_verification_attempt_assets(self, mocker, client: IdentityVerificationClient):
mock = mocker.patch('checkout_sdk.api_client.ApiClient.get', return_value='response')
query = AttemptAssetsQueryFilter()
query.skip = 0
query.limit = 10

assert client.get_identity_verification_attempt_assets('idv_12345', 'attempt_67890', query) == 'response'
assert_api_call(mock, 'identity-verifications/idv_12345/attempts/attempt_67890/assets')
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import pytest

from checkout_sdk.identities.entities import AttemptAssetsQueryFilter
from checkout_sdk.identities.identityverification.identityverification import (
IdentityVerificationRequest, IdentityVerificationAndAttemptRequest,
IdentityVerificationAttemptRequest, DeclaredData, ClientInformation
Expand Down Expand Up @@ -72,6 +73,20 @@ def test_should_get_identity_verification_attempt(default_api):
assert retrieved.id == created_attempt.id


@pytest.mark.skip(reason='Requires valid test environment setup')
def test_should_get_identity_verification_attempt_assets(default_api):
created = default_api.identity_verification.create_identity_verification(
identity_verification_request())
created_attempt = default_api.identity_verification.create_identity_verification_attempt(
created.id, identity_verification_attempt_request())
query = AttemptAssetsQueryFilter()
query.skip = 0
query.limit = 10
assets = default_api.identity_verification.get_identity_verification_attempt_assets(
created.id, created_attempt.id, query)
assert_response(assets, 'http_metadata', 'total_count', 'data')


@pytest.mark.skip(reason='Requires valid test environment setup')
def test_should_get_identity_verification_report(default_api):
created = default_api.identity_verification.create_identity_verification(
Expand Down
2 changes: 1 addition & 1 deletion tests/oauth_integration_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,4 @@ def test_should_fail_oauth_with_subdomain_invalid_credentials():
.scopes([OAuthScopes.GATEWAY, OAuthScopes.VAULT]) \
.build()
except CheckoutException as err:
assert err.args[0] == 'OAuth client_credentials authentication failed with status: (406)'
assert err.args[0] == 'OAuth client_credentials authentication failed with error: (invalid_client)'
Loading