public function getData()
 {
     $this->validate('pspId', 'transactionId', 'amount', 'currency', 'language');
     $data = array('PSPID' => $this->getPspId(), 'ORDERID' => $this->getTransactionId(), 'AMOUNT' => $this->getAmountInteger(), 'CURRENCY' => $this->getCurrency(), 'LANGUAGE' => $this->getLanguage());
     foreach ($this->optionalParams as $param) {
         $value = Helper::stringValue($this->getParameter($param));
         if ($value !== '') {
             $data[strtoupper($param)] = $value;
         }
     }
     /** @var CreditCard $card */
     if ($card = $this->getCard()) {
         $data['CN'] = $card->getName();
         $data['EMAIL'] = $card->getEmail();
         $data['OWNERADDRESS'] = $card->getAddress1() . ($card->getAddress2() ? ' / ' . $card->getAddress2() : '');
         $data['OWNERZIP'] = $card->getPostcode();
         $data['OWNERTOWN'] = $card->getCity();
         $data['OWNERCTY'] = $card->getCountry();
         $data['OWNERTELNO'] = $card->getPhone();
     }
     $data['COM'] = $this->getDescription();
     $data['ACCEPTURL'] = $this->getReturnUrl();
     $data['CANCELURL'] = $this->getCancelUrl();
     $data['EXCEPTIONURL'] = $this->getNotifyUrl();
     $data['DECLINEURL'] = $this->getNotifyUrl();
     // Operation setting
     $data['OPERATION'] = $this->getOperation();
     return $data;
 }
 /**
  * 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());
 }