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
9 changes: 9 additions & 0 deletions checkout_sdk/common/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -550,6 +550,8 @@ class AccountHolderIdentificationType(str, Enum):


class DocumentType(str, Enum):
"""Identity documents. The document type accepted when verifying a bank account is a
separate enum, InstrumentDocumentType, because the API keeps the two apart."""
PASSPORT = 'passport'
NATIONAL_IDENTITY_CARD = 'national_identity_card'
DRIVING_LICENSE = 'driving_license'
Expand All @@ -558,6 +560,13 @@ class DocumentType(str, Enum):
ELECTORAL_ID = 'electoral_id'


class InstrumentDocumentType(str, Enum):
"""The document type accepted by the legal document that verifies a bank account when
creating a payment instrument. The API accepts only bank_statement here, which is also the
default, and rejects the identity document types in DocumentType."""
BANK_STATEMENT = 'bank_statement'


class AccountChangeIndicatorType(str, Enum):
THIS_TRANSACTION = "this_transaction"
LESS_THAN_THIRTY_DAYS = "less_than_thirty_days"
Expand Down
19 changes: 19 additions & 0 deletions tests/accounts/instrument_document_type_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
from checkout_sdk.common.enums import DocumentType, InstrumentDocumentType


def test_should_expose_bank_statement_for_instrument_documents():
assert InstrumentDocumentType.BANK_STATEMENT == 'bank_statement'
assert InstrumentDocumentType.BANK_STATEMENT.value == 'bank_statement'


def test_should_be_the_only_accepted_instrument_document_type():
# The spec declares a single-value enum here, so anything else is a caller error rather
# than a value we forgot to add.
assert [d.value for d in InstrumentDocumentType] == ['bank_statement']


def test_should_keep_bank_statement_out_of_the_identity_document_type():
# bank_statement belongs to the instrument document enum, not the identity one. The API
# keeps them separate, and this is what stops the two being merged the next time someone
# reports the value as missing from DocumentType.
assert 'bank_statement' not in [d.value for d in DocumentType]
Loading