From 079cdc16e5d71a8c3a05b798d5c7332d2086a5ae Mon Sep 17 00:00:00 2001 From: Minh Vuong Date: Fri, 5 Jun 2020 00:36:22 +0700 Subject: [PATCH 01/19] Support Laravel 6 & 7. --- composer.json | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/composer.json b/composer.json index a9d6ac5..f93e077 100644 --- a/composer.json +++ b/composer.json @@ -18,17 +18,15 @@ ], "require": { "php": "^7.1", - "ignited/laravel-omnipay": "^3.0", - "illuminate/support": "^5.7", + "ignited/laravel-omnipay": "^3.2", + "illuminate/support": "^5.7 || ^6.0 || ^7.0", "phpviet/omnipay-onepay": "^1.0", "phpviet/omnipay-vnpay": "^1.0", "phpviet/omnipay-vtcpay": "^1.0", "phpviet/omnipay-momo": "^1.0" }, "require-dev": { - "orchestra/testbench": "^3.7", - "phpunit/phpunit": "~7.5", - "scrutinizer/ocular": "^1.5" + "orchestra/testbench": "^3.7 || ^4.0 || ^5.0" }, "autoload": { "psr-4": { From 7b7f8f6f1fe1f667f3d197b0731da9a4728d8eb4 Mon Sep 17 00:00:00 2001 From: Minh Vuong Date: Fri, 5 Jun 2020 00:38:10 +0700 Subject: [PATCH 02/19] Add PHP 7.4 to test env. --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index d54cc35..450d0c2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,6 +4,7 @@ php: - 7.1 - 7.2 - 7.3 + - 7.4 install: - composer self-update From 3173b168b54dbc7fcd7192a4097d50a4ec4ba2e9 Mon Sep 17 00:00:00 2001 From: Minh Vuong Date: Fri, 5 Jun 2020 22:02:16 +0700 Subject: [PATCH 03/19] CS Fix. --- tests/TestCase.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/TestCase.php b/tests/TestCase.php index a61bee7..cf24c5a 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -8,9 +8,9 @@ namespace PHPViet\Laravel\Omnipay\Tests; +use Ignited\LaravelOmnipay\LaravelOmnipayServiceProvider; use Orchestra\Testbench\TestCase as BaseTestCase; use PHPViet\Laravel\Omnipay\OmnipayServiceProvider; -use Ignited\LaravelOmnipay\LaravelOmnipayServiceProvider; /** * @author Vuong Minh From 09d824a77db87efc62c7f28d10bcea57892256dc Mon Sep 17 00:00:00 2001 From: Minh Vuong Date: Fri, 5 Jun 2020 22:03:17 +0700 Subject: [PATCH 04/19] Update CHANGELOG.md [skip ci]. --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 417d362..f62bb49 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ # Changelog Tất cả lịch sử tiến trình phát triển thư viện + +### 1.0.1 + ++ Hổ trợ Laravel 6 & 7. From e0f3a14b7c135d6e2c70c881404bb5d6ffaf1d06 Mon Sep 17 00:00:00 2001 From: Minh Vuong Date: Thu, 2 Jul 2020 23:54:34 +0700 Subject: [PATCH 05/19] Add complete purchase middleware. --- .../CompletePurchaseMiddleware.php | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 src/Middlewares/CompletePurchaseMiddleware.php diff --git a/src/Middlewares/CompletePurchaseMiddleware.php b/src/Middlewares/CompletePurchaseMiddleware.php new file mode 100644 index 0000000..cffddea --- /dev/null +++ b/src/Middlewares/CompletePurchaseMiddleware.php @@ -0,0 +1,47 @@ + + * @since 1.1.0 + */ +class CompletePurchaseMiddleware +{ + /** + * @param \Illuminate\Http\Request $request + * @param \Closure $next + * @return mixed + */ + public function handle($request, Closure $next, string $gateway, $successHandle, $failureHandle = null) + { + /** @var AbstractGateway $gateway */ + $gateway = app('omnipay')->gateway($gateway); + + if (!$gateway->supportsCompletePurchase()) { + throw new \InvalidArgumentException('Gateway configured not support complete purchase method!'); + } + + $response = $gateway->completePurchase()->send(); + + if ($response->isSuccessful()) { + return app()->call($successHandle, [$response]); + } + + if ($failureHandle) { + return app()->call($failureHandle, [$response]); + } + + throw new BadRequestHttpException('Bad request'); + } +} From 351e8ca6ecb6ebeeb7530d6e4040e18c9b041552 Mon Sep 17 00:00:00 2001 From: Minh Vuong Date: Fri, 3 Jul 2020 00:16:22 +0700 Subject: [PATCH 06/19] Update complete purchase middleware. --- src/Middlewares/CompletePurchaseMiddleware.php | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/Middlewares/CompletePurchaseMiddleware.php b/src/Middlewares/CompletePurchaseMiddleware.php index cffddea..c57c235 100644 --- a/src/Middlewares/CompletePurchaseMiddleware.php +++ b/src/Middlewares/CompletePurchaseMiddleware.php @@ -23,7 +23,7 @@ class CompletePurchaseMiddleware * @param \Closure $next * @return mixed */ - public function handle($request, Closure $next, string $gateway, $successHandle, $failureHandle = null) + public function handle($request, Closure $next, string $gateway, $failureHandle = null) { /** @var AbstractGateway $gateway */ $gateway = app('omnipay')->gateway($gateway); @@ -34,14 +34,16 @@ public function handle($request, Closure $next, string $gateway, $successHandle, $response = $gateway->completePurchase()->send(); - if ($response->isSuccessful()) { - return app()->call($successHandle, [$response]); - } + $request->attributes->set('completePurchaseResponse', $response); + + if (!$response->isSuccessful()) { + if ($failureHandle) { + return app()->call($failureHandle, [$response]); + } - if ($failureHandle) { - return app()->call($failureHandle, [$response]); + throw new BadRequestHttpException('Bad request'); } - throw new BadRequestHttpException('Bad request'); + return $next($request); } } From 2674b3096a7406b79bcc38d7e3c0a3c63a05f28f Mon Sep 17 00:00:00 2001 From: Minh Vuong Date: Fri, 3 Jul 2020 00:17:18 +0700 Subject: [PATCH 07/19] Fix typo middleware namespace. --- src/{Middlewares => Middleware}/CompletePurchaseMiddleware.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename src/{Middlewares => Middleware}/CompletePurchaseMiddleware.php (96%) diff --git a/src/Middlewares/CompletePurchaseMiddleware.php b/src/Middleware/CompletePurchaseMiddleware.php similarity index 96% rename from src/Middlewares/CompletePurchaseMiddleware.php rename to src/Middleware/CompletePurchaseMiddleware.php index c57c235..1464e70 100644 --- a/src/Middlewares/CompletePurchaseMiddleware.php +++ b/src/Middleware/CompletePurchaseMiddleware.php @@ -6,7 +6,7 @@ * @license [MIT](https://opensource.org/licenses/MIT) */ -namespace PHPViet\Laravel\Omnipay\Middlewares; +namespace PHPViet\Laravel\Omnipay\Middleware; use Closure; use Omnipay\Common\AbstractGateway; From e5629868495c3755b74cfad9140c02d3d33f2320 Mon Sep 17 00:00:00 2001 From: Minh Vuong Date: Sat, 4 Jul 2020 12:22:33 +0700 Subject: [PATCH 08/19] Add CompletePurchaseMiddlewareTest. --- src/Middleware/CompletePurchaseMiddleware.php | 17 ++--- .../CompletePurchaseMiddlewareTest.php | 71 +++++++++++++++++++ 2 files changed, 78 insertions(+), 10 deletions(-) create mode 100644 tests/Middleware/CompletePurchaseMiddlewareTest.php diff --git a/src/Middleware/CompletePurchaseMiddleware.php b/src/Middleware/CompletePurchaseMiddleware.php index 1464e70..d51a333 100644 --- a/src/Middleware/CompletePurchaseMiddleware.php +++ b/src/Middleware/CompletePurchaseMiddleware.php @@ -10,6 +10,7 @@ use Closure; use Omnipay\Common\AbstractGateway; +use Omnipay\Common\Exception\InvalidRequestException; use Symfony\Component\HttpKernel\Exception\BadRequestHttpException; /** @@ -23,7 +24,7 @@ class CompletePurchaseMiddleware * @param \Closure $next * @return mixed */ - public function handle($request, Closure $next, string $gateway, $failureHandle = null) + public function handle($request, Closure $next, string $gateway) { /** @var AbstractGateway $gateway */ $gateway = app('omnipay')->gateway($gateway); @@ -32,18 +33,14 @@ public function handle($request, Closure $next, string $gateway, $failureHandle throw new \InvalidArgumentException('Gateway configured not support complete purchase method!'); } - $response = $gateway->completePurchase()->send(); + try { + $response = $gateway->completePurchase()->send(); + } catch (InvalidRequestException $e) { + throw new BadRequestHttpException($e->getMessage()); + } $request->attributes->set('completePurchaseResponse', $response); - if (!$response->isSuccessful()) { - if ($failureHandle) { - return app()->call($failureHandle, [$response]); - } - - throw new BadRequestHttpException('Bad request'); - } - return $next($request); } } diff --git a/tests/Middleware/CompletePurchaseMiddlewareTest.php b/tests/Middleware/CompletePurchaseMiddlewareTest.php new file mode 100644 index 0000000..e96b77d --- /dev/null +++ b/tests/Middleware/CompletePurchaseMiddlewareTest.php @@ -0,0 +1,71 @@ + + * @since 1.0.0 + */ +class CompletePurchaseMiddlewareTest extends TestCase +{ + + public function getEnvironmentSetUp($app): void + { + $_GET['partnerCode'] = 'test'; + $_GET['accessKey'] = 'test'; + $_GET['requestId'] = 'test'; + $_GET['amount'] = 'test'; + $_GET['orderId'] = 'test'; + $_GET['orderInfo'] = 'test'; + $_GET['orderType'] = 'test'; + $_GET['transId'] = 'test'; + $_GET['message'] = 'test'; + $_GET['localMessage'] = 'test'; + $_GET['responseTime'] = 'test'; + $_GET['errorCode'] = 'test'; + $_GET['extraData'] = 'test'; + $_GET['signature'] = 'test'; + $_GET['payType'] = 'test'; + + parent::getEnvironmentSetUp($app); + + $router = $app->get('router'); + $router->middleware(CompletePurchaseMiddleware::class); + $router->aliasMiddleware('completePurchase', CompletePurchaseMiddleware::class); + $router->get( + '/test', + function (Request $request) { + $completePurchaseResponse = $request->attributes->get('completePurchaseResponse'); + + $this->assertInstanceOf(ResponseInterface::class, $completePurchaseResponse); + + return new Response('ok', 200); + } + )->middleware('completePurchase:MoMoAIO'); + } + + public function testCanGetResponse() + { + $response = $this->get('/test'); + $response->assertOk(); + } + + public function testMissingRequestQueryParam() + { + unset($_GET['signature']); + $response = $this->get('/test'); + $response->assertStatus(400); + } +} From fb0c57f2023ca62814ed141cf85c6955deba07e9 Mon Sep 17 00:00:00 2001 From: Minh Vuong Date: Sun, 5 Jul 2020 00:20:06 +0700 Subject: [PATCH 09/19] Add CompletePurchaseMiddleware doc. --- docs/VNPay.md | 3 ++ docs/VTCPay.md | 3 ++ docs/common/CompletePurchaseMiddleware.md | 37 +++++++++++++++++++ docs/momo/AllInOne.md | 3 ++ docs/onepay/Domestic.md | 3 ++ docs/onepay/International.md | 3 ++ src/Middleware/CompletePurchaseMiddleware.php | 4 +- 7 files changed, 54 insertions(+), 2 deletions(-) create mode 100644 docs/common/CompletePurchaseMiddleware.md diff --git a/docs/VNPay.md b/docs/VNPay.md index 50ee43a..dca1ba9 100644 --- a/docs/VNPay.md +++ b/docs/VNPay.md @@ -47,6 +47,9 @@ if ($response->isSuccessful()) { } ``` +Hoặc bạn có thể sử dụng `PHPViet\Laravel\Omnipay\Middleware\CompletePurchaseMiddleware` để giảm bớt nghiệp vụ xử lý kiểm tra tính hợp lệ +của request, xem thêm tại [đây](../common/CompletePurchaseMiddleware.md). + Kham khảo thêm các tham trị khi VNPay trả về tại [đây](https://sandbox.vnpayment.vn/apis/docs/huong-dan-tich-hop/#code-returnurl). ### Kiểm tra thông tin `IPN` do VNPay gửi sang: diff --git a/docs/VTCPay.md b/docs/VTCPay.md index 09d9652..e8b9e54 100644 --- a/docs/VTCPay.md +++ b/docs/VTCPay.md @@ -45,6 +45,9 @@ if ($response->isSuccessful()) { } ``` +Hoặc bạn có thể sử dụng `PHPViet\Laravel\Omnipay\Middleware\CompletePurchaseMiddleware` để giảm bớt nghiệp vụ xử lý kiểm tra tính hợp lệ +của request, xem thêm tại [đây](../common/CompletePurchaseMiddleware.md). + Kham khảo thêm các tham trị khi VTCPay trả về tại [đây](https://vtcpay.vn/tai-lieu-tich-hop-website). diff --git a/docs/common/CompletePurchaseMiddleware.md b/docs/common/CompletePurchaseMiddleware.md new file mode 100644 index 0000000..f39e4ea --- /dev/null +++ b/docs/common/CompletePurchaseMiddleware.md @@ -0,0 +1,37 @@ +Complete purchase middleware +================================================== + +Lớp `PHPViet\Laravel\Omnipay\Middleware\CompletePurchaseMiddleware` là một [route middleware](https://laravel.com/docs/7.x/middleware#assigning-middleware-to-routes) giúp bạn +giảm bớt nghiệp vụ xác thực phiên giao dịch của khách có thành công hay không hay có phải là do nhà cung cấp dịch vụ gửi về hay không, thay vào đó bạn chỉ cần tập trung vào xử lý +nghiệp vụ khi thanh toán thành công hoặc thất bại. + +Để sử dụng middleware này thì bạn cần khai báo nó vào `routeMiddleware`: + +```php +// Within App\Http\Kernel Class... + + protected $routeMiddleware = [ + 'completePurchase' => \PHPViet\Laravel\Omnipay\Middleware\CompletePurchaseMiddleware::class + ]; +``` + +Và gắn nó vào route đảm nhiệm nghiệp vụ khi nhà cung cấp dịch vụ redirect khách về site của bạn +ví dụ: + +```php + Route::get('/complete-purchase', function (\Illuminate\Http\Request $request) { + /** @var \Omnipay\Common\Message\ResponseInterface $completePurchaseResponse */ + $completePurchaseResponse = $request->attributes->get('completePurchaseResponse'); + + if ($completePurchaseResponse->isSuccessful()) { + // xử lý logic thanh toán thành công. + } elseif ($completePurchaseResponse->isCancelled()) { + // khi khách hủy giao dịch. + } else { + // các trường hợp khác + } + + })->middleware('completePurchase:MoMoAIO'); +``` + +Parameter truyền vào middleware chính là gateway name của bạn ở ví dụ trên nó là `MoMoAIO` gateway. diff --git a/docs/momo/AllInOne.md b/docs/momo/AllInOne.md index 5ce0dd1..491503b 100644 --- a/docs/momo/AllInOne.md +++ b/docs/momo/AllInOne.md @@ -44,6 +44,9 @@ if ($response->isSuccessful()) { } ``` +Hoặc bạn có thể sử dụng `PHPViet\Laravel\Omnipay\Middleware\CompletePurchaseMiddleware` để giảm bớt nghiệp vụ xử lý kiểm tra tính hợp lệ +của request, xem thêm tại [đây](../common/CompletePurchaseMiddleware.md). + Kham khảo thêm các tham trị khi MoMo trả về tại [đây](https://developers.momo.vn/#/docs/aio/?id=th%c3%b4ng-tin-tham-s%e1%bb%91). ### Kiểm tra thông tin `notifyUrl` do MoMo gửi sang: diff --git a/docs/onepay/Domestic.md b/docs/onepay/Domestic.md index 315cacd..bdc381a 100644 --- a/docs/onepay/Domestic.md +++ b/docs/onepay/Domestic.md @@ -44,6 +44,9 @@ if ($response->isSuccessful()) { } ``` +Hoặc bạn có thể sử dụng `PHPViet\Laravel\Omnipay\Middleware\CompletePurchaseMiddleware` để giảm bớt nghiệp vụ xử lý kiểm tra tính hợp lệ +của request, xem thêm tại [đây](../common/CompletePurchaseMiddleware.md). + Kham khảo thêm các tham trị khi OnePay trả về tại [đây](https://mtf.onepay.vn/developer/resource/documents/docx/quy_trinh_tich_hop-noidia.pdf). ### Kiểm tra thông tin `IPN` do OnePay gửi sang: diff --git a/docs/onepay/International.md b/docs/onepay/International.md index 973366d..22f5037 100644 --- a/docs/onepay/International.md +++ b/docs/onepay/International.md @@ -44,6 +44,9 @@ if ($response->isSuccessful()) { } ``` +Hoặc bạn có thể sử dụng `PHPViet\Laravel\Omnipay\Middleware\CompletePurchaseMiddleware` để giảm bớt nghiệp vụ xử lý kiểm tra tính hợp lệ +của request, xem thêm tại [đây](../common/CompletePurchaseMiddleware.md). + Kham khảo thêm các tham trị khi OnePay trả về tại [đây](https://mtf.onepay.vn/developer/resource/documents/docx/quy_trinh_tich_hop-noidia.pdf). ### Kiểm tra thông tin `IPN` do OnePay gửi sang: diff --git a/src/Middleware/CompletePurchaseMiddleware.php b/src/Middleware/CompletePurchaseMiddleware.php index d51a333..2b9c81d 100644 --- a/src/Middleware/CompletePurchaseMiddleware.php +++ b/src/Middleware/CompletePurchaseMiddleware.php @@ -10,7 +10,7 @@ use Closure; use Omnipay\Common\AbstractGateway; -use Omnipay\Common\Exception\InvalidRequestException; +use Omnipay\Common\Exception\OmnipayException; use Symfony\Component\HttpKernel\Exception\BadRequestHttpException; /** @@ -35,7 +35,7 @@ public function handle($request, Closure $next, string $gateway) try { $response = $gateway->completePurchase()->send(); - } catch (InvalidRequestException $e) { + } catch (OmnipayException $e) { throw new BadRequestHttpException($e->getMessage()); } From 703bda4a59121dd4388cde7ebcce9e13133a6652 Mon Sep 17 00:00:00 2001 From: Minh Vuong Date: Sun, 5 Jul 2020 00:23:23 +0700 Subject: [PATCH 10/19] Update CHANGELOG.md. --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f62bb49..0cb3eef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ Tất cả lịch sử tiến trình phát triển thư viện +### 1.1.0 + ++ Thêm lớp đối tượng `PHPViet\Laravel\Omnipay\Middleware\CompletePurchaseMiddleware` giảm nghiệp vụ xác minh tính hợp lệ của +complete purchase request. + + ### 1.0.1 + Hổ trợ Laravel 6 & 7. From f8209f2e3902f3dc380433db47c6259fd7fcbfd1 Mon Sep 17 00:00:00 2001 From: Vuong Minh Date: Sat, 4 Jul 2020 17:27:15 +0000 Subject: [PATCH 11/19] Apply fixes from StyleCI --- src/Middleware/CompletePurchaseMiddleware.php | 2 +- tests/Middleware/CompletePurchaseMiddlewareTest.php | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Middleware/CompletePurchaseMiddleware.php b/src/Middleware/CompletePurchaseMiddleware.php index 2b9c81d..126f2c7 100644 --- a/src/Middleware/CompletePurchaseMiddleware.php +++ b/src/Middleware/CompletePurchaseMiddleware.php @@ -29,7 +29,7 @@ public function handle($request, Closure $next, string $gateway) /** @var AbstractGateway $gateway */ $gateway = app('omnipay')->gateway($gateway); - if (!$gateway->supportsCompletePurchase()) { + if (! $gateway->supportsCompletePurchase()) { throw new \InvalidArgumentException('Gateway configured not support complete purchase method!'); } diff --git a/tests/Middleware/CompletePurchaseMiddlewareTest.php b/tests/Middleware/CompletePurchaseMiddlewareTest.php index e96b77d..933830b 100644 --- a/tests/Middleware/CompletePurchaseMiddlewareTest.php +++ b/tests/Middleware/CompletePurchaseMiddlewareTest.php @@ -20,7 +20,6 @@ */ class CompletePurchaseMiddlewareTest extends TestCase { - public function getEnvironmentSetUp($app): void { $_GET['partnerCode'] = 'test'; From 82c47b7f70445c16c1240c4ad53abd8b9f2a4129 Mon Sep 17 00:00:00 2001 From: Minh Vuong Date: Sun, 5 Jul 2020 00:34:48 +0700 Subject: [PATCH 12/19] Fix docs [skip ci]. --- docs/VNPay.md | 2 +- docs/VTCPay.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/VNPay.md b/docs/VNPay.md index dca1ba9..05a8cfe 100644 --- a/docs/VNPay.md +++ b/docs/VNPay.md @@ -48,7 +48,7 @@ if ($response->isSuccessful()) { ``` Hoặc bạn có thể sử dụng `PHPViet\Laravel\Omnipay\Middleware\CompletePurchaseMiddleware` để giảm bớt nghiệp vụ xử lý kiểm tra tính hợp lệ -của request, xem thêm tại [đây](../common/CompletePurchaseMiddleware.md). +của request, xem thêm tại [đây](common/CompletePurchaseMiddleware.md). Kham khảo thêm các tham trị khi VNPay trả về tại [đây](https://sandbox.vnpayment.vn/apis/docs/huong-dan-tich-hop/#code-returnurl). diff --git a/docs/VTCPay.md b/docs/VTCPay.md index e8b9e54..05882f1 100644 --- a/docs/VTCPay.md +++ b/docs/VTCPay.md @@ -46,7 +46,7 @@ if ($response->isSuccessful()) { ``` Hoặc bạn có thể sử dụng `PHPViet\Laravel\Omnipay\Middleware\CompletePurchaseMiddleware` để giảm bớt nghiệp vụ xử lý kiểm tra tính hợp lệ -của request, xem thêm tại [đây](../common/CompletePurchaseMiddleware.md). +của request, xem thêm tại [đây](common/CompletePurchaseMiddleware.md). Kham khảo thêm các tham trị khi VTCPay trả về tại [đây](https://vtcpay.vn/tai-lieu-tich-hop-website). From 48e96632d5cc843d7119189b0344ddf595b3bc30 Mon Sep 17 00:00:00 2001 From: hailkongsan Date: Sun, 13 Sep 2020 17:29:35 +0700 Subject: [PATCH 13/19] Add support for Laravel 8 --- composer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index f93e077..9b08475 100644 --- a/composer.json +++ b/composer.json @@ -19,14 +19,14 @@ "require": { "php": "^7.1", "ignited/laravel-omnipay": "^3.2", - "illuminate/support": "^5.7 || ^6.0 || ^7.0", + "illuminate/support": "^5.7 || ^6.0 || ^7.0 || ^8.0", "phpviet/omnipay-onepay": "^1.0", "phpviet/omnipay-vnpay": "^1.0", "phpviet/omnipay-vtcpay": "^1.0", "phpviet/omnipay-momo": "^1.0" }, "require-dev": { - "orchestra/testbench": "^3.7 || ^4.0 || ^5.0" + "orchestra/testbench": "^3.7 || ^4.0 || ^5.0 || ^6.0" }, "autoload": { "psr-4": { From 7978d0f3b06b3f61cd2615b6376a49f8d63aed31 Mon Sep 17 00:00:00 2001 From: Vuong Minh <38932626+vuongxuongminh@users.noreply.github.com> Date: Sun, 20 Sep 2020 00:39:20 +0700 Subject: [PATCH 14/19] Bump version to 1.1.1 --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0cb3eef..5b596ed 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ Tất cả lịch sử tiến trình phát triển thư viện +### 1.1.1 + ++ Hổ trợ Laravel 8. + ### 1.1.0 + Thêm lớp đối tượng `PHPViet\Laravel\Omnipay\Middleware\CompletePurchaseMiddleware` giảm nghiệp vụ xác minh tính hợp lệ của From 65dc343577af12f0ac1df5be2c0d6d922a62a730 Mon Sep 17 00:00:00 2001 From: Minh Vuong Date: Sun, 14 Mar 2021 10:08:49 +0700 Subject: [PATCH 15/19] Bump ignited/laravel-omnipay to 3.3. --- composer.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/composer.json b/composer.json index 9b08475..70dcf28 100644 --- a/composer.json +++ b/composer.json @@ -18,12 +18,12 @@ ], "require": { "php": "^7.1", - "ignited/laravel-omnipay": "^3.2", + "ignited/laravel-omnipay": "^3.3", "illuminate/support": "^5.7 || ^6.0 || ^7.0 || ^8.0", + "phpviet/omnipay-momo": "^1.0", "phpviet/omnipay-onepay": "^1.0", "phpviet/omnipay-vnpay": "^1.0", - "phpviet/omnipay-vtcpay": "^1.0", - "phpviet/omnipay-momo": "^1.0" + "phpviet/omnipay-vtcpay": "^1.0" }, "require-dev": { "orchestra/testbench": "^3.7 || ^4.0 || ^5.0 || ^6.0" @@ -46,7 +46,7 @@ }, "extra": { "branch-alias": { - "dev-master": "1.0-dev" + "dev-master": "1.x-dev" }, "laravel": { "aliases": { From e49ee629299f201b0fc3ffd276e9efd98963119c Mon Sep 17 00:00:00 2001 From: Minh Vuong Date: Sun, 14 Mar 2021 10:10:37 +0700 Subject: [PATCH 16/19] Update CHANGELOG [skip ci]. --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5b596ed..505e0dc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ Tất cả lịch sử tiến trình phát triển thư viện +### 1.1.2 + ++ Nâng cấp composer package `ignited/laravel-omnipay` lên phiên bản tối thiểu 3.3. + ### 1.1.1 + Hổ trợ Laravel 8. From a3aa32e094eb3f9dd70168c1971acb2f18d01472 Mon Sep 17 00:00:00 2001 From: Harry Date: Fri, 8 Oct 2021 09:00:04 +0700 Subject: [PATCH 17/19] Supported PHP 8.0 --- .travis.yml | 1 + composer.json | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 450d0c2..e2620a0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,6 +5,7 @@ php: - 7.2 - 7.3 - 7.4 + - 8.0 install: - composer self-update diff --git a/composer.json b/composer.json index 70dcf28..c136dc7 100644 --- a/composer.json +++ b/composer.json @@ -17,7 +17,7 @@ } ], "require": { - "php": "^7.1", + "php": "^7.1|^8.0", "ignited/laravel-omnipay": "^3.3", "illuminate/support": "^5.7 || ^6.0 || ^7.0 || ^8.0", "phpviet/omnipay-momo": "^1.0", From 1745da5e1e080e655034a982ffc0900e3d5da366 Mon Sep 17 00:00:00 2001 From: HarryTr Date: Sat, 9 Oct 2021 07:50:53 +0700 Subject: [PATCH 18/19] Update support php8 PR --- CHANGELOG.md | 4 ++++ composer.json | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 505e0dc..eaf65d1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ Tất cả lịch sử tiến trình phát triển thư viện +### 1.1.3 + ++ Hổ trợ PHP 8 + ### 1.1.2 + Nâng cấp composer package `ignited/laravel-omnipay` lên phiên bản tối thiểu 3.3. diff --git a/composer.json b/composer.json index c136dc7..529a98b 100644 --- a/composer.json +++ b/composer.json @@ -17,7 +17,7 @@ } ], "require": { - "php": "^7.1|^8.0", + "php": "^7.1 || ^8.0", "ignited/laravel-omnipay": "^3.3", "illuminate/support": "^5.7 || ^6.0 || ^7.0 || ^8.0", "phpviet/omnipay-momo": "^1.0", From 674cf53c8848bc32f4ae61a468151d48eb437b60 Mon Sep 17 00:00:00 2001 From: Minh Vuong Date: Sat, 9 Oct 2021 08:42:54 +0000 Subject: [PATCH 19/19] Apply fixes from StyleCI --- src/Facades/MoMo/AllInOneGateway.php | 1 + src/Facades/MoMo/AppInAppGateway.php | 1 + src/Facades/MoMo/POSGateway.php | 1 + src/Facades/MoMo/QRCodeGateway.php | 1 + src/Facades/OnePay/DomesticGateway.php | 1 + src/Facades/OnePay/InternationalGateway.php | 1 + src/Facades/VNPay/Gateway.php | 1 + src/Facades/VTCPay/Gateway.php | 1 + src/Middleware/CompletePurchaseMiddleware.php | 5 +++-- src/OmnipayServiceProvider.php | 1 + tests/FacadeGatewayTestCase.php | 1 + tests/Facades/MoMo/AllInOneGatewayTest.php | 1 + tests/Facades/MoMo/AppInAppGatewayTest.php | 1 + tests/Facades/MoMo/POSGatewayTest.php | 1 + tests/Facades/MoMo/QRCodeGatewayTest.php | 1 + tests/Facades/OnePay/DomesticGatewayTest.php | 1 + tests/Facades/OnePay/InternationalGatewayTest.php | 1 + tests/Facades/VNPay/GatewayTest.php | 1 + tests/Facades/VTCPay/GatewayTest.php | 1 + tests/Middleware/CompletePurchaseMiddlewareTest.php | 1 + tests/TestCase.php | 1 + 21 files changed, 23 insertions(+), 2 deletions(-) diff --git a/src/Facades/MoMo/AllInOneGateway.php b/src/Facades/MoMo/AllInOneGateway.php index 2707091..d448ca2 100644 --- a/src/Facades/MoMo/AllInOneGateway.php +++ b/src/Facades/MoMo/AllInOneGateway.php @@ -13,6 +13,7 @@ * @method static \Omnipay\MoMo\Message\AllInOne\QueryRefundRequest queryRefund(array $options = []) * * @author Vuong Minh + * * @since 1.0.0 */ class AllInOneGateway extends Facade diff --git a/src/Facades/MoMo/AppInAppGateway.php b/src/Facades/MoMo/AppInAppGateway.php index 6d4c75c..f39fe00 100644 --- a/src/Facades/MoMo/AppInAppGateway.php +++ b/src/Facades/MoMo/AppInAppGateway.php @@ -18,6 +18,7 @@ * @method static \Omnipay\MoMo\Message\PayRefundRequest queryRefund(array $options = []) * * @author Vuong Minh + * * @since 1.0.0 */ class AppInAppGateway extends Facade diff --git a/src/Facades/MoMo/POSGateway.php b/src/Facades/MoMo/POSGateway.php index feb6cd5..433a094 100644 --- a/src/Facades/MoMo/POSGateway.php +++ b/src/Facades/MoMo/POSGateway.php @@ -18,6 +18,7 @@ * @method static \Omnipay\MoMo\Message\PayRefundRequest queryRefund(array $options = []) * * @author Vuong Minh + * * @since 1.0.0 */ class POSGateway extends Facade diff --git a/src/Facades/MoMo/QRCodeGateway.php b/src/Facades/MoMo/QRCodeGateway.php index 03f5b81..6aac695 100644 --- a/src/Facades/MoMo/QRCodeGateway.php +++ b/src/Facades/MoMo/QRCodeGateway.php @@ -18,6 +18,7 @@ * @method static \Omnipay\MoMo\Message\PayRefundRequest queryRefund(array $options = []) * * @author Vuong Minh + * * @since 1.0.0 */ class QRCodeGateway extends Facade diff --git a/src/Facades/OnePay/DomesticGateway.php b/src/Facades/OnePay/DomesticGateway.php index c94e245..0f0b3d7 100644 --- a/src/Facades/OnePay/DomesticGateway.php +++ b/src/Facades/OnePay/DomesticGateway.php @@ -18,6 +18,7 @@ * @method static \Omnipay\OnePay\Message\IncomingRequest notification(array $options = []) * * @author Vuong Minh + * * @since 1.0.0 */ class DomesticGateway extends Facade diff --git a/src/Facades/OnePay/InternationalGateway.php b/src/Facades/OnePay/InternationalGateway.php index c401dec..90825a6 100644 --- a/src/Facades/OnePay/InternationalGateway.php +++ b/src/Facades/OnePay/InternationalGateway.php @@ -18,6 +18,7 @@ * @method static \Omnipay\OnePay\Message\IncomingRequest notification(array $options = []) * * @author Vuong Minh + * * @since 1.0.0 */ class InternationalGateway extends Facade diff --git a/src/Facades/VNPay/Gateway.php b/src/Facades/VNPay/Gateway.php index f834053..4291a57 100644 --- a/src/Facades/VNPay/Gateway.php +++ b/src/Facades/VNPay/Gateway.php @@ -19,6 +19,7 @@ * @method static \Omnipay\VNPay\Message\RefundRequest refund(array $options = []) * * @author Vuong Minh + * * @since 1.0.0 */ class Gateway extends Facade diff --git a/src/Facades/VTCPay/Gateway.php b/src/Facades/VTCPay/Gateway.php index 1402d89..288244a 100644 --- a/src/Facades/VTCPay/Gateway.php +++ b/src/Facades/VTCPay/Gateway.php @@ -17,6 +17,7 @@ * @method static \Omnipay\VTCPay\Message\NotificationRequest notification(array $options = []) * * @author Vuong Minh + * * @since 1.0.0 */ class Gateway extends Facade diff --git a/src/Middleware/CompletePurchaseMiddleware.php b/src/Middleware/CompletePurchaseMiddleware.php index 126f2c7..72d4264 100644 --- a/src/Middleware/CompletePurchaseMiddleware.php +++ b/src/Middleware/CompletePurchaseMiddleware.php @@ -15,13 +15,14 @@ /** * @author Vuong Minh + * * @since 1.1.0 */ class CompletePurchaseMiddleware { /** - * @param \Illuminate\Http\Request $request - * @param \Closure $next + * @param \Illuminate\Http\Request $request + * @param \Closure $next * @return mixed */ public function handle($request, Closure $next, string $gateway) diff --git a/src/OmnipayServiceProvider.php b/src/OmnipayServiceProvider.php index 3c30f30..177192b 100644 --- a/src/OmnipayServiceProvider.php +++ b/src/OmnipayServiceProvider.php @@ -12,6 +12,7 @@ /** * @author Vuong Minh + * * @since 1.0.0 */ class OmnipayServiceProvider extends ServiceProvider diff --git a/tests/FacadeGatewayTestCase.php b/tests/FacadeGatewayTestCase.php index fa47791..5fcc28f 100644 --- a/tests/FacadeGatewayTestCase.php +++ b/tests/FacadeGatewayTestCase.php @@ -10,6 +10,7 @@ /** * @author Vuong Minh + * * @since 1.0.0 */ abstract class FacadeGatewayTestCase extends TestCase diff --git a/tests/Facades/MoMo/AllInOneGatewayTest.php b/tests/Facades/MoMo/AllInOneGatewayTest.php index 0b18376..1c5f77b 100644 --- a/tests/Facades/MoMo/AllInOneGatewayTest.php +++ b/tests/Facades/MoMo/AllInOneGatewayTest.php @@ -12,6 +12,7 @@ /** * @author Vuong Minh + * * @since 1.0.0 */ class AllInOneGatewayTest extends FacadeGatewayTestCase diff --git a/tests/Facades/MoMo/AppInAppGatewayTest.php b/tests/Facades/MoMo/AppInAppGatewayTest.php index 3178004..d457213 100644 --- a/tests/Facades/MoMo/AppInAppGatewayTest.php +++ b/tests/Facades/MoMo/AppInAppGatewayTest.php @@ -12,6 +12,7 @@ /** * @author Vuong Minh + * * @since 1.0.0 */ class AppInAppGatewayTest extends FacadeGatewayTestCase diff --git a/tests/Facades/MoMo/POSGatewayTest.php b/tests/Facades/MoMo/POSGatewayTest.php index 7ec42b7..ee6c27f 100644 --- a/tests/Facades/MoMo/POSGatewayTest.php +++ b/tests/Facades/MoMo/POSGatewayTest.php @@ -12,6 +12,7 @@ /** * @author Vuong Minh + * * @since 1.0.0 */ class POSGatewayTest extends FacadeGatewayTestCase diff --git a/tests/Facades/MoMo/QRCodeGatewayTest.php b/tests/Facades/MoMo/QRCodeGatewayTest.php index e8ff378..201560f 100644 --- a/tests/Facades/MoMo/QRCodeGatewayTest.php +++ b/tests/Facades/MoMo/QRCodeGatewayTest.php @@ -12,6 +12,7 @@ /** * @author Vuong Minh + * * @since 1.0.0 */ class QRCodeGatewayTest extends FacadeGatewayTestCase diff --git a/tests/Facades/OnePay/DomesticGatewayTest.php b/tests/Facades/OnePay/DomesticGatewayTest.php index cad75bf..73bc353 100644 --- a/tests/Facades/OnePay/DomesticGatewayTest.php +++ b/tests/Facades/OnePay/DomesticGatewayTest.php @@ -12,6 +12,7 @@ /** * @author Vuong Minh + * * @since 1.0.0 */ class DomesticGatewayTest extends FacadeGatewayTestCase diff --git a/tests/Facades/OnePay/InternationalGatewayTest.php b/tests/Facades/OnePay/InternationalGatewayTest.php index ae66473..a05a2ab 100644 --- a/tests/Facades/OnePay/InternationalGatewayTest.php +++ b/tests/Facades/OnePay/InternationalGatewayTest.php @@ -12,6 +12,7 @@ /** * @author Vuong Minh + * * @since 1.0.0 */ class InternationalGatewayTest extends FacadeGatewayTestCase diff --git a/tests/Facades/VNPay/GatewayTest.php b/tests/Facades/VNPay/GatewayTest.php index 558d4ba..afc18b6 100644 --- a/tests/Facades/VNPay/GatewayTest.php +++ b/tests/Facades/VNPay/GatewayTest.php @@ -12,6 +12,7 @@ /** * @author Vuong Minh + * * @since 1.0.0 */ class GatewayTest extends FacadeGatewayTestCase diff --git a/tests/Facades/VTCPay/GatewayTest.php b/tests/Facades/VTCPay/GatewayTest.php index ff6a57b..3cb8c54 100644 --- a/tests/Facades/VTCPay/GatewayTest.php +++ b/tests/Facades/VTCPay/GatewayTest.php @@ -12,6 +12,7 @@ /** * @author Vuong Minh + * * @since 1.0.0 */ class GatewayTest extends FacadeGatewayTestCase diff --git a/tests/Middleware/CompletePurchaseMiddlewareTest.php b/tests/Middleware/CompletePurchaseMiddlewareTest.php index 933830b..0496265 100644 --- a/tests/Middleware/CompletePurchaseMiddlewareTest.php +++ b/tests/Middleware/CompletePurchaseMiddlewareTest.php @@ -16,6 +16,7 @@ /** * @author Vuong Minh + * * @since 1.0.0 */ class CompletePurchaseMiddlewareTest extends TestCase diff --git a/tests/TestCase.php b/tests/TestCase.php index cf24c5a..ae72997 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -14,6 +14,7 @@ /** * @author Vuong Minh + * * @since 1.0.0 */ class TestCase extends BaseTestCase