|
11 | 11 | use Bavix\Wallet\Exceptions\WalletOwnerInvalid; |
12 | 12 | use Bavix\Wallet\Internal\Exceptions\ExceptionInterface; |
13 | 13 | use Bavix\Wallet\Internal\Service\DatabaseServiceInterface; |
| 14 | +use Bavix\Wallet\Internal\Service\LockServiceInterface; |
14 | 15 | use Bavix\Wallet\Internal\Service\MathServiceInterface; |
15 | 16 | use Bavix\Wallet\Internal\Service\TranslatorServiceInterface; |
16 | 17 | use Bavix\Wallet\Models\Transaction; |
| 18 | +use Bavix\Wallet\Services\AtomicKeyServiceInterface; |
17 | 19 | use Bavix\Wallet\Services\CastServiceInterface; |
18 | 20 | use Bavix\Wallet\Services\CommonServiceLegacy; |
19 | 21 | use Bavix\Wallet\Services\ConsistencyServiceInterface; |
20 | | -use Bavix\Wallet\Services\LockServiceLegacy; |
21 | 22 |
|
22 | 23 | trait CanConfirm |
23 | 24 | { |
@@ -58,7 +59,11 @@ public function safeConfirm(Transaction $transaction): bool |
58 | 59 | */ |
59 | 60 | public function resetConfirm(Transaction $transaction): bool |
60 | 61 | { |
61 | | - return app(LockServiceLegacy::class)->lock($this, fn () => app(DatabaseServiceInterface::class)->transaction(function () use ($transaction) { |
| 62 | + $atomicKey = app(AtomicKeyServiceInterface::class) |
| 63 | + ->getIdentifier($this) |
| 64 | + ; |
| 65 | + |
| 66 | + return app(LockServiceInterface::class)->block($atomicKey, fn () => app(DatabaseServiceInterface::class)->transaction(function () use ($transaction) { |
62 | 67 | if (!$transaction->confirmed) { |
63 | 68 | throw new UnconfirmedInvalid( |
64 | 69 | app(TranslatorServiceInterface::class)->get('wallet::errors.unconfirmed_invalid'), |
@@ -93,7 +98,11 @@ public function safeResetConfirm(Transaction $transaction): bool |
93 | 98 | */ |
94 | 99 | public function forceConfirm(Transaction $transaction): bool |
95 | 100 | { |
96 | | - return app(LockServiceLegacy::class)->lock($this, fn () => app(DatabaseServiceInterface::class)->transaction(function () use ($transaction) { |
| 101 | + $atomicKey = app(AtomicKeyServiceInterface::class) |
| 102 | + ->getIdentifier($this) |
| 103 | + ; |
| 104 | + |
| 105 | + return app(LockServiceInterface::class)->block($atomicKey, fn () => app(DatabaseServiceInterface::class)->transaction(function () use ($transaction) { |
97 | 106 | if ($transaction->confirmed) { |
98 | 107 | throw new ConfirmedInvalid( |
99 | 108 | app(TranslatorServiceInterface::class)->get('wallet::errors.confirmed_invalid'), |
|
0 commit comments