Esempio n. 1
0
 /**
  * base constructor for Response objects
  *
  * @param Zend_Http_Response $response
  */
 public function __construct($response)
 {
     if ($response instanceof Zend_Http_Response) {
         $this->_response = WirecardCEE_Stdlib_SerialApi::decode($response->getBody());
     } elseif (is_array($response)) {
         $this->_response = $response;
     } else {
         throw new WirecardCEE_Stdlib_Exception_InvalidResponseException(sprintf('Invalid response from WirecardCEE thrown in %s.', __METHOD__));
     }
 }
 /**
  * creates an Return instance (Cancel, Failure, Success...)
  *
  * @param array $return - returned post data
  * @param string $secret - QMORE secret
  *
  * @return WirecardCEE_QMore_Return_Cancel|WirecardCEE_QMore_Return_Failure|WirecardCEE_QMore_Return_Pending|WirecardCEE_QMore_Return_Success
  * @throws WirecardCEE_QMore_Exception_InvalidResponseException
  */
 public static function getInstance($return, $secret)
 {
     if (!is_array($return)) {
         $return = WirecardCEE_Stdlib_SerialApi::decode($return);
     }
     if (array_key_exists('paymentState', $return)) {
         return self::_getInstance($return, $secret);
     } else {
         throw new WirecardCEE_QMore_Exception_InvalidResponseException('Invalid response from QMORE. Paymentstate is missing.');
     }
 }
 /**
  * @expectedException WirecardCEE_Stdlib_Exception_InvalidFormatException
  */
 public function testinvalidDecodeFormat()
 {
     try {
         WirecardCEE_Stdlib_SerialApi::decode('test=test=test');
     } catch (WirecardCEE_Stdlib_Exception_InvalidFormatException $e) {
         $this->assertEquals('Invalid format for WirecardCEE_Stdlib_SerialApi::decode. Expecting key=value pairs', $e->getMessage());
         throw $e;
     }
 }
 public function setUp()
 {
     $response = WirecardCEE_Stdlib_SerialApi::decode("message=Amount+is+missing.&consumerMessage=Amount+is+missing.");
     $this->object = new FakeResponse($response);
 }