From 463d2df1da1df01398729f8fcfc1eb155aeace13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20M=C3=BCller?= Date: Fri, 29 Nov 2024 18:58:55 +0100 Subject: [PATCH] OX6-164 - Added separate checkbox for sending billing address as shipping address --- .../controllers/admin/fcpayone_main.php | 9 +++++++++ application/views/admin/de/fcPayOne_lang.php | 2 ++ application/views/admin/en/fcPayOne_lang.php | 2 ++ application/views/admin/tpl/fcpayone_main.tpl | 11 +++++++++++ extend/application/models/fcPayOneOrder.php | 18 +++++++++++++++++- lib/fcporequest.php | 4 ++-- 6 files changed, 43 insertions(+), 3 deletions(-) diff --git a/application/controllers/admin/fcpayone_main.php b/application/controllers/admin/fcpayone_main.php index c25b796..e9d8ec5 100755 --- a/application/controllers/admin/fcpayone_main.php +++ b/application/controllers/admin/fcpayone_main.php @@ -1155,4 +1155,13 @@ private function writeFile($filename, $content, $destinationPath) } } + public function isPayPalV2DelAddressActive() + { + $aConfBools = $this->fcpoGetConfBools(); + $sConfigOptionName = "blFCPOPayPalV2DelAddress"; + if (!isset($aConfBools[$sConfigOptionName]) || $aConfBools[$sConfigOptionName] === true) { + return true; + } + return false; + } } diff --git a/application/views/admin/de/fcPayOne_lang.php b/application/views/admin/de/fcPayOne_lang.php index ba7eb16..d6368ff 100755 --- a/application/views/admin/de/fcPayOne_lang.php +++ b/application/views/admin/de/fcPayOne_lang.php @@ -270,7 +270,9 @@ 'FCPO_EXPORT_CONFIG' => "Konfiguration exportieren", 'FCPO_PAYPAL_DELADDRESS' => 'Rechnungsadresse bei fehlender Lieferadresse als Lieferadresse übergeben.', + 'FCPO_PAYPALV2_DELADDRESS' => 'Rechnungsadresse bei fehlender Lieferadresse als Lieferadresse übergeben.', 'FCPO_HELP_PAYPAL_DELADDRESS' => 'Wird für den PayPal Verkäuferschutz benötigt.', + 'FCPO_HELP_PAYPALV2_DELADDRESS' => 'Wird für den PayPal Verkäuferschutz benötigt.', 'FCPO_PAYPAL_LOGOS' => 'Hier können Sie die verwendeten PayPal Express Logos hinterlegen.', 'FCPO_PAYPAL_LOGOS_ACTIVE' => 'Aktiv', 'FCPO_PAYPAL_LOGOS_LANG' => 'Sprache', diff --git a/application/views/admin/en/fcPayOne_lang.php b/application/views/admin/en/fcPayOne_lang.php index 202dc8b..851fa69 100644 --- a/application/views/admin/en/fcPayOne_lang.php +++ b/application/views/admin/en/fcPayOne_lang.php @@ -335,7 +335,9 @@ 'FCPO_EXPORT_CONFIG' => "Export configuration", 'FCPO_PAYPAL_DELADDRESS' => 'Transmit the billing-address as delivery-address if delivery-address is missing.', + 'FCPO_PAYPALV2_DELADDRESS' => 'Transmit the billing-address as delivery-address if delivery-address is missing.', 'FCPO_HELP_PAYPAL_DELADDRESS' => 'This is used for the PayPal seller protection.', + 'FCPO_HELP_PAYPALV2_DELADDRESS' => 'This is used for the PayPal seller protection.', 'FCPO_PAYPAL_LOGOS' => 'You can upload the PayPal Express logos here.', 'FCPO_PAYPAL_LOGOS_ACTIVE' => 'active', 'FCPO_PAYPAL_LOGOS_LANG' => 'language', diff --git a/application/views/admin/tpl/fcpayone_main.tpl b/application/views/admin/tpl/fcpayone_main.tpl index 9f69023..256e29e 100755 --- a/application/views/admin/tpl/fcpayone_main.tpl +++ b/application/views/admin/tpl/fcpayone_main.tpl @@ -541,6 +541,17 @@
fcpoIsLogoAdded()}] class="exp"[{/if}]> [{oxmultilang ident="FCPO_CONFIG_GROUP_PAYPALV2"}] +
+
+ + isPayPalV2DelAddressActive()}]checked[{/if}]> + [{oxinputhelp ident="FCPO_HELP_PAYPALV2_DELADDRESS"}] +
+
+ [{oxmultilang ident="FCPO_PAYPALV2_DELADDRESS"}] +
+
+
diff --git a/extend/application/models/fcPayOneOrder.php b/extend/application/models/fcPayOneOrder.php index b63152d..8d8e28a 100755 --- a/extend/application/models/fcPayOneOrder.php +++ b/extend/application/models/fcPayOneOrder.php @@ -1665,8 +1665,24 @@ public function fcIsPayPalOrder() $blReturn = false; if (in_array($this->oxorder__oxpaymenttype->value, [ 'fcpopaypal', - 'fcpopaypalv2', fcpopaypalhelper::PPE_EXPRESS, + ])) { + $blReturn = true; + } + return $blReturn; + } + + /** + * Method checks via current paymenttype is of payone paypal V2 type + * + * @param void + * @return boolean + */ + public function fcIsPayPalV2Order() + { + $blReturn = false; + if (in_array($this->oxorder__oxpaymenttype->value, [ + 'fcpopaypalv2', fcpopaypalhelper::PPE_V2_EXPRESS, ])) { $blReturn = true; diff --git a/lib/fcporequest.php b/lib/fcporequest.php index d885842..6ebe2ee 100755 --- a/lib/fcporequest.php +++ b/lib/fcporequest.php @@ -271,8 +271,8 @@ protected function setAuthorizationParameters($oOrder, $oUser, $aDynvalue, $sRef $blIsWalletTypePaymentWithDelAddress = ( $oOrder->oxorder__oxpaymenttype->value == 'fcpopaydirekt' || - $oOrder->fcIsPayPalOrder() === true && - $this->getConfig()->getConfigParam('blFCPOPayPalDelAddress') === true + ($oOrder->fcIsPayPalOrder() === true && $this->getConfig()->getConfigParam('blFCPOPayPalDelAddress') === true) || + ($oOrder->fcIsPayPalV2Order() === true && $this->getConfig()->getConfigParam('blFCPOPayPalV2DelAddress') === true) ); $blIsBNPLPayment = (