diff --git a/Components/Services/Installments/InstallmentsRequestService.php b/Components/Services/Installments/InstallmentsRequestService.php index 45ede062..790d9f2e 100644 --- a/Components/Services/Installments/InstallmentsRequestService.php +++ b/Components/Services/Installments/InstallmentsRequestService.php @@ -46,7 +46,7 @@ public function getList($productPrice) $financingRequest = new FinancingRequest(); $financingRequest->setFinancingCountryCode('DE'); $transactionAmount = new FinancingRequest\TransactionAmount(); - $transactionAmount->setValue($productPrice); + $transactionAmount->setValue($this->formatPrice($productPrice)); $transactionAmount->setCurrencyCode('EUR'); $financingRequest->setTransactionAmount($transactionAmount); @@ -64,4 +64,14 @@ public function getList($productPrice) return null; } } + + /** + * @param float|string $price + * + * @return float + */ + private function formatPrice($price) + { + return round((float) str_replace(',', '.', $price), 2); + } } diff --git a/PayPalBundle/Structs/Installments/FinancingRequest/TransactionAmount.php b/PayPalBundle/Structs/Installments/FinancingRequest/TransactionAmount.php index 79a7364c..dc2e6aaa 100644 --- a/PayPalBundle/Structs/Installments/FinancingRequest/TransactionAmount.php +++ b/PayPalBundle/Structs/Installments/FinancingRequest/TransactionAmount.php @@ -11,7 +11,7 @@ class TransactionAmount { /** - * @var float + * @var string */ private $value; @@ -21,7 +21,7 @@ class TransactionAmount private $currencyCode; /** - * @return float + * @return string */ public function getValue() { @@ -29,11 +29,11 @@ public function getValue() } /** - * @param float $value + * @param float|string $value */ public function setValue($value) { - $this->value = $value; + $this->value = (string) $value; } /** diff --git a/PayPalBundle/Structs/Payment/Transactions/ItemList/Item.php b/PayPalBundle/Structs/Payment/Transactions/ItemList/Item.php index 3b17ec59..f2f56364 100644 --- a/PayPalBundle/Structs/Payment/Transactions/ItemList/Item.php +++ b/PayPalBundle/Structs/Payment/Transactions/ItemList/Item.php @@ -97,7 +97,7 @@ public function getPrice() } /** - * @param float $price + * @param float|string $price */ public function setPrice($price) { diff --git a/Setup/Updater.php b/Setup/Updater.php index c33a0ba1..3469147e 100644 --- a/Setup/Updater.php +++ b/Setup/Updater.php @@ -78,18 +78,46 @@ private function updateTo103() private function updateTo110() { - $sql = 'ALTER TABLE `swag_payment_paypal_unified_settings_general` - ADD COLUMN `landing_page_type` VARCHAR(255); - UPDATE `swag_payment_paypal_unified_settings_general` SET `landing_page_type` = "Login";'; + if (!$this->checkIfColumnExist('swag_payment_paypal_unified_settings_general', 'landing_page_type')) { + $sql = 'ALTER TABLE `swag_payment_paypal_unified_settings_general` + ADD COLUMN `landing_page_type` VARCHAR(255); + UPDATE `swag_payment_paypal_unified_settings_general` + SET `landing_page_type` = "Login";'; - $this->connection->executeQuery($sql); + $this->connection->executeQuery($sql); + } } private function updateTo111() { - $sql = 'ALTER TABLE `swag_payment_paypal_unified_settings_general` - DROP COLUMN `logo_image`;'; + if ($this->checkIfColumnExist('swag_payment_paypal_unified_settings_general', 'logo_image')) { + $sql = 'ALTER TABLE `swag_payment_paypal_unified_settings_general` + DROP COLUMN `logo_image`;'; + + $this->connection->executeQuery($sql); + } + } + + /** + * Helper function to check if a column exists which is needed during update + * + * @param string $tableName + * @param string $columnName + * + * @return bool + */ + private function checkIfColumnExist($tableName, $columnName) + { + $sql = <<connection->executeQuery($sql, ['tableName' => $tableName, 'columnName' => $columnName])->fetchColumn(); - $this->connection->executeQuery($sql); + return $columnNameInDb === $columnName; } } diff --git a/plugin.xml b/plugin.xml index 1e30643f..28625bca 100644 --- a/plugin.xml +++ b/plugin.xml @@ -5,13 +5,26 @@ - 1.1.0 + 1.1.1 (c) by shopware AG MIT http://store.shopware.com shopware AG + + + PT-8708 - Obsoleten Code und Tabellenspalte entfernt; + PT-9564 - Kompatibilität mit Safari auf iOS und MacOS verbessert; + PT-9710 - Übertragung von Preisen zu PayPal verbessert; + + + PT-8708 - Removed obsolete code and table column; + PT-9564 - Improved compatibility with Safari on iOS and MacOS; + PT-9710 - Improved transmission of prices to PayPal; + + + PT-8708, PT-9707 - Die PayPal Experience Profile Logik wurde durch den Application Context ersetzt. Dadurch entfällt die Bildauswahl für das Logo auf der PayPal-Seite. Dies wird nun über das Händlerkonto bezogen;