Skip to content

Commit

Permalink
Merge pull request #3 from chadtomkiss/patch-1
Browse files Browse the repository at this point in the history
Fix actualBalance to only include accepted transactions
  • Loading branch information
Simon Depelchin authored Jul 16, 2018
2 parents 95e74f0 + 4b56cb4 commit c600904
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/HasWallet.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,12 +119,14 @@ public function actualBalance()
{
$credits = $this->wallet->transactions()
->whereIn('type', ['deposit', 'refund'])
->where('accepted', 1)
->sum('amount');

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

return $credits - $debits;
}
}
}

0 comments on commit c600904

Please sign in to comment.