From 30c45e6f5ae8097f4427276e64069c2faa6a4330 Mon Sep 17 00:00:00 2001 From: julianajlk Date: Wed, 1 May 2024 19:56:39 -0400 Subject: [PATCH] refactor: handleRequestError DPM country not compatible --- src/payment/data/handleRequestError.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/payment/data/handleRequestError.js b/src/payment/data/handleRequestError.js index 5a2a0a9bd..4ac221542 100644 --- a/src/payment/data/handleRequestError.js +++ b/src/payment/data/handleRequestError.js @@ -85,9 +85,13 @@ export default function handleRequestError(error) { } // Country not DPM compatible - if (error.type === 'invalid_request_error' && ( - error.param === 'payment_method_data[billing_details][address][country]' || error.param === 'billing_details[address][state]' || error.param === 'billing_details[address][postal_code]' - )) { + const billingAddressErrors = [ + 'payment_method_data[billing_details][address][country]', + 'billing_details[address][state]', + 'billing_details[address][postal_code]', + ]; + + if (error.type === 'invalid_request_error' && billingAddressErrors.includes(error.param)) { logInfo('Dynamic Payment Method Country Error', error.param); handleApiErrors([ {