|
5 | 5 | namespace Bavix\Wallet\Traits; |
6 | 6 |
|
7 | 7 | use function array_unique; |
| 8 | +use Bavix\Wallet\Exceptions\BalanceIsEmpty; |
| 9 | +use Bavix\Wallet\Exceptions\InsufficientFunds; |
8 | 10 | use Bavix\Wallet\Exceptions\ProductEnded; |
9 | 11 | use Bavix\Wallet\Interfaces\CartInterface; |
10 | 12 | use Bavix\Wallet\Interfaces\Product; |
11 | 13 | use Bavix\Wallet\Internal\Assembler\AvailabilityDtoAssemblerInterface; |
12 | 14 | use Bavix\Wallet\Internal\Exceptions\ExceptionInterface; |
13 | 15 | use Bavix\Wallet\Internal\Exceptions\ModelNotFoundException; |
| 16 | +use Bavix\Wallet\Internal\Exceptions\TransactionFailedException; |
14 | 17 | use Bavix\Wallet\Internal\Service\DatabaseServiceInterface; |
15 | 18 | use Bavix\Wallet\Internal\Service\TranslatorServiceInterface; |
16 | 19 | use Bavix\Wallet\Models\Transfer; |
|
22 | 25 | use Bavix\Wallet\Services\PrepareServiceInterface; |
23 | 26 | use Bavix\Wallet\Services\PurchaseServiceInterface; |
24 | 27 | use function count; |
| 28 | +use Illuminate\Database\RecordsNotFoundException; |
25 | 29 |
|
26 | 30 | trait CartPay |
27 | 31 | { |
28 | 32 | use HasWallet; |
29 | 33 |
|
30 | 34 | /** |
| 35 | + * @throws ProductEnded |
| 36 | + * @throws BalanceIsEmpty |
| 37 | + * @throws InsufficientFunds |
| 38 | + * @throws RecordsNotFoundException |
| 39 | + * @throws TransactionFailedException |
| 40 | + * @throws ExceptionInterface |
| 41 | + * |
31 | 42 | * @return non-empty-array<Transfer> |
32 | 43 | */ |
33 | 44 | public function payFreeCart(CartInterface $cart): array |
@@ -74,6 +85,13 @@ public function safePayCart(CartInterface $cart, bool $force = false): array |
74 | 85 | } |
75 | 86 |
|
76 | 87 | /** |
| 88 | + * @throws ProductEnded |
| 89 | + * @throws BalanceIsEmpty |
| 90 | + * @throws InsufficientFunds |
| 91 | + * @throws RecordsNotFoundException |
| 92 | + * @throws TransactionFailedException |
| 93 | + * @throws ExceptionInterface |
| 94 | + * |
77 | 95 | * @return non-empty-array<Transfer> |
78 | 96 | */ |
79 | 97 | public function payCart(CartInterface $cart, bool $force = false): array |
|
0 commit comments