diff --git a/CHANGELOG_de-DE.md b/CHANGELOG_de-DE.md index 6e7141e1..3e0ea255 100644 --- a/CHANGELOG_de-DE.md +++ b/CHANGELOG_de-DE.md @@ -1,3 +1,8 @@ +# 5.12.4 +* Verbesserung: Shopware-Bestellnummer wird nun in den Zahlungsdetails gespeichert, um das Tracking von Unzer Paylater-Zahlungen zu verbessern +* Fehlerbehebung: Zahlungsarten für Rechnung und Ratenzahlung wurden auf die neuen offiziellen Bezeichnungen aktualisiert (nur Deutsch). Betrifft nur Neuinstallationen +* Fehlerbehebung: In einigen Fällen wurde bei erfolgreichen Click-to-Pay-Zahlungen fälschlicherweise eine Fehlermeldung angezeigt + # 5.12.3 * Aktualisierung iDEAL Payment Naming diff --git a/CHANGELOG_en-GB.md b/CHANGELOG_en-GB.md index 8f2643a6..4d75f7c2 100644 --- a/CHANGELOG_en-GB.md +++ b/CHANGELOG_en-GB.md @@ -1,3 +1,8 @@ +# 5.12.4 +* Improvement: Save Shopware Order Number in payment details for Unzer Paylater payment tracking +* Fix: Changed payment method names for Invoice and Installment to the new official brands (German only). This will only affect new installs +* Fix: Sometimes Click to pay payments would display an error for succesfull payments. + # 5.12.3 * Updated iDEAL Payment naming diff --git a/composer.json b/composer.json index 305f927d..d76918c4 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "name": "unzerdev/shopware6", "description": "Unzer payment integration for Shopware 6", - "version": "5.12.3", + "version": "5.12.4", "type": "shopware-platform-plugin", "license": "Apache-2.0", "minimum-stability": "dev", @@ -21,7 +21,7 @@ }, "require": { "php": ">=8.1 || <=8.3", - "unzerdev/php-sdk": "~3.13.0", + "unzerdev/php-sdk": "~3.14.0", "shopware/core": "~6.5.0", "shopware/administration": "*", "shopware/storefront": "*" diff --git a/src/Components/PaymentHandler/AbstractUnzerPaymentHandler.php b/src/Components/PaymentHandler/AbstractUnzerPaymentHandler.php index 4aad7ac1..f47c2602 100755 --- a/src/Components/PaymentHandler/AbstractUnzerPaymentHandler.php +++ b/src/Components/PaymentHandler/AbstractUnzerPaymentHandler.php @@ -120,7 +120,8 @@ public function pay( $this->unzerClient = $this->clientFactory->createClientFromSalesChannelContext($salesChannelContext, $currentRequest); $this->unzerBasket = $this->basketHydrator->hydrateObject($salesChannelContext, $transaction); - $this->unzerMetadata = $this->metadataHydrator->hydrateObject($salesChannelContext, $transaction); + $orderTransaction = $this->fetchTransactionById($transaction->getOrderTransaction()->getId(), $salesChannelContext->getContext()); + $this->unzerMetadata = $this->metadataHydrator->hydrateObject($salesChannelContext, $orderTransaction); $this->metadataHydrator->setIsExpress($this->unzerMetadata, $this->isExpress); $this->unzerCustomer = $this->getUnzerCustomer($currentRequest->get('unzerCustomerId', ''), $transaction->getOrderTransaction()->getPaymentMethodId(), $transaction->getOrderTransaction(), $salesChannelContext); diff --git a/src/Components/PaymentHandler/Traits/CanAuthorize.php b/src/Components/PaymentHandler/Traits/CanAuthorize.php index c7ff0c25..eca63e6f 100644 --- a/src/Components/PaymentHandler/Traits/CanAuthorize.php +++ b/src/Components/PaymentHandler/Traits/CanAuthorize.php @@ -35,6 +35,9 @@ public function authorize( ); $authorization->setOrderId($this->unzerBasket->getOrderId()); + if (!empty($this->unzerMetadata) && !empty($this->unzerMetadata->getMetadata('shopwareOrderNumber'))) { + $authorization->setInvoiceId($this->unzerMetadata->getMetadata('shopwareOrderNumber')); + } $authorization->setCard3ds(true); if ($recurrenceType !== null) { diff --git a/src/Components/PaymentHandler/Traits/CanCharge.php b/src/Components/PaymentHandler/Traits/CanCharge.php index 3cf158b0..785019d5 100644 --- a/src/Components/PaymentHandler/Traits/CanCharge.php +++ b/src/Components/PaymentHandler/Traits/CanCharge.php @@ -38,6 +38,9 @@ public function charge( ); $charge->setOrderId($this->unzerBasket->getOrderId()); + if (!empty($this->unzerMetadata) && !empty($this->unzerMetadata->getMetadata('shopwareOrderNumber'))) { + $charge->setInvoiceId($this->unzerMetadata->getMetadata('shopwareOrderNumber')); + } $charge->setCard3ds(true); if ($recurrenceType !== null) { diff --git a/src/Components/PaymentHandler/UnzerPayPalPaymentHandler.php b/src/Components/PaymentHandler/UnzerPayPalPaymentHandler.php index 0b3f3887..9a8b9372 100644 --- a/src/Components/PaymentHandler/UnzerPayPalPaymentHandler.php +++ b/src/Components/PaymentHandler/UnzerPayPalPaymentHandler.php @@ -339,6 +339,7 @@ private function payExpress( $unzerClient->updateBasket($unzerBasket); $orderTransaction = $this->fetchTransactionById($transaction->getOrderTransaction()->getId(), $salesChannelContext->getContext()); + // this does implicitly update the customer object $this->getUnzerCustomer($payment->getCustomer()?->getId() ?? '', $transaction->getOrderTransaction()->getPaymentMethodId(), $orderTransaction, $salesChannelContext); @@ -348,6 +349,8 @@ private function payExpress( $unzerBasket->getCurrencyCode(), $transaction->getReturnUrl() ); + $authorization->setInvoiceId($orderTransaction->getOrder()->getOrderNumber()); + $authorization->setOrderId($orderTransaction->getId()); $unzerClient->updateAuthorization($payment->getId(), $authorization); } else { $charge = new Charge( @@ -355,6 +358,8 @@ private function payExpress( $unzerBasket->getCurrencyCode(), $transaction->getReturnUrl() ); + $charge->setInvoiceId($orderTransaction->getOrder()->getOrderNumber()); + $charge->setOrderId($orderTransaction->getId()); $unzerClient->updateCharge($payment->getId(), $charge); } $this->persistPaymentInformation( diff --git a/src/Components/PaymentHandler/UnzerWeroPaymentHandler.php b/src/Components/PaymentHandler/UnzerWeroPaymentHandler.php index c80da54d..d633d16e 100644 --- a/src/Components/PaymentHandler/UnzerWeroPaymentHandler.php +++ b/src/Components/PaymentHandler/UnzerWeroPaymentHandler.php @@ -21,6 +21,6 @@ protected function getUnzerPaymentTypeObject(): Wero protected function setBookingMode(): void { $this->bookingMode = BookingMode::CHARGE; - #$this->bookingMode = $this->pluginConfig->get(ConfigReader::CONFIG_KEY_BOOKING_MODE_WERO, BookingMode::CHARGE); + // $this->bookingMode = $this->pluginConfig->get(ConfigReader::CONFIG_KEY_BOOKING_MODE_WERO, BookingMode::CHARGE); } } diff --git a/src/Components/PaymentTransitionMapper/CreditCardTransitionMapper.php b/src/Components/PaymentTransitionMapper/CreditCardTransitionMapper.php index 46c299a7..4730f6a6 100644 --- a/src/Components/PaymentTransitionMapper/CreditCardTransitionMapper.php +++ b/src/Components/PaymentTransitionMapper/CreditCardTransitionMapper.php @@ -9,6 +9,7 @@ use UnzerPayment6\Components\PaymentTransitionMapper\Traits\IsBasicPaymentMethodTransitionMapperWithBookingMode; use UnzerSDK\Resources\PaymentTypes\BasePaymentType; use UnzerSDK\Resources\PaymentTypes\Card; +use UnzerSDK\Resources\PaymentTypes\Clicktopay; class CreditCardTransitionMapper extends AbstractTransitionMapper { @@ -19,7 +20,7 @@ class CreditCardTransitionMapper extends AbstractTransitionMapper public function supports(BasePaymentType $paymentType): bool { - return $paymentType instanceof Card; + return $paymentType instanceof Card || $paymentType instanceof Clicktopay; } protected function getResourceName(): string diff --git a/src/Components/ResourceHydrator/MetadataResourceHydrator.php b/src/Components/ResourceHydrator/MetadataResourceHydrator.php index f5580cd8..3e516a2e 100755 --- a/src/Components/ResourceHydrator/MetadataResourceHydrator.php +++ b/src/Components/ResourceHydrator/MetadataResourceHydrator.php @@ -4,6 +4,8 @@ namespace UnzerPayment6\Components\ResourceHydrator; +use Shopware\Core\Checkout\Order\Aggregate\OrderTransaction\OrderTransactionEntity; +use Shopware\Core\Checkout\Order\OrderEntity; use Shopware\Core\Framework\Context; use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository; use Shopware\Core\Framework\DataAbstractionLayer\Search\Criteria; @@ -43,6 +45,10 @@ public function hydrateObject( $unzerMetadata->setShopVersion($this->shopwareVersion); $unzerMetadata->addMetadata('pluginType', 'unzerdev/shopware6'); + if ($transaction instanceof OrderTransactionEntity && $transaction->getOrder() instanceof OrderEntity) { + $unzerMetadata->addMetadata('shopwareOrderNumber', $transaction->getOrder()->getOrderNumber()); + } + if ($pluginData !== null) { $unzerMetadata->addMetadata('pluginVersion', $pluginData->getVersion()); } diff --git a/src/Installer/PaymentInstaller.php b/src/Installer/PaymentInstaller.php index 64640348..b164bf60 100755 --- a/src/Installer/PaymentInstaller.php +++ b/src/Installer/PaymentInstaller.php @@ -174,12 +174,12 @@ class PaymentInstaller implements InstallerInterface 'technicalName' => 'unzer_installment', 'translations' => [ 'de-DE' => [ - 'name' => 'Ratenkauf', - 'description' => 'Unzer Ratenkauf', + 'name' => 'Ratenzahlung', + 'description' => 'Ratenzahlung mit Unzer payments', ], 'en-GB' => [ 'name' => 'Installment', - 'description' => 'Unzer Installment', + 'description' => 'Installment with Unzer payments', ], ], ], @@ -302,8 +302,8 @@ class PaymentInstaller implements InstallerInterface 'technicalName' => 'unzer_invoice', 'translations' => [ 'de-DE' => [ - 'name' => 'Rechnungskauf', - 'description' => 'Rechnungskauf mit Unzer payments', + 'name' => 'Rechnung', + 'description' => 'Zahlung auf Rechnung mit Unzer payments', ], 'en-GB' => [ 'name' => 'Invoice', diff --git a/src/Resources/app/administration/src/module/unzer-payment-configuration/page/unzer-payment-settings/unzer-payment-settings.html.twig b/src/Resources/app/administration/src/module/unzer-payment-configuration/page/unzer-payment-settings/unzer-payment-settings.html.twig index b89179d5..79212bb1 100644 --- a/src/Resources/app/administration/src/module/unzer-payment-configuration/page/unzer-payment-settings/unzer-payment-settings.html.twig +++ b/src/Resources/app/administration/src/module/unzer-payment-configuration/page/unzer-payment-settings/unzer-payment-settings.html.twig @@ -86,7 +86,9 @@ size="16px" :class="{'unzer-additional-keys__title-icon': true, 'is-expanded': isAdditionalKeysExpanded}" > - +
{ diff --git a/src/Resources/app/storefront/src/unzer/unzer-payment.apple-pay-v2.plugin.js b/src/Resources/app/storefront/src/unzer/unzer-payment.apple-pay-v2.plugin.js index 24e85ce8..892ae38e 100755 --- a/src/Resources/app/storefront/src/unzer/unzer-payment.apple-pay-v2.plugin.js +++ b/src/Resources/app/storefront/src/unzer/unzer-payment.apple-pay-v2.plugin.js @@ -17,21 +17,8 @@ export default class UnzerPaymentApplePayPlugin extends UnzerPaymentBaseParent { init() { super.init(); - if (this._hasCapability()) { - this._createForm(); - // this._registerEvents(); - this._hideBuyButton(); - } else { - this._disableApplePay(); - } - } - - _hasCapability() { - return ( - window.ApplePaySession && - window.ApplePaySession.canMakePayments() && - window.ApplePaySession.supportsVersion(6) - ); + this._createForm(); + this._hideBuyButton(); } _disableApplePay() { @@ -89,6 +76,7 @@ export default class UnzerPaymentApplePayPlugin extends UnzerPaymentBaseParent { }, }; } + /** * @private */ diff --git a/src/Resources/app/storefront/webpack.config.js b/src/Resources/app/storefront/webpack.config.js index 5dd306a0..b190949d 100644 --- a/src/Resources/app/storefront/webpack.config.js +++ b/src/Resources/app/storefront/webpack.config.js @@ -1,19 +1,41 @@ -const path = require("path") -const {resolve, join} = require("path"); +const path = require('path'); +const { resolve, join } = require('path'); module.exports = { mode: 'production', entry: './src/custom.js', output: { - path: path.resolve(__dirname, 'dist', 'storefront', 'js', 'unzer-payment6'), + path: path.resolve( + __dirname, + 'dist', + 'storefront', + 'js', + 'unzer-payment6' + ), filename: 'unzer-payment6.js', }, resolve: { extensions: ['.js'], alias: { - 'src': resolve( - join(__dirname, '..', '..', '..', '..', '..', '..', '..', 'vendor', 'shopware', 'storefront', 'Resources', 'app', 'storefront', 'src'), + src: resolve( + join( + __dirname, + '..', + '..', + '..', + '..', + '..', + '..', + '..', + 'vendor', + 'shopware', + 'storefront', + 'Resources', + 'app', + 'storefront', + 'src' + ) ), }, }, -} +};