Skip to content

components.payment_gateway.public.enums

This module defines all the common enums that don't belong to a specific subcomponent. It also exports all the public enums from all the subcomponents.

Classes

AccountStatus

Bases: AlanBaseEnum

Account status on the provider.

Note: Suspended is a special state that can only be set by the Payment Service Provider.

Allowed transitions (self-transitions are allowed):

stateDiagram-v2
    direction LR
    [*] --> Inactive
    Inactive --> Active
    Inactive --> Closed
    Active --> Inactive
    Active --> Closed
    Closed --> [*]
Hold "Alt" / "Option" to enable pan & zoom
Hold "Alt" / "Option" to enable pan & zoom

Attributes

active class-attribute instance-attribute
active = 'active'
closed class-attribute instance-attribute
closed = 'closed'
inactive class-attribute instance-attribute
inactive = 'inactive'
suspended class-attribute instance-attribute
suspended = 'suspended'

AuthorizationRequestStatus

Bases: AlanBaseEnum

Status of an authorization request throughout its lifecycle.

Attributes

active class-attribute instance-attribute
active = 'active'

Active on PSP side.

approved class-attribute instance-attribute
approved = 'approved'

Approved by the authorization relay.

complete class-attribute instance-attribute
complete = 'complete'

Completed on both sides.

declined class-attribute instance-attribute
declined = 'declined'

Declined by the authorization relay.

AuthorizationResult

Bases: AlanBaseEnum

Result of a transaction authorization.

Attributes

approved class-attribute instance-attribute
approved = 'approved'
declined class-attribute instance-attribute
declined = 'declined'

CardDeliveryStatus

Bases: AlanBaseEnum

Status of a card delivery.

Attributes

created class-attribute instance-attribute
created = 'created'
delivered class-attribute instance-attribute
delivered = 'delivered'
error class-attribute instance-attribute
error = 'error'
pending class-attribute instance-attribute
pending = 'pending'
shipped class-attribute instance-attribute
shipped = 'shipped'

CardFormFactor

Bases: AlanBaseEnum

Cards can be either physical or virtual.

Attributes

physical class-attribute instance-attribute
physical = 'physical'
virtual class-attribute instance-attribute
virtual = 'virtual'

CardStatus

Bases: AlanBaseEnum

Card status on the provider.

Allowed transitions (self-transitions are allowed):

stateDiagram-v2
    direction LR
    [*] --> Inactive
    Inactive --> Active
    Inactive --> Suspended
    Inactive --> Closed
    Active --> Suspended
    Active --> Closed
    Suspended --> Active
    Suspended --> Closed
    Closed --> [*]
Hold "Alt" / "Option" to enable pan & zoom
Hold "Alt" / "Option" to enable pan & zoom

Attributes

active class-attribute instance-attribute
active = 'active'
closed class-attribute instance-attribute
closed = 'closed'
inactive class-attribute instance-attribute
inactive = 'inactive'
suspended class-attribute instance-attribute
suspended = 'suspended'

CardSuspensionSource

Bases: AlanBaseEnum

Who initiated the suspension of a card.

Attributes

card_holder class-attribute instance-attribute
card_holder = 'card_holder'
care class-attribute instance-attribute
care = 'care'
provider class-attribute instance-attribute
provider = 'provider'

CountryCode

Bases: AlanBaseEnum

Country codes used throughout the payment gateway.

Attributes

BELGIUM class-attribute instance-attribute
BELGIUM = 'BE'
FRANCE class-attribute instance-attribute
FRANCE = 'FR'
NETHERLANDS class-attribute instance-attribute
NETHERLANDS = 'NL'
OTHER class-attribute instance-attribute
OTHER = 'OTHER'

For all other countries not listed above.

SPAIN class-attribute instance-attribute
SPAIN = 'ES'

Functions

from_country_name staticmethod
from_country_name(country_name)

Convert country name to CountryCode enum.

Source code in components/payment_gateway/public/enums.py
@staticmethod
def from_country_name(country_name: str) -> "CountryCode":
    """Convert country name to CountryCode enum."""
    match country_name.strip().upper():
        case "SPAIN":
            return CountryCode.SPAIN
        case "FRANCE":
            return CountryCode.FRANCE
        case "BELGIUM":
            return CountryCode.BELGIUM
        case "NETHERLANDS":
            return CountryCode.NETHERLANDS
        case _:
            return CountryCode.OTHER
from_iso_alpha2 staticmethod
from_iso_alpha2(code)

Convert ISO 3166-1 alpha-2 country code to CountryCode enum.

https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2 ⧉

Source code in components/payment_gateway/public/enums.py
@staticmethod
def from_iso_alpha2(
    code: str,
) -> "CountryCode":
    """Convert ISO 3166-1 alpha-2 country code to CountryCode enum.

    https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2
    """
    match code:
        case "ES":
            return CountryCode.SPAIN
        case "FR":
            return CountryCode.FRANCE
        case "BE":
            return CountryCode.BELGIUM
        case "NL":
            return CountryCode.NETHERLANDS
        case _:
            return CountryCode.OTHER
from_iso_alpha3 staticmethod
from_iso_alpha3(code)

Convert ISO 3166-1 alpha-3 country code to CountryCode enum.

https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3 ⧉

Source code in components/payment_gateway/public/enums.py
@staticmethod
def from_iso_alpha3(
    code: str,
) -> "CountryCode":
    """Convert ISO 3166-1 alpha-3 country code to CountryCode enum.

    https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3
    """
    match code:
        case "ESP":
            return CountryCode.SPAIN
        case "FRA":
            return CountryCode.FRANCE
        case "BEL":
            return CountryCode.BELGIUM
        case "NLD":
            return CountryCode.NETHERLANDS
        case _:
            return CountryCode.OTHER
to_country_name
to_country_name()

Convert CountryCode enum to country name.

Source code in components/payment_gateway/public/enums.py
def to_country_name(self) -> str:
    """Convert CountryCode enum to country name."""
    match self:
        case CountryCode.SPAIN:
            return "SPAIN"
        case CountryCode.FRANCE:
            return "FRANCE"
        case CountryCode.BELGIUM:
            return "BELGIUM"
        case CountryCode.NETHERLANDS:
            return "NETHERLANDS"
        case CountryCode.OTHER:
            return "XXX"
        case _:
            assert_never(self)  # Exhaustiveness check
to_iso_alpha2
to_iso_alpha2()

Convert CountryCode enum to ISO 3166-1 alpha-2 country code.

https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2 ⧉

Source code in components/payment_gateway/public/enums.py
def to_iso_alpha2(self) -> str:
    """Convert CountryCode enum to ISO 3166-1 alpha-2 country code.

    https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2
    """
    match self:
        case CountryCode.SPAIN:
            return "ES"
        case CountryCode.FRANCE:
            return "FR"
        case CountryCode.BELGIUM:
            return "BE"
        case CountryCode.NETHERLANDS:
            return "NL"
        case CountryCode.OTHER:
            return "XX"
        case _:
            assert_never(self)  # Exhaustiveness check
to_iso_alpha3
to_iso_alpha3()

Convert CountryCode enum to ISO 3166-1 alpha-3 country code.

https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3 ⧉

Source code in components/payment_gateway/public/enums.py
def to_iso_alpha3(self) -> str:
    """Convert CountryCode enum to ISO 3166-1 alpha-3 country code.

    https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3
    """
    match self:
        case CountryCode.SPAIN:
            return "ESP"
        case CountryCode.FRANCE:
            return "FRA"
        case CountryCode.BELGIUM:
            return "BEL"
        case CountryCode.NETHERLANDS:
            return "NLD"
        case CountryCode.OTHER:
            return "XXX"
        case _:
            assert_never(self)  # Exhaustiveness check

CurrencyCode

Bases: AlanBaseEnum

Currency codes used throughout the payment gateway.

Attributes

EUR class-attribute instance-attribute
EUR = 'EUR'
GBP class-attribute instance-attribute
GBP = 'GBP'
USD class-attribute instance-attribute
USD = 'USD'

ExpenseLimitPeriod

Bases: AlanBaseEnum

Period of time over which the expense limit amounts are aggregated.

Attributes

day class-attribute instance-attribute
day = 'day'

Expense limit amounts are aggregated on a daily basis.

month class-attribute instance-attribute
month = 'month'

Expense limit amounts are aggregated on a monthly basis.

ListMatch

Bases: AlanBaseEnum

Condition to apply when matching against a list of values.

Attributes

any class-attribute instance-attribute
any = 'any'

The rule applies if the payment matches any of the provided values.

none class-attribute instance-attribute
none = 'none'

The rule applies if the payment matches none of the provided values.

MCC

Bases: AlanBaseEnum

Merchant Category Code

Declare all the MCCs we support here. The enum names are from the Stripe MCC database.

Although there is no standard list of MCCs and each vendor provides their own list, there is a pretty large list of common MCC values that work everywhere for the most common merchant types.

Citing the Stripe documentation ⧉:

" A frustrating aspect of MCCs is that there is not one universally
accepted set of merchant category codes used by all entities and
organizations. That said, the category code ranges are consistent."

References: - Wikipedia: https://en.wikipedia.org/wiki/Merchant_category_code ⧉ - Visa: https://usa.visa.com/content/dam/VCOM/download/merchants/visa-merchant-data-standards-manual.pdf ⧉ - Stripe: https://stripe.com/docs/issuing/categories ⧉ - python-iso18245: https://github.com/jleclanche/python-iso18245 ⧉ This library provides a list of MCCs from the ISO 18245 standard in CSV format.

Note: The MCCs are four-digit strings and not integers because some values have leading zeros.

Attributes

automobile_rental_agencies class-attribute instance-attribute
automobile_rental_agencies = '7512'

7512 Automobile Rental Agencies

bakeries class-attribute instance-attribute
bakeries = '5462'

5462 Bakeries

bus_lines class-attribute instance-attribute
bus_lines = '4131'

4131 Bus Lines

candy_nut_and_confectionery_stores class-attribute instance-attribute
candy_nut_and_confectionery_stores = '5441'

5441 Candy, Nut, and Confectionery Stores

caterers class-attribute instance-attribute
caterers = '5811'

5811 Caterers

child_care_services class-attribute instance-attribute
child_care_services = '8351'

8351 Child Care Services

cigar_stores_and_stands class-attribute instance-attribute
cigar_stores_and_stands = '5993'

5993 Cigar Stores and Stands

commuter_transport_and_ferries class-attribute instance-attribute
commuter_transport_and_ferries = '4111'

4111 Commuter Transport, Ferries

dairy_products_stores class-attribute instance-attribute
dairy_products_stores = '5451'

5451 Dairy Products Stores

drinking_places class-attribute instance-attribute
drinking_places = '5813'

5813 Drinking Places

eating_places_restaurants class-attribute instance-attribute
eating_places_restaurants = '5812'

5812 Eating Places, Restaurants

fast_food_restaurants class-attribute instance-attribute
fast_food_restaurants = '5814'

5814 Fast Food Restaurants

grocery_stores_supermarkets class-attribute instance-attribute
grocery_stores_supermarkets = '5411'

5411 Grocery Stores, Supermarkets

miscellaneous_food_stores class-attribute instance-attribute
miscellaneous_food_stores = '5499'

5499 Miscellaneous Food Stores

miscellaneous_recreation_services class-attribute instance-attribute
miscellaneous_recreation_services = '7999'

7999 Miscellaneous Recreation Services

passenger_railways class-attribute instance-attribute
passenger_railways = '4112'

4112 Passenger Railways

taxicabs_limousines class-attribute instance-attribute
taxicabs_limousines = '4121'

4121 Taxicabs, Limousines

PaymentServiceProvider

Bases: AlanBaseEnum

Supported Payment Service Providers (PSPs) used throughout the Payment Gateway.

Attributes

adyen class-attribute instance-attribute
adyen = 'adyen'
jpmorgan class-attribute instance-attribute
jpmorgan = 'jpmorgan'
revolut class-attribute instance-attribute
revolut = 'revolut'
swan class-attribute instance-attribute
swan = 'swan'

PayoutBankTransferStatus

Bases: AlanBaseEnum

Status of a payout bank transfer.

Attributes

failed class-attribute instance-attribute
failed = 'failed'
pending class-attribute instance-attribute
pending = 'pending'
submission_failed class-attribute instance-attribute
submission_failed = 'submission_failed'
submitted class-attribute instance-attribute
submitted = 'submitted'
succeeded class-attribute instance-attribute
succeeded = 'succeeded'

ProcessingType

Bases: AlanBaseEnum

Method used to process a payment.

Attributes

atm_withdrawal class-attribute instance-attribute
atm_withdrawal = 'atm_withdrawal'
online class-attribute instance-attribute
online = 'online'
point_of_sale class-attribute instance-attribute
point_of_sale = 'point_of_sale'

ProvisioningType

Bases: AlanBaseEnum

Types of CardProvisioning

Attributes

card_on_file class-attribute instance-attribute
card_on_file = 'card_on_file'
in_app class-attribute instance-attribute
in_app = 'in_app'
manual class-attribute instance-attribute
manual = 'manual'
unknown class-attribute instance-attribute
unknown = 'unknown'

SepaBeneficiaryStatus

Bases: AlanBaseEnum

Attributes

cancelled class-attribute instance-attribute
cancelled = 'cancelled'
enabled class-attribute instance-attribute
enabled = 'enabled'

SepaMandateStatus

Bases: AlanBaseEnum

Attributes

cancelled class-attribute instance-attribute
cancelled = 'cancelled'
enabled class-attribute instance-attribute
enabled = 'enabled'
pending class-attribute instance-attribute
pending = 'pending'
rejected class-attribute instance-attribute
rejected = 'rejected'

TransferDirection

Bases: AlanBaseEnum

Direction of a bank or account transfer.

Attributes

INCOMING class-attribute instance-attribute
INCOMING = 'incoming'
OUTGOING class-attribute instance-attribute
OUTGOING = 'outgoing'

TransferUpdateTransferType

Bases: AlanBaseEnum

Types of transfers that can have updates.

Attributes

ACCOUNT class-attribute instance-attribute
ACCOUNT = 'account_transfer'
BANK class-attribute instance-attribute
BANK = 'bank_transfer'
CARD class-attribute instance-attribute
CARD = 'card_transfer'

WebhookLogTransferStatus

Bases: AlanBaseEnum

Defines the possible statuses of a webhook log transfer.

  • received: The transfer webhook event was correctly received from payment provider
  • ingested: The transfer webhook event was correctly parsed, and ingested in our system. But we could not route it to the appropriate transfer type / transfer_history
  • routed: Successfully ingested and routed the transfer webhook event

Attributes

ingested class-attribute instance-attribute
ingested = 'ingested'
received class-attribute instance-attribute
received = 'received'
routed class-attribute instance-attribute
routed = 'routed'

WebhookLogTransferType

Bases: AlanBaseEnum

Defines the possible types of a webhook log transfer.

  • internalTransfer: Transfer between two accounts
  • bankTransfer: Transfer between an account and a bank
  • payment: Payment made to a merchant

Attributes

bank_transfer class-attribute instance-attribute
bank_transfer = 'bankTransfer'
internalTransfer class-attribute instance-attribute
internalTransfer = 'internalTransfer'
payment class-attribute instance-attribute
payment = 'payment'

WebhookStatus

Bases: AlanBaseEnum

Processing status of an incoming webhook.

Attributes

ok class-attribute instance-attribute
ok = 'ok'
unknown_type class-attribute instance-attribute
unknown_type = 'unknown_type'
validation_error class-attribute instance-attribute
validation_error = 'validation_error'