Skip to content

Commit 63d12bc

Browse files
committed
add get wallet balance method as getter
1 parent b29b8f5 commit 63d12bc

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

src/Interfaces/WalletOperations.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,9 @@ public function pay(int|float $orderValue, ?string $notes = null): void;
3232
* Deposit an amount to the user's wallet of a specific type.
3333
*/
3434
public function deposit(string $type, int|float $amount, ?string $notes = null): bool;
35+
36+
/**
37+
* Get user's wallet balance.
38+
*/
39+
public function getWalletBalance(): int|float;
3540
}

src/Services/PocketServices.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public function pay(WalletOperations $user, int|float $orderValue, ?string $note
3030
*/
3131
public function checkBalance(WalletOperations $user): int|float
3232
{
33-
return $user->walletBalance;
33+
return $user->getWalletBalance();
3434
}
3535

3636
/**

src/Traits/HasWallet.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,4 +68,9 @@ public function getWalletBalanceByType(string $walletType): int|float
6868

6969
return $wallet->balance;
7070
}
71+
72+
public function getWalletBalance(): int|float
73+
{
74+
return $this->walletBalance;
75+
}
7176
}

0 commit comments

Comments
 (0)