Skip to content

Commit 05be83e

Browse files
committed
fix
1 parent 25fdde3 commit 05be83e

File tree

3 files changed

+10
-9
lines changed

3 files changed

+10
-9
lines changed

src/Message/CompletePurchaseRequest.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace Omnipay\Payware\Message;
44

5+
use Omnipay\Common\Exception\InvalidRequestException;
56
use Omnipay\Common\Exception\InvalidResponseException;
67
use Omnipay\Payware\Traits\HasMerchant;
78

@@ -29,12 +30,12 @@ public function sendData($data)
2930
/**
3031
* @return array
3132
*
32-
* @throws InvalidResponseException
33+
* @throws InvalidRequestException
3334
*/
3435
private function checkMacValue($data)
3536
{
36-
if (! hash_equals($this->httpRequest->request->get('CheckMacValue', ''), $this->makeHash($data))) {
37-
throw new InvalidResponseException();
37+
if (! hash_equals($this->makeHash($data), $this->httpRequest->request->get('CheckMacValue', ''))) {
38+
throw new InvalidRequestException('Incorrect CheckMacValue');
3839
}
3940

4041
return $data;

tests/Message/AcceptNotificationRequestTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace Omnipay\Payware\Tests\Message;
44

5-
use Omnipay\Common\Exception\InvalidResponseException;
5+
use Omnipay\Common\Exception\InvalidRequestException;
66
use Omnipay\Common\Message\NotificationInterface;
77
use Omnipay\Payware\Message\AcceptNotificationRequest;
88
use Omnipay\Tests\TestCase;
@@ -55,8 +55,8 @@ public function testSend($result)
5555

5656
public function testInvalidCheckMacValue()
5757
{
58-
$this->expectException(InvalidResponseException::class);
59-
$this->expectExceptionMessage('Invalid response from payment gateway');
58+
$this->expectException(InvalidRequestException::class);
59+
$this->expectExceptionMessage('Incorrect CheckMacValue');
6060

6161
$options = [
6262
'MerchantId' => '1',

tests/Message/CompletePurchaseRequestTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace Omnipay\Payware\Tests\Message;
44

5-
use Omnipay\Common\Exception\InvalidResponseException;
5+
use Omnipay\Common\Exception\InvalidRequestException;
66
use Omnipay\Payware\Message\CompletePurchaseRequest;
77
use Omnipay\Tests\TestCase;
88

@@ -54,8 +54,8 @@ public function testSend($options)
5454

5555
public function testInvalidCheckMacValue()
5656
{
57-
$this->expectException(InvalidResponseException::class);
58-
$this->expectExceptionMessage('Invalid response from payment gateway');
57+
$this->expectException(InvalidRequestException::class);
58+
$this->expectExceptionMessage('Incorrect CheckMacValue');
5959

6060
$data = [
6161
'MerchantId' => '1',

0 commit comments

Comments
 (0)