From 385c8c6ef1f86cdcb7603017b31f1edbc5184600 Mon Sep 17 00:00:00 2001 From: Raphael Michel Date: Fri, 22 Dec 2023 14:10:34 +0100 Subject: [PATCH] PayPal: Extend retry mechanism to POST and PATCH --- src/pretix/plugins/paypal2/client/core/paypal_http_client.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/pretix/plugins/paypal2/client/core/paypal_http_client.py b/src/pretix/plugins/paypal2/client/core/paypal_http_client.py index 5a63536a0..f3ae46abc 100644 --- a/src/pretix/plugins/paypal2/client/core/paypal_http_client.py +++ b/src/pretix/plugins/paypal2/client/core/paypal_http_client.py @@ -58,6 +58,9 @@ class PayPalHttpClient(VendorPayPalHttpClient): # with PayPal's system, where executing GET on the same order ID would only succeed # ~50% of the time, as if we were routed to inconsistent databases within PayPal. status_forcelist=[404, 500, 502, 503, 504], + # We also need to add non-idempotent methods since OrdersPatchRequest and OrdersCaptureRequest + # are also affected. Oof. Let's hope we're idempotent enough by setting PayPal-Request-Id. + allowed_methods=["HEAD", "GET", "PUT", "DELETE", "OPTIONS", "TRACE", "PATCH", "POST"], raise_on_status=False, ) self.session.mount('https://', HTTPAdapter(max_retries=retries))