Skip to content

Commit 6fe6a7e

Browse files
authoredSep 29, 2021
Merge pull request #369 from bavix/develop
[7.x. Stage 1] add new exception (UnconfirmedInvalid)
2 parents ab9129e + 26b4ce6 commit 6fe6a7e

9 files changed

+30
-7
lines changed
 

‎src/Exceptions/AmountInvalid.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Bavix\Wallet\Exceptions;
46

57
use InvalidArgumentException;
68

7-
class AmountInvalid extends InvalidArgumentException
9+
final class AmountInvalid extends InvalidArgumentException
810
{
911
}

‎src/Exceptions/BalanceIsEmpty.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Bavix\Wallet\Exceptions;
46

5-
class BalanceIsEmpty extends InsufficientFunds
7+
final class BalanceIsEmpty extends InsufficientFunds
68
{
79
}

‎src/Exceptions/ConfirmedInvalid.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44

55
use InvalidArgumentException;
66

7-
class ConfirmedInvalid extends InvalidArgumentException
7+
final class ConfirmedInvalid extends InvalidArgumentException
88
{
99
}

‎src/Exceptions/InsufficientFunds.php

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Bavix\Wallet\Exceptions;
46

57
use LogicException;

‎src/Exceptions/ProductEnded.php

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Bavix\Wallet\Exceptions;
46

57
use LogicException;

‎src/Exceptions/UnconfirmedInvalid.php

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Bavix\Wallet\Exceptions;
6+
7+
use InvalidArgumentException;
8+
9+
final class UnconfirmedInvalid extends InvalidArgumentException
10+
{
11+
}

‎src/Exceptions/WalletOwnerInvalid.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Bavix\Wallet\Exceptions;
46

57
use InvalidArgumentException;
68

7-
class WalletOwnerInvalid extends InvalidArgumentException
9+
final class WalletOwnerInvalid extends InvalidArgumentException
810
{
911
}

‎src/Traits/CanConfirm.php

+3-2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use Bavix\Wallet\Exceptions\BalanceIsEmpty;
66
use Bavix\Wallet\Exceptions\ConfirmedInvalid;
77
use Bavix\Wallet\Exceptions\InsufficientFunds;
8+
use Bavix\Wallet\Exceptions\UnconfirmedInvalid;
89
use Bavix\Wallet\Exceptions\WalletOwnerInvalid;
910
use Bavix\Wallet\Interfaces\Confirmable;
1011
use Bavix\Wallet\Interfaces\Mathable;
@@ -59,7 +60,7 @@ public function safeConfirm(Transaction $transaction): bool
5960
/**
6061
* Removal of confirmation (forced), use at your own peril and risk.
6162
*
62-
* @throws ConfirmedInvalid
63+
* @throws UnconfirmedInvalid
6364
*/
6465
public function resetConfirm(Transaction $transaction): bool
6566
{
@@ -74,7 +75,7 @@ public function resetConfirm(Transaction $transaction): bool
7475
}
7576

7677
if (!$transaction->confirmed) {
77-
throw new ConfirmedInvalid(trans('wallet::errors.unconfirmed_invalid'));
78+
throw new UnconfirmedInvalid(trans('wallet::errors.unconfirmed_invalid'));
7879
}
7980

8081
$mathService = app(Mathable::class);

‎tests/ConfirmTest.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace Bavix\Wallet\Test;
44

55
use Bavix\Wallet\Exceptions\ConfirmedInvalid;
6+
use Bavix\Wallet\Exceptions\UnconfirmedInvalid;
67
use Bavix\Wallet\Exceptions\WalletOwnerInvalid;
78
use Bavix\Wallet\Test\Factories\BuyerFactory;
89
use Bavix\Wallet\Test\Factories\UserConfirmFactory;
@@ -136,7 +137,7 @@ public function testConfirmedInvalid(): void
136137

137138
public function testUnconfirmedInvalid(): void
138139
{
139-
$this->expectException(ConfirmedInvalid::class);
140+
$this->expectException(UnconfirmedInvalid::class);
140141
$this->expectExceptionMessageStrict(trans('wallet::errors.unconfirmed_invalid'));
141142

142143
/** @var Buyer $buyer */

0 commit comments

Comments
 (0)
Please sign in to comment.