-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathCommonLibraryInit.php
More file actions
42 lines (36 loc) · 1.35 KB
/
CommonLibraryInit.php
File metadata and controls
42 lines (36 loc) · 1.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
namespace Airwallex\Payments;
use Airwallex\PayappsPlugin\CommonLibrary\Configuration\Init;
use Airwallex\Payments\Helper\Configuration;
use Airwallex\Payments\Model\CacheService;
use Magento\Framework\App\ProductMetadataInterface;
use Magento\Framework\Module\ModuleListInterface;
use Airwallex\PayappsPlugin\CommonLibrary\Cache\CacheManager;
class CommonLibraryInit
{
protected Configuration $configuration;
protected ModuleListInterface $moduleList;
protected ProductMetadataInterface $productMetadata;
public function __construct(
Configuration $configuration,
ModuleListInterface $moduleList,
ProductMetadataInterface $productMetadata
)
{
$this->configuration = $configuration;
$this->moduleList = $moduleList;
$this->productMetadata = $productMetadata;
}
public function exec()
{
Init::getInstance([
'env' => $this->configuration->getMode(),
'client_id' => $this->configuration->getClientId(),
'api_key' => $this->configuration->getApiKey(),
'plugin_type' => 'magento',
'plugin_version' => $this->moduleList->getOne(Configuration::MODULE_NAME)['setup_version'],
'platform_version' => $this->productMetadata->getVersion(),
]);
CacheManager::setInstance(new CacheService());
}
}