Merge pull request #5097 from bagisto-europe/5041

fix #5041
This commit is contained in:
Glenn Hermans 2021-08-20 19:24:18 +02:00 committed by GitHub
commit 9f18e1fd97
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 0 deletions

View File

@ -261,6 +261,14 @@ class Order extends Model implements OrderContract
*/
public function canCancel(): bool
{
if ($this->payment->method == 'cashondelivery' && core()->getConfigData('sales.paymentmethods.cashondelivery.generate_invoice')) {
return false;
}
if ($this->payment->method == 'moneytransfer' && core()->getConfigData('sales.paymentmethods.moneytransfer.generate_invoice')) {
return false;
}
if ($this->status === self::STATUS_FRAUD) {
return false;
}