Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG_de-DE.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# 7.1.7
* Fix: Fehlende Übersetzungen neuer Zahlungsarten konnten nach einem Update im Frontend zu einer Fehlermeldung führen
* Fix: Dateien veralteter Zahlungsarten wurden nicht korrekt entfernt und konnten in einigen Fällen Probleme verursachen
* Optimierung: Umstellung auf Preloading der Zahlungskomponenten für ein besseres Checkout-Erlebnis
* Fix: Korrekte Fehlerbehandlung, wenn Kunden auf „Bezahlen“ klickten, bevor die Zahlungskomponente vollständig geladen war
* Optimierung: Caching von Schlüsselpaaren für ein schnelleres Laden der Zahlungskomponenten

# 7.1.6
* 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
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG_en-GB.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# 7.1.7
* Fix: Missing translation of new payment methods could display an error in Frontend after updating
* Fix: Files from deprecated payment methods was not properly removed and could in some cases create issues
* Optimizing: Switch to preloading of payment components for better checkout experience
* Fix: Correct error handling if customer clicked pay before payment component was fully loaded
* Optimizing: Cache of key pairs for faster loading payment components

# 7.1.6
* 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
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "unzerdev/shopware6",
"description": "Unzer payment integration for Shopware 6",
"version": "7.1.6",
"version": "7.1.7",
"type": "shopware-platform-plugin",
"license": "Apache-2.0",
"minimum-stability": "dev",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public function pay(
}
}

public static function fetchChannelId(Unzer $client): string
public static function fetchChannelId(Unzer $client, bool $cached = true): string
{
try {
$keyPair = $client->fetchKeyPair(true);
Expand Down
18 changes: 13 additions & 5 deletions src/Components/Storefront/ExtensionFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
namespace UnzerPayment6\Components\Storefront;

use Shopware\Core\System\SystemConfig\SystemConfigService;
use Symfony\Contracts\Cache\CacheInterface;
use Symfony\Contracts\Cache\ItemInterface;
use UnzerPayment6\Components\ClientFactory\ClientFactoryInterface;
use UnzerPayment6\Components\ConfigReader\ConfigReader;
use UnzerPayment6\Components\ConfigReader\ConfigReaderInterface;
Expand All @@ -20,7 +22,8 @@ class ExtensionFactory
public function __construct(
private readonly ConfigReaderInterface $configReader,
private readonly ClientFactoryInterface $clientFactory,
private readonly SystemConfigService $systemConfigService
private readonly SystemConfigService $systemConfigService,
private readonly CacheInterface $cache,
) {
}

Expand Down Expand Up @@ -62,11 +65,16 @@ private function readConfig(?string $salesChannelId = null): void
$this->configData = $this->configReader->read($salesChannelId);
}

private function fetchGooglePayChannelId($salesChannelId = null)
private function fetchGooglePayChannelId($salesChannelId = null, int $cacheTtl = 7200): string
{
$publicKey = $this->configData->get(ConfigReader::CONFIG_KEY_PUBLIC_KEY);
$client = $this->clientFactory->createClientFromPublicKey($publicKey, (string) $salesChannelId);
$cacheKey = 'UnzerGooglePayChannelId_' . ($salesChannelId ?? 'main');

return UnzerGooglePayPaymentHandler::fetchChannelId($client);
return $this->cache->get($cacheKey, function (ItemInterface $item) use ($salesChannelId, $cacheTtl) {
$item->expiresAfter($cacheTtl);
$publicKey = $this->configData->get(ConfigReader::CONFIG_KEY_PUBLIC_KEY);
$client = $this->clientFactory->createClientFromPublicKey($publicKey, (string) $salesChannelId);

return UnzerGooglePayPaymentHandler::fetchChannelId($client);
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
class UnzerDataPageExtension extends Struct
{
public const EXTENSION_NAME = 'unzerPaymentData';
public const JS_LIBRARY_URL = 'https://static-v2.unzer.com/v2/ui-components/index.js';

private string $publicKey;

Expand Down
8 changes: 0 additions & 8 deletions src/EventListeners/Checkout/ConfirmPageEventListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
use UnzerPayment6\Components\ConfigReader\KeyPairConfigReader;
use UnzerPayment6\Components\ExpressCheckout\ExpressCheckoutService;
use UnzerPayment6\Components\PaymentFrame\PaymentFrameFactoryInterface;
use UnzerPayment6\Components\PaymentHandler\UnzerGooglePayPaymentHandler;
use UnzerPayment6\Components\ResourceHydrator\CustomerResourceHydrator\CustomerResourceHydratorInterface;
use UnzerPayment6\Components\Storefront\ExtensionFactory;
use UnzerPayment6\Components\Struct\Configuration;
Expand Down Expand Up @@ -313,13 +312,6 @@ private function addGooglePayExtension(PageLoadedEvent $event): void
$event->getPage()->addExtension(GooglePayPageExtension::EXTENSION_NAME, $extension);
}

private function fetchGooglePayChannelId(PageLoadedEvent $event): string
{
$client = $this->clientFactory->createClientFromSalesChannelContext($event->getSalesChannelContext(), $event->getRequest());

return UnzerGooglePayPaymentHandler::fetchChannelId($client);
}

private function addPaylaterInstallmentExtension(PageLoadedEvent $event): void
{
$extension = new PaylaterInstallmentPageExtension();
Expand Down
4 changes: 2 additions & 2 deletions src/Installer/PaymentInstaller.php
Original file line number Diff line number Diff line change
Expand Up @@ -530,10 +530,10 @@ private function renameIdeal(Context $context): void
foreach ($existingPaymentMethod->getTranslations()->getElements() as $uniqueId => $translation) {
$newName = null;
$newDescription = null;
if (stripos($translation->getName(), 'wero') === false) {
if ($translation->getName() !== null && stripos($translation->getName(), 'wero') === false) {
$newName = str_replace('iDEAL', 'iDEAL | Wero', $translation->getName());
}
if (stripos($translation->getDescription(), 'wero') === false) {
if ($translation->getDescription() !== null && stripos($translation->getDescription(), 'wero') === false) {
$newDescription = str_replace('iDEAL', 'iDEAL | Wero', $translation->getDescription());
}

Expand Down
60 changes: 30 additions & 30 deletions src/Migration/Migration1605179799ForeignKeyChanges.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,37 +16,37 @@ public function getCreationTimestamp(): int

public function update(Connection $connection): void
{
//this is taken care of by Migration1612513284FixForeignKeyHandling
// this is taken care of by Migration1612513284FixForeignKeyHandling

// $transferInfoSql = $connection->fetchOne('SHOW KEYS FROM `unzer_payment_transfer_info` WHERE Key_name = "fk.heidelpay_transfer_info.transaction_id";');
//
// if (!$transferInfoSql) {
// $connection->executeStatement(
// <<<SQL
// ALTER TABLE unzer_payment_transfer_info
// DROP FOREIGN KEY `fk.heidelpay_transfer_info.transaction_id`,
// ADD CONSTRAINT `fk.unzer_payment_transfer_info.transaction_id`
// FOREIGN KEY (`transaction_id`)
// REFERENCES `order_transaction` (`id`)
// ON DELETE RESTRICT ON UPDATE CASCADE
//SQL
// );
// }
//
// $paymentDeviceResult = $connection->fetchOne('SHOW KEYS FROM `unzer_payment_payment_device` WHERE Key_name = "fk.heidelpay_payment_device.customer_id";');
//
// if (!$paymentDeviceResult) {
// $connection->executeStatement(
// <<<SQL
// ALTER TABLE unzer_payment_payment_device
// DROP FOREIGN KEY `fk.heidelpay_payment_device.customer_id`,
// ADD CONSTRAINT `fk.unzer_payment_payment_device.customer_id`
// FOREIGN KEY (`customer_id`)
// REFERENCES `customer` (`id`)
// ON DELETE RESTRICT ON UPDATE CASCADE
//SQL
// );
// }
// $transferInfoSql = $connection->fetchOne('SHOW KEYS FROM `unzer_payment_transfer_info` WHERE Key_name = "fk.heidelpay_transfer_info.transaction_id";');
//
// if (!$transferInfoSql) {
// $connection->executeStatement(
// <<<SQL
// ALTER TABLE unzer_payment_transfer_info
// DROP FOREIGN KEY `fk.heidelpay_transfer_info.transaction_id`,
// ADD CONSTRAINT `fk.unzer_payment_transfer_info.transaction_id`
// FOREIGN KEY (`transaction_id`)
// REFERENCES `order_transaction` (`id`)
// ON DELETE RESTRICT ON UPDATE CASCADE
// SQL
// );
// }
//
// $paymentDeviceResult = $connection->fetchOne('SHOW KEYS FROM `unzer_payment_payment_device` WHERE Key_name = "fk.heidelpay_payment_device.customer_id";');
//
// if (!$paymentDeviceResult) {
// $connection->executeStatement(
// <<<SQL
// ALTER TABLE unzer_payment_payment_device
// DROP FOREIGN KEY `fk.heidelpay_payment_device.customer_id`,
// ADD CONSTRAINT `fk.unzer_payment_payment_device.customer_id`
// FOREIGN KEY (`customer_id`)
// REFERENCES `customer` (`id`)
// ON DELETE RESTRICT ON UPDATE CASCADE
// SQL
// );
// }
}

public function updateDestructive(Connection $connection): void
Expand Down
20 changes: 10 additions & 10 deletions src/Migration/Migration1612513284FixForeignKeyHandling.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,23 +54,23 @@ private function migrateTransferInfo(Connection $connection): void

private function migratePaymentDevices(Connection $connection): void
{
$this->dropForeignKey($connection, 'unzer_payment_payment_device', 'fk.heidelpay_payment_device.customer_id');
$this->dropForeignKey($connection, 'unzer_payment_payment_device', 'fk.unzer_payment_payment_device.customer_id');
$this->dropIndex($connection, 'unzer_payment_payment_device', 'fk.heidelpay_payment_device.customer_id');
$this->dropForeignKey($connection, 'unzer_payment_payment_device', 'fk.heidelpay_payment_device.customer_id');
$this->dropForeignKey($connection, 'unzer_payment_payment_device', 'fk.unzer_payment_payment_device.customer_id');
$this->dropIndex($connection, 'unzer_payment_payment_device', 'fk.heidelpay_payment_device.customer_id');

try {
$connection->executeStatement(
<<<SQL
try {
$connection->executeStatement(
<<<SQL
ALTER TABLE unzer_payment_payment_device
ADD CONSTRAINT `fk.unzer_payment_payment_device.customer_id`
FOREIGN KEY (`customer_id`)
REFERENCES `customer` (`id`)
ON DELETE RESTRICT ON UPDATE CASCADE
SQL
);
} catch (\Throwable $t) {
// silentfail - already created
}
);
} catch (\Throwable $t) {
// silentfail - already created
}
}

private function dropForeignKey(Connection $connection, string $table, string $keyName): void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,4 +184,4 @@
</template>
{% endblock %}
</sw-page>
{% endblock %}
{% endblock %}
Original file line number Diff line number Diff line change
Expand Up @@ -160,11 +160,11 @@
}
}

.unzer-additional-keys__title{
.unzer-additional-keys__title-content{
flex-basis:100%;
.unzer-additional-keys__title {
.unzer-additional-keys__title-content {
flex-basis: 100%;
}
.unzer-additional-keys__title-icon{
.unzer-additional-keys__title-icon {
flex-basis: 32px;
}
}
}
Loading
Loading