From d10b86c55ff9a786d96d6d6db14f69ae14afaba9 Mon Sep 17 00:00:00 2001 From: rutgervandriel Date: Mon, 28 Nov 2022 14:50:53 +0100 Subject: [PATCH 1/2] Ensure that if PSP Reference is missing from response data or is empty, take the PSP Reference from the header instead --- Adyen/client.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/Adyen/client.py b/Adyen/client.py index 19a68804..9be956f0 100644 --- a/Adyen/client.py +++ b/Adyen/client.py @@ -632,9 +632,8 @@ def _handle_http_error(self, url, response_obj, status_code, psp_ref, headers=headers, error_code=response_obj.get("errorCode")) @staticmethod - def _get_psp(response, header): + def _get_psp(response, headers): psp_ref = response.get('pspReference') - if psp_ref == "": - return header.get('pspReference') - else: - return psp_ref + if not psp_ref: + psp_ref = headers.get('pspReference') + return psp_ref From dfd7edccc1276758b041236e83a3c7beabf105c2 Mon Sep 17 00:00:00 2001 From: Antoni Stroinski <55943882+antolo-arch@users.noreply.github.com> Date: Wed, 30 Nov 2022 09:24:55 +0100 Subject: [PATCH 2/2] Update client.py --- Adyen/client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Adyen/client.py b/Adyen/client.py index 9be956f0..f8c5e289 100644 --- a/Adyen/client.py +++ b/Adyen/client.py @@ -634,6 +634,6 @@ def _handle_http_error(self, url, response_obj, status_code, psp_ref, @staticmethod def _get_psp(response, headers): psp_ref = response.get('pspReference') - if not psp_ref: + if psp_ref is None: psp_ref = headers.get('pspReference') return psp_ref