Exemplo n.º 1
0
 /**
  * Payment method code setter. Also instantiates/updates config
  *
  * @param string $code
  * @param int|null $storeId
  * @return $this
  */
 public function setMethod($code, $storeId = null)
 {
     if (null === $this->_config) {
         $params = [$code];
         if (null !== $storeId) {
             $params[] = $storeId;
         }
         $this->_config = $this->_configFactory->create($this->_configType, ['params' => $params]);
     } else {
         $this->_config->setMethod($code);
         if (null !== $storeId) {
             $this->_config->setStoreId($storeId);
         }
     }
     return $this;
 }
Exemplo n.º 2
0
 /**
  * Config instance getter
  * @return \Magento\Paypal\Model\Config
  */
 public function getConfig()
 {
     if (null === $this->_config) {
         $params = array($this->_code);
         $store = $this->getStore();
         if ($store) {
             $params[] = is_object($store) ? $store->getId() : $store;
         }
         $this->_config = $this->_configFactory->create('Magento\\Paypal\\Model\\Config', array('params' => $params));
     }
     return $this->_config;
 }