mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-23 20:00:33 -04:00
Check if referral payments have been refunded
This commit is contained in:
parent
2451baafa0
commit
10fd839c78
@ -74,7 +74,8 @@ class CalculatePayouts extends Command
|
||||
$this->info("User: $user");
|
||||
|
||||
foreach ($client->payments as $payment) {
|
||||
$this->info("Date: $payment->payment_date, Amount: $payment->amount, Reference: $payment->transaction_reference");
|
||||
$amount = $payment->getCompletedAmount();
|
||||
$this->info("Date: $payment->payment_date, Amount: $amount, Reference: $payment->transaction_reference");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -295,6 +295,10 @@ class Payment extends EntityModel
|
||||
*/
|
||||
public function getCompletedAmount()
|
||||
{
|
||||
if ($this->isFailed() || $this->isVoided()) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return $this->amount - $this->refunded;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user