/** * @param Actions\ActionsInterface $action * @param array $requestParams * @return Url */ protected function buildRequestUrl(Actions\ActionsInterface $action, array $requestParams) { $url = new Url('https', $this->connection->getEndpoint()); $url->setPath($action->getAction()); $url->setQuery($requestParams); return $url; }
/** * The endpoint varies depending on developer mode, and whether the method is GET or POST. * If the method is GET, then the data needs to be added to the URL here. I've not found any * helper functions to construct URLs in omnipay, but they could be there. * It may also be possible to leave the URL construction to Guzzle, assuming Guzzle is able * to add an arbitrary list of query parameters to the endpoint that may already have some * query parameters. * CHECKME: it seems that Guzzle will accept an array containing a template and substitution * variables for its endpoint. This would avoid us needing to construct it here. */ public function getEndpoint() { $domain = $this->getDeveloperMode() ? $this->endpointDevDomain : $this->endpointProdDomain; $path = $this->getPath(); // Build the URL from the parts. // There is a dependency on Guzzle here, which OmniPay uses, but may be a // bit of an assumption in the longer term. $url = new Url($this->endpointScheme, $domain); $url->setPath($path); if ($this->getMethod() == 'GET') { $url->setQuery($this->getData()); } return $url; }