diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml new file mode 100644 index 0000000..b5c1421 --- /dev/null +++ b/.github/workflows/run-tests.yml @@ -0,0 +1,38 @@ +name: PHP Composer + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +permissions: + contents: read + +jobs: + build: + + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + php: [7.4, 8.0, 8.1, 8.2] + + steps: + - uses: actions/checkout@v3 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + coverage: none + + - name: Validate composer.json and composer.lock + run: composer validate + + - name: Install dependencies + run: composer install --prefer-dist --no-progress --no-suggest + + - name: Run test suite + run: composer run-script test diff --git a/composer.json b/composer.json index f2e9dba..b55e4e4 100644 --- a/composer.json +++ b/composer.json @@ -19,12 +19,14 @@ } ], "require": { - "php": "^7.1", + "php": "^7.4|^8", "omnipay/common": "^3.0" }, "require-dev": { - "omnipay/tests": "^3.0", - "scrutinizer/ocular": "^1.5" + "http-interop/http-factory-guzzle": "^1.2", + "omnipay/tests": "^4.0", + "scrutinizer/ocular": "^1.5", + "php-http/guzzle7-adapter": "^1.0" }, "autoload": { "psr-4": { diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 9af3c5d..4ec8536 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,22 +1,13 @@ - - - - tests - - - - - src/ - - + + + + src/ + + + + + tests + + diff --git a/src/Concerns/Parameters.php b/src/Concerns/Parameters.php index 8cee1e5..8c507b5 100644 --- a/src/Concerns/Parameters.php +++ b/src/Concerns/Parameters.php @@ -15,7 +15,7 @@ trait Parameters { /** - * Trả về mã Tmn do VNPay cấp. + * Trả về mã Version * * @return null|string */ @@ -25,7 +25,7 @@ public function getVnpVersion(): ?string } /** - * Thiết lập mã Tmn. + * Thiết lập mã Version * * @param null|string $code * @return $this diff --git a/src/Gateway.php b/src/Gateway.php index 16acfd4..113403f 100644 --- a/src/Gateway.php +++ b/src/Gateway.php @@ -47,7 +47,7 @@ public function initialize(array $parameters = []) public function getDefaultParameters() { return [ - 'vnp_Version' => '2.0.0', + 'vnp_Version' => '2.1.0', ]; } diff --git a/src/Message/AbstractSignatureRequest.php b/src/Message/AbstractSignatureRequest.php index 4b45a6c..a44a4e9 100644 --- a/src/Message/AbstractSignatureRequest.php +++ b/src/Message/AbstractSignatureRequest.php @@ -7,6 +7,7 @@ namespace Omnipay\VNPay\Message; +use Omnipay\Common\Exception\InvalidRequestException; use Omnipay\Common\Message\AbstractRequest; use Omnipay\VNPay\Concerns\Parameters; use Omnipay\VNPay\Concerns\ParametersNormalization; @@ -37,24 +38,23 @@ public function initialize(array $parameters = []) $this->setVnpCreateDate( $this->getVnpCreateDate() ?? date('Ymdhis') ); + $this->setVnpExpireDate( + $this->getVnpExpireDate() ?? date('Ymdhis', strtotime('+15 minutes')) + ); return $this; } /** * {@inheritdoc} + * @throws InvalidRequestException */ public function getData(): array { - call_user_func_array( - [$this, 'validate'], - $this->getSignatureParameters() - ); + $this->validate(...$this->getSignatureParameters()); $parameters = $this->getParameters(); - $parameters['vnp_SecureHash'] = $this->generateSignature( - $parameters['vnp_SecureHashType'] = $this->getSecureHashType() ?? 'sha256' - ); + $parameters['vnp_SecureHash'] = $this->generateSignature(); unset($parameters['vnp_HashSecret'], $parameters['testMode']); @@ -77,7 +77,7 @@ public function getVnpTxnRef(): ?string * Thiết lập mã đơn hàng cần thực thi tác vụ. * Đây là phương thức ánh xạ của [[setTransactionId()]]. * - * @param null|string $ref + * @param null|string $ref * * @return $this * @see setTransactionId @@ -116,7 +116,7 @@ public function getVnpOrderInfo(): ?string /** * Thiết lập thông tin đơn hàng hay lý do truy vấn đến VNPay. * - * @param null|string $info + * @param null|string $info * @return $this */ public function setVnpOrderInfo(?string $info) @@ -139,7 +139,7 @@ public function getVnpCreateDate(): ?string * Thiết lập thời gian khởi tạo truy vấn đến VNPay. * Mặc định sẽ là thời gian hiện tại. * - * @param null|string $date + * @param null|string $date * @return $this * @see setReturnUrl */ @@ -148,6 +148,16 @@ public function setVnpCreateDate(?string $date) return $this->setParameter('vnp_CreateDate', $date); } + public function getVnpExpireDate(): ?string + { + return $this->getParameter('vnp_ExpireDate'); + } + + public function setVnpExpireDate(string $date) + { + $this->setParameter('vnp_ExpireDate', $date); + } + /** * Trả về ip của khách dùng để thanh toán. * Đây là phương thức ánh xạ của [[getClientIp()]]. @@ -165,7 +175,7 @@ public function getVnpIpAddr(): ?string * Đây là phương thức ánh xạ của [[setClientIp()]]. * Mặc định nếu không thiết lập sẽ là IP của khách. * - * @param null|string $ip + * @param null|string $ip * @return $this * @see setClientIp */ @@ -204,7 +214,7 @@ public function getSecureHashType(): ?string /** * Thiết lập phương thức mã hóa dùng để tạo chữ ký dự liệu. * - * @param null|string $secureHashType + * @param null|string $secureHashType * * @return $this * @since 1.0.1 diff --git a/src/Message/Concerns/RequestSignature.php b/src/Message/Concerns/RequestSignature.php index c2357b9..e3f27a4 100644 --- a/src/Message/Concerns/RequestSignature.php +++ b/src/Message/Concerns/RequestSignature.php @@ -18,21 +18,18 @@ trait RequestSignature /** * Trả về chữ ký điện tử gửi đến VNPay dựa theo [[getSignatureParameters()]]. * - * @param string $hashType * @return string */ - protected function generateSignature(string $hashType = 'sha256'): string + protected function generateSignature(): string { $data = []; - $signature = new Signature( - $this->getVnpHashSecret(), - $hashType - ); foreach ($this->getSignatureParameters() as $parameter) { $data[$parameter] = $this->getParameter($parameter); } + $signature = new Signature($this->getVnpHashSecret()); + return $signature->generate($data); } diff --git a/src/Message/Concerns/ResponseSignatureValidation.php b/src/Message/Concerns/ResponseSignatureValidation.php index e6ae59c..0e504d7 100644 --- a/src/Message/Concerns/ResponseSignatureValidation.php +++ b/src/Message/Concerns/ResponseSignatureValidation.php @@ -30,18 +30,13 @@ protected function validateSignature(): void } $dataSignature = array_filter($this->getData(), function ($parameter) { - return 0 === strpos($parameter, 'vnp_') - && 'vnp_SecureHash' !== $parameter - && 'vnp_SecureHashType' !== $parameter; + return 0 === strpos($parameter, 'vnp_') && $parameter !== 'vnp_SecureHash'; }, ARRAY_FILTER_USE_KEY); - $signature = new Signature( - $this->getRequest()->getVnpHashSecret(), - $data['vnp_SecureHashType'] ?? 'md5' - ); + $signature = new Signature($this->getRequest()->getVnpHashSecret()); if (! $signature->validate($dataSignature, $data['vnp_SecureHash'])) { - throw new InvalidResponseException(sprintf('Data signature response from VNPay is invalid!')); + throw new InvalidResponseException('Data signature response from VNPay is invalid!'); } } } diff --git a/src/Message/PurchaseRequest.php b/src/Message/PurchaseRequest.php index 7159a15..d333d8f 100644 --- a/src/Message/PurchaseRequest.php +++ b/src/Message/PurchaseRequest.php @@ -248,7 +248,7 @@ public function setReturnUrl($value) protected function getSignatureParameters(): array { $parameters = [ - 'vnp_CreateDate', 'vnp_IpAddr', 'vnp_ReturnUrl', 'vnp_Amount', 'vnp_OrderType', 'vnp_OrderInfo', + 'vnp_CreateDate', 'vnp_ExpireDate', 'vnp_IpAddr', 'vnp_ReturnUrl', 'vnp_Amount', 'vnp_OrderType', 'vnp_OrderInfo', 'vnp_TxnRef', 'vnp_CurrCode', 'vnp_Locale', 'vnp_TmnCode', 'vnp_Command', 'vnp_Version', ]; diff --git a/src/Message/QueryTransactionRequest.php b/src/Message/QueryTransactionRequest.php index 897f09c..7f7280f 100644 --- a/src/Message/QueryTransactionRequest.php +++ b/src/Message/QueryTransactionRequest.php @@ -42,7 +42,7 @@ public function initialize(array $parameters = []) */ public function sendData($data): SignatureResponse { - $query = http_build_query($data, null, '&', PHP_QUERY_RFC3986); + $query = http_build_query($data, '', '&', PHP_QUERY_RFC3986); $requestUrl = $this->getEndpoint().'?'.$query; $response = $this->httpClient->request('GET', $requestUrl); $responseRawData = $response->getBody()->getContents(); diff --git a/src/Message/RefundRequest.php b/src/Message/RefundRequest.php index d32669b..7688148 100644 --- a/src/Message/RefundRequest.php +++ b/src/Message/RefundRequest.php @@ -42,7 +42,7 @@ public function initialize(array $parameters = []) */ public function sendData($data): SignatureResponse { - $query = http_build_query($data, null, '&', PHP_QUERY_RFC3986); + $query = http_build_query($data, '', '&', PHP_QUERY_RFC3986); $requestUrl = $this->getEndpoint().'?'.$query; $response = $this->httpClient->request('GET', $requestUrl); $responseRawData = $response->getBody()->getContents(); diff --git a/src/Support/Signature.php b/src/Support/Signature.php index feb6074..cc605a4 100644 --- a/src/Support/Signature.php +++ b/src/Support/Signature.php @@ -17,32 +17,17 @@ class Signature { /** * Khóa bí mật dùng để tạo và kiểm tra chữ ký dữ liệu. - * - * @var string */ - protected $hashSecret; - - /** - * Loại thuật toán mã hóa sẽ sử dụng. - * - * @var string - */ - protected $hashType; + protected string $hashSecret; /** * Khởi tạo đối tượng DataSignature. * * @param string $hashSecret - * @param string $hashType * @throws InvalidArgumentException */ - public function __construct(string $hashSecret, string $hashType = 'sha256') + public function __construct(string $hashSecret) { - if (! $this->isSupportHashType($hashType)) { - throw new InvalidArgumentException(sprintf('Hash type: `%s` is not supported by VNPay', $hashType)); - } - - $this->hashType = $hashType; $this->hashSecret = $hashSecret; } @@ -55,9 +40,8 @@ public function __construct(string $hashSecret, string $hashType = 'sha256') public function generate(array $data): string { ksort($data); - $dataSign = $this->hashSecret.urldecode(http_build_query($data)); - return hash($this->hashType, $dataSign); + return hash_hmac('sha512', http_build_query($data), $this->hashSecret); } /** @@ -73,15 +57,4 @@ public function validate(array $data, string $expect): bool return 0 === strcasecmp($expect, $actual); } - - /** - * Phương thức cho biết loại mã hóa truyền vào có được VNPay hổ trợ hay không. - * - * @param string $type - * @return bool - */ - protected function isSupportHashType(string $type): bool - { - return 0 === strcasecmp($type, 'md5') || 0 === strcasecmp($type, 'sha256'); - } } diff --git a/tests/GatewayTest.php b/tests/GatewayTest.php index c95b4d4..e6d8a60 100644 --- a/tests/GatewayTest.php +++ b/tests/GatewayTest.php @@ -26,7 +26,7 @@ class GatewayTest extends GatewayTestCase */ protected $gateway; - protected function setUp() + protected function setUp(): void { $this->gateway = Omnipay::create('VNPay', $this->getHttpClient(), $this->getHttpRequest()); $this->gateway->setVnpTmnCode('COCOSIN'); @@ -37,11 +37,11 @@ protected function setUp() public function testPurchaseSuccess() { $response = $this->gateway->purchase([ - 'vnp_TxnRef' => time(), + 'vnp_TxnRef' => time(), 'vnp_OrderType' => 100000, 'vnp_OrderInfo' => time(), - 'vnp_IpAddr' => '127.0.0.1', - 'vnp_Amount' => 1000000, + 'vnp_IpAddr' => '127.0.0.1', + 'vnp_Amount' => 1000000, 'vnp_ReturnUrl' => 'https://github.com/phpviet', ])->send(); @@ -57,11 +57,11 @@ public function testPurchaseFailure() { $this->expectException(InvalidRequestException::class); $this->gateway->purchase([ - 'vnp_TxnRef' => time(), + 'vnp_TxnRef' => time(), 'vnp_OrderType' => 100000, - 'OrderInfo' => time(), - 'vnp_IpAddr' => '127.0.0.1', - 'vnp_Amount' => 1000000, + 'OrderInfo' => time(), + 'vnp_IpAddr' => '127.0.0.1', + 'vnp_Amount' => 1000000, 'vnp_ReturnUrl' => 'https://github.com/phpviet', ])->send(); } @@ -73,19 +73,19 @@ public function testPurchaseFailure() public function testIncomingSuccess(string $requestMethod) { $this->getHttpRequest()->query->replace([ - 'vnp_Amount' => 1000000, - 'vnp_BankCode' => 'NCB', - 'vnp_BankTranNo' => 20170829152730, - 'vnp_CardType' => 'ATM', - 'vnp_OrderInfo' => 'Thanh+toan+don+hang+thoi+gian%3A+2017-08-29+15%3A27%3A02', - 'vnp_PayDate' => 20170829153052, - 'vnp_ResponseCode' => '00', - 'vnp_TmnCode' => '2QXUI4J4', + 'vnp_Amount' => 1000000, + 'vnp_BankCode' => 'NCB', + 'vnp_BankTranNo' => 20170829152730, + 'vnp_CardType' => 'ATM', + 'vnp_OrderInfo' => 'Thanh+toan+don+hang+thoi+gian%3A+2017-08-29+15%3A27%3A02', + 'vnp_PayDate' => 20170829153052, + 'vnp_ResponseCode' => '00', + 'vnp_TmnCode' => 'COCOSIN', 'vnp_TransactionNo' => 12996460, - 'vnp_TxnRef' => 23597, - 'vnp_SecureHash' => '32c2be7c9a4282ca13ce4a5e443902fe', - 'vnp_SecureHashType' => 'md5', + 'vnp_TxnRef' => 23597, + 'vnp_SecureHash' => 'f0de0729898a035116feb908a36a55fad7e9c7ebb5ded3e752a1dad891e6af2bbdd6f56505b6664bfc417422dae11c8813576f209e62c10f4919f7db5d37124f', ]); + $response = call_user_func([$this->gateway, $requestMethod])->send(); $this->assertTrue($response->isSuccessful()); @@ -103,9 +103,9 @@ public function testIncomingSuccess(string $requestMethod) public function testIncomingFailure(string $requestMethod) { $this->getHttpRequest()->query->replace([ - 'vnp_Amount' => 1000000, + 'vnp_Amount' => 1000000, 'vnp_ResponseCode' => '00', - 'vnp_SecureHash' => '32c2be7c9a4282ca13ce4a5e443902fe', + 'vnp_SecureHash' => '32c2be7c9a4282ca13ce4a5e443902fe', ]); $this->expectException(InvalidResponseException::class); @@ -116,11 +116,12 @@ public function testIncomingFailure(string $requestMethod) public function testQueryTransactionSuccess() { $this->setMockHttpResponse('QueryTransactionSuccess.txt'); + $response = $this->gateway->queryTransaction([ - 'vnp_TransDate' => 20190705151126, - 'vnp_TxnRef' => 1562314234, - 'vnp_OrderInfo' => time(), - 'vnp_IpAddr' => '127.0.0.1', + 'vnp_TransDate' => 20190705151126, + 'vnp_TxnRef' => 1562314234, + 'vnp_OrderInfo' => time(), + 'vnp_IpAddr' => '127.0.0.1', 'vnp_TransactionNo' => 496558, ])->send(); @@ -133,11 +134,12 @@ public function testQueryTransactionSuccess() public function testQueryTransactionFailure() { $this->setMockHttpResponse('QueryTransactionFailure.txt'); + $response = $this->gateway->queryTransaction([ - 'vnp_TransDate' => 20190705151126, - 'vnp_TxnRef' => 15623142234, - 'vnp_OrderInfo' => time(), - 'vnp_IpAddr' => '127.0.0.1', + 'vnp_TransDate' => 20190705151126, + 'vnp_TxnRef' => 15623142234, + 'vnp_OrderInfo' => time(), + 'vnp_IpAddr' => '127.0.0.1', 'vnp_TransactionNo' => 4961111558, ])->send(); @@ -148,14 +150,15 @@ public function testQueryTransactionFailure() public function testRefundSuccess() { $this->setMockHttpResponse('RefundSuccess.txt'); + $response = $this->gateway->refund([ - 'vnp_Amount' => 10000, + 'vnp_Amount' => 10000, 'vnp_TransactionType' => '03', - 'vnp_TransDate' => 20190705151126, - 'vnp_TxnRef' => 32321, - 'vnp_OrderInfo' => time(), - 'vnp_IpAddr' => '127.0.0.1', - 'vnp_TransactionNo' => 496558, + 'vnp_TransDate' => 20190705151126, + 'vnp_TxnRef' => 32321, + 'vnp_OrderInfo' => time(), + 'vnp_IpAddr' => '127.0.0.1', + 'vnp_TransactionNo' => 496558, ])->send(); $this->assertTrue($response->isSuccessful()); @@ -165,13 +168,14 @@ public function testRefundSuccess() public function testRefundFailure() { $this->setMockHttpResponse('RefundFailure.txt'); + $response = $this->gateway->refund([ - 'vnp_TxnRef' => 23597, - 'vnp_Amount' => 10000, + 'vnp_TxnRef' => 23597, + 'vnp_Amount' => 10000, 'vnp_TransactionType' => '03', - 'vnp_OrderInfo' => time(), - 'vnp_IpAddr' => '127.0.0.1', - 'vnp_TransDate' => 20190705151126, + 'vnp_OrderInfo' => time(), + 'vnp_IpAddr' => '127.0.0.1', + 'vnp_TransDate' => 20190705151126, ])->send(); $this->assertEquals(99, $response->getCode()); @@ -183,8 +187,8 @@ public function testDefaultParametersHaveMatchingMethods() $settings = $this->gateway->getDefaultParameters(); foreach ($settings as $key => $default) { $key = str_replace('_', '', $key); - $getter = 'get'.$key; - $setter = 'set'.$key; + $getter = 'get' . $key; + $setter = 'set' . $key; $value = uniqid(); $this->assertTrue(method_exists($this->gateway, $getter), "Gateway must implement $getter()"); @@ -198,8 +202,8 @@ public function testPurchaseParameters() { foreach ($this->gateway->getDefaultParameters() as $key => $default) { $key = str_replace('_', '', $key); - $getter = 'get'.$key; - $setter = 'set'.$key; + $getter = 'get' . $key; + $setter = 'set' . $key; $value = uniqid(); $this->gateway->$setter($value); @@ -213,8 +217,8 @@ public function testRefundParameters() { foreach ($this->gateway->getDefaultParameters() as $key => $default) { $key = str_replace('_', '', $key); - $getter = 'get'.$key; - $setter = 'set'.$key; + $getter = 'get' . $key; + $setter = 'set' . $key; $value = uniqid(); $this->gateway->$setter($value); @@ -228,8 +232,8 @@ public function testCompletePurchaseParameters() { foreach ($this->gateway->getDefaultParameters() as $key => $default) { $key = str_replace('_', '', $key); - $getter = 'get'.$key; - $setter = 'set'.$key; + $getter = 'get' . $key; + $setter = 'set' . $key; $value = uniqid(); $this->gateway->$setter($value); @@ -243,8 +247,8 @@ public function testQueryTransactionParameters() { foreach ($this->gateway->getDefaultParameters() as $key => $default) { $key = str_replace('_', '', $key); - $getter = 'get'.$key; - $setter = 'set'.$key; + $getter = 'get' . $key; + $setter = 'set' . $key; $value = uniqid(); $this->gateway->$setter($value); @@ -258,8 +262,8 @@ public function testNotificationParameters() { foreach ($this->gateway->getDefaultParameters() as $key => $default) { $key = str_replace('_', '', $key); - $getter = 'get'.$key; - $setter = 'set'.$key; + $getter = 'get' . $key; + $setter = 'set' . $key; $value = uniqid(); $this->gateway->$setter($value); diff --git a/tests/Message/IncomingRequestTest.php b/tests/Message/IncomingRequestTest.php index 9f62816..53dc9fa 100644 --- a/tests/Message/IncomingRequestTest.php +++ b/tests/Message/IncomingRequestTest.php @@ -22,7 +22,7 @@ class IncomingRequestTest extends TestCase */ private $request; - public function setUp() + public function setUp(): void { $client = $this->getHttpClient(); $request = $this->getHttpRequest(); diff --git a/tests/Message/PurchaseRequestTest.php b/tests/Message/PurchaseRequestTest.php index b36520c..b13e74d 100644 --- a/tests/Message/PurchaseRequestTest.php +++ b/tests/Message/PurchaseRequestTest.php @@ -22,11 +22,12 @@ class PurchaseRequestTest extends TestCase */ private $request; - public function setUp() + public function setUp(): void { $client = $this->getHttpClient(); $request = $this->getHttpRequest(); $this->request = new PurchaseRequest($client, $request); + $this->request->initialize(); } public function testGetData() @@ -44,7 +45,7 @@ public function testGetData() $request->setVnpReturnUrl(10); $request->setVnpTxnRef(11); $request->setVnpVersion(12); - $request->setSecureHashType('sha256'); + $request->setVnpExpireDate(13); $request->setTestMode(true); $data = $request->getData(); $this->assertEquals(14, count($data)); @@ -71,7 +72,7 @@ public function testGetData() $this->assertEquals(10, $data['vnp_ReturnUrl']); $this->assertEquals(11, $data['vnp_TxnRef']); $this->assertEquals(12, $data['vnp_Version']); - $this->assertEquals('sha256', $data['vnp_SecureHashType']); + $this->assertEquals(13, $data['vnp_ExpireDate']); $this->assertTrue(isset($data['vnp_SecureHash'])); $this->assertFalse(isset($data['vnp_HashSecret'])); } diff --git a/tests/Message/QueryTransactionRequestTest.php b/tests/Message/QueryTransactionRequestTest.php index 808b44e..730978f 100644 --- a/tests/Message/QueryTransactionRequestTest.php +++ b/tests/Message/QueryTransactionRequestTest.php @@ -22,7 +22,7 @@ class QueryTransactionRequestTest extends TestCase */ private $request; - public function setUp() + public function setUp(): void { $client = $this->getHttpClient(); $request = $this->getHttpRequest(); diff --git a/tests/Message/RefundRequestTest.php b/tests/Message/RefundRequestTest.php index 6e12873..314343d 100644 --- a/tests/Message/RefundRequestTest.php +++ b/tests/Message/RefundRequestTest.php @@ -22,7 +22,7 @@ class RefundRequestTest extends TestCase */ private $request; - public function setUp() + public function setUp(): void { $client = $this->getHttpClient(); $request = $this->getHttpRequest(); diff --git a/tests/Message/SignatureResponseTest.php b/tests/Message/SignatureResponseTest.php index 8972ffe..1d0277e 100644 --- a/tests/Message/SignatureResponseTest.php +++ b/tests/Message/SignatureResponseTest.php @@ -10,6 +10,7 @@ use Omnipay\Tests\TestCase; use Omnipay\VNPay\Message\SignatureResponse; +use Omnipay\VNPay\Support\Signature; /** * @author Vuong Minh @@ -41,8 +42,7 @@ public function testIncoming() 'vnp_TmnCode' => '2QXUI4J4', 'vnp_TransactionNo' => 12996460, 'vnp_TxnRef' => 23597, - 'vnp_SecureHash' => '32c2be7c9a4282ca13ce4a5e443902fe', - 'vnp_SecureHashType' => 'md5', + 'vnp_SecureHash' => 'c9acf5dc3da383d6f415bee855e5286c53f3b75da755b32328db74f0509fcaa9d874189a91f4f3fbb5d5ed90fc3f34176f8f103401105f5e9406b0b1a6bc3b2f', ]); $this->assertFalse($response->isPending()); $this->assertTrue($response->isSuccessful()); diff --git a/tests/Mock/QueryTransactionSuccess.txt b/tests/Mock/QueryTransactionSuccess.txt index 704898f..c5c125a 100644 --- a/tests/Mock/QueryTransactionSuccess.txt +++ b/tests/Mock/QueryTransactionSuccess.txt @@ -4,4 +4,4 @@ Server: Apache Connection: close Content-Type: text/plain; charset=utf-8 -vnp_Amount=1000000&vnp_Message=QueryDR+Success&vnp_OrderInfo=1562314234&vnp_PayDate=20190705151100&vnp_ResponseCode=00&vnp_TmnCode=COCOSIN&vnp_TransactionNo=496558&vnp_TransactionStatus=01&vnp_TxnRef=1562314234&vnp_SecureHash=8c3f728cef087916f1f7f2995106ec27 \ No newline at end of file +vnp_Amount=1000000&vnp_Message=QueryDR+Success&vnp_OrderInfo=1562314234&vnp_PayDate=20190705151100&vnp_ResponseCode=00&vnp_TmnCode=COCOSIN&vnp_TransactionNo=496558&vnp_TransactionStatus=01&vnp_TxnRef=1562314234&vnp_SecureHash=20fb4aed508f697eb0019b48c7a5e2e80007ad19f9c20fb5bb45717437150d5f26a0f71f966e8ec9e0dfed587e2d9222474ef012181738fd9b84316fa30a77d6 \ No newline at end of file diff --git a/tests/Mock/RefundSuccess.txt b/tests/Mock/RefundSuccess.txt index 704898f..c5c125a 100644 --- a/tests/Mock/RefundSuccess.txt +++ b/tests/Mock/RefundSuccess.txt @@ -4,4 +4,4 @@ Server: Apache Connection: close Content-Type: text/plain; charset=utf-8 -vnp_Amount=1000000&vnp_Message=QueryDR+Success&vnp_OrderInfo=1562314234&vnp_PayDate=20190705151100&vnp_ResponseCode=00&vnp_TmnCode=COCOSIN&vnp_TransactionNo=496558&vnp_TransactionStatus=01&vnp_TxnRef=1562314234&vnp_SecureHash=8c3f728cef087916f1f7f2995106ec27 \ No newline at end of file +vnp_Amount=1000000&vnp_Message=QueryDR+Success&vnp_OrderInfo=1562314234&vnp_PayDate=20190705151100&vnp_ResponseCode=00&vnp_TmnCode=COCOSIN&vnp_TransactionNo=496558&vnp_TransactionStatus=01&vnp_TxnRef=1562314234&vnp_SecureHash=20fb4aed508f697eb0019b48c7a5e2e80007ad19f9c20fb5bb45717437150d5f26a0f71f966e8ec9e0dfed587e2d9222474ef012181738fd9b84316fa30a77d6 \ No newline at end of file