/** * Gets the redirect form data array, if the redirect method is POST. */ public function getRedirectData() { // Build the post data as expected by Postfinance. $params = $this->getData(); $postData = array(); foreach ($params as $key => $value) { $postData[$key] = $value; } $postData['SHASIGN'] = Helper::createShaHash($postData, $this->getRequest()->getShaIn(), $this->getRequest()->getHashingMethod()); return $postData; }
public function getData() { $data = array(); foreach ($this->httpRequest->query as $key => $value) { $data[strtoupper($key)] = $value; } if (isset($data['SHASIGN'])) { $signData = array(); foreach ($this->signatureParams as $param) { if (isset($data[$param])) { $signData[$param] = $data[$param]; } } $hash = Helper::createShaHash($signData, $this->getShaOut(), $this->getHashingMethod()); if ($hash != $data['SHASIGN']) { throw new InvalidResponseException(); } } //TODO: Deal with non-signed response? return $data; }
public function testCompleteAuthorizeError() { $data = array('STATUS' => 0, 'NCERROR' => 500, 'orderID' => '1', 'PAYID' => 'a'); // create sha hash for the given data $data['SHASIGN'] = Helper::createShaHash($data, $this->gateway->getShaOut()); $this->getHttpRequest()->query->replace($data); $response = $this->gateway->completeAuthorize($this->options)->send(); $this->assertFalse($response->isSuccessful()); }