Skip to content
Open
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
2 changes: 1 addition & 1 deletion checkout_sdk/accounts/accounts.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ class AccountsPaymentInstrument:

class PaymentInstrumentRequest:
label: str
type = InstrumentType
type: InstrumentType
currency: Currency
country: Country
default: bool
Expand Down
16 changes: 16 additions & 0 deletions checkout_sdk/balances/balances.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,18 @@
class BalancesQuery:
query: str
with_currency_account_id: str
balances_at: str

# The /balances/{id} endpoint uses camelCase query params, inconsistent with
# the rest of the API. Handle the mapping locally so the quirk stays scoped
# to this class — if the API ever normalizes to snake_case, deleting this
# method is the entire fix.
def to_json(self):
out = {}
if getattr(self, 'query', None) is not None:
out['query'] = self.query
if getattr(self, 'with_currency_account_id', None) is not None:
out['withCurrencyAccountId'] = self.with_currency_account_id
if getattr(self, 'balances_at', None) is not None:
out['balancesAt'] = self.balances_at
return out
4 changes: 4 additions & 0 deletions checkout_sdk/checkout_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
from checkout_sdk.identities.iddocumentverification.iddocumentverification_client import IdDocumentVerificationClient
from checkout_sdk.identities.applicants.applicants_client import ApplicantsClient
from checkout_sdk.identities.identityverification.identityverification_client import IdentityVerificationClient
from checkout_sdk.networktokens.network_tokens_client import NetworkTokensClient
from checkout_sdk.paymentmethods.payment_methods_client import PaymentMethodsClient


def _base_api_client(configuration: CheckoutConfiguration) -> ApiClient:
Expand Down Expand Up @@ -111,3 +113,5 @@ def __init__(self, configuration: CheckoutConfiguration):
self.applicants = ApplicantsClient(api_client=identity_api_client, configuration=configuration)
self.identity_verification = IdentityVerificationClient(api_client=identity_api_client,
configuration=configuration)
self.network_tokens = NetworkTokensClient(api_client=base_api_client, configuration=configuration)
self.payment_methods = PaymentMethodsClient(api_client=base_api_client, configuration=configuration)
3 changes: 3 additions & 0 deletions checkout_sdk/common/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ class CustomerRequest:
email: str
name: str
phone: Phone
default: str
metadata: dict
tax_number: str


class CustomerRetry:
Expand Down
9 changes: 9 additions & 0 deletions checkout_sdk/common/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -476,8 +476,16 @@ class PaymentSourceType(str, Enum):
OCTOPUS = 'octopus'
PLAID = 'plaid'
SEQURA = 'sequra'
MOBILEPAY = 'mobilepay'
PAYNOW = 'paynow'
SWISH = 'swish'
TWINT = 'twint'
VIPPS = 'vipps'
BLIK = 'blik'


# Used by ThreeDsRequest (in payments). The /sessions endpoint accepts
# additional exemption-like values — see SessionChallengeIndicator.
class ChallengeIndicator(str, Enum):
NO_PREFERENCE = 'no_preference'
NO_CHALLENGE_REQUESTED = 'no_challenge_requested'
Expand All @@ -490,6 +498,7 @@ class InstrumentType(str, Enum):
TOKEN = 'token'
CARD = 'card'
SEPA = 'sepa'
ACH = 'ach'
CARD_TOKEN = 'card_token'


Expand Down
29 changes: 29 additions & 0 deletions checkout_sdk/disputes/disputes.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,30 @@ class DisputesQueryFilter:
entity_ids: str
sub_entity_ids: str
payment_mcc: str
processing_channel_ids: str
segment_ids: str


class CompellingEvidenceShippingAddress:
address1: str
address2: str
city: str
state: str
postal_code: str
country: str


class CompellingEvidence:
merchandise_or_service: str
merchandise_or_service_desc: str
merchandise_or_service_provided_date: datetime
shipping_delivery_status: str
tracking_information: str
user_id: str
ip_address: str
device_id: str
shipping_address: CompellingEvidenceShippingAddress
historical_transactions: list # CompellingEvidenceHistoricalTransaction


class DisputeEvidenceRequest:
Expand All @@ -34,3 +58,8 @@ class DisputeEvidenceRequest:
additional_evidence_text: str
proof_of_delivery_or_service_date_file: str
proof_of_delivery_or_service_date_text: str
arbitration_no_review_files: list # list[str]
arbitration_no_review_text: str
arbitration_review_required_files: list # list[str]
arbitration_review_required_text: str
compelling_evidence: CompellingEvidence
16 changes: 16 additions & 0 deletions checkout_sdk/disputes/disputes_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class DisputesClient(FilesClient):
__DISPUTES_PATH = 'disputes'
__ACCEPT_PATH = 'accept'
__EVIDENCE_PATH = 'evidence'
__ARBITRATION_PATH = 'arbitration'
__SUBMITTED_PATH = 'submitted'
__SCHEME_FILES_PATH = "schemefiles"

Expand Down Expand Up @@ -42,13 +43,28 @@ def submit_evidence(self, dispute_id: str):
return self._api_client.post(self.build_path(self.__DISPUTES_PATH, dispute_id, self.__EVIDENCE_PATH),
self._sdk_authorization())

def submit_arbitration_evidence(self, dispute_id: str):
return self._api_client.post(self.build_path(
self.__DISPUTES_PATH, dispute_id,
self.__EVIDENCE_PATH,
self.__ARBITRATION_PATH),
self._sdk_authorization())

def get_compiled_submitted_evidence(self, dispute_id: str):
return self._api_client.get(self.build_path(
self.__DISPUTES_PATH, dispute_id,
self.__EVIDENCE_PATH,
self.__SUBMITTED_PATH),
self._sdk_authorization())

def get_compiled_submitted_arbitration_evidence(self, dispute_id: str):
return self._api_client.get(self.build_path(
self.__DISPUTES_PATH, dispute_id,
self.__EVIDENCE_PATH,
self.__ARBITRATION_PATH,
self.__SUBMITTED_PATH),
self._sdk_authorization())

def get_dispute_scheme_files(self, dispute_id: str):
return self._api_client.get(self.build_path(self.__DISPUTES_PATH, dispute_id, self.__SCHEME_FILES_PATH),
self._sdk_authorization())
2 changes: 1 addition & 1 deletion checkout_sdk/forex/forex.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ class RatesQueryFilter:
product: str
source: ForexSource
currency_pairs: str
process_channel_id: str
processing_channel_id: str
5 changes: 5 additions & 0 deletions checkout_sdk/forex/forex_client.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from __future__ import absolute_import

from warnings import warn

from checkout_sdk.api_client import ApiClient
from checkout_sdk.authorization_type import AuthorizationType
from checkout_sdk.checkout_configuration import CheckoutConfiguration
Expand All @@ -18,6 +20,9 @@ def __init__(self, api_client: ApiClient, configuration: CheckoutConfiguration):
authorization_type=AuthorizationType.OAUTH)

def request_quote(self, quote_request: QuoteRequest):
# Deprecated: 2023-05-31 The /forex/quotes endpoint was removed from the API. Use get_rates instead.
warn('Deprecated: /forex/quotes endpoint was removed from the API. Use get_rates instead.',
DeprecationWarning, stacklevel=2)
return self._api_client.post(self.build_path(self.__FOREX_PATH, self.__QUOTES_PATH),
self._sdk_authorization(), quote_request)

Expand Down
7 changes: 7 additions & 0 deletions checkout_sdk/forward/forward.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,19 @@ class Headers:
encrypted: str = None


class ForwardKeyValue:
name: str
value: str


class DestinationRequest:
url: str
method: MethodType
headers: Headers
body: str
signature: DlocalSignature = None
query: list # ForwardKeyValue
variables: list # ForwardKeyValue


class NetworkToken:
Expand Down
22 changes: 22 additions & 0 deletions checkout_sdk/instruments/instruments.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ class CreateBankAccountInstrumentRequest(CreateInstrumentRequest):
bban: str
swift_bic: str
currency: Currency
country: Country
processing_channel_id: str
account_holder: AccountHolder
bank_details: BankDetails
Expand All @@ -67,6 +68,27 @@ def __init__(self):
super().__init__(InstrumentType.BANK_ACCOUNT)


class CreateCardInstrumentRequest(CreateInstrumentRequest):
number: str
expiry_month: int
expiry_year: int
network_token: str
processing_channel_id: str
entity_id: str
account_holder: AccountHolder

def __init__(self):
super().__init__(InstrumentType.CARD)


class CreateAchInstrumentRequest(CreateInstrumentRequest):
instrument_data: InstrumentData
account_holder: AccountHolder

def __init__(self):
super().__init__(InstrumentType.ACH)


# Update
class UpdateInstrumentRequest:
type: InstrumentType
Expand Down
45 changes: 44 additions & 1 deletion checkout_sdk/issuing/cards.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,19 @@ class CardLifetime:


class ShippingInstructions:
recipient_address: str
shipping_recipient: str
shipping_address: Address
additional_comment: str


class CardMetadata:
udf1: str
udf2: str
udf3: str
udf4: str
udf5: str


class CardRequest:
type: CardType
cardholder_id: str
Expand All @@ -43,6 +51,8 @@ class CardRequest:
card_product_id: str
display_name: str
activate_card: bool
metadata: CardMetadata
revocation_date: str

def __init__(self, type_p: CardType):
self.type = type_p
Expand All @@ -62,6 +72,39 @@ def __init__(self):
super().__init__(CardType.VIRTUAL)


class UpdateCardRequest:
reference: str
metadata: CardMetadata
expiry_month: int
expiry_year: int


class RenewCardRequest:
type: CardType
display_name: str
reference: str
metadata: CardMetadata

def __init__(self, type_p: CardType):
self.type = type_p


class PhysicalCardRenewRequest(RenewCardRequest):
shipping_instructions: ShippingInstructions

def __init__(self):
super().__init__(CardType.PHYSICAL)


class VirtualCardRenewRequest(RenewCardRequest):
def __init__(self):
super().__init__(CardType.VIRTUAL)


class ScheduleCardRevocationRequest:
revocation_date: str


class SecurityPair:
question: str
answer: str
Expand Down
61 changes: 61 additions & 0 deletions checkout_sdk/issuing/controls.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
class ControlType(str, Enum):
VELOCITY_LIMIT = 'velocity_limit'
MCC_LIMIT = 'mcc_limit'
MID_LIMIT = 'mid_limit'


class VelocityWindowType(str, Enum):
Expand All @@ -18,6 +19,16 @@ class MccLimitType(str, Enum):
BLOCK = 'block'


class MidLimitType(str, Enum):
ALLOW = 'allow'
BLOCK = 'block'


class FailIfType(str, Enum):
ALL_FAIL = 'all_fail'
ANY_FAIL = 'any_fail'


class VelocityWindow:
type: VelocityWindowType

Expand All @@ -26,13 +37,19 @@ class VelocityLimit:
amount_limit: int
velocity_window: VelocityWindow
mcc_list: list # str
mid_list: list # str


class MccLimit:
type: MccLimitType
mcc_list: list # str


class MidLimit:
type: MidLimitType
mid_list: list # str


class CardControlRequest:
description: str
control_type: ControlType
Expand Down Expand Up @@ -64,3 +81,47 @@ class UpdateCardControlRequest:
description: str
velocity_limit: VelocityLimit
mcc_limit: MccLimit


class ControlGroupControl:
control_type: ControlType
description: str

def __init__(self, control_type: ControlType):
self.control_type = control_type


class MccControlGroupControl(ControlGroupControl):
mcc_limit: MccLimit

def __init__(self):
super().__init__(ControlType.MCC_LIMIT)


class MidControlGroupControl(ControlGroupControl):
mid_limit: MidLimit

def __init__(self):
super().__init__(ControlType.MID_LIMIT)


class VelocityControlGroupControl(ControlGroupControl):
velocity_limit: VelocityLimit

def __init__(self):
super().__init__(ControlType.VELOCITY_LIMIT)


class CreateControlGroupRequest:
target_id: str
fail_if: FailIfType
controls: list # ControlGroupControl
description: str


class ControlGroupQueryTarget:
target_id: str


class ControlProfileRequest:
name: str
Loading
Loading