Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 3.14.3 #443

Merged
merged 4 commits into from
Dec 20, 2023
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
}
],
"description": "Official Shopware 6 Plugin to connect to Payment Service Provider Adyen",
"version": "3.14.2",
"version": "3.14.3",
"type": "shopware-platform-plugin",
"license": "MIT",
"require": {
"shopware/core": "^6.4.0.0 || ^6.5.0.0",
"shopware/storefront": "^6.4.0.0 || ^6.5.0.0",
"adyen/php-api-library": "15.0.0",
"shopware/core": "~6.4.0 || ~6.5.0",
"shopware/storefront": "~6.4.0 || ~6.5.0",
"adyen/php-api-library": "^15.0.0",
"adyen/php-webhook-module": "0.8.0",
"ext-json": "*"
},
Expand Down
24 changes: 14 additions & 10 deletions src/AdyenPaymentShopware6.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,31 +50,25 @@

class AdyenPaymentShopware6 extends Plugin
{
public function build(ContainerBuilder $container): void
{
parent::build($container);
$this->installJsAssets($container->getParameter('kernel.shopware_version'));
}

public function installJsAssets($shopwareVersion)
{
$storefrontAssetPath = __DIR__ . '/Resources/app/storefront/dist/storefront/js/adyen-payment-shopware6.js';
$adminAssetPath = __DIR__ . '/Resources/public/administration/js/adyen-payment-shopware6.js';
if (\version_compare($shopwareVersion, '6.5.0.0', '<')) {
$resultStorefront = copy(
$resultStorefront = $this->safeCopyAsset(
__DIR__ . '/Resources/app/storefront/dist/storefront/js/adyen-payment-shopware64.js.dist',
$storefrontAssetPath
);
$resultAdmin = copy(
$resultAdmin = $this->safeCopyAsset(
__DIR__ . '/Resources/public/administration/js/adyen-payment-shopware64.js.dist',
$adminAssetPath
);
} else {
$resultStorefront = copy(
$resultStorefront = $this->safeCopyAsset(
__DIR__ . '/Resources/app/storefront/dist/storefront/js/adyen-payment-shopware65.js.dist',
$storefrontAssetPath
);
$resultAdmin = copy(
$resultAdmin = $this->safeCopyAsset(
__DIR__ . '/Resources/public/administration/js/adyen-payment-shopware64.js.dist',
$adminAssetPath
);
Expand Down Expand Up @@ -103,6 +97,7 @@ public function install(InstallContext $installContext): void

public function activate(ActivateContext $activateContext): void
{
$this->installJsAssets($activateContext->getCurrentShopwareVersion());
foreach (PaymentMethods\PaymentMethods::PAYMENT_METHODS as $paymentMethod) {
$this->setPaymentMethodIsActive(true, $activateContext->getContext(), new $paymentMethod());
}
Expand Down Expand Up @@ -568,6 +563,15 @@ private function updateTo3100(UpdateContext $updateContext): void
);
}
}

private function safeCopyAsset($source, $destination): bool
{
try {
return copy($source, $destination);
} catch (\Exception $e) {
return false;
}
}
}

if (file_exists(__DIR__ . '/../vendor/autoload.php')) {
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.