Magento Extensions Rating 2024
EXTENSIONS BY CATEGORY
B2B (Business-To-Business)
Blog
Customer
ERP (Enterprise Resource Planning)
Mega Menu
One Step Checkout
Order
POS (Point Of Sale)
Search
Shopping Cart
Sitemap
SEO
Social
Stock & Inventory Management
EXTENSIONS BY DEVELOPER
aheadWorks
Amasty
Boost My Shop
BSS Commerce
Magestore
MageWorx
Mirasvit
Templates Master
Wyomind
XTENTO
Magento 2 Documentation
Magento 2 Documentation
2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
vendor
magento
magento2-base
dev
tests
integration
testsuite
Magento
Braintree
_files
payment_configuration.php
Go to the documentation of this file.
1
<?php
7
use
Magento\Config\Model\Config
;
8
use
Magento\Framework\App\Config\ScopeConfigInterface
;
9
use
Magento\Framework\Encryption\EncryptorInterface
;
10
use
Magento\Store\Model\ScopeInterface
;
11
use
Magento\TestFramework\Helper\Bootstrap
;
12
13
$objectManager
= Bootstrap::getObjectManager();
14
16
$encryptor
=
$objectManager
->get(EncryptorInterface::class);
17
18
$processConfigData
=
function
(
Config
$config
, array
$data
) {
19
foreach
(
$data
as $key =>
$value
) {
20
$config
->setDataByPath($key,
$value
);
21
$config
->save();
22
}
23
};
24
25
// save payment configuration for the default scope
26
$configData
= [
27
'payment/braintree/merchant_id'
=>
'def_merchant_id'
,
28
'payment/braintree/public_key'
=>
$encryptor
->encrypt(
'def_public_key'
),
29
'payment/braintree/private_key'
=>
$encryptor
->encrypt(
'def_private_key'
),
30
];
32
$defConfig
=
$objectManager
->create(Config::class);
33
$defConfig
->setScope(ScopeConfigInterface::SCOPE_TYPE_DEFAULT);
34
$processConfigData
(
$defConfig
,
$configData
);
35
36
// save payment configuration per store
37
require
__DIR__
.
'/../../Store/_files/store.php'
;
38
$storeConfigData
= [
39
'payment/braintree/merchant_id'
=>
'store_merchant_id'
,
40
'payment/braintree/public_key'
=>
$encryptor
->encrypt(
'store_public_key'
),
41
];
43
$storeConfig
=
$objectManager
->create(Config::class);
44
$storeConfig
->setScope(ScopeInterface::SCOPE_STORES);
45
$storeConfig
->setStore(
'test'
);
46
$processConfigData
(
$storeConfig
,
$storeConfigData
);
47
48
// save payment website config data
49
require
__DIR__
.
'/../../Store/_files/second_website_with_two_stores.php'
;
50
$websiteConfigData
= [
51
'payment/braintree/merchant_id'
=>
'website_merchant_id'
,
52
'payment/braintree/private_key'
=>
$encryptor
->encrypt(
'website_private_key'
),
53
];
55
$websiteConfig
=
$objectManager
->create(Config::class);
56
$websiteConfig
->setScope(ScopeInterface::SCOPE_WEBSITES);
57
$websiteConfig
->setWebsite(
$websiteId
);
58
$processConfigData
(
$websiteConfig
,
$websiteConfigData
);
$objectManager
$objectManager
Definition:
payment_configuration.php:13
$websiteConfig
$websiteConfig
Definition:
payment_configuration.php:55
Magento\TestFramework\Helper\Bootstrap
Definition:
Bootstrap.php:12
$config
$config
Definition:
fraud_order.php:17
__DIR__
defined('TESTS_BP')||define('TESTS_BP' __DIR__
Definition:
_bootstrap.php:60
$defConfig
$defConfig
Definition:
payment_configuration.php:32
Magento\Framework\Encryption\EncryptorInterface
Definition:
EncryptorInterface.php:14
$data
$data
Definition:
attribute_set_with_image_attribute.php:16
$storeConfig
$storeConfig
Definition:
payment_configuration.php:43
$value
$value
Definition:
gender.phtml:16
Magento\Store\Model\ScopeInterface
Definition:
ScopeInterface.php:12
$websiteConfigData
$websiteConfigData
Definition:
payment_configuration.php:50
$configData
$configData
Definition:
payment_configuration.php:26
Magento\Config\Model\Config
Magento\Framework\App\Config
Definition:
Config.php:17
Magento\Framework\App\Config\ScopeConfigInterface
Definition:
ScopeConfigInterface.php:15
$websiteId
$websiteId
Definition:
products_with_websites_and_stores.php:11
$encryptor
$encryptor
Definition:
payment_configuration.php:16
$processConfigData
$processConfigData
Definition:
payment_configuration.php:18
$storeConfigData
$storeConfigData
Definition:
payment_configuration.php:38