/** * Builds the Shopgate Library object graph for ShopgateMerchantApi and returns the instance. * * @return ShopgateMerchantApi */ public function buildMerchantApi() { $merchantApi = null; switch ($smaAuthServiceClassName = $this->config->getSmaAuthServiceClassName()) { case ShopgateConfigInterface::SHOPGATE_AUTH_SERVICE_CLASS_NAME_SHOPGATE: $smaAuthService = new ShopgateAuthenticationServiceShopgate($this->config->getCustomerNumber(), $this->config->getApikey()); $smaAuthService->setup($this->config); $merchantApi = new ShopgateMerchantApi($smaAuthService, $this->config->getShopNumber(), $this->config->getApiUrl()); break; case ShopgateConfigInterface::SHOPGATE_AUTH_SERVICE_CLASS_NAME_OAUTH: $smaAuthService = new ShopgateAuthenticationServiceOAuth($this->config->getOauthAccessToken()); $smaAuthService->setup($this->config); $merchantApi = new ShopgateMerchantApi($smaAuthService, null, $this->config->getApiUrl()); break; default: // undefined auth service trigger_error('Invalid SMA-Auth-Service defined - this should not happen with valid plugin code', E_USER_ERROR); break; } return $merchantApi; }