From f68b429700d922b93801127b435ed4dd9f36149d Mon Sep 17 00:00:00 2001 From: carmenmaymo Date: Thu, 12 Sep 2024 10:39:57 +0200 Subject: [PATCH 1/4] Add birth from meta to fields in pay page PIWOO-521 --- .../PaymentFieldsStrategies/In3FieldsStrategy.php | 9 ++++++--- .../PaymentFieldsStrategies/RivertyFieldsStrategy.php | 10 +++++++--- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/PaymentMethods/PaymentFieldsStrategies/In3FieldsStrategy.php b/src/PaymentMethods/PaymentFieldsStrategies/In3FieldsStrategy.php index 3df76754..74d977f8 100644 --- a/src/PaymentMethods/PaymentFieldsStrategies/In3FieldsStrategy.php +++ b/src/PaymentMethods/PaymentFieldsStrategies/In3FieldsStrategy.php @@ -15,12 +15,14 @@ public function execute($gateway, $dataHelper) $showPhoneField = false; $isPhoneRequired = get_option('mollie_wc_is_phone_required_flag'); $phoneValue = false; + $birthValue = false; if (is_checkout_pay_page()) { $showBirthdateField = true; $showPhoneField = true; $order = $this->getOrderIdOnPayForOrderPage(); $phoneValue = $order->get_billing_phone(); + $birthValue = $order->get_meta('billing_birthdate'); } if (is_checkout() && !is_checkout_pay_page() && !$isPhoneRequired) { @@ -35,7 +37,7 @@ public function execute($gateway, $dataHelper) } if ($showBirthdateField) { - $this->dateOfBirth(); + $this->dateOfBirth($birthValue); } } @@ -46,15 +48,16 @@ protected function getOrderIdOnPayForOrderPage() return wc_get_order($orderId); } - protected function dateOfBirth() + protected function dateOfBirth($birthValue) { + $birthValue = $birthValue?: ''; ?>

getOrderIdOnPayForOrderPage(); $phoneValue = $order->get_billing_phone(); + $birthValue = $order->get_meta('billing_birthdate'); + } if (is_checkout() && !is_checkout_pay_page() && !$isPhoneRequired) { @@ -35,7 +38,7 @@ public function execute($gateway, $dataHelper) } if ($showBirthdateField) { - $this->dateOfBirth(); + $this->dateOfBirth($birthValue); } } @@ -46,15 +49,16 @@ protected function getOrderIdOnPayForOrderPage() return wc_get_order($orderId); } - protected function dateOfBirth() + protected function dateOfBirth($birthValue) { + $birthValue = $birthValue?: ''; ?>

Date: Thu, 12 Sep 2024 10:43:13 +0200 Subject: [PATCH 2/4] Fix cs PIWOO-521 --- .../PaymentFieldsStrategies/In3FieldsStrategy.php | 2 +- .../PaymentFieldsStrategies/RivertyFieldsStrategy.php | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/PaymentMethods/PaymentFieldsStrategies/In3FieldsStrategy.php b/src/PaymentMethods/PaymentFieldsStrategies/In3FieldsStrategy.php index 74d977f8..e8797705 100644 --- a/src/PaymentMethods/PaymentFieldsStrategies/In3FieldsStrategy.php +++ b/src/PaymentMethods/PaymentFieldsStrategies/In3FieldsStrategy.php @@ -50,7 +50,7 @@ protected function getOrderIdOnPayForOrderPage() protected function dateOfBirth($birthValue) { - $birthValue = $birthValue?: ''; + $birthValue = $birthValue ?: ''; ?>

- - - -

- query_vars['order-pay']); + return wc_get_order($orderId); + } + + protected function dateOfBirth($birthValue) + { + $birthValue = $birthValue ?: ''; + ?> +

+ + + +

+ query_vars['order-pay']); - return wc_get_order($orderId); - } - - protected function dateOfBirth($birthValue) - { - $birthValue = $birthValue ?: ''; - ?> -

- - - -

- Date: Mon, 16 Sep 2024 10:26:47 +0200 Subject: [PATCH 4/4] Fix CS --- src/PaymentMethods/PaymentFieldsStrategies/In3FieldsStrategy.php | 1 + .../PaymentFieldsStrategies/RivertyFieldsStrategy.php | 1 + 2 files changed, 2 insertions(+) diff --git a/src/PaymentMethods/PaymentFieldsStrategies/In3FieldsStrategy.php b/src/PaymentMethods/PaymentFieldsStrategies/In3FieldsStrategy.php index 709f261c..1e5d551d 100644 --- a/src/PaymentMethods/PaymentFieldsStrategies/In3FieldsStrategy.php +++ b/src/PaymentMethods/PaymentFieldsStrategies/In3FieldsStrategy.php @@ -7,6 +7,7 @@ class In3FieldsStrategy implements PaymentFieldsStrategyI { use PaymentFieldsStrategiesTrait; + const FIELD_BIRTHDATE = "billing_birthdate"; const FIELD_PHONE = "billing_phone_in3"; diff --git a/src/PaymentMethods/PaymentFieldsStrategies/RivertyFieldsStrategy.php b/src/PaymentMethods/PaymentFieldsStrategies/RivertyFieldsStrategy.php index 8b927ed7..c2138f24 100644 --- a/src/PaymentMethods/PaymentFieldsStrategies/RivertyFieldsStrategy.php +++ b/src/PaymentMethods/PaymentFieldsStrategies/RivertyFieldsStrategy.php @@ -7,6 +7,7 @@ class RivertyFieldsStrategy implements PaymentFieldsStrategyI { use PaymentFieldsStrategiesTrait; + const FIELD_BIRTHDATE = "billing_birthdate"; const FIELD_PHONE = "billing_phone_riverty";