Skip to content

Commit a580a40

Browse files
committed
update @throws
1 parent 00c57b4 commit a580a40

File tree

2 files changed

+43
-0
lines changed

2 files changed

+43
-0
lines changed

src/Interfaces/Customer.php

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,13 @@
44

55
namespace Bavix\Wallet\Interfaces;
66

7+
use Bavix\Wallet\Exceptions\BalanceIsEmpty;
8+
use Bavix\Wallet\Exceptions\InsufficientFunds;
9+
use Bavix\Wallet\Exceptions\ProductEnded;
10+
use Bavix\Wallet\Internal\Exceptions\ExceptionInterface;
11+
use Bavix\Wallet\Internal\Exceptions\TransactionFailedException;
712
use Bavix\Wallet\Models\Transfer;
13+
use Illuminate\Database\RecordsNotFoundException;
814

915
interface Customer extends Wallet
1016
{
@@ -23,6 +29,25 @@ public function safeRefund(Product $product, bool $force = false, bool $gifts =
2329
public function forceRefund(Product $product, bool $gifts = false): bool;
2430

2531
/**
32+
* @throws ProductEnded
33+
* @throws BalanceIsEmpty
34+
* @throws InsufficientFunds
35+
* @throws RecordsNotFoundException
36+
* @throws TransactionFailedException
37+
* @throws ExceptionInterface
38+
*
39+
* @return Transfer[]
40+
*/
41+
public function payFreeCart(CartInterface $cart): array;
42+
43+
/**
44+
* @throws ProductEnded
45+
* @throws BalanceIsEmpty
46+
* @throws InsufficientFunds
47+
* @throws RecordsNotFoundException
48+
* @throws TransactionFailedException
49+
* @throws ExceptionInterface
50+
*
2651
* @return Transfer[]
2752
*/
2853
public function payCart(CartInterface $cart, bool $force = false): array;

src/Traits/CartPay.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,15 @@
55
namespace Bavix\Wallet\Traits;
66

77
use function array_unique;
8+
use Bavix\Wallet\Exceptions\BalanceIsEmpty;
9+
use Bavix\Wallet\Exceptions\InsufficientFunds;
810
use Bavix\Wallet\Exceptions\ProductEnded;
911
use Bavix\Wallet\Interfaces\CartInterface;
1012
use Bavix\Wallet\Interfaces\Product;
1113
use Bavix\Wallet\Internal\Assembler\AvailabilityDtoAssemblerInterface;
1214
use Bavix\Wallet\Internal\Exceptions\ExceptionInterface;
1315
use Bavix\Wallet\Internal\Exceptions\ModelNotFoundException;
16+
use Bavix\Wallet\Internal\Exceptions\TransactionFailedException;
1417
use Bavix\Wallet\Internal\Service\DatabaseServiceInterface;
1518
use Bavix\Wallet\Internal\Service\TranslatorServiceInterface;
1619
use Bavix\Wallet\Models\Transfer;
@@ -22,12 +25,20 @@
2225
use Bavix\Wallet\Services\PrepareServiceInterface;
2326
use Bavix\Wallet\Services\PurchaseServiceInterface;
2427
use function count;
28+
use Illuminate\Database\RecordsNotFoundException;
2529

2630
trait CartPay
2731
{
2832
use HasWallet;
2933

3034
/**
35+
* @throws ProductEnded
36+
* @throws BalanceIsEmpty
37+
* @throws InsufficientFunds
38+
* @throws RecordsNotFoundException
39+
* @throws TransactionFailedException
40+
* @throws ExceptionInterface
41+
*
3142
* @return non-empty-array<Transfer>
3243
*/
3344
public function payFreeCart(CartInterface $cart): array
@@ -74,6 +85,13 @@ public function safePayCart(CartInterface $cart, bool $force = false): array
7485
}
7586

7687
/**
88+
* @throws ProductEnded
89+
* @throws BalanceIsEmpty
90+
* @throws InsufficientFunds
91+
* @throws RecordsNotFoundException
92+
* @throws TransactionFailedException
93+
* @throws ExceptionInterface
94+
*
7795
* @return non-empty-array<Transfer>
7896
*/
7997
public function payCart(CartInterface $cart, bool $force = false): array

0 commit comments

Comments
 (0)