Beispiel #1
0
 /**
  * @param PaymentResponse $response
  * @throws Exception
  * @throws PaymentResponseException
  */
 public function verifyPaymentResponse(PaymentResponse $response)
 {
     // verify digest & digest1
     try {
         $responseParams = $response->getParams();
         $this->signer->verify($responseParams, $response->getDigest());
         $responseParams['MERCHANTNUMBER'] = $this->merchantNumber;
         $this->signer->verify($responseParams, $response->getDigest1());
     } catch (SignerException $e) {
         throw new Exception($e->getMessage(), $e->getCode(), $e);
     }
     // verify PRCODE and SRCODE
     if (false !== $response->hasError()) {
         throw new PaymentResponseException($response->getParams()['prcode'], $response->getParams()['srcode'], "Response has an error.");
     }
 }
Beispiel #2
0
 /**
  * Verifies if the current hash matches with with the result of the creation of
  * a new signature with given data
  *
  * @param Signer $signer
  * @param string $payload
  * @param string $key
  *
  * @return boolean
  */
 public function verify(Signer $signer, $payload, $key)
 {
     return $signer->verify($this->hash, $payload, $key);
 }
Beispiel #3
0
 /**
  * Verifies if the current hash matches with with the result of the creation of
  * a new signature with given data
  *
  * @param Signer $signer
  * @param string $payload
  * @param Key|string $key
  *
  * @return bool
  */
 public function verify(Signer $signer, string $payload, $key) : bool
 {
     return $signer->verify($this->hash, $payload, $key);
 }
Beispiel #4
0
 /**
  * @expectedException \AdamStipak\Webpay\SignerException
  */
 public function testVerifyWithInvalidDigest()
 {
     $params = array('param1' => 'foo', 'param2' => 'bar');
     $signer = new Signer(__DIR__ . '/keys/test_key.pem', 'changeit', __DIR__ . '/keys/test_cert.pem');
     $signer->verify($params, 'invalid-digest');
 }