From 1573a89b560ad5015cd2b1e8b0e0416a5fd752a1 Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Sun, 24 Sep 2017 11:52:30 +0300 Subject: [PATCH] Fix for restoring a failed/voided payment --- app/Models/Payment.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/Models/Payment.php b/app/Models/Payment.php index 8e644a651db8..415f2664d1db 100644 --- a/app/Models/Payment.php +++ b/app/Models/Payment.php @@ -285,6 +285,10 @@ class Payment extends EntityModel */ public function getCompletedAmount() { + if ($this->isFailed() || $this->isVoided()) { + return 0; + } + return $this->amount - $this->refunded; }