Merge pull request #4973 from bagisto-europe/refunds

fixed #4971
This commit is contained in:
Glenn Hermans 2021-06-28 18:04:40 +02:00 committed by GitHub
commit 63b5c53cba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View File

@ -289,6 +289,11 @@ class Order extends Model implements OrderContract
if ($this->status === self::STATUS_FRAUD) {
return false;
}
$pendingInvoice = $this->invoices->where('state', 'pending')->first();
if ($pendingInvoice) {
return false;
}
foreach ($this->items as $item) {
if ($item->qty_to_refund > 0 && $item->order->status !== self::STATUS_CLOSED) {
@ -302,4 +307,4 @@ class Order extends Model implements OrderContract
return false;
}
}
}