diff --git a/src/Message/MyCash/CompletePurchaseRequest.php b/src/Message/MyCash/CompletePurchaseRequest.php index 5a5be79..1636171 100644 --- a/src/Message/MyCash/CompletePurchaseRequest.php +++ b/src/Message/MyCash/CompletePurchaseRequest.php @@ -2,7 +2,7 @@ namespace Omnipay\EPays\Message\MyCash; -use Omnipay\Common\Exception\InvalidRequestException; +use Omnipay\Common\Exception\InvalidResponseException; use Omnipay\Common\Message\AbstractRequest; use Omnipay\EPays\Traits\MyCash\HasMyCash; @@ -13,7 +13,7 @@ class CompletePurchaseRequest extends AbstractRequest /** * @return array * - * @throws InvalidRequestException + * @throws InvalidResponseException */ public function getData() { @@ -21,7 +21,7 @@ public function getData() $validate = array_key_exists('Validate', $data) ? $data['Validate'] : ''; if ($this->makeHash($data) !== $validate) { - throw new InvalidRequestException('Incorrect hash'); + throw new InvalidResponseException('Incorrect hash'); } return $data; diff --git a/src/Message/XWallet/AbstractRequest.php b/src/Message/XWallet/AbstractRequest.php index 95eaea3..dfd3930 100644 --- a/src/Message/XWallet/AbstractRequest.php +++ b/src/Message/XWallet/AbstractRequest.php @@ -7,6 +7,7 @@ abstract class AbstractRequest extends BaseAbstractRequest { private $liveEndpoint = 'https://xwallet-op.epays.tw'; + private $testEndpoint = 'http://xpop-test.epays.com.tw'; public function getEndpoint() diff --git a/tests/Message/MyCash/AcceptNotificationRequestTest.php b/tests/Message/MyCash/AcceptNotificationRequestTest.php index d5aaf42..33c2889 100644 --- a/tests/Message/MyCash/AcceptNotificationRequestTest.php +++ b/tests/Message/MyCash/AcceptNotificationRequestTest.php @@ -2,7 +2,7 @@ namespace Omnipay\EPays\Tests\Message\MyCash; -use Omnipay\Common\Exception\InvalidRequestException; +use Omnipay\Common\Exception\InvalidResponseException; use Omnipay\Common\Message\NotificationInterface; use Omnipay\EPays\Message\MyCash\AcceptNotificationRequest; use Omnipay\EPays\Message\MyCash\CompletePurchaseRequest; @@ -18,7 +18,7 @@ class AcceptNotificationRequestTest extends TestCase public function testValidateFails(): void { - $this->expectException(InvalidRequestException::class); + $this->expectException(InvalidResponseException::class); $options = [ 'RtnCode' => '1', diff --git a/tests/Message/MyCash/CompletePurchaseRequestTest.php b/tests/Message/MyCash/CompletePurchaseRequestTest.php index a096e22..7e39e84 100644 --- a/tests/Message/MyCash/CompletePurchaseRequestTest.php +++ b/tests/Message/MyCash/CompletePurchaseRequestTest.php @@ -2,7 +2,7 @@ namespace Omnipay\EPays\Tests\Message\MyCash; -use Omnipay\Common\Exception\InvalidRequestException; +use Omnipay\Common\Exception\InvalidResponseException; use Omnipay\EPays\Message\MyCash\CompletePurchaseRequest; use Omnipay\Tests\TestCase; @@ -16,7 +16,7 @@ class CompletePurchaseRequestTest extends TestCase public function testValidateFails(): void { - $this->expectException(InvalidRequestException::class); + $this->expectException(InvalidResponseException::class); $this->expectExceptionMessage('Incorrect hash'); $options = [ diff --git a/tests/Message/XWallet/PurchaseRequestTest.php b/tests/Message/XWallet/PurchaseRequestTest.php index 7645c17..d66e834 100644 --- a/tests/Message/XWallet/PurchaseRequestTest.php +++ b/tests/Message/XWallet/PurchaseRequestTest.php @@ -54,8 +54,8 @@ public function testSendData() self::assertEquals('http://xpop-test.epays.com.tw/api/o/new', $response->getRedirectUrl()); self::assertEquals('POST', $response->getRedirectMethod()); self::assertEquals([ - "Hashkey" => "ABCDEFGHIJKLMNOPQRSTUVWXYZ", - "data" => "u4OlyM8T0QFQPQkL8XhzfxH5QVFmVcYqUW+hXuic5a+y9cIjEY8qr3gOoIUmOZLufZtW/3fDRNP2yQAR2kt4Uaqpq24cR9GTgQBXg5eZDjEzsv4hCE+vXqHdQeNBOe+R", + 'Hashkey' => 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', + 'data' => 'u4OlyM8T0QFQPQkL8XhzfxH5QVFmVcYqUW+hXuic5a+y9cIjEY8qr3gOoIUmOZLufZtW/3fDRNP2yQAR2kt4Uaqpq24cR9GTgQBXg5eZDjEzsv4hCE+vXqHdQeNBOe+R', ], $response->getRedirectData()); } }