From deaf39d29d55c461bf77b22e25b7ad6ef803e02a Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Sun, 24 Sep 2017 11:52:02 +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 e1556b7d6046..0fc6da08eda2 100644 --- a/app/Models/Payment.php +++ b/app/Models/Payment.php @@ -295,6 +295,10 @@ class Payment extends EntityModel */ public function getCompletedAmount() { + if ($this->isFailed() || $this->isVoided()) { + return 0; + } + return $this->amount - $this->refunded; }