diff --git a/CHANGELOG.md b/CHANGELOG.md index 7e69579..8a56aac 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +# 6.1.15 +- Fixed issue with shipping costs not being processed correctly + +# 6.1.14 +- Disable Recreate Cart for Headless Storefront Order +- Added the correct Exception Type to the finalize method + # 6.1.13 - Updated English documentation - Added French, German and Italian documentation diff --git a/CHANGELOG_de-DE.md b/CHANGELOG_de-DE.md index 7601b00..d490c5a 100644 --- a/CHANGELOG_de-DE.md +++ b/CHANGELOG_de-DE.md @@ -1,3 +1,10 @@ +# 6.1.15 +- Problem behoben, bei dem die Versandkosten nicht korrekt verarbeitet wurden + +# 6.1.14 +– Warenkorb neu erstellen für Headless Storefront Order deaktivieren +– Der korrekte Ausnahmetyp wurde zur Finalisierungsmethode hinzugefügt + # 6.1.13 – Englische Dokumentation aktualisiert – Französische, deutsche und italienische Dokumentation hinzugefügt diff --git a/README.md b/README.md index cebd85d..532362e 100644 --- a/README.md +++ b/README.md @@ -14,10 +14,10 @@ The VR Payment Payment Plugin integrates modern payment processing into Shopware ## Documentation -- For English documentation click [here](https://plugin-documentation.vr-payment.de/vr-payment/shopware-6/6.1.14/docs/en/documentation.html) -- Für die deutsche Dokumentation klicken Sie [hier](https://plugin-documentation.vr-payment.de/vr-payment/shopware-6/6.1.14/docs/de/documentation.html) -- Pour la documentation Française, cliquez [ici](https://plugin-documentation.vr-payment.de/vr-payment/shopware-6/6.1.14/docs/fr/documentation.html) -- Per la documentazione in tedesco, clicca [qui](https://plugin-documentation.vr-payment.de/vr-payment/shopware-6/6.1.14/docs/it/documentation.html) +- For English documentation click [here](@WalleeDocPath(/docs/en/documentation.html)) +- Für die deutsche Dokumentation klicken Sie [hier](@WalleeDocPath(/docs/de/documentation.html)) +- Pour la documentation Française, cliquez [ici](@WalleeDocPath(/docs/fr/documentation.html)) +- Per la documentazione in tedesco, clicca [qui](@WalleeDocPath(/docs/it/documentation.html)) ## Installation diff --git a/composer.json b/composer.json index 74efe27..c0ce698 100644 --- a/composer.json +++ b/composer.json @@ -59,5 +59,5 @@ "vrpayment/sdk": "^4.0.0" }, "type": "shopware-platform-plugin", - "version": "6.1.14" + "version": "6.1.15" } diff --git a/docs/de/documentation.html b/docs/de/documentation.html index ffd25d0..ed6b1ea 100644 --- a/docs/de/documentation.html +++ b/docs/de/documentation.html @@ -5,7 +5,7 @@ - + VR Payment Zahlungs-Plugin für Shopware 6 @@ -23,7 +23,7 @@
  • - + Source
  • @@ -185,7 +185,7 @@ php bin/console plugin:install --activate --clearCache VRPaymentPayment
    -

    Gehen Sie zu VR Payment und erstellen Sie ein Konto, falls Sie noch keines haben.

    +

    Gehen Sie zu VR Payment und erstellen Sie ein Konto, falls Sie noch keines haben.

    diff --git a/docs/en/documentation.html b/docs/en/documentation.html index 2bc5fb2..f7bdf11 100644 --- a/docs/en/documentation.html +++ b/docs/en/documentation.html @@ -5,7 +5,7 @@ - + VR Payment Shopware 6 Documentation @@ -23,7 +23,7 @@
  • - + Source
  • @@ -179,7 +179,7 @@ php bin/console plugin:install --activate --clearCache VRPaymentPayment
    -

    Go to VR Payment and create an Account if you do not already have one.

    +

    Go to VR Payment and create an Account if you do not already have one.

    diff --git a/docs/fr/documentation.html b/docs/fr/documentation.html index b52ef49..8cae0bf 100644 --- a/docs/fr/documentation.html +++ b/docs/fr/documentation.html @@ -5,7 +5,7 @@ - + Wallee Payment Plugin pour Shopware 6 @@ -23,7 +23,7 @@
  • - + Source
  • @@ -172,7 +172,7 @@ php bin/console plugin:install --activate --clearCache VRPaymentPayment
    -

    Allez sur VR Payment et créez un Compte si vous n’en avez pas déjà un

    +

    Allez sur hhttps://gateway.vr-payment.de/user/login[VR Payment] et créez un Compte si vous n’en avez pas déjà un

    diff --git a/docs/it/documentation.html b/docs/it/documentation.html index f605626..ab4930c 100644 --- a/docs/it/documentation.html +++ b/docs/it/documentation.html @@ -5,7 +5,7 @@ - + VR Payment Shopware 6 Documentation @@ -23,7 +23,7 @@
  • - + Source
  • @@ -179,7 +179,7 @@ php bin/console plugin:install --activate --clearCache VRPaymentPayment
    -

    Andate su VR Payment e create un account se non ne avete già uno.

    +

    Andate su VR Payment e create un account se non ne avete già uno.

    diff --git a/src/Core/Settings/Service/SettingsService.php b/src/Core/Settings/Service/SettingsService.php index 33c0c33..a307ea6 100644 --- a/src/Core/Settings/Service/SettingsService.php +++ b/src/Core/Settings/Service/SettingsService.php @@ -29,6 +29,31 @@ class SettingsService { public const CONFIG_STOREFRONT_WEBHOOKS_UPDATE_ENABLED = 'storefrontWebhooksUpdateEnabled'; public const CONFIG_STOREFRONT_PAYMENTS_UPDATE_ENABLED = 'storefrontPaymentsUpdateEnabled'; + /** + * List of config properties whose values allowed to be empty without triggering a warning in logger. + * + * This list is derived from testing of all config properties. The plugin fails only when either spaceId, userId, applicationKey and/or integration is empty. + * On top of that, spaceId, userId, applicationKey are marked as "required" input fields in admin interface. + * + * It is worth considering updating this list whenever a new config is introduced in settings. + * If new config is optional, left empty by design and not required for transactions to work, this list should be updated to avoid false-positive warnings. + * + * @var array + */ + private const ALLOWED_EMPTY_CONFIGS = [ + // Options + self::CONFIG_SPACE_VIEW_ID, + self::CONFIG_LINE_ITEM_CONSISTENCY_ENABLED, + self::CONFIG_EMAIL_ENABLED, + + // Storefront Options + self::CONFIG_STOREFRONT_INVOICE_DOWNLOAD_ENABLED, + + // Advanced Options + self::CONFIG_STOREFRONT_WEBHOOKS_UPDATE_ENABLED, + self::CONFIG_STOREFRONT_PAYMENTS_UPDATE_ENABLED + ]; + /** * @var \Shopware\Core\System\SystemConfig\SystemConfigService */ @@ -132,7 +157,13 @@ class SettingsService { if ($property === '') { continue; } - if (!is_numeric($value) && empty($value)) { + // Space view id is only numeric setting which can be 0. If it is, rest of the loop is skipped. + if ($property === self::CONFIG_SPACE_VIEW_ID && $value === 0) { + $propertyValuePairs[$property] = $value; + continue; + } + // Check if $value is empty and is not in the list of configs which are allowed to be empty + if (empty($value) && !in_array($property, self::ALLOWED_EMPTY_CONFIGS, true)) { $this->logger->warning(strtr('Empty value :value for settings :property.', [':property' => $property, ':value' => $value])); } $propertyValuePairs[$property] = $value; diff --git a/src/Core/Util/Analytics/Analytics.php b/src/Core/Util/Analytics/Analytics.php index f7ee765..cf2fd15 100644 --- a/src/Core/Util/Analytics/Analytics.php +++ b/src/Core/Util/Analytics/Analytics.php @@ -14,6 +14,7 @@ class Analytics { public const SHOP_SYSTEM = 'x-meta-shop-system'; public const SHOP_SYSTEM_VERSION = 'x-meta-shop-system-version'; public const SHOP_SYSTEM_AND_VERSION = 'x-meta-shop-system-and-version'; + public const PLUGIN_SYSTEM_VERSION = 'x-meta-plugin-version'; /** * @return array @@ -24,6 +25,7 @@ class Analytics { self::SHOP_SYSTEM => 'shopware', self::SHOP_SYSTEM_VERSION => '6', self::SHOP_SYSTEM_AND_VERSION => 'shopware-6', + self::PLUGIN_SYSTEM_VERSION => '6.1.15', ]; } diff --git a/src/Core/Util/Payload/TransactionPayload.php b/src/Core/Util/Payload/TransactionPayload.php index a9b21bb..8f9bc59 100644 --- a/src/Core/Util/Payload/TransactionPayload.php +++ b/src/Core/Util/Payload/TransactionPayload.php @@ -357,7 +357,9 @@ class TransactionPayload extends AbstractPayload */ protected function addOptionalLineItems(array &$lineItems): void { - if (count($this->transaction->getOrder()->getShippingCosts()->getCalculatedTaxes()) === 1) { + $shippingCosts = $this->transaction->getOrder()->getShippingCosts(); + + if ($shippingCosts && $this->transaction->getOrder()->getShippingTotal() > 0) { if ($shippingLineItem = $this->getShippingLineItem()) { $lineItems[] = $shippingLineItem; } @@ -619,12 +621,22 @@ class TransactionPayload extends AbstractPayload { $lineItem = null; - $lineItemPriceTotal = array_sum(array_map(static function (LineItemCreate $lineItem) { - return $lineItem->getAmountIncludingTax(); - }, $lineItems)); + // Calculate total of all current line items + $lineItemPriceTotal = array_sum(array_map(static fn(LineItemCreate $li) => $li->getAmountIncludingTax(), $lineItems)); - $adjustmentPrice = $this->transaction->getOrder()->getAmountTotal() - $lineItemPriceTotal; - $adjustmentPrice = self::round($adjustmentPrice); + $this->logger->debug("LineItem price total before adjustment: $lineItemPriceTotal"); + + // Get shipping total including taxes from the order + $shippingCosts = $this->transaction->getOrder()->getShippingCosts(); + $shippingTotal = $shippingCosts ? self::round($shippingCosts->getTotalPrice()) : 0.0; + + // Add shipping to the line items total if it's not already included + $hasShippingLineItem = array_filter($lineItems, static fn(LineItemCreate $li) => $li->getType() === LineItemType::SHIPPING); + if (!$hasShippingLineItem && $shippingTotal > 0) { + $lineItemPriceTotal += $shippingTotal; + } + + $adjustmentPrice = self::round($this->transaction->getOrder()->getAmountTotal() - $lineItemPriceTotal); if (abs($adjustmentPrice) != 0) { if ($this->settings->isLineItemConsistencyEnabled()) {