Skip to content

Commit d3477af

Browse files
HelloAsso: retry without payer info for BadRequestException (400) (#857)
in addition to UnauthorizedException (403) I think HelloAsso probably changed its error code when the PayerInfo contains invalid data
1 parent 5988ab6 commit d3477af

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

app/core/payment/payment_tool.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from helloasso_python.api.paiements_api import PaiementsApi
99
from helloasso_python.api_client import ApiClient
1010
from helloasso_python.configuration import Configuration
11-
from helloasso_python.exceptions import UnauthorizedException
11+
from helloasso_python.exceptions import BadRequestException, UnauthorizedException
1212
from helloasso_python.models.hello_asso_api_v5_models_carts_checkout_payer import (
1313
HelloAssoApiV5ModelsCartsCheckoutPayer,
1414
)
@@ -196,7 +196,7 @@ async def init_checkout(
196196
self._helloasso_slug,
197197
init_checkout_body,
198198
)
199-
except UnauthorizedException:
199+
except (UnauthorizedException, BadRequestException):
200200
# We know that HelloAsso may refuse some payer infos, like using the firstname "test"
201201
# Even when prefilling the payer infos,the user will be able to edit them on the payment page,
202202
# so we can safely retry without the payer infos

0 commit comments

Comments
 (0)