Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions | Data Fields
Config Class Reference
Inheritance diagram for Config:
Config ConfigInterface

Public Member Functions

 __construct (ScopeConfigInterface $scopeConfig, $methodCode=null, $pathPattern=self::DEFAULT_PATH_PATTERN, Json $serializer=null)
 
 getCountrySpecificCardTypeConfig ($storeId=null)
 
 getAvailableCardTypes ($storeId=null)
 
 getCcTypesMapper ()
 
 getCountryAvailableCardTypes ($country, $storeId=null)
 
 isCvvEnabled ($storeId=null)
 
 isVerify3DSecure ($storeId=null)
 
 getThresholdAmount ($storeId=null)
 
 get3DSecureSpecificCountries ($storeId=null)
 
 getEnvironment ($storeId=null)
 
 getKountMerchantId ($storeId=null)
 
 getMerchantId ($storeId=null)
 
 getMerchantAccountId ($storeId=null)
 
 getSdkUrl ()
 
 hasFraudProtection ($storeId=null)
 
 isActive ($storeId=null)
 
 getDynamicDescriptors ($storeId=null)
 
- Public Member Functions inherited from Config
 __construct (ScopeConfigInterface $scopeConfig, $methodCode=null, $pathPattern=self::DEFAULT_PATH_PATTERN)
 
 setMethodCode ($methodCode)
 
 setPathPattern ($pathPattern)
 
 getValue ($field, $storeId=null)
 

Data Fields

const KEY_ENVIRONMENT = 'environment'
 
const KEY_ACTIVE = 'active'
 
const KEY_MERCHANT_ID = 'merchant_id'
 
const KEY_MERCHANT_ACCOUNT_ID = 'merchant_account_id'
 
const KEY_PUBLIC_KEY = 'public_key'
 
const KEY_PRIVATE_KEY = 'private_key'
 
const KEY_COUNTRY_CREDIT_CARD = 'countrycreditcard'
 
const KEY_CC_TYPES = 'cctypes'
 
const KEY_CC_TYPES_BRAINTREE_MAPPER = 'cctypes_braintree_mapper'
 
const KEY_SDK_URL = 'sdk_url'
 
const KEY_USE_CVV = 'useccv'
 
const KEY_VERIFY_3DSECURE = 'verify_3dsecure'
 
const KEY_THRESHOLD_AMOUNT = 'threshold_amount'
 
const KEY_VERIFY_ALLOW_SPECIFIC = 'verify_all_countries'
 
const KEY_VERIFY_SPECIFIC = 'verify_specific_countries'
 
const VALUE_3DSECURE_ALL = 0
 
const CODE_3DSECURE = 'three_d_secure'
 
const KEY_KOUNT_MERCHANT_ID = 'kount_id'
 
const FRAUD_PROTECTION = 'fraudprotection'
 
- Data Fields inherited from Config
const DEFAULT_PATH_PATTERN = 'payment/%s/%s'
 

Detailed Description

Class Config

Definition at line 14 of file Config.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( ScopeConfigInterface  $scopeConfig,
  $methodCode = null,
  $pathPattern = self::DEFAULT_PATH_PATTERN,
Json  $serializer = null 
)

Braintree config constructor

Parameters
ScopeConfigInterface$scopeConfig
null | string$methodCode
string$pathPattern
Json | null$serializer

Definition at line 49 of file Config.php.

54  {
55  parent::__construct($scopeConfig, $methodCode, $pathPattern);
56  $this->serializer = $serializer ?: \Magento\Framework\App\ObjectManager::getInstance()
57  ->get(Json::class);
58  }

Member Function Documentation

◆ get3DSecureSpecificCountries()

get3DSecureSpecificCountries (   $storeId = null)

Gets list of specific countries for 3d secure.

Parameters
int | null$storeId
Returns
array

Definition at line 165 of file Config.php.

166  {
167  if ((int) $this->getValue(self::KEY_VERIFY_ALLOW_SPECIFIC, $storeId) == self::VALUE_3DSECURE_ALL) {
168  return [];
169  }
170 
171  return explode(',', $this->getValue(self::KEY_VERIFY_SPECIFIC, $storeId));
172  }
getValue($field, $storeId=null)
Definition: Config.php:83

◆ getAvailableCardTypes()

getAvailableCardTypes (   $storeId = null)

Retrieve available credit card types

Parameters
int | null$storeId
Returns
array

Definition at line 90 of file Config.php.

91  {
92  $ccTypes = $this->getValue(self::KEY_CC_TYPES, $storeId);
93 
94  return !empty($ccTypes) ? explode(',', $ccTypes) : [];
95  }
getValue($field, $storeId=null)
Definition: Config.php:83

◆ getCcTypesMapper()

getCcTypesMapper ( )

Retrieve mapper between Magento and Braintree card types

Returns
array

Definition at line 102 of file Config.php.

103  {
104  $result = json_decode(
105  $this->getValue(self::KEY_CC_TYPES_BRAINTREE_MAPPER),
106  true
107  );
108 
109  return is_array($result) ? $result : [];
110  }
getValue($field, $storeId=null)
Definition: Config.php:83

◆ getCountryAvailableCardTypes()

getCountryAvailableCardTypes (   $country,
  $storeId = null 
)

Gets list of card types available for country.

Parameters
string$country
int | null$storeId
Returns
array

Definition at line 119 of file Config.php.

120  {
122 
123  return (!empty($types[$country])) ? $types[$country] : [];
124  }
getCountrySpecificCardTypeConfig($storeId=null)
Definition: Config.php:74

◆ getCountrySpecificCardTypeConfig()

getCountrySpecificCardTypeConfig (   $storeId = null)

Return the country specific card type config

Parameters
int | null$storeId
Returns
array

Definition at line 74 of file Config.php.

75  {
76  $countryCardTypes = $this->getValue(self::KEY_COUNTRY_CREDIT_CARD, $storeId);
77  if (!$countryCardTypes) {
78  return [];
79  }
80  $countryCardTypes = $this->serializer->unserialize($countryCardTypes);
81  return is_array($countryCardTypes) ? $countryCardTypes : [];
82  }
getValue($field, $storeId=null)
Definition: Config.php:83

◆ getDynamicDescriptors()

getDynamicDescriptors (   $storeId = null)

Gets list of configured dynamic descriptors.

Parameters
int | null$storeId
Returns
array

Definition at line 255 of file Config.php.

256  {
257  $values = [];
258  foreach (self::$dynamicDescriptorKeys as $key) {
259  $value = $this->getValue('descriptor_' . $key, $storeId);
260  if (!empty($value)) {
261  $values[$key] = $value;
262  }
263  }
264  return $values;
265  }
$values
Definition: options.phtml:88
$value
Definition: gender.phtml:16
getValue($field, $storeId=null)
Definition: Config.php:83

◆ getEnvironment()

getEnvironment (   $storeId = null)

Gets value of configured environment. Possible values: production or sandbox.

Parameters
int | null$storeId
Returns
string

Definition at line 181 of file Config.php.

182  {
183  return $this->getValue(Config::KEY_ENVIRONMENT, $storeId);
184  }
getValue($field, $storeId=null)
Definition: Config.php:83

◆ getKountMerchantId()

getKountMerchantId (   $storeId = null)

Gets Kount merchant ID.

Parameters
int | null$storeId
Returns
string

Definition at line 192 of file Config.php.

193  {
195  }
getValue($field, $storeId=null)
Definition: Config.php:83

◆ getMerchantAccountId()

getMerchantAccountId (   $storeId = null)

Gets Merchant account ID.

Parameters
int | null$storeId
Returns
string

Definition at line 214 of file Config.php.

215  {
216  return $this->getValue(self::KEY_MERCHANT_ACCOUNT_ID, $storeId);
217  }
getValue($field, $storeId=null)
Definition: Config.php:83

◆ getMerchantId()

getMerchantId (   $storeId = null)

Gets merchant ID.

Parameters
int | null$storeId
Returns
string

Definition at line 203 of file Config.php.

204  {
205  return $this->getValue(Config::KEY_MERCHANT_ID, $storeId);
206  }
getValue($field, $storeId=null)
Definition: Config.php:83

◆ getSdkUrl()

getSdkUrl ( )
Returns
string

Definition at line 222 of file Config.php.

223  {
224  return $this->getValue(Config::KEY_SDK_URL);
225  }
getValue($field, $storeId=null)
Definition: Config.php:83

◆ getThresholdAmount()

getThresholdAmount (   $storeId = null)

Gets threshold amount for 3d secure.

Parameters
int | null$storeId
Returns
float

Definition at line 154 of file Config.php.

155  {
156  return (double) $this->getValue(self::KEY_THRESHOLD_AMOUNT, $storeId);
157  }
getValue($field, $storeId=null)
Definition: Config.php:83

◆ hasFraudProtection()

hasFraudProtection (   $storeId = null)

Checks if fraud protection is enabled.

Parameters
int | null$storeId
Returns
bool

Definition at line 233 of file Config.php.

234  {
235  return (bool) $this->getValue(Config::FRAUD_PROTECTION, $storeId);
236  }
getValue($field, $storeId=null)
Definition: Config.php:83

◆ isActive()

isActive (   $storeId = null)

Gets Payment configuration status.

Parameters
int | null$storeId
Returns
bool

Definition at line 244 of file Config.php.

245  {
246  return (bool) $this->getValue(self::KEY_ACTIVE, $storeId);
247  }
getValue($field, $storeId=null)
Definition: Config.php:83

◆ isCvvEnabled()

isCvvEnabled (   $storeId = null)

Checks if cvv field is enabled.

Parameters
int | null$storeId
Returns
bool

Definition at line 132 of file Config.php.

133  {
134  return (bool) $this->getValue(self::KEY_USE_CVV, $storeId);
135  }
getValue($field, $storeId=null)
Definition: Config.php:83

◆ isVerify3DSecure()

isVerify3DSecure (   $storeId = null)

Checks if 3d secure verification enabled.

Parameters
int | null$storeId
Returns
bool

Definition at line 143 of file Config.php.

144  {
145  return (bool) $this->getValue(self::KEY_VERIFY_3DSECURE, $storeId);
146  }
getValue($field, $storeId=null)
Definition: Config.php:83

Field Documentation

◆ CODE_3DSECURE

const CODE_3DSECURE = 'three_d_secure'

Definition at line 32 of file Config.php.

◆ FRAUD_PROTECTION

const FRAUD_PROTECTION = 'fraudprotection'

Definition at line 34 of file Config.php.

◆ KEY_ACTIVE

const KEY_ACTIVE = 'active'

Definition at line 17 of file Config.php.

◆ KEY_CC_TYPES

const KEY_CC_TYPES = 'cctypes'

Definition at line 23 of file Config.php.

◆ KEY_CC_TYPES_BRAINTREE_MAPPER

const KEY_CC_TYPES_BRAINTREE_MAPPER = 'cctypes_braintree_mapper'

Definition at line 24 of file Config.php.

◆ KEY_COUNTRY_CREDIT_CARD

const KEY_COUNTRY_CREDIT_CARD = 'countrycreditcard'

Definition at line 22 of file Config.php.

◆ KEY_ENVIRONMENT

const KEY_ENVIRONMENT = 'environment'

Definition at line 16 of file Config.php.

◆ KEY_KOUNT_MERCHANT_ID

const KEY_KOUNT_MERCHANT_ID = 'kount_id'

Definition at line 33 of file Config.php.

◆ KEY_MERCHANT_ACCOUNT_ID

const KEY_MERCHANT_ACCOUNT_ID = 'merchant_account_id'

Definition at line 19 of file Config.php.

◆ KEY_MERCHANT_ID

const KEY_MERCHANT_ID = 'merchant_id'

Definition at line 18 of file Config.php.

◆ KEY_PRIVATE_KEY

const KEY_PRIVATE_KEY = 'private_key'

Definition at line 21 of file Config.php.

◆ KEY_PUBLIC_KEY

const KEY_PUBLIC_KEY = 'public_key'

Definition at line 20 of file Config.php.

◆ KEY_SDK_URL

const KEY_SDK_URL = 'sdk_url'

Definition at line 25 of file Config.php.

◆ KEY_THRESHOLD_AMOUNT

const KEY_THRESHOLD_AMOUNT = 'threshold_amount'

Definition at line 28 of file Config.php.

◆ KEY_USE_CVV

const KEY_USE_CVV = 'useccv'

Definition at line 26 of file Config.php.

◆ KEY_VERIFY_3DSECURE

const KEY_VERIFY_3DSECURE = 'verify_3dsecure'

Definition at line 27 of file Config.php.

◆ KEY_VERIFY_ALLOW_SPECIFIC

const KEY_VERIFY_ALLOW_SPECIFIC = 'verify_all_countries'

Definition at line 29 of file Config.php.

◆ KEY_VERIFY_SPECIFIC

const KEY_VERIFY_SPECIFIC = 'verify_specific_countries'

Definition at line 30 of file Config.php.

◆ VALUE_3DSECURE_ALL

const VALUE_3DSECURE_ALL = 0

Definition at line 31 of file Config.php.


The documentation for this class was generated from the following file: