From 272b16cd2d0e4d39b86bf5a78ef6d637981523a0 Mon Sep 17 00:00:00 2001 From: Yurii Myronchuk Date: Tue, 23 May 2017 22:09:32 +0200 Subject: [PATCH 01/14] + ipn --- src/Message/PurchaseRequest.php | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/Message/PurchaseRequest.php b/src/Message/PurchaseRequest.php index ff43513..2f1654c 100644 --- a/src/Message/PurchaseRequest.php +++ b/src/Message/PurchaseRequest.php @@ -14,13 +14,18 @@ class PurchaseRequest extends AbstractRequest { public function getData() { + // \yii\helpers\VarDumper::dump($this);die(); $this->validate('purse', 'currency', 'amount', 'description'); - $data['ok_receiver'] = $this->getPurse(); - $data['ok_item_1_name'] = $this->getDescription(); - $data['ok_currency'] = $this->getCurrency(); - $data['ok_item_1_price'] = $this->getAmount(); - $data['ok_invoice'] = $this->getTransactionId(); - return $data; + return [ + 'ok_receiver' => $this->getPurse(), + 'ok_item_1_name' => $this->getDescription(), + 'ok_currency' => $this->getCurrency(), + 'ok_item_1_price' => $this->getAmount(), + 'ok_invoice' => $this->getTransactionId(), + 'ok_ipn' => $this->getNotifyUrl(), + 'ok_return_success' => $this->getReturnUrl(), + 'ok_return_fail' => $this->getCancelUrl(), + ]; } public function sendData($data) From 2c1c65a26c3921d05aeea3740c137d5aa49c968f Mon Sep 17 00:00:00 2001 From: Yurii Myronchuk Date: Wed, 24 May 2017 09:50:38 +0200 Subject: [PATCH 02/14] fix: revove commented code --- src/Message/PurchaseRequest.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Message/PurchaseRequest.php b/src/Message/PurchaseRequest.php index 2f1654c..caf4e81 100644 --- a/src/Message/PurchaseRequest.php +++ b/src/Message/PurchaseRequest.php @@ -14,7 +14,6 @@ class PurchaseRequest extends AbstractRequest { public function getData() { - // \yii\helpers\VarDumper::dump($this);die(); $this->validate('purse', 'currency', 'amount', 'description'); return [ 'ok_receiver' => $this->getPurse(), From 2443b23a2fda40fa083738af12b1aef43dbfc252 Mon Sep 17 00:00:00 2001 From: Yurii Myronchuk Date: Wed, 24 May 2017 09:58:18 +0200 Subject: [PATCH 03/14] fix: client should be pay commission --- src/Message/PurchaseRequest.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Message/PurchaseRequest.php b/src/Message/PurchaseRequest.php index caf4e81..f5b7083 100644 --- a/src/Message/PurchaseRequest.php +++ b/src/Message/PurchaseRequest.php @@ -24,6 +24,7 @@ public function getData() 'ok_ipn' => $this->getNotifyUrl(), 'ok_return_success' => $this->getReturnUrl(), 'ok_return_fail' => $this->getCancelUrl(), + 'ok_fees' => 1, ]; } From 9f362f3b02ad0d0c5385f3895989b5109852d401 Mon Sep 17 00:00:00 2001 From: Yurii Myronchuk Date: Wed, 24 May 2017 10:00:50 +0200 Subject: [PATCH 04/14] + fees --- src/Message/AbstractRequest.php | 10 ++++++++++ src/Message/PurchaseRequest.php | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/Message/AbstractRequest.php b/src/Message/AbstractRequest.php index 7a7a756..59f6daf 100644 --- a/src/Message/AbstractRequest.php +++ b/src/Message/AbstractRequest.php @@ -51,4 +51,14 @@ public function getDescriotion() { return $this->getParameter('description'); } + + public function setFees($value) + { + return $this->setParameter('fees', $value); + } + + public function getFees() + { + return $this->getParameter('fees'); + } } diff --git a/src/Message/PurchaseRequest.php b/src/Message/PurchaseRequest.php index f5b7083..c4172bf 100644 --- a/src/Message/PurchaseRequest.php +++ b/src/Message/PurchaseRequest.php @@ -24,7 +24,7 @@ public function getData() 'ok_ipn' => $this->getNotifyUrl(), 'ok_return_success' => $this->getReturnUrl(), 'ok_return_fail' => $this->getCancelUrl(), - 'ok_fees' => 1, + 'ok_fees' => $this->getFees(), ]; } From 605e5e8d604e25f8d2388c43a30340795ccb838c Mon Sep 17 00:00:00 2001 From: Yurii Myronchuk Date: Wed, 24 May 2017 10:13:57 +0200 Subject: [PATCH 05/14] + fees fixes --- src/Gateway.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/Gateway.php b/src/Gateway.php index 7ffd6fd..53fec19 100644 --- a/src/Gateway.php +++ b/src/Gateway.php @@ -42,11 +42,22 @@ public function setSecret($value) return $this->setParameter('secret', $value); } + public function setFees($value) + { + return $this->setParameter('fees', $value); + } + + public function getFees() + { + return $this->getParameter('fees'); + } + public function getDefaultParameters() { return [ 'purse' => '', 'secret' => '', + 'fees' => 1, ]; } From 7b060c61478f993ad9ab6db15e76a51d86fde5d4 Mon Sep 17 00:00:00 2001 From: Andrii Vasyliev Date: Wed, 24 May 2017 11:23:32 +0200 Subject: [PATCH 06/14] quickfixed PurchaseResponseTest --- .gitignore | 24 ++++++++++----------- tests/unit/Message/PurchaseResponseTest.php | 2 +- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/.gitignore b/.gitignore index 61ecf11..67883ff 100644 --- a/.gitignore +++ b/.gitignore @@ -1,9 +1,12 @@ # hidev internals -.hidev/composer.json -.hidev/composer.lock -.hidev/runtime -.hidev/vendor -hidev-local.yml +/.hidev/composer.json +/.hidev/composer.lock +/.hidev/runtime +/.hidev/vendor + +# local config +/.env +/hidev-local.yml # IDE & OS files .*.swp @@ -15,11 +18,9 @@ hidev-local.yml Thumbs.db nbproject -# vendor dirs -vendor - -# composer lock files -composer.lock +# composer internals +/composer.lock +/vendor # php-cs-fixer cache .php_cs.cache @@ -34,6 +35,3 @@ ocular.phar php-cs-fixer.phar phpunit-skelgen.phar phpunit.phar - -# Codeception generated files -tests/_support/_generated diff --git a/tests/unit/Message/PurchaseResponseTest.php b/tests/unit/Message/PurchaseResponseTest.php index d916d0d..068739e 100644 --- a/tests/unit/Message/PurchaseResponseTest.php +++ b/tests/unit/Message/PurchaseResponseTest.php @@ -55,6 +55,6 @@ public function testSuccess() 'ok_currency' => $this->currency, 'ok_item_1_price' => $this->amount, 'ok_invoice' => $this->transactionId, - ], $response->getRedirectData()); + ], array_filter($response->getRedirectData())); } } From e88fcfc1d93406682c3f6f75819047768433f756 Mon Sep 17 00:00:00 2001 From: Yurii Myronchuk Date: Mon, 7 Aug 2017 13:08:53 +0000 Subject: [PATCH 07/14] change: rename ok_txn_amount to ok_txn_gross --- src/Message/CompletePurchaseResponse.php | 2 +- tests/unit/Message/CompletePurchaseRequestTest.php | 3 +-- tests/unit/Message/CompletePurchaseResponseTest.php | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/Message/CompletePurchaseResponse.php b/src/Message/CompletePurchaseResponse.php index c208d5b..42828ad 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_amount']); + return floatval($this->data['ok_txn_gross']); } public function getCurrency() diff --git a/tests/unit/Message/CompletePurchaseRequestTest.php b/tests/unit/Message/CompletePurchaseRequestTest.php index 1436416..b8d5ebb 100644 --- a/tests/unit/Message/CompletePurchaseRequestTest.php +++ b/tests/unit/Message/CompletePurchaseRequestTest.php @@ -36,7 +36,6 @@ class CompletePurchaseRequestTest extends TestCase 'ok_txn_payment_type' => 'instant', 'ok_txn_payment_method' => 'OKB', 'ok_txn_gross' => '68.71', - 'ok_txn_amount' => 68.71, 'ok_txn_net' => '68.71', 'ok_txn_fee' => '0.00', 'ok_txn_currency' => 'USD', @@ -87,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_amount']); + $this->assertSame($this->amount, $data['ok_txn_gross']); $this->assertSame($this->timestamp, $data['ok_txn_datetime']); $this->assertSame($this->purse, $data['ok_receiver']); } diff --git a/tests/unit/Message/CompletePurchaseResponseTest.php b/tests/unit/Message/CompletePurchaseResponseTest.php index 0659f10..13392f6 100644 --- a/tests/unit/Message/CompletePurchaseResponseTest.php +++ b/tests/unit/Message/CompletePurchaseResponseTest.php @@ -41,7 +41,7 @@ public function testSuccess() $response = new CompletePurchaseResponse($this->request, [ 'ok_item_1_name' => $this->description, 'ok_receiver' => $this->purse, - 'ok_txn_amount' => $this->amount, + 'ok_txn_gross' => $this->amount, 'ok_txn_datetime' => $this->timestamp, 'ok_txn_id' => $this->transactionId, 'ok_txn_status' => $this->status, From dc93cee0b6a248468fa500d7343a7f5560023556 Mon Sep 17 00:00:00 2001 From: SilverFire - Dmitry Naumenko Date: Mon, 7 Aug 2017 16:37:50 +0300 Subject: [PATCH 08/14] version bump to 0.2.0 --- CHANGELOG.md | 9 ++++++++- hidev.yml | 3 --- history.md | 29 ++++++++++++++++++++++++++++- version | 2 +- 4 files changed, 37 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0ec21eb..5b30efe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,12 @@ hiqdev/omnipay-okpay commits history ------------------------------------ +## [0.2.0] - 2017-08-07 + +- Use `ok_txn_amount` instead of `ok_txn_gross` to follow OkPay API changes ([@SilverFire], [@BladeRoot]) +- Added IPN and fees support ([@BladeRoot], [@hiqsol]) +- Enhanced tests, other minor enhancements ([@hiqsol]) + ## [0.1.0] - 2017-05-05 - Added tests ([@SilverFire], [@BladeRoot], [@hiqsol]) @@ -17,5 +23,6 @@ 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/releases +[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 diff --git a/hidev.yml b/hidev.yml index c46ba29..3ff6c72 100644 --- a/hidev.yml +++ b/hidev.yml @@ -11,6 +11,3 @@ package: processing library for PHP 5.3+. This package implements [OKPAY](https://okpay.com/) support for Omnipay. -require: - hiqdev/hidev-vendor: "*" - hiqdev/hidev-php: "*" diff --git a/history.md b/history.md index 930c762..40bf876 100644 --- a/history.md +++ b/history.md @@ -1,6 +1,22 @@ hiqdev/omnipay-okpay commits history ------------------------------------ +## [0.2.0] - 2017-08-07 + +- Use `ok_txn_amount` instead of `ok_txn_gross` to follow OkPay API changes + - [8eef1f9] 2017-08-07 Merge pull request #4 from bladeroot/omnipay-rename-amount [@SilverFire] + - [e88fcfc] 2017-08-07 change: rename ok_txn_amount to ok_txn_gross [@BladeRoot] +- Added IPN and fees support + - [272b16c] 2017-05-23 + ipn [@BladeRoot] + - [2c1c65a] 2017-05-24 fix: revove commented code [@BladeRoot] + - [efcbe27] 2017-05-24 Merge pull request #3 from bladeroot/okpay-add-ipn [@hiqsol] + - [0631ec6] 2017-05-24 Merge pull request #2 from bladeroot/okpay-add-ipn [@hiqsol] + - [605e5e8] 2017-05-24 + fees fixes [@BladeRoot] + - [9f362f3] 2017-05-24 + fees [@BladeRoot] + - [2443b23] 2017-05-24 fix: client should be pay commission [@BladeRoot] +- Enhanced tests, other minor enhancements + - [7b060c6] 2017-05-24 quickfixed PurchaseResponseTest [@hiqsol] + ## [0.1.0] - 2017-05-05 - Added tests @@ -47,6 +63,17 @@ 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/releases +[Under development]: https://github.com/hiqdev/omnipay-okpay/compare/0.1.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 +[e88fcfc]: https://github.com/hiqdev/omnipay-okpay/commit/e88fcfc +[7b060c6]: https://github.com/hiqdev/omnipay-okpay/commit/7b060c6 +[efcbe27]: https://github.com/hiqdev/omnipay-okpay/commit/efcbe27 +[0631ec6]: https://github.com/hiqdev/omnipay-okpay/commit/0631ec6 +[605e5e8]: https://github.com/hiqdev/omnipay-okpay/commit/605e5e8 +[9f362f3]: https://github.com/hiqdev/omnipay-okpay/commit/9f362f3 +[2443b23]: https://github.com/hiqdev/omnipay-okpay/commit/2443b23 +[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 diff --git a/version b/version index e4052d2..ad74a27 100644 --- a/version +++ b/version @@ -1 +1 @@ -omnipay-okpay 0.1.0 2017-05-05 17:59:51 +0300 a041e6be4674754829f019fb6a1510f66820e0b2 +omnipay-okpay 0.2.0 2017-08-07 16:31:57 +0300 8eef1f9bd89b235c14256333fb6553ac5cb4c4d8 From 91f9111f8f24c4469301f00c65548741062a92d2 Mon Sep 17 00:00:00 2001 From: SilverFire - Dmitry Naumenko Date: Tue, 10 Oct 2017 14:58:48 +0300 Subject: [PATCH 09/14] 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 10/14] 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 11/14] 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 12/14] 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 13/14] 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 14/14] 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