Skip to content

Commit

Permalink
Merge pull request #443 from Adyen/develop
Browse files Browse the repository at this point in the history
Release 3.14.3
  • Loading branch information
candemiralp authored Dec 20, 2023
2 parents e583daa + c59d4c9 commit dacfc11
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 18 deletions.
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.

0 comments on commit dacfc11

Please sign in to comment.