Skip to content

Commit 58975af

Browse files
committed
fix
1 parent 72a6975 commit 58975af

File tree

4 files changed

+10
-6
lines changed

4 files changed

+10
-6
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
],
1616
"require": {
1717
"omnipay/common": "^3.0",
18-
"ecpay/sdk": "^1.1"
18+
"ecpay/sdk": "^1.3"
1919
},
2020
"require-dev": {
2121
"omnipay/tests": "^3.0|^4.0",

src/Message/CompletePurchaseRequest.php

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

55
use Ecpay\Sdk\Response\VerifiedArrayResponse;
66
use Exception;
7+
use Omnipay\Common\Exception\InvalidRequestException;
78
use Omnipay\Common\Exception\InvalidResponseException;
89
use Omnipay\Common\Message\AbstractRequest;
910
use Omnipay\ECPay\Traits\HasDefaults;
@@ -28,14 +29,14 @@ public function getData()
2829
* @param array $data
2930
* @return CompletePurchaseResponse
3031
*
31-
* @throws InvalidResponseException
32+
* @throws InvalidRequestException
3233
*/
3334
public function sendData($data)
3435
{
3536
try {
3637
$this->factory($this, VerifiedArrayResponse::class)->get($data);
3738
} catch (Exception $e) {
38-
throw new InvalidResponseException($e->getMessage(), $e->getCode(), $e);
39+
throw new InvalidRequestException($e->getMessage(), $e->getCode(), $e);
3940
}
4041

4142
return $this->response = new CompletePurchaseResponse($this, $data);
@@ -46,13 +47,14 @@ public function sendData($data)
4647
* @return array
4748
*
4849
* @throws InvalidResponseException
50+
* @throws InvalidRequestException
4951
*/
5052
private function checkMacValue($data)
5153
{
5254
try {
5355
$this->factory($this, VerifiedArrayResponse::class)->get($data);
5456
} catch (Exception $e) {
55-
throw new InvalidResponseException($e->getMessage(), $e->getCode(), $e);
57+
throw new InvalidRequestException($e->getMessage(), $e->getCode(), $e);
5658
}
5759

5860
return $data;

tests/Message/AcceptNotificationRequestTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace Omnipay\ECPay\Tests\Message;
44

5+
use Omnipay\Common\Exception\InvalidRequestException;
56
use Omnipay\Common\Exception\InvalidResponseException;
67
use Omnipay\Common\Message\NotificationInterface;
78
use Omnipay\ECPay\Message\AcceptNotificationRequest;
@@ -66,7 +67,7 @@ public function testSendData($results)
6667

6768
public function testInvalidCheckMacValue()
6869
{
69-
$this->expectException(InvalidResponseException::class);
70+
$this->expectException(InvalidRequestException::class);
7071
$this->expectExceptionMessage('CheckMacValue verify fail');
7172

7273
$data = [

tests/Message/CompletePurchaseRequestTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace Omnipay\ECPay\Tests\Message;
44

5+
use Omnipay\Common\Exception\InvalidRequestException;
56
use Omnipay\Common\Exception\InvalidResponseException;
67
use Omnipay\ECPay\Message\CompletePurchaseRequest;
78
use Omnipay\Tests\TestCase;
@@ -65,7 +66,7 @@ public function testSendData($result)
6566

6667
public function testInvalidCheckMacValue()
6768
{
68-
$this->expectException(InvalidResponseException::class);
69+
$this->expectException(InvalidRequestException::class);
6970
$this->expectExceptionMessage('CheckMacValue verify fail');
7071

7172
$data = [

0 commit comments

Comments
 (0)