Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
payment_configuration.php
Go to the documentation of this file.
1 <?php
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
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);
35 
36 // save payment configuration per store
37 require __DIR__ . '/../../Store/_files/store.php';
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');
47 
48 // save payment website config data
49 require __DIR__ . '/../../Store/_files/second_website_with_two_stores.php';
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);
$config
Definition: fraud_order.php:17
defined('TESTS_BP')||define('TESTS_BP' __DIR__
Definition: _bootstrap.php:60
$value
Definition: gender.phtml:16