Reference
shared.services.payment_providers.revolut.entities ¶
CounterPartyInfo
dataclass
¶
RevolutBusinessAccountConfig
dataclass
¶
RevolutBusinessAccountConfig(
base_url,
api_credentials_secret_name,
private_key,
private_key_secret_name,
client_id,
issuer,
reimbursement_account_id=None,
)
RevolutBusinessAccountName ¶
RevolutBusinessAccountNamesAvailableByCountry ¶
prevoyance_france
class-attribute
instance-attribute
¶
RevolutPrevoyancePaymentAccount
dataclass
¶
This dataclass is storing the name of the env vars used to setup Revolut client. We introduced the model when we had to switch our Revolut business accounts from Alan SA to Alan Insurance.
Alan property is nullable as the bank account for Alan insurer was created immediately on Alan Insurance business account.
RevolutTransactionInfo
dataclass
¶
RevolutTransactionInfo(
id,
type,
request_id,
state,
created_at,
updated_at,
completed_at=None,
reason_code=None,
related_transaction_id=None,
reference=None,
legs=list(),
)
https://developer.revolut.com/docs/business/get-transaction#response ⧉
RevolutTransactionState ¶
Bases: AlanBaseEnum
Possible states for a payment transaction.
RevolutTransactionType ¶
Bases: AlanBaseEnum
Possible types for a payment transaction.
shared.services.payment_providers.revolut.errors ¶
PotentialSwiftError ¶
Bases: RevolutError
A special case of RevolutError. Raised when we think it may be fixable by resetting the SWIFT. Context: many calls to /counterparty fail because we supply the wrong SWIFT number. We don't get details from the 400 response from Revolut, but we want to communicate that it's possibly caused by a SWIFT problem.
Source code in shared/services/payment_providers/revolut/errors.py
RevolutError ¶
Bases: Exception
A generic revolut exception we should handle
Source code in shared/services/payment_providers/revolut/errors.py
RevolutInternalError ¶
Bases: RevolutError
Revolut issue, we can't act on it
Source code in shared/services/payment_providers/revolut/errors.py
RevolutNotAuthorizedError ¶
Bases: RevolutError
The access token is not valid.
We have a scheduled job running every 15 minutes to rotate the access token as it is valid for less than 1h. If the command failed to run for some reason, the token won't have been rotated, and will thus be expired / invalid.
Source code in shared/services/payment_providers/revolut/errors.py
RevolutNotFoundError ¶
Bases: RevolutError
Resource does not exist on Revolut, it is up to us to decide whether we take this error into account or not
Source code in shared/services/payment_providers/revolut/errors.py
RevolutParallelRequestsError ¶
shared.services.payment_providers.revolut.helpers ¶
EEA_COUNTRIES
module-attribute
¶
EEA_COUNTRIES = [
"AT",
"AX",
"BE",
"BG",
"CY",
"CZ",
"DE",
"DK",
"EA",
"EE",
"ES",
"FI",
"FR",
"GB",
"GF",
"GI",
"GP",
"GR",
"HR",
"HU",
"IC",
"IE",
"IT",
"LT",
"LU",
"LV",
"MF",
"MQ",
"MT",
"NL",
"PL",
"PT",
"RE",
"RO",
"SE",
"SI",
"SK",
"YT",
"NO",
"IS",
"LI",
"JE",
"GG",
"IM",
]
PREVOYANCE_BANK_ACCOUNT_CONFIG_MAPPING
module-attribute
¶
PREVOYANCE_BANK_ACCOUNT_CONFIG_MAPPING = {
alan_sa: RevolutPrevoyancePaymentAccount(
cnp="REVOLUT_PREVOYANCE_CNP_PAYMENT_ACCOUNT_ID",
lamie="REVOLUT_PREVOYANCE_LAMIE_PAYMENT_ACCOUNT_ID",
),
alan_insurance: RevolutPrevoyancePaymentAccount(
cnp="REVOLUT_ALAN_INSURANCE_PREVOYANCE_CNP_PAYMENT_ACCOUNT_ID",
lamie="REVOLUT_ALAN_INSURANCE_PREVOYANCE_LAMIE_PAYMENT_ACCOUNT_ID",
alan="REVOLUT_ALAN_INSURANCE_PREVOYANCE_ALAN_PAYMENT_ACCOUNT_ID",
),
}
get_revolut_config_from_business_account_name ¶
Source code in shared/services/payment_providers/revolut/helpers.py
is_reimbursement_transaction ¶
Check if a Revolut transaction is linked to Alan's Revolut reimbursement account
Source code in shared/services/payment_providers/revolut/helpers.py
shared.services.payment_providers.revolut.mixins ¶
Mixins for Revolut payment provider integration.
RevolutPaymentMixin ¶
Mixin for models that need to track Revolut payment information.
Provides fields for Revolut payment ID, refund ID, and business account.
revolut_business_account_name
class-attribute
instance-attribute
¶
revolut_business_account_name = mapped_column(
AlanBaseEnumTypeDecorator(RevolutBusinessAccountName),
nullable=False,
index=True,
server_default=alan_insurance,
)
revolut_payment_id
class-attribute
instance-attribute
¶
revolut_refund_id
class-attribute
instance-attribute
¶
validates_revolut_business_account_name
class-attribute
instance-attribute
¶
shared.services.payment_providers.revolut.noop_revolut_client ¶
NoopRevolutClient ¶
Revolut client that does nothing
get_supported_currency ¶
get_transaction_info ¶
Source code in shared/services/payment_providers/revolut/noop_revolut_client.py
pay ¶
pay(
request_id,
amount_in_cents,
recipient_first_name=None,
recipient_last_name=None,
recipient_company_name=None,
revolut_counterparty_id=None,
revolut_account_id=None,
ibancode=None,
swift=None,
country_iso=None,
address=None,
payment_description=None,
reimbursement_payment_id=None,
)
Source code in shared/services/payment_providers/revolut/noop_revolut_client.py
shared.services.payment_providers.revolut.revolut_client ¶
RevolutAuth ¶
Bases: AuthBase
Source code in shared/services/payment_providers/revolut/revolut_client.py
RevolutClient ¶
Source code in shared/services/payment_providers/revolut/revolut_client.py
REFUND_TRANSACTION_ENDPOINT
class-attribute
instance-attribute
¶
create_counterparty ¶
create_counterparty(
*,
recipient_company_name=None,
recipient_first_name=None,
recipient_last_name=None,
iban,
swift,
country_iso=None,
address,
reimbursement_payment_id=None
)
Create a new counterparty in Revolut https://developer.revolut.com/docs/business/add-counterparty ⧉
:param country_iso: Set by default to the IBAN first two characters. Must be overridden for countries like French Polynesia (=> PF). You can use IBANClient().get_iban_info(iban) to fetch it
Source code in shared/services/payment_providers/revolut/revolut_client.py
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 | |
get_refund_transactions ¶
Source code in shared/services/payment_providers/revolut/revolut_client.py
get_supported_currency ¶
get_transaction_info ¶
https://developer.revolut.com/docs/business/get-transaction ⧉
Source code in shared/services/payment_providers/revolut/revolut_client.py
pay ¶
pay(
*,
request_id,
amount_in_cents,
payment_description=None,
reimbursement_payment_id=None,
revolut_counterparty_id=None,
revolut_account_id=None,
recipient_first_name=None,
recipient_last_name=None,
recipient_company_name=None,
ibancode=None,
swift=None,
country_iso=None,
address=None
)
https://developer.revolut.com/docs/business/create-transfer ⧉
Trigger a payment using Revolut.
The payment will be sent to the recipient described by revolut_counterparty_id. If this is not specified, a new counterpary will be created from the recipient_* fields.