diff --git a/Block/Adminhtml/Configuration/Index.php b/Block/Adminhtml/Configuration/Index.php
index 3c0c3dd2..695a2f8b 100644
--- a/Block/Adminhtml/Configuration/Index.php
+++ b/Block/Adminhtml/Configuration/Index.php
@@ -7,6 +7,7 @@
use Magento\Backend\Model\Auth\Session;
use Magento\Framework\Exception\LocalizedException;
use Sequra\Core\Helper\UrlHelper;
+use SeQura\Core\Infrastructure\Utility\RegexProvider;
class Index extends Template
{
@@ -18,6 +19,10 @@ class Index extends Template
* @var Session
*/
private $authSession;
+ /**
+ * @var RegexProvider
+ */
+ private $regexProvider;
/**
* Content constructor.
@@ -25,10 +30,16 @@ class Index extends Template
* @param Context $context
* @param UrlHelper $urlHelper
* @param Session $authSession
+ * @param RegexProvider $regexProvider
* @param mixed[] $data
*/
- public function __construct(Context $context, UrlHelper $urlHelper, Session $authSession, array $data = [])
- {
+ public function __construct(
+ Context $context,
+ UrlHelper $urlHelper,
+ Session $authSession,
+ RegexProvider $regexProvider,
+ array $data = []
+ ) {
if (!is_iterable($data)) {
throw new \InvalidArgumentException('Data must be iterable');
}
@@ -36,6 +47,7 @@ public function __construct(Context $context, UrlHelper $urlHelper, Session $aut
$this->urlHelper = $urlHelper;
$this->authSession = $authSession;
+ $this->regexProvider = $regexProvider;
}
/**
@@ -109,4 +121,17 @@ public function getAdminLanguage(): string
$user = $this->authSession->getUser();
return strtoupper($user ? substr($user->getInterfaceLocale(), 0, 2) : 'en');
}
+
+ /**
+ * Get the regex in JSON format
+ *
+ * @return string
+ */
+ public function getRegexJson(): string
+ {
+ $regex = $this->regexProvider->toArray();
+
+ $jsonEncoded = json_encode($regex);
+ return $jsonEncoded === false ? '' : $jsonEncoded;
+ }
}
diff --git a/Controller/Adminhtml/Configuration/Connection.php b/Controller/Adminhtml/Configuration/Connection.php
new file mode 100755
index 00000000..b3bc9a60
--- /dev/null
+++ b/Controller/Adminhtml/Configuration/Connection.php
@@ -0,0 +1,56 @@
+allowedActions = ['reRegisterWebhooks'];
+ }
+
+ /**
+ * Re-register webhooks on the Merchant Portal.
+ *
+ * @return Json
+ */
+ protected function reRegisterWebhooks(): Json
+ {
+ /**
+ * @var array $data
+ */
+ $data = $this->getSequraPostData();
+ $environment = $data['environment'] ?? '';
+ $username = $data['username'] ?? '';
+ $password = $data['password'] ?? '';
+ $deployment = $data['deployment'] ?? '';
+
+ // @phpstan-ignore-next-line
+ $response = AdminAPI::get()->connection($this->storeId)->reRegisterWebhooks(
+ new ReRegisterWebhookRequest(
+ $environment,
+ '',
+ $username,
+ $password,
+ $deployment
+ )
+ );
+ $this->addResponseCode($response);
+
+ return $this->result->setData(['isSuccessful' => $response->isSuccessful()]);
+ }
+}
diff --git a/Controller/Adminhtml/Configuration/WidgetSettings.php b/Controller/Adminhtml/Configuration/WidgetSettings.php
index c1b28380..983abe96 100644
--- a/Controller/Adminhtml/Configuration/WidgetSettings.php
+++ b/Controller/Adminhtml/Configuration/WidgetSettings.php
@@ -55,23 +55,8 @@ protected function getWidgetSettings(): Json
{
/** @var WidgetSettingsResponse $data */
$data = AdminAPI::get()->widgetConfiguration($this->storeId)->getWidgetSettings();
-
$result = $data->toArray();
- if (empty($result)) {
- $result['productPriceSelector'] = '.price-container .price';
- $result['defaultProductLocationSelector'] = '.actions .action.primary.tocart';
- $result['altProductPriceSelector'] = '[data-price-type="finalPrice"] .price';
- $result['altProductPriceTriggerSelector'] = '.bundle-actions';
- $result['cartPriceSelector'] = '.grand.totals .price';
- $result['cartLocationSelector'] = '.cart-summary';
-
- return $this->result->setData($result);
- }
-
- $result['widgetStyles'] = $result['widgetConfiguration'];
- unset($result['widgetConfiguration']);
-
$this->addResponseCode($data);
return $this->result->setData($result);
diff --git a/Services/Bootstrap.php b/Services/Bootstrap.php
index 4edec156..7ee5e871 100644
--- a/Services/Bootstrap.php
+++ b/Services/Bootstrap.php
@@ -25,6 +25,7 @@
use SeQura\Core\BusinessLogic\Domain\Integration\SellingCountries\SellingCountriesServiceInterface;
use SeQura\Core\BusinessLogic\Domain\Integration\ShopOrderStatuses\ShopOrderStatusesServiceInterface;
use SeQura\Core\BusinessLogic\Domain\Integration\Store\StoreServiceInterface;
+use SeQura\Core\BusinessLogic\Domain\Integration\StoreIntegration\StoreIntegrationServiceInterface;
use SeQura\Core\BusinessLogic\Domain\Integration\Version\VersionServiceInterface;
use SeQura\Core\BusinessLogic\Domain\Order\Models\SeQuraOrder;
use SeQura\Core\BusinessLogic\Domain\Order\RepositoryContracts\SeQuraOrderRepositoryInterface;
@@ -63,6 +64,7 @@
use Sequra\Core\Services\BusinessLogic\SellingCountriesService;
use Sequra\Core\Services\BusinessLogic\ShopOrderStatusesService;
use Sequra\Core\Services\BusinessLogic\StatisticalDataService;
+use Sequra\Core\Services\BusinessLogic\StoreIntegrationService;
use Sequra\Core\Services\BusinessLogic\StoreService;
use Sequra\Core\Services\BusinessLogic\Utility\Encryptor;
use Sequra\Core\Services\BusinessLogic\VersionService;
@@ -89,6 +91,10 @@ class Bootstrap extends BootstrapComponent
* @var StoreService
*/
private $storeService;
+ /**
+ * @var StoreIntegrationService
+ */
+ private $storeIntegrationService;
/**
* @var VersionService
*/
@@ -138,6 +144,7 @@ class Bootstrap extends BootstrapComponent
* @param LoggerService $loggerService
* @param ConfigurationService $configurationService
* @param StoreService $storeService
+ * @param StoreIntegrationService $storeIntegrationService
* @param VersionService $versionService
* @param SellingCountriesService $sellingCountriesService
* @param CategoryService $categoryService
@@ -155,6 +162,7 @@ public function __construct(
LoggerService $loggerService,
ConfigurationService $configurationService,
StoreService $storeService,
+ StoreIntegrationService $storeIntegrationService,
VersionService $versionService,
SellingCountriesService $sellingCountriesService,
CategoryService $categoryService,
@@ -171,6 +179,7 @@ public function __construct(
$this->loggerService = $loggerService;
$this->configurationService = $configurationService;
$this->storeService = $storeService;
+ $this->storeIntegrationService = $storeIntegrationService;
$this->versionService = $versionService;
$this->sellingCountriesService = $sellingCountriesService;
$this->categoryService = $categoryService;
@@ -258,6 +267,13 @@ static function () {
}
);
+ ServiceRegister::registerService(
+ StoreIntegrationServiceInterface::class,
+ static function () {
+ return static::$instance->storeIntegrationService;
+ }
+ );
+
ServiceRegister::registerService(
VersionServiceInterface::class,
static function () {
diff --git a/Services/BusinessLogic/PromotionalWidget/WidgetConfigurator.php b/Services/BusinessLogic/PromotionalWidget/WidgetConfigurator.php
index 0bbf26e1..8d89e13e 100644
--- a/Services/BusinessLogic/PromotionalWidget/WidgetConfigurator.php
+++ b/Services/BusinessLogic/PromotionalWidget/WidgetConfigurator.php
@@ -7,6 +7,7 @@
use Magento\Store\Model\Store;
use NumberFormatter;
use SeQura\Core\BusinessLogic\Domain\Integration\PromotionalWidgets\WidgetConfiguratorInterface;
+use SeQura\Core\BusinessLogic\Domain\PromotionalWidgets\Models\WidgetSettings;
class WidgetConfigurator implements WidgetConfiguratorInterface
{
@@ -83,6 +84,33 @@ public function getThousandsSeparator(): string
return (string) $this->getFormatter()->getSymbol(NumberFormatter::GROUPING_SEPARATOR_SYMBOL);
}
+ /**
+ * Returns an instance of WidgetSettings having the default values.
+ * See SeQura\Core\BusinessLogic\Domain\PromotionalWidgets\Models\WidgetSettings::createDefault().
+ */
+ public function getDefaultWidgetSettings(): WidgetSettings
+ {
+ $productPriceSelector = '.price-container .price';
+ $productLocationSelector = '.actions .action.primary.tocart';
+ $cartPriceSelector = '.grand.totals .price';
+ $cartLocationSelector = '.cart-summary';
+ $listingPriceSelector = '';
+ $listingLocationSelector = '';
+ $altProductPriceSelector = '[data-price-type="finalPrice"] .price';
+ $altProductPriceTriggerSelector = '.bundle-actions';
+
+ return WidgetSettings::createDefault(
+ $productPriceSelector,
+ $productLocationSelector,
+ $cartPriceSelector,
+ $cartLocationSelector,
+ $listingPriceSelector,
+ $listingLocationSelector,
+ $altProductPriceSelector,
+ $altProductPriceTriggerSelector
+ );
+ }
+
/**
* Get formatter instance.
*
diff --git a/Services/BusinessLogic/StoreIntegrationService.php b/Services/BusinessLogic/StoreIntegrationService.php
new file mode 100644
index 00000000..33406b1a
--- /dev/null
+++ b/Services/BusinessLogic/StoreIntegrationService.php
@@ -0,0 +1,53 @@
+urlHelper = $urlHelper;
+ }
+
+ /**
+ * Returns webhook url for integration.
+ *
+ * @return URL
+ *
+ * @throws NoSuchEntityException
+ * @throws InvalidUrlException
+ */
+ public function getWebhookUrl(): URL
+ {
+ return new URL($this->urlHelper->getFrontendUrl('sequra/integrationwebhook/index'));
+ }
+
+ /**
+ * Returns an array of supported capabilities.
+ *
+ * @return Capability[]
+ */
+ public function getSupportedCapabilities(): array
+ {
+ return [
+ Capability::storeInfo(),
+ Capability::general(),
+ Capability::widget()
+ ];
+ }
+}
diff --git a/Setup/Patch/Data/Version400.php b/Setup/Patch/Data/Version400.php
new file mode 100755
index 00000000..41ddb772
--- /dev/null
+++ b/Setup/Patch/Data/Version400.php
@@ -0,0 +1,41 @@
+execute();
+
+ Logger::logInfo('Migration ' . self::class . ' has been successfully finished.');
+ } catch (Throwable $e) {
+ Logger::logInfo('Update script V4.0.0 execution failed because: ' . $e->getMessage());
+ }
+ }
+}
diff --git a/composer.json b/composer.json
index 75ea083c..f622e98a 100644
--- a/composer.json
+++ b/composer.json
@@ -1,79 +1,79 @@
-{
- "name": "sequra/magento2-core",
- "description": "Core module for SeQura Payment Methods",
- "type": "magento2-module",
- "keywords": [
- "payment",
- "sequra",
- "pagos",
- "magento2"
- ],
- "version": "3.1.1",
- "license": "MIT",
- "authors": [
- {
- "name": "Sequra Engineering",
- "email": "dev@sequra.es"
- }
- ],
- "minimum-stability": "dev",
- "prefer-stable": true,
- "require": {
- "php": ">=7.4 <8.5",
- "sequra/integration-core": "^3.0.0",
- "ext-json": "*"
- },
- "autoload": {
- "files": [
- "registration.php"
- ],
- "psr-4": {
- "Sequra\\Core\\": ""
- }
- },
- "autoload-dev": {
- "psr-4": {
- "SeQura\\Core\\Tests\\Infrastructure\\": "vendor/sequra/integration-core/tests/Infrastructure",
- "SeQura\\Core\\Tests\\BusinessLogic\\": "vendor/sequra/integration-core/tests/BusinessLogic"
- }
- },
- "archive": {
- "exclude": [
- ".docker",
- ".github",
- "bin",
- "docker-entrypoint-init.d",
- "Test",
- ".env",
- ".env.sample",
- ".gitattributes",
- ".gitignore",
- "docker-compose.override.sample.yml",
- "docker-compose.yml",
- "README.md",
- "setup.sh",
- "teardown.sh",
- "tests-e2e",
- "package.json",
- "package-lock.json",
- "playwright.config.js"
- ]
- },
- "require-dev": {
- "magento/magento-coding-standard": "^38.0"
- },
- "config": {
- "allow-plugins": {
- "dealerdirect/phpcodesniffer-composer-installer": true
- }
- },
- "repositories": [
- {
- "type": "git",
- "url": "git@github.com:sequra/integration-core.git"
- }
- ]
-}
-
-
-
+{
+ "name": "sequra/magento2-core",
+ "description": "Core module for SeQura Payment Methods",
+ "type": "magento2-module",
+ "keywords": [
+ "payment",
+ "sequra",
+ "pagos",
+ "magento2"
+ ],
+ "version": "3.1.1",
+ "license": "MIT",
+ "authors": [
+ {
+ "name": "Sequra Engineering",
+ "email": "dev@sequra.es"
+ }
+ ],
+ "minimum-stability": "dev",
+ "prefer-stable": true,
+ "require": {
+ "php": ">=7.4 <8.5",
+ "sequra/integration-core": "dev-feature/LIS-90",
+ "ext-json": "*"
+ },
+ "autoload": {
+ "files": [
+ "registration.php"
+ ],
+ "psr-4": {
+ "Sequra\\Core\\": ""
+ }
+ },
+ "autoload-dev": {
+ "psr-4": {
+ "SeQura\\Core\\Tests\\Infrastructure\\": "vendor/sequra/integration-core/tests/Infrastructure",
+ "SeQura\\Core\\Tests\\BusinessLogic\\": "vendor/sequra/integration-core/tests/BusinessLogic"
+ }
+ },
+ "archive": {
+ "exclude": [
+ ".docker",
+ ".github",
+ "bin",
+ "docker-entrypoint-init.d",
+ "Test",
+ ".env",
+ ".env.sample",
+ ".gitattributes",
+ ".gitignore",
+ "docker-compose.override.sample.yml",
+ "docker-compose.yml",
+ "README.md",
+ "setup.sh",
+ "teardown.sh",
+ "tests-e2e",
+ "package.json",
+ "package-lock.json",
+ "playwright.config.js"
+ ]
+ },
+ "require-dev": {
+ "magento/magento-coding-standard": "^38.0"
+ },
+ "config": {
+ "allow-plugins": {
+ "dealerdirect/phpcodesniffer-composer-installer": true
+ }
+ },
+ "repositories": [
+ {
+ "type": "git",
+ "url": "git@github.com:sequra/integration-core.git"
+ }
+ ]
+}
+
+
+
diff --git a/package-lock.json b/package-lock.json
index d67a8732..076e505c 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -12,17 +12,17 @@
"@playwright/test": "^1.56.1",
"@types/node": "^22.10.7",
"playwright-fixture-for-plugins": "github:sequra/playwright-fixture-for-plugins#1.1.0",
- "sequra-core-admin-fe": "github:sequra/integration-core-ui#2.0.0"
+ "sequra-core-admin-fe": "github:sequra/integration-core-ui#feature/LIS-90"
}
},
"node_modules/@playwright/test": {
- "version": "1.56.1",
- "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.56.1.tgz",
- "integrity": "sha512-vSMYtL/zOcFpvJCW71Q/OEGQb7KYBPAdKh35WNSkaZA75JlAO8ED8UN6GUNTm3drWomcbcqRPFqQbLae8yBTdg==",
+ "version": "1.57.0",
+ "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.57.0.tgz",
+ "integrity": "sha512-6TyEnHgd6SArQO8UO2OMTxshln3QMWBtPGrOCgs3wVEmQmwyuNtB10IZMfmYDE0riwNR1cu4q+pPcxMVtaG3TA==",
"dev": true,
"license": "Apache-2.0",
"dependencies": {
- "playwright": "1.56.1"
+ "playwright": "1.57.0"
},
"bin": {
"playwright": "cli.js"
@@ -32,15 +32,29 @@
}
},
"node_modules/@types/node": {
- "version": "22.17.1",
- "resolved": "https://registry.npmjs.org/@types/node/-/node-22.17.1.tgz",
- "integrity": "sha512-y3tBaz+rjspDTylNjAX37jEC3TETEFGNJL6uQDxwF9/8GLLIjW1rvVHlynyuUKMnMr1Roq8jOv3vkopBjC4/VA==",
+ "version": "22.19.6",
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-22.19.6.tgz",
+ "integrity": "sha512-qm+G8HuG6hOHQigsi7VGuLjUVu6TtBo/F05zvX04Mw2uCg9Dv0Qxy3Qw7j41SidlTcl5D/5yg0SEZqOB+EqZnQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"undici-types": "~6.21.0"
}
},
+ "node_modules/dayjs": {
+ "version": "1.11.19",
+ "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.19.tgz",
+ "integrity": "sha512-t5EcLVS6QPBNqM2z8fakk/NKel+Xzshgt8FFKAn+qwlD1pzZWxh0nVCrvFK7ZDb6XucZeF9z8C7CBWTRIVApAw==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/diff-dom": {
+ "version": "5.2.1",
+ "resolved": "https://registry.npmjs.org/diff-dom/-/diff-dom-5.2.1.tgz",
+ "integrity": "sha512-G6WquwIa/XOxiYDYRMxfJj+c+a6LXMv7zgXoAQ3eRjTYkc8Lc4Aq97krTu/B15r243FR7dyeSxDenzKtO6sbfA==",
+ "dev": true,
+ "license": "LGPL-3.0"
+ },
"node_modules/fsevents": {
"version": "2.3.2",
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz",
@@ -56,14 +70,21 @@
"node": "^8.16.0 || ^10.6.0 || >=11.0.0"
}
},
+ "node_modules/json-formatter-js": {
+ "version": "2.5.23",
+ "resolved": "https://registry.npmjs.org/json-formatter-js/-/json-formatter-js-2.5.23.tgz",
+ "integrity": "sha512-Cbm8wHXjo/C56aCePP1VuKvjxoMEmL7g7Ckss1oWFFlCsvOEEbye1kTeaNNaqba1Cl6YpIOYAnK65pUQ8mDIUQ==",
+ "dev": true,
+ "license": "MIT"
+ },
"node_modules/playwright": {
- "version": "1.56.1",
- "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.56.1.tgz",
- "integrity": "sha512-aFi5B0WovBHTEvpM3DzXTUaeN6eN0qWnTkKx4NQaH4Wvcmc153PdaY2UBdSYKaGYw+UyWXSVyxDUg5DoPEttjw==",
+ "version": "1.57.0",
+ "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.57.0.tgz",
+ "integrity": "sha512-ilYQj1s8sr2ppEJ2YVadYBN0Mb3mdo9J0wQ+UuDhzYqURwSoW4n1Xs5vs7ORwgDGmyEh33tRMeS8KhdkMoLXQw==",
"dev": true,
"license": "Apache-2.0",
"dependencies": {
- "playwright-core": "1.56.1"
+ "playwright-core": "1.57.0"
},
"bin": {
"playwright": "cli.js"
@@ -76,9 +97,9 @@
}
},
"node_modules/playwright-core": {
- "version": "1.56.1",
- "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.56.1.tgz",
- "integrity": "sha512-hutraynyn31F+Bifme+Ps9Vq59hKuUCz7H1kDOcBs+2oGguKkWTU50bBWrtz34OUWmIwpBTWDxaRPXrIXkgvmQ==",
+ "version": "1.57.0",
+ "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.57.0.tgz",
+ "integrity": "sha512-agTcKlMw/mjBWOnD6kFZttAAGHgi/Nw0CZ2o6JqWSbMlI219lAFLZZCyqByTsvVAJq5XA5H8cA6PrvBRpBWEuQ==",
"dev": true,
"license": "Apache-2.0",
"bin": {
@@ -95,9 +116,24 @@
"license": "MIT"
},
"node_modules/sequra-core-admin-fe": {
- "version": "1.0.0",
- "resolved": "git+ssh://git@github.com/sequra/integration-core-ui.git#f853f474d659b7e0edad41cb23f052d124cdbc9b",
- "dev": true
+ "version": "2.0.2",
+ "resolved": "git+ssh://git@github.com/sequra/integration-core-ui.git#c4ca71a9ee5201b2679107f8ab48a276ded4876c",
+ "dev": true,
+ "dependencies": {
+ "json-formatter-js": "^2.5.23",
+ "simple-datatables": "^10.0.0"
+ }
+ },
+ "node_modules/simple-datatables": {
+ "version": "10.2.0",
+ "resolved": "https://registry.npmjs.org/simple-datatables/-/simple-datatables-10.2.0.tgz",
+ "integrity": "sha512-Lq3k5JZ4WXT0G0dhIAUfYc3M+GRs9y8U15wfbF7i67/rPm8wa43Iyrac+yP+lXQVTy1MPCPvxvZ44P9N4k0OhQ==",
+ "dev": true,
+ "license": "LGPL-3.0",
+ "dependencies": {
+ "dayjs": "^1.11.10",
+ "diff-dom": "5.2.1"
+ }
},
"node_modules/undici-types": {
"version": "6.21.0",
diff --git a/package.json b/package.json
index 5b8c8c89..172a7b64 100644
--- a/package.json
+++ b/package.json
@@ -4,7 +4,7 @@
"type": "module",
"description": "1. [About seQura](#about-sequra) 2. [Installation guide](https://sequra.atlassian.net/wiki/spaces/DOC/pages/1377304583/MAGENTO+2) 3. [Sign-up](#sign-up) 4. [For developers](#for-developers)",
"main": "index.js",
- "scripts": {
+ "scripts": {
"copy-assets": "cp -r node_modules/sequra-core-admin-fe/dist/resources/assets/* view/adminhtml/web/assets/",
"copy-css": "cp -r node_modules/sequra-core-admin-fe/dist/resources/css/* view/adminhtml/web/css/",
"copy-js": "cp -r node_modules/sequra-core-admin-fe/dist/resources/js/* view/adminhtml/web/js/",
@@ -15,7 +15,7 @@
"author": "",
"license": "ISC",
"devDependencies": {
- "sequra-core-admin-fe": "github:sequra/integration-core-ui#2.0.0",
+ "sequra-core-admin-fe": "github:sequra/integration-core-ui#feature/LIS-90",
"@playwright/test": "^1.56.1",
"@types/node": "^22.10.7",
"playwright-fixture-for-plugins": "github:sequra/playwright-fixture-for-plugins#1.1.0"
diff --git a/view/adminhtml/layout/sequra_configuration_index.xml b/view/adminhtml/layout/sequra_configuration_index.xml
index e75b908f..80576b2d 100644
--- a/view/adminhtml/layout/sequra_configuration_index.xml
+++ b/view/adminhtml/layout/sequra_configuration_index.xml
@@ -10,7 +10,6 @@
-
@@ -27,10 +26,10 @@
-
+
-
-
+
+
diff --git a/view/adminhtml/templates/configuration/index.phtml b/view/adminhtml/templates/configuration/index.phtml
index 0300a26b..0d190f3e 100644
--- a/view/adminhtml/templates/configuration/index.phtml
+++ b/view/adminhtml/templates/configuration/index.phtml
@@ -13,6 +13,17 @@
+
+
+
+