diff --git a/composer.json b/composer.json
index 0e8e3cbf..a9947574 100644
--- a/composer.json
+++ b/composer.json
@@ -6,7 +6,7 @@
}
],
"description": "Official Shopware 6 Plugin to connect to Payment Service Provider Adyen",
- "version": "3.8.0",
+ "version": "3.8.1",
"type": "shopware-platform-plugin",
"license": "MIT",
"require": {
diff --git a/composer.lock b/composer.lock
index db4ec225..7a3ee328 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
- "content-hash": "c86de8ac7bf62232656d08f7445e54a9",
+ "content-hash": "703630cdfb7ef2d5dde3463934933eb1",
"packages": [
{
"name": "adyen/php-api-library",
@@ -152,16 +152,16 @@
},
{
"name": "aws/aws-sdk-php",
- "version": "3.247.1",
+ "version": "3.251.0",
"source": {
"type": "git",
"url": "https://github.com/aws/aws-sdk-php.git",
- "reference": "337e447997148b9e5024c2d0ae69618b1cbf80d6"
+ "reference": "ff9cc2d44675ebb74a5506b68e55c86b122fdf2f"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/337e447997148b9e5024c2d0ae69618b1cbf80d6",
- "reference": "337e447997148b9e5024c2d0ae69618b1cbf80d6",
+ "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/ff9cc2d44675ebb74a5506b68e55c86b122fdf2f",
+ "reference": "ff9cc2d44675ebb74a5506b68e55c86b122fdf2f",
"shasum": ""
},
"require": {
@@ -240,9 +240,9 @@
"support": {
"forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80",
"issues": "https://github.com/aws/aws-sdk-php/issues",
- "source": "https://github.com/aws/aws-sdk-php/tree/3.247.1"
+ "source": "https://github.com/aws/aws-sdk-php/tree/3.251.0"
},
- "time": "2022-11-22T19:23:34+00:00"
+ "time": "2022-11-30T19:19:28+00:00"
},
{
"name": "brick/math",
@@ -2482,16 +2482,16 @@
},
{
"name": "google/auth",
- "version": "v1.23.1",
+ "version": "v1.24.0",
"source": {
"type": "git",
"url": "https://github.com/googleapis/google-auth-library-php.git",
- "reference": "cb43cb8ccde76ace65ec40130a9e9c2a15ecfe17"
+ "reference": "1f8cff5aa324700d041efd2df1a0855112a2e7ae"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/googleapis/google-auth-library-php/zipball/cb43cb8ccde76ace65ec40130a9e9c2a15ecfe17",
- "reference": "cb43cb8ccde76ace65ec40130a9e9c2a15ecfe17",
+ "url": "https://api.github.com/repos/googleapis/google-auth-library-php/zipball/1f8cff5aa324700d041efd2df1a0855112a2e7ae",
+ "reference": "1f8cff5aa324700d041efd2df1a0855112a2e7ae",
"shasum": ""
},
"require": {
@@ -2506,8 +2506,8 @@
"guzzlehttp/promises": "0.1.1|^1.3",
"kelvinmo/simplejwt": "^0.2.5|^0.5.1",
"phpseclib/phpseclib": "^2.0.31",
- "phpspec/prophecy-phpunit": "^1.1",
- "phpunit/phpunit": "^7.5||^8.5",
+ "phpspec/prophecy-phpunit": "^1.1||^2.0",
+ "phpunit/phpunit": "^7.5||^9.0.0",
"sebastian/comparator": ">=1.2.3",
"squizlabs/php_codesniffer": "^3.5"
},
@@ -2534,9 +2534,9 @@
"support": {
"docs": "https://googleapis.github.io/google-auth-library-php/main/",
"issues": "https://github.com/googleapis/google-auth-library-php/issues",
- "source": "https://github.com/googleapis/google-auth-library-php/tree/v1.23.1"
+ "source": "https://github.com/googleapis/google-auth-library-php/tree/v1.24.0"
},
- "time": "2022-10-26T20:30:45+00:00"
+ "time": "2022-11-28T18:29:23+00:00"
},
{
"name": "google/cloud-core",
@@ -6646,16 +6646,16 @@
},
{
"name": "symfony/console",
- "version": "v5.4.15",
+ "version": "v5.4.16",
"source": {
"type": "git",
"url": "https://github.com/symfony/console.git",
- "reference": "ea59bb0edfaf9f28d18d8791410ee0355f317669"
+ "reference": "8e9b9c8dfb33af6057c94e1b44846bee700dc5ef"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/console/zipball/ea59bb0edfaf9f28d18d8791410ee0355f317669",
- "reference": "ea59bb0edfaf9f28d18d8791410ee0355f317669",
+ "url": "https://api.github.com/repos/symfony/console/zipball/8e9b9c8dfb33af6057c94e1b44846bee700dc5ef",
+ "reference": "8e9b9c8dfb33af6057c94e1b44846bee700dc5ef",
"shasum": ""
},
"require": {
@@ -6725,7 +6725,7 @@
"terminal"
],
"support": {
- "source": "https://github.com/symfony/console/tree/v5.4.15"
+ "source": "https://github.com/symfony/console/tree/v5.4.16"
},
"funding": [
{
@@ -6741,7 +6741,7 @@
"type": "tidelift"
}
],
- "time": "2022-10-26T21:41:52+00:00"
+ "time": "2022-11-25T14:09:27+00:00"
},
{
"name": "symfony/debug-bundle",
@@ -6824,16 +6824,16 @@
},
{
"name": "symfony/dependency-injection",
- "version": "v5.4.13",
+ "version": "v5.4.16",
"source": {
"type": "git",
"url": "https://github.com/symfony/dependency-injection.git",
- "reference": "24cf522668845391c0542bc1de496366072a6d0e"
+ "reference": "a93e1863500940780fc1235f52d54397be2d14b3"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/24cf522668845391c0542bc1de496366072a6d0e",
- "reference": "24cf522668845391c0542bc1de496366072a6d0e",
+ "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/a93e1863500940780fc1235f52d54397be2d14b3",
+ "reference": "a93e1863500940780fc1235f52d54397be2d14b3",
"shasum": ""
},
"require": {
@@ -6893,7 +6893,7 @@
"description": "Allows you to standardize and centralize the way objects are constructed in your application",
"homepage": "https://symfony.com",
"support": {
- "source": "https://github.com/symfony/dependency-injection/tree/v5.4.13"
+ "source": "https://github.com/symfony/dependency-injection/tree/v5.4.16"
},
"funding": [
{
@@ -6909,7 +6909,7 @@
"type": "tidelift"
}
],
- "time": "2022-08-30T19:10:13+00:00"
+ "time": "2022-11-25T07:33:13+00:00"
},
{
"name": "symfony/deprecation-contracts",
@@ -6980,16 +6980,16 @@
},
{
"name": "symfony/doctrine-messenger",
- "version": "v5.4.12",
+ "version": "v5.4.16",
"source": {
"type": "git",
"url": "https://github.com/symfony/doctrine-messenger.git",
- "reference": "7649a80e917b47c5072480a2d763c2422da239d2"
+ "reference": "e44bc95cf7f9ad34b7a993b9aaa93703e0bc35eb"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/doctrine-messenger/zipball/7649a80e917b47c5072480a2d763c2422da239d2",
- "reference": "7649a80e917b47c5072480a2d763c2422da239d2",
+ "url": "https://api.github.com/repos/symfony/doctrine-messenger/zipball/e44bc95cf7f9ad34b7a993b9aaa93703e0bc35eb",
+ "reference": "e44bc95cf7f9ad34b7a993b9aaa93703e0bc35eb",
"shasum": ""
},
"require": {
@@ -7033,7 +7033,7 @@
"description": "Symfony Doctrine Messenger Bridge",
"homepage": "https://symfony.com",
"support": {
- "source": "https://github.com/symfony/doctrine-messenger/tree/v5.4.12"
+ "source": "https://github.com/symfony/doctrine-messenger/tree/v5.4.16"
},
"funding": [
{
@@ -7049,7 +7049,7 @@
"type": "tidelift"
}
],
- "time": "2022-08-09T12:54:00+00:00"
+ "time": "2022-11-04T07:27:04+00:00"
},
{
"name": "symfony/dotenv",
@@ -7486,16 +7486,16 @@
},
{
"name": "symfony/framework-bundle",
- "version": "v5.4.14",
+ "version": "v5.4.16",
"source": {
"type": "git",
"url": "https://github.com/symfony/framework-bundle.git",
- "reference": "00ac4d7e31597f6a49759bd925d83fc87d4ade68"
+ "reference": "70bfb2e76b8d97b2b19058bd65046b4cc1f04e3d"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/framework-bundle/zipball/00ac4d7e31597f6a49759bd925d83fc87d4ade68",
- "reference": "00ac4d7e31597f6a49759bd925d83fc87d4ade68",
+ "url": "https://api.github.com/repos/symfony/framework-bundle/zipball/70bfb2e76b8d97b2b19058bd65046b4cc1f04e3d",
+ "reference": "70bfb2e76b8d97b2b19058bd65046b4cc1f04e3d",
"shasum": ""
},
"require": {
@@ -7617,7 +7617,7 @@
"description": "Provides a tight integration between Symfony components and the Symfony full-stack framework",
"homepage": "https://symfony.com",
"support": {
- "source": "https://github.com/symfony/framework-bundle/tree/v5.4.14"
+ "source": "https://github.com/symfony/framework-bundle/tree/v5.4.16"
},
"funding": [
{
@@ -7633,20 +7633,20 @@
"type": "tidelift"
}
],
- "time": "2022-10-07T08:01:20+00:00"
+ "time": "2022-11-25T14:26:10+00:00"
},
{
"name": "symfony/http-foundation",
- "version": "v5.4.15",
+ "version": "v5.4.16",
"source": {
"type": "git",
"url": "https://github.com/symfony/http-foundation.git",
- "reference": "75bd663ff2db90141bfb733682459d5bbe9e29c3"
+ "reference": "5032c5849aef24741e1970cb03511b0dd131d838"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/http-foundation/zipball/75bd663ff2db90141bfb733682459d5bbe9e29c3",
- "reference": "75bd663ff2db90141bfb733682459d5bbe9e29c3",
+ "url": "https://api.github.com/repos/symfony/http-foundation/zipball/5032c5849aef24741e1970cb03511b0dd131d838",
+ "reference": "5032c5849aef24741e1970cb03511b0dd131d838",
"shasum": ""
},
"require": {
@@ -7693,7 +7693,7 @@
"description": "Defines an object-oriented layer for the HTTP specification",
"homepage": "https://symfony.com",
"support": {
- "source": "https://github.com/symfony/http-foundation/tree/v5.4.15"
+ "source": "https://github.com/symfony/http-foundation/tree/v5.4.16"
},
"funding": [
{
@@ -7709,20 +7709,20 @@
"type": "tidelift"
}
],
- "time": "2022-10-12T09:43:19+00:00"
+ "time": "2022-11-07T08:06:40+00:00"
},
{
"name": "symfony/http-kernel",
- "version": "v5.4.15",
+ "version": "v5.4.16",
"source": {
"type": "git",
"url": "https://github.com/symfony/http-kernel.git",
- "reference": "fc63c8c3e1036d424820cc993a4ea163778dc5c7"
+ "reference": "b432c57c5de73634b1859093c1f58e3cd84455a1"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/http-kernel/zipball/fc63c8c3e1036d424820cc993a4ea163778dc5c7",
- "reference": "fc63c8c3e1036d424820cc993a4ea163778dc5c7",
+ "url": "https://api.github.com/repos/symfony/http-kernel/zipball/b432c57c5de73634b1859093c1f58e3cd84455a1",
+ "reference": "b432c57c5de73634b1859093c1f58e3cd84455a1",
"shasum": ""
},
"require": {
@@ -7805,7 +7805,7 @@
"description": "Provides a structured process for converting a Request into a Response",
"homepage": "https://symfony.com",
"support": {
- "source": "https://github.com/symfony/http-kernel/tree/v5.4.15"
+ "source": "https://github.com/symfony/http-kernel/tree/v5.4.16"
},
"funding": [
{
@@ -7821,7 +7821,7 @@
"type": "tidelift"
}
],
- "time": "2022-10-28T17:52:18+00:00"
+ "time": "2022-11-28T18:08:58+00:00"
},
{
"name": "symfony/inflector",
@@ -8065,16 +8065,16 @@
},
{
"name": "symfony/mailer",
- "version": "v5.4.15",
+ "version": "v5.4.16",
"source": {
"type": "git",
"url": "https://github.com/symfony/mailer.git",
- "reference": "926f4deddb60d40024e6058fd8f94e70e4024930"
+ "reference": "501ac1c388b18390547aa138253de2c5e44e931e"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/mailer/zipball/926f4deddb60d40024e6058fd8f94e70e4024930",
- "reference": "926f4deddb60d40024e6058fd8f94e70e4024930",
+ "url": "https://api.github.com/repos/symfony/mailer/zipball/501ac1c388b18390547aa138253de2c5e44e931e",
+ "reference": "501ac1c388b18390547aa138253de2c5e44e931e",
"shasum": ""
},
"require": {
@@ -8121,7 +8121,7 @@
"description": "Helps sending emails",
"homepage": "https://symfony.com",
"support": {
- "source": "https://github.com/symfony/mailer/tree/v5.4.15"
+ "source": "https://github.com/symfony/mailer/tree/v5.4.16"
},
"funding": [
{
@@ -8137,20 +8137,20 @@
"type": "tidelift"
}
],
- "time": "2022-10-27T07:55:40+00:00"
+ "time": "2022-11-04T07:37:26+00:00"
},
{
"name": "symfony/messenger",
- "version": "v5.4.14",
+ "version": "v5.4.16",
"source": {
"type": "git",
"url": "https://github.com/symfony/messenger.git",
- "reference": "de4b258a5551934460c422620b61cf0a35744f51"
+ "reference": "ead27c3bcb125799a249b430ca0540ee0b3a4504"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/messenger/zipball/de4b258a5551934460c422620b61cf0a35744f51",
- "reference": "de4b258a5551934460c422620b61cf0a35744f51",
+ "url": "https://api.github.com/repos/symfony/messenger/zipball/ead27c3bcb125799a249b430ca0540ee0b3a4504",
+ "reference": "ead27c3bcb125799a249b430ca0540ee0b3a4504",
"shasum": ""
},
"require": {
@@ -8211,7 +8211,7 @@
"description": "Helps applications send and receive messages to/from other applications or via message queues",
"homepage": "https://symfony.com",
"support": {
- "source": "https://github.com/symfony/messenger/tree/v5.4.14"
+ "source": "https://github.com/symfony/messenger/tree/v5.4.16"
},
"funding": [
{
@@ -8227,20 +8227,20 @@
"type": "tidelift"
}
],
- "time": "2022-10-10T09:32:54+00:00"
+ "time": "2022-11-14T10:09:38+00:00"
},
{
"name": "symfony/mime",
- "version": "v5.4.14",
+ "version": "v5.4.16",
"source": {
"type": "git",
"url": "https://github.com/symfony/mime.git",
- "reference": "1c118b253bb3495d81e95a6e3ec6c2766a98a0c4"
+ "reference": "46eeedb08f0832b1b61a84c612d945fc85ee4734"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/mime/zipball/1c118b253bb3495d81e95a6e3ec6c2766a98a0c4",
- "reference": "1c118b253bb3495d81e95a6e3ec6c2766a98a0c4",
+ "url": "https://api.github.com/repos/symfony/mime/zipball/46eeedb08f0832b1b61a84c612d945fc85ee4734",
+ "reference": "46eeedb08f0832b1b61a84c612d945fc85ee4734",
"shasum": ""
},
"require": {
@@ -8295,7 +8295,7 @@
"mime-type"
],
"support": {
- "source": "https://github.com/symfony/mime/tree/v5.4.14"
+ "source": "https://github.com/symfony/mime/tree/v5.4.16"
},
"funding": [
{
@@ -8311,7 +8311,7 @@
"type": "tidelift"
}
],
- "time": "2022-10-07T08:01:20+00:00"
+ "time": "2022-11-26T16:45:22+00:00"
},
{
"name": "symfony/monolog-bridge",
@@ -9499,16 +9499,16 @@
},
{
"name": "symfony/property-info",
- "version": "v5.4.15",
+ "version": "v5.4.16",
"source": {
"type": "git",
"url": "https://github.com/symfony/property-info.git",
- "reference": "3ef5e026a71a39345da241292c153979893033c2"
+ "reference": "9dd148c4fbfc231fa4bff00def8dc16a2cd89944"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/property-info/zipball/3ef5e026a71a39345da241292c153979893033c2",
- "reference": "3ef5e026a71a39345da241292c153979893033c2",
+ "url": "https://api.github.com/repos/symfony/property-info/zipball/9dd148c4fbfc231fa4bff00def8dc16a2cd89944",
+ "reference": "9dd148c4fbfc231fa4bff00def8dc16a2cd89944",
"shasum": ""
},
"require": {
@@ -9570,7 +9570,7 @@
"validator"
],
"support": {
- "source": "https://github.com/symfony/property-info/tree/v5.4.15"
+ "source": "https://github.com/symfony/property-info/tree/v5.4.16"
},
"funding": [
{
@@ -9586,7 +9586,7 @@
"type": "tidelift"
}
],
- "time": "2022-10-27T07:55:40+00:00"
+ "time": "2022-11-19T17:41:50+00:00"
},
{
"name": "symfony/proxy-manager-bridge",
@@ -10642,16 +10642,16 @@
},
{
"name": "symfony/twig-bridge",
- "version": "v5.4.14",
+ "version": "v5.4.16",
"source": {
"type": "git",
"url": "https://github.com/symfony/twig-bridge.git",
- "reference": "60db1cc3f5b098eb194c00a10489148a03861371"
+ "reference": "227d5030714c024bf4bc760b5762224070d4288c"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/twig-bridge/zipball/60db1cc3f5b098eb194c00a10489148a03861371",
- "reference": "60db1cc3f5b098eb194c00a10489148a03861371",
+ "url": "https://api.github.com/repos/symfony/twig-bridge/zipball/227d5030714c024bf4bc760b5762224070d4288c",
+ "reference": "227d5030714c024bf4bc760b5762224070d4288c",
"shasum": ""
},
"require": {
@@ -10743,7 +10743,7 @@
"description": "Provides integration for Twig with various Symfony components",
"homepage": "https://symfony.com",
"support": {
- "source": "https://github.com/symfony/twig-bridge/tree/v5.4.14"
+ "source": "https://github.com/symfony/twig-bridge/tree/v5.4.16"
},
"funding": [
{
@@ -10759,7 +10759,7 @@
"type": "tidelift"
}
],
- "time": "2022-10-11T12:49:22+00:00"
+ "time": "2022-11-04T07:37:26+00:00"
},
{
"name": "symfony/twig-bundle",
@@ -11127,16 +11127,16 @@
},
{
"name": "symfony/yaml",
- "version": "v5.4.14",
+ "version": "v5.4.16",
"source": {
"type": "git",
"url": "https://github.com/symfony/yaml.git",
- "reference": "e83fe9a72011f07c662da46a05603d66deeeb487"
+ "reference": "ebd37c71f62d5ec5f6e27de3e06fee492d4c6298"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/yaml/zipball/e83fe9a72011f07c662da46a05603d66deeeb487",
- "reference": "e83fe9a72011f07c662da46a05603d66deeeb487",
+ "url": "https://api.github.com/repos/symfony/yaml/zipball/ebd37c71f62d5ec5f6e27de3e06fee492d4c6298",
+ "reference": "ebd37c71f62d5ec5f6e27de3e06fee492d4c6298",
"shasum": ""
},
"require": {
@@ -11182,7 +11182,7 @@
"description": "Loads and dumps YAML files",
"homepage": "https://symfony.com",
"support": {
- "source": "https://github.com/symfony/yaml/tree/v5.4.14"
+ "source": "https://github.com/symfony/yaml/tree/v5.4.16"
},
"funding": [
{
@@ -11198,7 +11198,7 @@
"type": "tidelift"
}
],
- "time": "2022-10-03T15:15:50+00:00"
+ "time": "2022-11-25T16:04:03+00:00"
},
{
"name": "tecnickcom/tcpdf",
@@ -13411,5 +13411,5 @@
"ext-json": "*"
},
"platform-dev": [],
- "plugin-api-version": "2.2.0"
+ "plugin-api-version": "2.3.0"
}
diff --git a/src/Command/DisablePaymentMethodCommand.php b/src/Command/DisablePaymentMethodCommand.php
new file mode 100644
index 00000000..2bc3a674
--- /dev/null
+++ b/src/Command/DisablePaymentMethodCommand.php
@@ -0,0 +1,86 @@
+
+ */
+
+namespace Adyen\Shopware\Command;
+
+use Adyen\Shopware\Handlers\Command\DisablePaymentMethodHandler;
+use Symfony\Component\Console\Command\Command;
+use Symfony\Component\Console\Input\InputInterface;
+use Symfony\Component\Console\Input\InputOption;
+use Symfony\Component\Console\Output\OutputInterface;
+
+class DisablePaymentMethodCommand extends Command
+{
+ protected static $defaultName = 'adyen:payment-method:disable';
+
+ /**
+ * @var DisablePaymentMethodHandler
+ */
+ protected $handler;
+
+ public function __construct(DisablePaymentMethodHandler $handler)
+ {
+ parent::__construct();
+ $this->handler = $handler;
+ }
+
+ protected function configure()
+ {
+ $this->setDescription('Finds the payment method according to given PM handler and disables it');
+
+ $this->addOption(
+ 'all',
+ 'A',
+ InputOption::VALUE_NONE,
+ 'Disables all Adyen payment methods'
+ );
+
+ $this->addOption(
+ 'payment-method',
+ 'm',
+ InputOption::VALUE_REQUIRED,
+ 'Disables given Adyen payment method'
+ );
+ }
+
+ protected function execute(InputInterface $input, OutputInterface $output)
+ {
+ try {
+ $isAllSelected = $input->getOption('all');
+ $paymentMethodHandlerIdentifier = $input->getOption('payment-method');
+
+ if ($isAllSelected xor isset($paymentMethodHandlerIdentifier)) {
+ $this->handler->run($isAllSelected, $paymentMethodHandlerIdentifier);
+ $message = 'Payment method is disabled successfully.';
+ } else {
+ throw new \Exception('Invalid parameter! For usage please check manual --help.');
+ }
+ } catch (\Exception $e) {
+ $message = $e->getMessage();
+ }
+
+ $output->writeln($message);
+ return 0;
+ }
+}
diff --git a/src/Command/EnablePaymentMethodCommand.php b/src/Command/EnablePaymentMethodCommand.php
new file mode 100644
index 00000000..9b8199d8
--- /dev/null
+++ b/src/Command/EnablePaymentMethodCommand.php
@@ -0,0 +1,86 @@
+
+ */
+
+namespace Adyen\Shopware\Command;
+
+use Adyen\Shopware\Handlers\Command\EnablePaymentMethodHandler;
+use Symfony\Component\Console\Command\Command;
+use Symfony\Component\Console\Input\InputInterface;
+use Symfony\Component\Console\Input\InputOption;
+use Symfony\Component\Console\Output\OutputInterface;
+
+class EnablePaymentMethodCommand extends Command
+{
+ protected static $defaultName = 'adyen:payment-method:enable';
+
+ /**
+ * @var EnablePaymentMethodHandler
+ */
+ protected $handler;
+
+ public function __construct(EnablePaymentMethodHandler $handler)
+ {
+ parent::__construct();
+ $this->handler = $handler;
+ }
+
+ protected function configure()
+ {
+ $this->setDescription('Finds the payment method according to given PM handler and enables it');
+
+ $this->addOption(
+ 'all',
+ 'A',
+ InputOption::VALUE_NONE,
+ 'Enables all Adyen payment methods'
+ );
+
+ $this->addOption(
+ 'payment-method',
+ 'm',
+ InputOption::VALUE_REQUIRED,
+ 'Enables given Adyen payment method'
+ );
+ }
+
+ protected function execute(InputInterface $input, OutputInterface $output)
+ {
+ try {
+ $isAllSelected = $input->getOption('all');
+ $paymentMethodHandlerIdentifier = $input->getOption('payment-method');
+
+ if ($isAllSelected xor isset($paymentMethodHandlerIdentifier)) {
+ $this->handler->run($isAllSelected, $paymentMethodHandlerIdentifier);
+ $message = 'Payment method is enabled successfully.';
+ } else {
+ throw new \Exception('Invalid parameter! For usage please check manual --help.');
+ }
+ } catch (\Exception $e) {
+ $message = $e->getMessage();
+ }
+
+ $output->writeln($message);
+ return 0;
+ }
+}
diff --git a/src/Handlers/Command/DisablePaymentMethodHandler.php b/src/Handlers/Command/DisablePaymentMethodHandler.php
new file mode 100644
index 00000000..02bbb67f
--- /dev/null
+++ b/src/Handlers/Command/DisablePaymentMethodHandler.php
@@ -0,0 +1,112 @@
+
+ */
+
+namespace Adyen\Shopware\Handlers\Command;
+
+use Adyen\Shopware\Provider\AdyenPluginProvider;
+use Shopware\Core\Framework\Context;
+use Shopware\Core\Framework\DataAbstractionLayer\EntityRepositoryInterface;
+use Shopware\Core\Framework\DataAbstractionLayer\Search\Criteria;
+use Shopware\Core\Framework\DataAbstractionLayer\Search\Filter\ContainsFilter;
+use Shopware\Core\Framework\DataAbstractionLayer\Search\Filter\EqualsFilter;
+
+class DisablePaymentMethodHandler
+{
+ /**
+ * @var AdyenPluginProvider
+ */
+ private $adyenPluginProvider;
+
+ /**
+ * @var EntityRepositoryInterface
+ */
+ private $paymentMethodRepository;
+
+ /**
+ * @var EntityRepositoryInterface
+ */
+ private $salesChannelRepository;
+
+ /**
+ * @var EntityRepositoryInterface
+ */
+ private $salesChannelPaymentMethodRepository;
+
+ public function __construct(
+ AdyenPluginProvider $adyenPluginProvider,
+ EntityRepositoryInterface $paymentMethodRepository,
+ EntityRepositoryInterface $salesChannelRepository,
+ EntityRepositoryInterface $salesChannelPaymentMethodRepository
+ ) {
+ $this->adyenPluginProvider = $adyenPluginProvider;
+ $this->paymentMethodRepository = $paymentMethodRepository;
+ $this->salesChannelRepository = $salesChannelRepository;
+ $this->salesChannelPaymentMethodRepository = $salesChannelPaymentMethodRepository;
+ }
+
+ public function run(bool $isAll, ?string $paymentMethodHandlerIdentifier): void
+ {
+ $criteria = new Criteria();
+ $criteria->addFilter(
+ new EqualsFilter('pluginId', $this->adyenPluginProvider->getAdyenPluginId())
+ );
+ if (!$isAll) {
+ $criteria->addFilter(
+ new ContainsFilter('handlerIdentifier', $paymentMethodHandlerIdentifier)
+ );
+ }
+
+ $paymentMethods = $this->paymentMethodRepository
+ ->search($criteria, Context::createDefaultContext())
+ ->getEntities();
+
+ if (!count($paymentMethods->getElements())) {
+ throw new \Exception('No payment methods found!');
+ }
+
+ $criteria = new Criteria();
+ $salesChannels = $this->salesChannelRepository
+ ->searchIds($criteria, Context::createDefaultContext())
+ ->getData();
+
+ echo "Following payment methods will be disabled: \n";
+ foreach ($paymentMethods->getElements() as $paymentMethod) {
+ $paymentMethodName = $paymentMethod->getName();
+ echo "* $paymentMethodName \n";
+
+ foreach ($salesChannels as $salesChannel) {
+ $this->disablePaymentMethod($paymentMethod->getId(), $salesChannel['id']);
+ }
+ }
+ }
+
+ private function disablePaymentMethod(string $paymentMethodId, string $salesChannelId)
+ {
+ $this->salesChannelPaymentMethodRepository
+ ->delete(
+ [['paymentMethodId' => $paymentMethodId, 'salesChannelId' => $salesChannelId]],
+ Context::createDefaultContext()
+ );
+ }
+}
diff --git a/src/Handlers/Command/EnablePaymentMethodHandler.php b/src/Handlers/Command/EnablePaymentMethodHandler.php
new file mode 100644
index 00000000..3cf0da32
--- /dev/null
+++ b/src/Handlers/Command/EnablePaymentMethodHandler.php
@@ -0,0 +1,116 @@
+
+ */
+
+namespace Adyen\Shopware\Handlers\Command;
+
+use Adyen\Shopware\Provider\AdyenPluginProvider;
+use Shopware\Core\Framework\Context;
+use Shopware\Core\Framework\DataAbstractionLayer\EntityRepositoryInterface;
+use Shopware\Core\Framework\DataAbstractionLayer\Search\Criteria;
+use Shopware\Core\Framework\DataAbstractionLayer\Search\Filter\ContainsFilter;
+use Shopware\Core\Framework\DataAbstractionLayer\Search\Filter\EqualsFilter;
+
+class EnablePaymentMethodHandler
+{
+ /**
+ * @var AdyenPluginProvider
+ */
+ private $adyenPluginProvider;
+
+ /**
+ * @var EntityRepositoryInterface
+ */
+ private $paymentMethodRepository;
+
+ /**
+ * @var EntityRepositoryInterface
+ */
+ private $salesChannelRepository;
+
+ /**
+ * @var EntityRepositoryInterface
+ */
+ private $salesChannelPaymentMethodRepository;
+
+ public function __construct(
+ AdyenPluginProvider $adyenPluginProvider,
+ EntityRepositoryInterface $paymentMethodRepository,
+ EntityRepositoryInterface $salesChannelRepository,
+ EntityRepositoryInterface $salesChannelPaymentMethodRepository
+ ) {
+ $this->adyenPluginProvider = $adyenPluginProvider;
+ $this->paymentMethodRepository = $paymentMethodRepository;
+ $this->salesChannelRepository = $salesChannelRepository;
+ $this->salesChannelPaymentMethodRepository = $salesChannelPaymentMethodRepository;
+ }
+
+ public function run(bool $isAll, ?string $paymentMethodHandlerIdentifier): void
+ {
+ $criteria = new Criteria();
+ $criteria->addFilter(
+ new EqualsFilter('pluginId', $this->adyenPluginProvider->getAdyenPluginId())
+ );
+ if (!$isAll) {
+ $criteria->addFilter(
+ new ContainsFilter('handlerIdentifier', $paymentMethodHandlerIdentifier)
+ );
+ }
+
+ $paymentMethods = $this->paymentMethodRepository
+ ->search($criteria, Context::createDefaultContext())
+ ->getEntities();
+
+ if (!count($paymentMethods->getElements())) {
+ throw new \Exception('No payment methods found!');
+ }
+
+ $criteria = new Criteria();
+ $salesChannels = $this->salesChannelRepository
+ ->searchIds($criteria, Context::createDefaultContext())
+ ->getData();
+
+ echo "Following payment methods will be enabled: \n";
+ foreach ($paymentMethods->getElements() as $paymentMethod) {
+ $paymentMethodName = $paymentMethod->getName();
+ echo "* $paymentMethodName \n";
+
+ foreach ($salesChannels as $salesChannel) {
+ $this->enablePaymentMethod($paymentMethod->getId(), $salesChannel['id']);
+ }
+ }
+ }
+
+ private function enablePaymentMethod(string $paymentMethodId, string $salesChannelId)
+ {
+ $this->salesChannelPaymentMethodRepository->create(
+ [
+ [
+ 'salesChannelId' => $salesChannelId,
+ 'paymentMethodId' => $paymentMethodId
+ ]
+ ],
+ Context::createDefaultContext()
+ );
+ }
+}
diff --git a/src/Resources/app/storefront/src/checkout/confirm-order.plugin.js b/src/Resources/app/storefront/src/checkout/confirm-order.plugin.js
index b9b4c866..68ce201d 100644
--- a/src/Resources/app/storefront/src/checkout/confirm-order.plugin.js
+++ b/src/Resources/app/storefront/src/checkout/confirm-order.plugin.js
@@ -160,6 +160,9 @@ export default class ConfirmOrderPlugin extends Plugin {
const orderId = adyenCheckoutOptions.orderId;
let url = null;
let callback = null;
+ formData.set('affiliateCode', adyenCheckoutOptions.affiliateCode);
+ formData.set('campaignCode', adyenCheckoutOptions.campaignCode);
+
if (!!orderId) { //Only used if the order is being edited
formData.set('orderId', orderId);
url = adyenCheckoutOptions.updatePaymentUrl;
diff --git a/src/Resources/config/services.xml b/src/Resources/config/services.xml
index 385766ab..1787433f 100644
--- a/src/Resources/config/services.xml
+++ b/src/Resources/config/services.xml
@@ -13,6 +13,7 @@
+
@@ -67,16 +68,6 @@
id="Shopware\Core\Checkout\Order\Aggregate\OrderTransaction\OrderTransactionStateHandler"/>
-
-
-
-
-
-
-
-
-
-
diff --git a/src/Resources/config/services/commands.xml b/src/Resources/config/services/commands.xml
new file mode 100644
index 00000000..4230f2cd
--- /dev/null
+++ b/src/Resources/config/services/commands.xml
@@ -0,0 +1,60 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/Resources/views/storefront/page/checkout/confirm/confirm-payment.html.twig b/src/Resources/views/storefront/page/checkout/confirm/confirm-payment.html.twig
index c7b9c811..1d12e861 100644
--- a/src/Resources/views/storefront/page/checkout/confirm/confirm-payment.html.twig
+++ b/src/Resources/views/storefront/page/checkout/confirm/confirm-payment.html.twig
@@ -53,6 +53,8 @@
data-selected-payment-method-handler="{{ adyenFrontendData.selectedPaymentMethodHandler }}"
data-selected-payment-method-plugin-id="{{ adyenFrontendData.selectedPaymentMethodPluginId }}"
data-display-save-credit-card-option="{{ adyenFrontendData.displaySaveCreditCardOption }}"
+ data-affiliate-code="{{ adyenFrontendData.affiliateCode }}"
+ data-campaign-code="{{ adyenFrontendData.campaignCode }}"
>