Adapters
components.payment_gateway.subcomponents.cards.adapters.adyen ¶
helpers ¶
CARD_DELIVERY_STATUS_MAP
module-attribute
¶
CARD_DELIVERY_STATUS_MAP = {
"created": created,
"processing": pending,
"produced": pending,
"shipped": shipped,
"delivered": delivered,
"rejected": error,
}
CARD_DISPLAY_NAME_LIMIT
module-attribute
¶
The maximum length of the display name for a card. This is the value that we use for branded cards with vertical layout.
DELIVERY_CONTACT_LINE_WIDTH
module-attribute
¶
The maximum width of each line in the delivery contact address. This value was provided to us by Adyen.
PAYMENT_INSTRUMENT_STATUS_MAP
module-attribute
¶
PAYMENT_INSTRUMENT_STATUS_MAP = {
"Inactive": inactive,
"Active": active,
"Suspended": suspended,
"Closed": closed,
}
from_adyen_card_delivery_status ¶
Map Adyen CardOrderItemDeliveryStatus.status string to our own enum.
Returns None for ignored value.
Source code in components/payment_gateway/subcomponents/cards/adapters/adyen/helpers.py
from_adyen_payment_instrument_status ¶
Map Adyen PaymentInstrument.status string to our own enum.
Returns None for ignored value.
Source code in components/payment_gateway/subcomponents/cards/adapters/adyen/helpers.py
generate_card_password ¶
Utility to generate a deterministic password from a UUID and a salt.
This can be used to generate a lifetime 3DS password for a card.
We use SHA256 as a cryptographically secure hash function. The hash is computed on the concatenation of the UUID and the salt, and we extract the first 8 decimal digits of the hash as the password.
Source code in components/payment_gateway/subcomponents/cards/adapters/adyen/helpers.py
get_short_name ¶
Returns a shortened version of the full name by abbreviating the middle names or truncating the last name if necessary.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
first_name
|
str
|
The first name. |
required |
last_name
|
str
|
The last name. |
required |
limit
|
int
|
The maximum length of the shortened name. |
required |
Returns:
| Type | Description |
|---|---|
str
|
The shortened name. |
Source code in components/payment_gateway/subcomponents/cards/adapters/adyen/helpers.py
get_short_names ¶
Returns a shortened version of the first and last names by abbreviating the middle names or truncating the last name if necessary.
Assumes that both parts will be joined by a single space, hence the sum of their lengths is kept under limit-1.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
first_name
|
str
|
The first name. |
required |
last_name
|
str
|
The last name. |
required |
limit
|
int
|
The maximum length of the shortened name. |
required |
Returns:
| Type | Description |
|---|---|
tuple[str, str]
|
A tuple containing the shortened first and last names. |
Source code in components/payment_gateway/subcomponents/cards/adapters/adyen/helpers.py
remove_accents ¶
to_adyen_payment_instrument_info ¶
to_adyen_payment_instrument_info(
configuration,
card_holder,
account,
form_factor,
phone_number,
email,
shipment_info,
password,
description=None,
reference=None,
)
Convert our card holder model into an Adyen PaymentInstrumentInfo for API creation calls.
shipment_info MUST be provided for physical cards.
Source code in components/payment_gateway/subcomponents/cards/adapters/adyen/helpers.py
topic_subscribers ¶
CardOrderTopicSubscriber ¶
Bases: Subscriber
This class subscribes to the Adyen card order topic messages and forwards them to the card order tracking policy.
Source code in components/payment_gateway/subcomponents/cards/adapters/adyen/topic_subscribers.py
card_order_tracking_policy
instance-attribute
¶
receive ¶
Source code in components/payment_gateway/subcomponents/cards/adapters/adyen/topic_subscribers.py
PaymentInstrumentTopicSubscriber ¶
Bases: Subscriber
This class subscribes to the Adyen payment instrument topic messages and forwards update events to the card status handling policy.