diff --git a/CHANGELOG.md b/CHANGELOG.md index ab92a0f..f2dfb16 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,12 @@ +# 7.0.1 +## Feature +- Add plugin version metric + +## Bugfix +- Fixed error message when refund amount exceeds total +- Fixed bug where only 25 sales channels showed in the dropdown +- Removed erroneous logs + # 7.0.0 - Compatibility with Shopware 6.7.0 diff --git a/CHANGELOG_de-DE.md b/CHANGELOG_de-DE.md index b984dfe..57e960f 100644 --- a/CHANGELOG_de-DE.md +++ b/CHANGELOG_de-DE.md @@ -1,3 +1,9 @@ +# 7.0.1 +- Plugin-Versionsmetrik hinzugefügt +- Fehlermeldung behoben, wenn der Rückerstattungsbetrag den Gesamtbetrag überschreitet +- Fehler behoben, bei dem nur 25 Vertriebskanäle in der Dropdown-Liste angezeigt wurden +- Fehlerhafte Protokolle entfernt + # 7.0.0 - Kompatibilität mit Shopware 6.7.0 diff --git a/README.md b/README.md index 697db8f..e4d10b1 100644 --- a/README.md +++ b/README.md @@ -13,10 +13,10 @@ Please note that this plugin is for versions 6.5, 6.6 or 6.7. For the 6.4 plugin ## Documentation -- For English documentation click [here](https://plugin-documentation.vr-payment.de/vr-payment/shopware-6/7.0.0/docs/en/documentation.html) -- Für die deutsche Dokumentation klicken Sie [hier](https://plugin-documentation.vr-payment.de/vr-payment/shopware-6/7.0.0/docs/de/documentation.html) -- Pour la documentation Française, cliquez [ici](https://plugin-documentation.vr-payment.de/vr-payment/shopware-6/7.0.0/docs/fr/documentation.html) -- Per la documentazione in tedesco, clicca [qui](https://plugin-documentation.vr-payment.de/vr-payment/shopware-6/7.0.0/docs/it/documentation.html) +- For English documentation click [here](https://docs.plugin-documentation.vr-payment.de/vr-payment/shopware-6/7.0.1/docs/en/documentation.html) +- Für die deutsche Dokumentation klicken Sie [hier](https://docs.plugin-documentation.vr-payment.de/vr-payment/shopware-6/7.0.1/docs/de/documentation.html) +- Pour la documentation Française, cliquez [ici](https://docs.plugin-documentation.vr-payment.de/vr-payment/shopware-6/7.0.1/docs/fr/documentation.html) +- Per la documentazione in tedesco, clicca [qui](https://docs.plugin-documentation.vr-payment.de/vr-payment/shopware-6/7.0.1/docs/it/documentation.html) ## Installation diff --git a/composer.json b/composer.json index 0db25e7..cb18b7a 100644 --- a/composer.json +++ b/composer.json @@ -59,5 +59,5 @@ "vrpayment/sdk": "^4.0.0" }, "type": "shopware-platform-plugin", - "version": "7.0.0" + "version": "7.0.1" } diff --git a/docs/de/documentation.html b/docs/de/documentation.html index ee8230f..4484d4a 100644 --- a/docs/de/documentation.html +++ b/docs/de/documentation.html @@ -23,7 +23,7 @@
  • - + Source
  • diff --git a/docs/en/documentation.html b/docs/en/documentation.html index 44f3ddb..8c4ae32 100644 --- a/docs/en/documentation.html +++ b/docs/en/documentation.html @@ -23,7 +23,7 @@
  • - + Source
  • diff --git a/docs/fr/documentation.html b/docs/fr/documentation.html index 5daf7d1..6e71948 100644 --- a/docs/fr/documentation.html +++ b/docs/fr/documentation.html @@ -23,7 +23,7 @@
  • - + Source
  • diff --git a/docs/it/documentation.html b/docs/it/documentation.html index 0101f44..ad1c991 100644 --- a/docs/it/documentation.html +++ b/docs/it/documentation.html @@ -23,7 +23,7 @@
  • - + Source
  • diff --git a/src/Core/Api/Refund/Controller/RefundController.php b/src/Core/Api/Refund/Controller/RefundController.php index 0133c85..b6b8661 100644 --- a/src/Core/Api/Refund/Controller/RefundController.php +++ b/src/Core/Api/Refund/Controller/RefundController.php @@ -115,7 +115,11 @@ class RefundController extends AbstractController $apiClient = $settings->getApiClient(); $transaction = $apiClient->getTransactionService()->read($settings->getSpaceId(), $transactionId); - $this->refundService->createRefundByAmount($transaction, $refundableAmount, $context); + $refund = $this->refundService->createRefundByAmount($transaction, $refundableAmount, $context); + + if ($refund === null) { + return new Response('refundExceedsAmount', Response::HTTP_BAD_REQUEST); + } return new Response(null, Response::HTTP_NO_CONTENT); } 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..474d11c 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 => '7.0.1', ]; } diff --git a/src/Resources/app/administration/src/module/vrpayment-order/component/vrpayment-order-action-refund-by-amount/index.js b/src/Resources/app/administration/src/module/vrpayment-order/component/vrpayment-order-action-refund-by-amount/index.js index 2a0e0ad..f11d712 100644 --- a/src/Resources/app/administration/src/module/vrpayment-order/component/vrpayment-order-action-refund-by-amount/index.js +++ b/src/Resources/app/administration/src/module/vrpayment-order/component/vrpayment-order-action-refund-by-amount/index.js @@ -70,9 +70,18 @@ Component.register('vrpayment-order-action-refund-by-amount', { }); }).catch((errorResponse) => { try { + var errorTitle; + var errorMessage; + if (errorResponse.response.data == 'refundExceedsAmount') { + errorTitle = this.$tc('vrpayment-order.refundAction.refundExceedsTotalError.title'); + errorMessage = this.$tc('vrpayment-order.refundAction.refundExceedsTotalError.messageRefundAmountExceedsAvailableBalance'); + } else { + errorTitle = errorResponse.response.data.errors[0].title; + errorMessage = errorResponse.response.data.errors[0].detail; + } this.createNotificationError({ - title: errorResponse.response.data.errors[0].title, - message: errorResponse.response.data.errors[0].detail, + title: errorTitle, + message: errorMessage, autoClose: false }); } catch (e) { diff --git a/src/Resources/app/administration/src/module/vrpayment-order/snippet/de-DE.json b/src/Resources/app/administration/src/module/vrpayment-order/snippet/de-DE.json index ecd1e48..d712fb1 100644 --- a/src/Resources/app/administration/src/module/vrpayment-order/snippet/de-DE.json +++ b/src/Resources/app/administration/src/module/vrpayment-order/snippet/de-DE.json @@ -77,7 +77,11 @@ "successMessage": "Ihre Rückerstattung war erfolgreich", "successTitle": "Erfolg", "maxAvailableItemsToRefund": "Maximal Verfügbare Artikel zum Erstatten", - "maxAvailableAmountToRefund": "Maximal verfügbarer Erstattungsbetrag" + "maxAvailableAmountToRefund": "Maximal verfügbarer Erstattungsbetrag", + "refundExceedsTotalError": { + "title": "Fehler beim Erstellen der Rückerstattung.", + "messageRefundAmountExceedsAvailableBalance": "Der Rückerstattungsbetrag übersteigt das verfügbare Guthaben." + } }, "transactionHistory": { "cardTitle": "Einzelheiten", diff --git a/src/Resources/app/administration/src/module/vrpayment-order/snippet/en-GB.json b/src/Resources/app/administration/src/module/vrpayment-order/snippet/en-GB.json index 8f3f943..370354c 100644 --- a/src/Resources/app/administration/src/module/vrpayment-order/snippet/en-GB.json +++ b/src/Resources/app/administration/src/module/vrpayment-order/snippet/en-GB.json @@ -78,7 +78,11 @@ "successMessage": "Your refund was successful.", "successTitle": "Success", "maxAvailableItemsToRefund": "Maximum available items to refund", - "maxAvailableAmountToRefund": "Maximum available amount to refund" + "maxAvailableAmountToRefund": "Maximum available amount to refund", + "refundExceedsTotalError": { + "title": "Error while creating the refund.", + "messageRefundAmountExceedsAvailableBalance": "Refund amount exceeds available balance." + } }, "transactionHistory": { "cardTitle": "Details", diff --git a/src/Resources/app/administration/src/module/vrpayment-order/snippet/fr-FR.json b/src/Resources/app/administration/src/module/vrpayment-order/snippet/fr-FR.json index 97688e3..b4e9f00 100644 --- a/src/Resources/app/administration/src/module/vrpayment-order/snippet/fr-FR.json +++ b/src/Resources/app/administration/src/module/vrpayment-order/snippet/fr-FR.json @@ -77,7 +77,11 @@ "successMessage": "Votre remboursement a été effectué avec succès.", "successTitle": "Succès", "maxAvailableItemsToRefund": "Nombre maximum d'articles disponibles pour le remboursement", - "maxAvailableAmountToRefund": "Montant maximal disponible pour le remboursement" + "maxAvailableAmountToRefund": "Montant maximal disponible pour le remboursement", + "refundExceedsTotalError": { + "title": "Erreur lors de la création du remboursement.", + "messageRefundAmountExceedsAvailableBalance": "Le montant du remboursement dépasse le solde disponible." + } }, "transactionHistory": { "cardTitle": "Détails", diff --git a/src/Resources/app/administration/src/module/vrpayment-order/snippet/it-IT.json b/src/Resources/app/administration/src/module/vrpayment-order/snippet/it-IT.json index 12d174b..12a9ac8 100644 --- a/src/Resources/app/administration/src/module/vrpayment-order/snippet/it-IT.json +++ b/src/Resources/app/administration/src/module/vrpayment-order/snippet/it-IT.json @@ -77,7 +77,11 @@ "successMessage": "Il tuo rimborso è andato a buon fine.", "successTitle": "Successo", "maxAvailableItemsToRefund": "Numero massimo di articoli disponibili da rimborsare", - "maxAvailableAmountToRefund": "Importo massimo disponibile per il rimborso" + "maxAvailableAmountToRefund": "Importo massimo disponibile per il rimborso", + "refundExceedsTotalError": { + "title": "Errore durante la creazione del rimborso.", + "messageRefundAmountExceedsAvailableBalance": "LL'importo del rimborso supera il saldo disponibile." + } }, "transactionHistory": { "cardTitle": "Dettagli", diff --git a/src/Resources/app/administration/src/module/vrpayment-settings/page/vrpayment-settings/index.html.twig b/src/Resources/app/administration/src/module/vrpayment-settings/page/vrpayment-settings/index.html.twig index a13b216..377d7a2 100644 --- a/src/Resources/app/administration/src/module/vrpayment-settings/page/vrpayment-settings/index.html.twig +++ b/src/Resources/app/administration/src/module/vrpayment-settings/page/vrpayment-settings/index.html.twig @@ -45,15 +45,15 @@ {% block vrpayment_settings_content_card_channel_config_sales_channel_card_title %} - - + {% endblock %} {% block vrpayment_settings_content_card_channel_config_sales_channel_card_footer %}