From bb99dea04dcb1efc741c19e21f6ae617a7b26707 Mon Sep 17 00:00:00 2001 From: Claudio Biselli Date: Thu, 19 Dec 2024 17:37:53 +0100 Subject: [PATCH 1/4] fallback on country if state is missing --- www/src/CPGraphQlTypes/Customer.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/www/src/CPGraphQlTypes/Customer.php b/www/src/CPGraphQlTypes/Customer.php index c9709a3431..b258eaa933 100644 --- a/www/src/CPGraphQlTypes/Customer.php +++ b/www/src/CPGraphQlTypes/Customer.php @@ -72,6 +72,11 @@ public function __construct(array $options) new DateTime($options['planRenewalDate']) : null; $this->next_wpt_plan_id = $options['nextWptPlanId'] ?? null; $this->address = null; + + if (!isset($options['creditCardBillingState']) && strlen(trim($options['creditCardBillingState'])) == 0) { + $options['creditCardBillingState'] = $options['creditCardBillingCountry']; + } + if ( isset($options['creditCardBillingCountry']) && isset($options['creditCardBillingZip']) && From d7838a47fa2e8a7ff516024eb02e02c3a78790c4 Mon Sep 17 00:00:00 2001 From: Claudio Biselli Date: Fri, 20 Dec 2024 14:00:50 +0100 Subject: [PATCH 2/4] fix --- www/src/CPGraphQlTypes/Customer.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/www/src/CPGraphQlTypes/Customer.php b/www/src/CPGraphQlTypes/Customer.php index b258eaa933..5b0c4fec1b 100644 --- a/www/src/CPGraphQlTypes/Customer.php +++ b/www/src/CPGraphQlTypes/Customer.php @@ -73,7 +73,7 @@ public function __construct(array $options) $this->next_wpt_plan_id = $options['nextWptPlanId'] ?? null; $this->address = null; - if (!isset($options['creditCardBillingState']) && strlen(trim($options['creditCardBillingState'])) == 0) { + if (!isset($options['creditCardBillingState']) || strlen(trim($options['creditCardBillingState'])) == 0) { $options['creditCardBillingState'] = $options['creditCardBillingCountry']; } From 717c914a970a58f81f795c0637f7c952501dac8c Mon Sep 17 00:00:00 2001 From: Leonardo Bartoli <142893024+lbartoli79@users.noreply.github.com> Date: Fri, 20 Dec 2024 15:55:46 +0100 Subject: [PATCH 3/4] Test fix --- tests/Handlers/AccountTest.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/Handlers/AccountTest.php b/tests/Handlers/AccountTest.php index 724b3a3a9a..a69639795b 100644 --- a/tests/Handlers/AccountTest.php +++ b/tests/Handlers/AccountTest.php @@ -798,7 +798,9 @@ public function testGetUpdatePaymentMethodAddressPage(): void 'subscriptionPrice' => 10.00, 'status' => 'ACTIVE', 'wptPlanName' => '', - 'monthlyRuns' => 8 + 'monthlyRuns' => 8, + 'creditCardBillingCountry' => 'US', + 'creditCardBillingState' => 'US' ]); $wpt_api_key_list = new ApiKeyList(); $paid_page_info = new PaidPageInfo($customer, $wpt_api_key_list); From 58939649672a293d9a2107951256a2d9e9705bd3 Mon Sep 17 00:00:00 2001 From: Leonardo Bartoli <142893024+lbartoli79@users.noreply.github.com> Date: Fri, 20 Dec 2024 16:01:31 +0100 Subject: [PATCH 4/4] Remove whitestace --- www/src/CPGraphQlTypes/Customer.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/www/src/CPGraphQlTypes/Customer.php b/www/src/CPGraphQlTypes/Customer.php index 5b0c4fec1b..e105773b33 100644 --- a/www/src/CPGraphQlTypes/Customer.php +++ b/www/src/CPGraphQlTypes/Customer.php @@ -74,9 +74,9 @@ public function __construct(array $options) $this->address = null; if (!isset($options['creditCardBillingState']) || strlen(trim($options['creditCardBillingState'])) == 0) { - $options['creditCardBillingState'] = $options['creditCardBillingCountry']; + $options['creditCardBillingState'] = $options['creditCardBillingCountry']; } - + if ( isset($options['creditCardBillingCountry']) && isset($options['creditCardBillingZip']) &&