示例#1
0
 /**
  * Initializes the provider object.
  *
  * @param \Aimeos\MShop\Context\Item\Iface $context Context object
  * @param \Aimeos\MShop\Service\Item\Iface $serviceItem Service item with configuration
  * @throws \Aimeos\MShop\Service\Exception If one of the required configuration values isn't available
  */
 public function __construct(\Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MShop\Service\Item\Iface $serviceItem)
 {
     parent::__construct($context, $serviceItem);
     $configParameters = array('paypalexpress.AccountEmail', 'paypalexpress.ApiUsername', 'paypalexpress.ApiPassword', 'paypalexpress.ApiSignature');
     $config = $serviceItem->getConfig();
     foreach ($configParameters as $param) {
         if (!isset($config[$param])) {
             throw new \Aimeos\MShop\Service\Exception(sprintf('Configuration for "%1$s" is missing', $param));
         }
     }
     $default = 'https://api-3t.paypal.com/nvp';
     $this->apiendpoint = $this->getConfigValue(array('paypalexpress.ApiEndpoint'), $default);
 }