diff --git a/.version b/.version
index 09843e3..7ec1d6d 100644
--- a/.version
+++ b/.version
@@ -1 +1 @@
-2.0.9
+2.1.0
diff --git a/CHANGELOG.MD b/CHANGELOG.MD
index 776cfc9..eb05cf3 100644
--- a/CHANGELOG.MD
+++ b/CHANGELOG.MD
@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
+## [2.1.0]
+### Added
+- Adding version information in the Tpay configuration view
+
## [2.0.9]
### Fixed
- Fixed refund scope
diff --git a/Model/Config/Source/VersionInfo.php b/Model/Config/Source/VersionInfo.php
new file mode 100644
index 0000000..25ad888
--- /dev/null
+++ b/Model/Config/Source/VersionInfo.php
@@ -0,0 +1,25 @@
+tpayConfig = $tpayConfig;
+ parent::__construct($context, $data);
+ }
+
+ protected function _getElementHtml(AbstractElement $element): string // phpcs:ignore
+ {
+ return $this->tpayConfig->buildMagentoInfo();
+ }
+}
diff --git a/Provider/ConfigurationProvider.php b/Provider/ConfigurationProvider.php
index fbb0f7d..d63eab5 100755
--- a/Provider/ConfigurationProvider.php
+++ b/Provider/ConfigurationProvider.php
@@ -4,7 +4,7 @@
namespace Tpay\Magento2\Provider;
-use Composer\InstalledVersions;
+use Composer\Autoload\ClassLoader;
use Magento\Framework\App\Config\ScopeConfigInterface;
use Magento\Framework\App\ProductMetadataInterface;
use Magento\Framework\Locale\Resolver;
@@ -222,11 +222,13 @@ public function getMagentoVersion(): string
public function buildMagentoInfo(): string
{
+ $apiVersions = $this->getApisVersions();
+
return sprintf(
'magento2:%s|tpay-openapi-php:%s|tpay-php:%s|magento2basic:%s|PHP:%s',
$this->getMagentoVersion(),
- InstalledVersions::getPrettyVersion('tpay-com/tpay-openapi-php'),
- InstalledVersions::getPrettyVersion('tpay-com/tpay-php'),
+ $apiVersions[0],
+ $apiVersions[1],
$this->getTpayPluginVersion(),
phpversion()
);
@@ -257,4 +259,30 @@ private function getTpayPluginVersion(): string
return 'n/a';
}
+
+ private function getApisVersions(): array
+ {
+ $apiVersions = ['n/a', 'n/a'];
+
+ if (true === method_exists('Composer\Autoload\ClassLoader', 'getRegisteredLoaders')) {
+ $vendorDir = array_keys(ClassLoader::getRegisteredLoaders())[0];
+ $installed = $vendorDir.'/composer/installed.php';
+
+ if (false === file_exists($installed)) {
+ return $apiVersions;
+ }
+
+ $dir = require $installed;
+
+ if (isset($dir['versions']['tpay-com/tpay-openapi-php'])) {
+ $apiVersions[0] = $dir['versions']['tpay-com/tpay-openapi-php']['pretty_version'];
+ }
+
+ if (isset($dir['versions']['tpay-com/tpay-php'])) {
+ $apiVersions[1] = $dir['versions']['tpay-com/tpay-php']['pretty_version'];
+ }
+ }
+
+ return $apiVersions;
+ }
}
diff --git a/etc/adminhtml/system.xml b/etc/adminhtml/system.xml
index 0c950be..909bd29 100644
--- a/etc/adminhtml/system.xml
+++ b/etc/adminhtml/system.xml
@@ -179,6 +179,10 @@
Magento\Config\Model\Config\Source\Yesno
+
diff --git a/i18n/pl_PL.csv b/i18n/pl_PL.csv
index c94d2eb..ac90fcf 100644
--- a/i18n/pl_PL.csv
+++ b/i18n/pl_PL.csv
@@ -30,6 +30,7 @@
"Maximal amount for method","Maksymalna kwota"
"Leave empty for no limit","Puste pole bez ograniczeń"
"View bank payments","Widok płatności bankowych"
+"Version information","Informacje o wersji"
"If you use other currencies visible on the website and pay in PLN, turn it on/off","W przypadku korzystania z innych walut widocznych na stronie i płatności w PLN należy włączyć/wyłączyć"
"Type in 6 digit code and press pay to commit blik payment.", "Wpisz 6 cyfrowy kod aby powiązać transakcję blik."
"Choose a payment method","Wybierz jeden ze sposobów płatności"
diff --git a/view/frontend/web/js/view/payment/method-renderer/tpay-generic-onsite.js b/view/frontend/web/js/view/payment/method-renderer/tpay-generic-onsite.js
index b368569..e3f4314 100644
--- a/view/frontend/web/js/view/payment/method-renderer/tpay-generic-onsite.js
+++ b/view/frontend/web/js/view/payment/method-renderer/tpay-generic-onsite.js
@@ -27,7 +27,7 @@ define(
},
getRegulations: function () {
- return window.checkoutConfig.tpaycards.payment.getRegulations;
+ return window.checkoutConfig.tpay.payment.getRegulations;
},
getLogoUrl: function (code) {
diff --git a/view/frontend/web/js/view/payment/method-renderer/tpay-method.js b/view/frontend/web/js/view/payment/method-renderer/tpay-method.js
index 8814212..5b36ce2 100644
--- a/view/frontend/web/js/view/payment/method-renderer/tpay-method.js
+++ b/view/frontend/web/js/view/payment/method-renderer/tpay-method.js
@@ -38,7 +38,7 @@ define(
},
getRegulations: function () {
- return window.checkoutConfig.tpaycards.payment.getRegulations;
+ return window.checkoutConfig.tpay.payment.getRegulations;
},
getLogoUrl: function () {