Skip to content

Commit c600904

Browse files
author
Simon Depelchin
authored
Merge pull request #3 from chadtomkiss/patch-1
Fix actualBalance to only include accepted transactions
2 parents 95e74f0 + 4b56cb4 commit c600904

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/HasWallet.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,12 +119,14 @@ public function actualBalance()
119119
{
120120
$credits = $this->wallet->transactions()
121121
->whereIn('type', ['deposit', 'refund'])
122+
->where('accepted', 1)
122123
->sum('amount');
123124

124125
$debits = $this->wallet->transactions()
125126
->whereIn('type', ['withdraw', 'payout'])
127+
->where('accepted', 1)
126128
->sum('amount');
127129

128130
return $credits - $debits;
129131
}
130-
}
132+
}

0 commit comments

Comments
 (0)