/** * Add the parameters to the bag * @param array $parameters */ private function addParameters(array $parameters) { $this->parameters = new ParameterBag(); $supportedKeys = Settings::getKeys(); if (is_array($parameters)) { foreach ($parameters as $key => $value) { $method = 'set' . ucfirst(Helper::camelCase($key)); if (method_exists($this, $method)) { $this->{$method}($value); } elseif (in_array($key, $supportedKeys)) { $this->parameters->set($key, $value); } } } }
/** * Get the raw data array for this message. The format of this varies from gateway to * gateway, but will usually be either an associative array, or a SimpleXMLElement. * * @return array */ public function getData() { $this->validate('merchantnumber', 'amount', 'transactionid'); $data = array(); foreach (Settings::getCaptureKeys() as $key) { $value = $this->parameters->get($key); if (!empty($value)) { $data[$key] = $value; } } /** Hack from SOAP description */ $data['pbsResponse'] = -1; $data['epayresponse'] = -1; return $data; }
/** * Gets the redirect target url. * @return string */ public function getRedirectUrl() { return Settings::getEndpoint() . '?' . http_build_query($this->getData()); }