From 91f9111f8f24c4469301f00c65548741062a92d2 Mon Sep 17 00:00:00 2001 From: SilverFire - Dmitry Naumenko Date: Tue, 10 Oct 2017 14:58:48 +0300 Subject: [PATCH 1/6] Fixed tests to run without remove requests, removed casting to float in CompletePurchaseRespose::getAmount() --- src/Message/CompletePurchaseResponse.php | 2 +- tests/unit/Message/CompletePurchaseRequestTest.php | 12 ++++++++++-- tests/unit/Message/CompletePurchaseResponseTest.php | 2 +- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/Message/CompletePurchaseResponse.php b/src/Message/CompletePurchaseResponse.php index 42828ad..32e4dc8 100644 --- a/src/Message/CompletePurchaseResponse.php +++ b/src/Message/CompletePurchaseResponse.php @@ -52,7 +52,7 @@ public function getTransactionId() public function getAmount() { - return floatval($this->data['ok_txn_gross']); + return $this->data['ok_txn_gross']; } public function getCurrency() diff --git a/tests/unit/Message/CompletePurchaseRequestTest.php b/tests/unit/Message/CompletePurchaseRequestTest.php index b8d5ebb..52466d9 100644 --- a/tests/unit/Message/CompletePurchaseRequestTest.php +++ b/tests/unit/Message/CompletePurchaseRequestTest.php @@ -72,7 +72,7 @@ public function setUp() $httpRequest = new HttpRequest([], $this->data); - $this->request = new CompletePurchaseRequest($this->getHttpClient(), $httpRequest); + $this->request = new NoVerificationCompletePurchaseRequest($this->getHttpClient(), $httpRequest); $this->request->initialize([ 'purse' => $this->purse, 'secret' => $this->secret, @@ -86,7 +86,7 @@ public function testGetData() $this->assertSame($this->description, $data['ok_item_1_name']); $this->assertSame($this->transactionId, $data['ok_txn_id']); - $this->assertSame($this->amount, $data['ok_txn_gross']); + $this->assertEquals($this->amount, $data['ok_txn_gross']); $this->assertSame($this->timestamp, $data['ok_txn_datetime']); $this->assertSame($this->purse, $data['ok_receiver']); } @@ -98,3 +98,11 @@ public function testSendData() $this->assertInstanceOf('Omnipay\OKPAY\Message\CompletePurchaseResponse', $response); } } + +class NoVerificationCompletePurchaseRequest extends CompletePurchaseRequest +{ + public function getData() + { + return $this->httpRequest->request->all(); + } +} diff --git a/tests/unit/Message/CompletePurchaseResponseTest.php b/tests/unit/Message/CompletePurchaseResponseTest.php index 13392f6..ede6272 100644 --- a/tests/unit/Message/CompletePurchaseResponseTest.php +++ b/tests/unit/Message/CompletePurchaseResponseTest.php @@ -19,7 +19,7 @@ class CompletePurchaseResponseTest extends TestCase private $purse = 'purse@company.co'; private $description = 'sDf#$Sdf#$%'; private $transactionId = 1234567890; - private $amount = 8.69; + private $amount = '8.69'; private $currency = 'USD'; private $testMode = true; private $status = 'completed'; From d54fb1a9465fadc4829dc0e792b1cb538f684df8 Mon Sep 17 00:00:00 2001 From: SilverFire - Dmitry Naumenko Date: Tue, 10 Oct 2017 15:37:54 +0300 Subject: [PATCH 2/6] Added CompletePurchaseResponse:: getFee(), getPayer(), getTime() --- src/Message/CompletePurchaseResponse.php | 15 +++++++++++++++ .../unit/Message/CompletePurchaseResponseTest.php | 14 +++++++++++++- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/src/Message/CompletePurchaseResponse.php b/src/Message/CompletePurchaseResponse.php index 32e4dc8..5dc89ca 100644 --- a/src/Message/CompletePurchaseResponse.php +++ b/src/Message/CompletePurchaseResponse.php @@ -69,4 +69,19 @@ public function getPurse() { return $this->data['ok_receiver']; } + + public function getFee() + { + return $this->data['ok_txn_fee']; + } + + public function getPayer() + { + return $this->data['ok_payer_first_name'] . ' ' . $this->data['ok_payer_last_name'] . ' / ' . $this->data['ok_payer_email']; + } + + public function getTime() + { + return new \DateTime($this->data['ok_txn_datetime']); + } } diff --git a/tests/unit/Message/CompletePurchaseResponseTest.php b/tests/unit/Message/CompletePurchaseResponseTest.php index ede6272..f67c341 100644 --- a/tests/unit/Message/CompletePurchaseResponseTest.php +++ b/tests/unit/Message/CompletePurchaseResponseTest.php @@ -23,6 +23,11 @@ class CompletePurchaseResponseTest extends TestCase private $currency = 'USD'; private $testMode = true; private $status = 'completed'; + private $fee = '0.00'; + private $payer_first_name = 'FirstName'; + private $payer_last_name = 'LastName'; + private $payer_email = 'email@example.com'; + private $datetime = '2017-09-20 16:07:50'; public function setUp() { @@ -42,10 +47,14 @@ public function testSuccess() 'ok_item_1_name' => $this->description, 'ok_receiver' => $this->purse, 'ok_txn_gross' => $this->amount, - 'ok_txn_datetime' => $this->timestamp, + 'ok_txn_datetime' => $this->datetime, 'ok_txn_id' => $this->transactionId, 'ok_txn_status' => $this->status, 'ok_txn_currency' => $this->currency, + 'ok_txn_fee' => $this->fee, + 'ok_payer_first_name' => $this->payer_first_name, + 'ok_payer_last_name' => $this->payer_last_name, + 'ok_payer_email' => $this->payer_email, ]); $this->assertTrue($response->isSuccessful()); @@ -56,5 +65,8 @@ public function testSuccess() $this->assertSame($this->purse, $response->getPurse()); $this->assertSame($this->currency, $response->getCurrency()); $this->assertSame($this->transactionId, $response->getTransactionId()); + $this->assertSame($this->fee, $response->getFee()); + $this->assertEquals(new \DateTime($this->datetime), $response->getTime()); + $this->assertSame($this->payer_first_name . ' ' . $this->payer_last_name . ' / ' . $this->payer_email, $response->getPayer()); } } From c9006d4539f27b1ab641e20ad339d193017563d8 Mon Sep 17 00:00:00 2001 From: SilverFire - Dmitry Naumenko Date: Tue, 10 Oct 2017 16:35:36 +0300 Subject: [PATCH 3/6] Removed typecasting from getTransactionId() --- src/Message/CompletePurchaseResponse.php | 2 +- tests/unit/Message/CompletePurchaseResponseTest.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Message/CompletePurchaseResponse.php b/src/Message/CompletePurchaseResponse.php index 5dc89ca..cb94d97 100644 --- a/src/Message/CompletePurchaseResponse.php +++ b/src/Message/CompletePurchaseResponse.php @@ -47,7 +47,7 @@ public function getRedirectData() public function getTransactionId() { - return intval($this->data['ok_txn_id']); + return $this->data['ok_txn_id']; } public function getAmount() diff --git a/tests/unit/Message/CompletePurchaseResponseTest.php b/tests/unit/Message/CompletePurchaseResponseTest.php index f67c341..409257a 100644 --- a/tests/unit/Message/CompletePurchaseResponseTest.php +++ b/tests/unit/Message/CompletePurchaseResponseTest.php @@ -18,7 +18,7 @@ class CompletePurchaseResponseTest extends TestCase private $purse = 'purse@company.co'; private $description = 'sDf#$Sdf#$%'; - private $transactionId = 1234567890; + private $transactionId = '1234567890'; private $amount = '8.69'; private $currency = 'USD'; private $testMode = true; From 35ee3d3dd9d100cd9d170120009ff522b7287862 Mon Sep 17 00:00:00 2001 From: SilverFire - Dmitry Naumenko Date: Tue, 10 Oct 2017 16:44:22 +0300 Subject: [PATCH 4/6] Fixed CompletePurchaseResponse::getTransactionId() to represent ID, provided by merchant Added CompletePurchaseResponse::getTransactionReference() to represent ID, provided by gateway --- src/Message/CompletePurchaseResponse.php | 15 ++++++++++----- .../unit/Message/CompletePurchaseResponseTest.php | 7 +++++-- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/Message/CompletePurchaseResponse.php b/src/Message/CompletePurchaseResponse.php index cb94d97..400e7fa 100644 --- a/src/Message/CompletePurchaseResponse.php +++ b/src/Message/CompletePurchaseResponse.php @@ -45,11 +45,6 @@ public function getRedirectData() return null; } - public function getTransactionId() - { - return $this->data['ok_txn_id']; - } - public function getAmount() { return $this->data['ok_txn_gross']; @@ -84,4 +79,14 @@ public function getTime() { return new \DateTime($this->data['ok_txn_datetime']); } + + public function getTransactionReference() + { + return $this->data['ok_txn_id']; + } + + public function getTransactionId() + { + return $this->data['ok_invoice']; + } } diff --git a/tests/unit/Message/CompletePurchaseResponseTest.php b/tests/unit/Message/CompletePurchaseResponseTest.php index 409257a..886256d 100644 --- a/tests/unit/Message/CompletePurchaseResponseTest.php +++ b/tests/unit/Message/CompletePurchaseResponseTest.php @@ -18,7 +18,8 @@ class CompletePurchaseResponseTest extends TestCase private $purse = 'purse@company.co'; private $description = 'sDf#$Sdf#$%'; - private $transactionId = '1234567890'; + private $transactionReference = '1234567890'; + private $transactionId = '843145'; private $amount = '8.69'; private $currency = 'USD'; private $testMode = true; @@ -48,7 +49,8 @@ public function testSuccess() 'ok_receiver' => $this->purse, 'ok_txn_gross' => $this->amount, 'ok_txn_datetime' => $this->datetime, - 'ok_txn_id' => $this->transactionId, + 'ok_invoice' => $this->transactionId, + 'ok_txn_id' => $this->transactionReference, 'ok_txn_status' => $this->status, 'ok_txn_currency' => $this->currency, 'ok_txn_fee' => $this->fee, @@ -65,6 +67,7 @@ public function testSuccess() $this->assertSame($this->purse, $response->getPurse()); $this->assertSame($this->currency, $response->getCurrency()); $this->assertSame($this->transactionId, $response->getTransactionId()); + $this->assertSame($this->transactionReference, $response->getTransactionReference()); $this->assertSame($this->fee, $response->getFee()); $this->assertEquals(new \DateTime($this->datetime), $response->getTime()); $this->assertSame($this->payer_first_name . ' ' . $this->payer_last_name . ' / ' . $this->payer_email, $response->getPayer()); From 507645655b87f48846bb374511187d75cd662ba2 Mon Sep 17 00:00:00 2001 From: SilverFire - Dmitry Naumenko Date: Thu, 17 Oct 2019 18:49:44 +0300 Subject: [PATCH 5/6] Update to Omnipay v3 --- CHANGELOG.md | 3 +++ composer.json | 9 +++++++-- history.md | 14 ++++++++++++-- version | 2 +- 4 files changed, 23 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5b30efe..3e007e0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,8 @@ hiqdev/omnipay-okpay commits history ------------------------------------ +## [3.0.0] - 2017-10-10 + ## [0.2.0] - 2017-08-07 - Use `ok_txn_amount` instead of `ok_txn_gross` to follow OkPay API changes ([@SilverFire], [@BladeRoot]) @@ -26,3 +28,4 @@ hiqdev/omnipay-okpay commits history [Under development]: https://github.com/hiqdev/omnipay-okpay/compare/0.1.0...HEAD [0.1.0]: https://github.com/hiqdev/omnipay-okpay/releases/tag/0.1.0 [0.2.0]: https://github.com/hiqdev/omnipay-okpay/compare/0.1.0...0.2.0 +[3.0.0]: https://github.com/hiqdev/omnipay-okpay/compare/0.2.0...3.0.0 diff --git a/composer.json b/composer.json index 9617168..8b991cf 100644 --- a/composer.json +++ b/composer.json @@ -45,10 +45,10 @@ } ], "require": { - "omnipay/common": "~2.3" + "omnipay/common": "^3.0" }, "require-dev": { - "omnipay/tests": "~2.0", + "omnipay/tests": "^3.0", "hiqdev/hidev-php": "*", "hiqdev/hidev-hiqdev": "*" }, @@ -56,5 +56,10 @@ "psr-4": { "Omnipay\\OKPAY\\": "src" } + }, + "extra": { + "branch-alias": { + "dev-master": "3.0.x-dev" + } } } diff --git a/history.md b/history.md index 40bf876..e9b17b2 100644 --- a/history.md +++ b/history.md @@ -1,6 +1,13 @@ hiqdev/omnipay-okpay commits history ------------------------------------ +## [3.0.0] - 2017-10-10 + + - [35ee3d3] 2017-10-10 Fixed CompletePurchaseResponse::getTransactionId() to represent ID, provided by merchant [@SilverFire] + - [c9006d4] 2017-10-10 Removed typecasting from getTransactionId() [@SilverFire] + - [d54fb1a] 2017-10-10 Added CompletePurchaseResponse:: getFee(), getPayer(), getTime() [@SilverFire] + - [91f9111] 2017-10-10 Fixed tests to run without remove requests, removed casting to float in CompletePurchaseRespose::getAmount() [@SilverFire] + ## [0.2.0] - 2017-08-07 - Use `ok_txn_amount` instead of `ok_txn_gross` to follow OkPay API changes @@ -21,7 +28,6 @@ hiqdev/omnipay-okpay commits history - Added tests - [a041e6b] 2017-05-05 hideved, csfixed [@SilverFire] - - [a60b417] 2017-05-05 Merge branch 'bladeroot-omnipay-okpay-tests' [@SilverFire] - [9cfd609] 2017-04-03 tests [@BladeRoot] - [3a07721] 2017-04-03 init test [@BladeRoot] - [359b4bf] 2017-03-27 added get/setPurse, made account parameter mandatory [@hiqsol] @@ -57,7 +63,6 @@ hiqdev/omnipay-okpay commits history [ad4dd3b]: https://github.com/hiqdev/omnipay-okpay/commit/ad4dd3b [5bd56b7]: https://github.com/hiqdev/omnipay-okpay/commit/5bd56b7 [7860d5e]: https://github.com/hiqdev/omnipay-okpay/commit/7860d5e -[a60b417]: https://github.com/hiqdev/omnipay-okpay/commit/a60b417 [9cfd609]: https://github.com/hiqdev/omnipay-okpay/commit/9cfd609 [3a07721]: https://github.com/hiqdev/omnipay-okpay/commit/3a07721 [359b4bf]: https://github.com/hiqdev/omnipay-okpay/commit/359b4bf @@ -77,3 +82,8 @@ hiqdev/omnipay-okpay commits history [2c1c65a]: https://github.com/hiqdev/omnipay-okpay/commit/2c1c65a [272b16c]: https://github.com/hiqdev/omnipay-okpay/commit/272b16c [0.2.0]: https://github.com/hiqdev/omnipay-okpay/compare/0.1.0...0.2.0 +[35ee3d3]: https://github.com/hiqdev/omnipay-okpay/commit/35ee3d3 +[c9006d4]: https://github.com/hiqdev/omnipay-okpay/commit/c9006d4 +[d54fb1a]: https://github.com/hiqdev/omnipay-okpay/commit/d54fb1a +[91f9111]: https://github.com/hiqdev/omnipay-okpay/commit/91f9111 +[3.0.0]: https://github.com/hiqdev/omnipay-okpay/compare/0.2.0...3.0.0 diff --git a/version b/version index ad74a27..726e22f 100644 --- a/version +++ b/version @@ -1 +1 @@ -omnipay-okpay 0.2.0 2017-08-07 16:31:57 +0300 8eef1f9bd89b235c14256333fb6553ac5cb4c4d8 +omnipay-okpay 3.0.0 2017-10-10 16:44:22 +0300 35ee3d3dd9d100cd9d170120009ff522b7287862 From 724c78a2f751e1e7349735dc9803073e1195a75d Mon Sep 17 00:00:00 2001 From: SilverFire - Dmitry Naumenko Date: Thu, 17 Oct 2019 18:50:30 +0300 Subject: [PATCH 6/6] version bump to 3.0.0 --- .gitignore | 1 + CHANGELOG.md | 11 ++++++++--- history.md | 14 ++++++++++++-- version | 2 +- 4 files changed, 22 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index 67883ff..7ece95f 100644 --- a/.gitignore +++ b/.gitignore @@ -33,5 +33,6 @@ chkipper.phar composer.phar ocular.phar php-cs-fixer.phar +phpstan.phar phpunit-skelgen.phar phpunit.phar diff --git a/CHANGELOG.md b/CHANGELOG.md index 3e007e0..a52dcec 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,12 @@ +dev release hiqdev/omnipay-okpay commits history ------------------------------------- -## [3.0.0] - 2017-10-10 +## [Under development] + +## [3.0.0] - 2019-10-17 + +- Update to Omnipay v3 ([@SilverFire]) +- Some fixes and enhancements ([@SilverFire]) ## [0.2.0] - 2017-08-07 @@ -25,7 +30,7 @@ hiqdev/omnipay-okpay commits history [andreyklochok@gmail.com]: https://github.com/tafid [@BladeRoot]: https://github.com/BladeRoot [bladeroot@gmail.com]: https://github.com/BladeRoot -[Under development]: https://github.com/hiqdev/omnipay-okpay/compare/0.1.0...HEAD +[Under development]: https://github.com/hiqdev/omnipay-okpay/compare/3.0.0...HEAD [0.1.0]: https://github.com/hiqdev/omnipay-okpay/releases/tag/0.1.0 [0.2.0]: https://github.com/hiqdev/omnipay-okpay/compare/0.1.0...0.2.0 [3.0.0]: https://github.com/hiqdev/omnipay-okpay/compare/0.2.0...3.0.0 diff --git a/history.md b/history.md index e9b17b2..d40d3ef 100644 --- a/history.md +++ b/history.md @@ -1,8 +1,17 @@ +dev release hiqdev/omnipay-okpay commits history + +## [Under development] + + - [] + - [] ------------------------------------ -## [3.0.0] - 2017-10-10 +## [3.0.0] - 2019-10-17 +- Update to Omnipay v3 + - [5076456] 2019-10-17 Update to Omnipay v3 [@SilverFire] +- Some fixes and enhancements - [35ee3d3] 2017-10-10 Fixed CompletePurchaseResponse::getTransactionId() to represent ID, provided by merchant [@SilverFire] - [c9006d4] 2017-10-10 Removed typecasting from getTransactionId() [@SilverFire] - [d54fb1a] 2017-10-10 Added CompletePurchaseResponse:: getFee(), getPayer(), getTime() [@SilverFire] @@ -68,7 +77,7 @@ hiqdev/omnipay-okpay commits history [359b4bf]: https://github.com/hiqdev/omnipay-okpay/commit/359b4bf [f970bb3]: https://github.com/hiqdev/omnipay-okpay/commit/f970bb3 [0259525]: https://github.com/hiqdev/omnipay-okpay/commit/0259525 -[Under development]: https://github.com/hiqdev/omnipay-okpay/compare/0.1.0...HEAD +[Under development]: https://github.com/hiqdev/omnipay-okpay/compare/3.0.0...HEAD [a041e6b]: https://github.com/hiqdev/omnipay-okpay/commit/a041e6b [0.1.0]: https://github.com/hiqdev/omnipay-okpay/releases/tag/0.1.0 [8eef1f9]: https://github.com/hiqdev/omnipay-okpay/commit/8eef1f9 @@ -87,3 +96,4 @@ hiqdev/omnipay-okpay commits history [d54fb1a]: https://github.com/hiqdev/omnipay-okpay/commit/d54fb1a [91f9111]: https://github.com/hiqdev/omnipay-okpay/commit/91f9111 [3.0.0]: https://github.com/hiqdev/omnipay-okpay/compare/0.2.0...3.0.0 +[5076456]: https://github.com/hiqdev/omnipay-okpay/commit/5076456 diff --git a/version b/version index 726e22f..dc6a94b 100644 --- a/version +++ b/version @@ -1 +1 @@ -omnipay-okpay 3.0.0 2017-10-10 16:44:22 +0300 35ee3d3dd9d100cd9d170120009ff522b7287862 +omnipay-okpay 3.0.0 2019-10-17 18:49:44 +0300 507645655b87f48846bb374511187d75cd662ba2