Skip to content

Commit 3638b50

Browse files
authored
Merge pull request #938 from bavix/pending-balances
Pending Balances
2 parents bc60fb8 + 41dac42 commit 3638b50

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

tests/Units/Domain/ExtraTest.php

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,4 +303,31 @@ public function testExtraExchangeWithdraw(): void
303303
'message' => 'Write off from the ruble account',
304304
], $transfer->withdraw->meta);
305305
}
306+
307+
public function testPendingBalances(): void
308+
{
309+
/** @var Buyer $user1 */
310+
/** @var Buyer $user2 */
311+
[$user1, $user2] = BuyerFactory::times(2)->create();
312+
313+
$user1->deposit(1000);
314+
self::assertSame(1000, $user1->balanceInt);
315+
self::assertSame(0, $user2->balanceInt);
316+
317+
$transfer = $user1->transfer($user2, 500, new Extra(
318+
deposit: new Option(null, confirmed: false),
319+
withdraw: null,
320+
));
321+
322+
self::assertNotNull($transfer);
323+
self::assertTrue($transfer->withdraw->confirmed);
324+
self::assertFalse($transfer->deposit->confirmed);
325+
326+
self::assertSame(500, $user1->balanceInt);
327+
self::assertSame(0, $user2->balanceInt);
328+
329+
self::assertTrue($user2->wallet->confirm($transfer->deposit)); // confirmed
330+
331+
self::assertSame(500, $user2->balanceInt);
332+
}
306333
}

0 commit comments

Comments
 (0)