2022-11-04 09:54:23 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace Sarga\Shop\Models;
|
|
|
|
|
|
2022-11-04 09:56:52 +00:00
|
|
|
class Order extends \Webkul\Sales\Models\Order implements \Sarga\Shop\Contracts\Order
|
2022-11-04 09:54:23 +00:00
|
|
|
{
|
|
|
|
|
public const STATUS_PURCHASE = 'purchase';
|
|
|
|
|
|
|
|
|
|
public const STATUS_SHIPPING = 'shipping';
|
|
|
|
|
|
|
|
|
|
protected $statusLabel = [
|
|
|
|
|
self::STATUS_PENDING => 'Pending',
|
|
|
|
|
self::STATUS_PENDING_PAYMENT => 'Pending Payment',
|
2022-11-11 14:07:40 +00:00
|
|
|
self::STATUS_PURCHASE => 'Accepted',
|
|
|
|
|
self::STATUS_SHIPPING => 'Shipping',
|
2022-11-04 09:54:23 +00:00
|
|
|
self::STATUS_PROCESSING => 'Arrived',
|
|
|
|
|
self::STATUS_COMPLETED => 'Completed',
|
|
|
|
|
self::STATUS_CANCELED => 'Canceled',
|
|
|
|
|
self::STATUS_CLOSED => 'Closed',
|
|
|
|
|
self::STATUS_FRAUD => 'Fraud',
|
2022-11-11 14:07:40 +00:00
|
|
|
|
2022-11-04 09:54:23 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
|
|
public function canSendShip(){
|
|
|
|
|
return $this->status === self::STATUS_PURCHASE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function canAccept(){
|
|
|
|
|
return $this->status === self::STATUS_PENDING;
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* Checks if new invoice is allow or not
|
|
|
|
|
*
|
|
|
|
|
* @return bool
|
|
|
|
|
*/
|
|
|
|
|
public function canInvoice(): bool{
|
|
|
|
|
return $this->status === self::STATUS_SHIPPING && parent::canInvoice();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Checks if new shipment is allow or not
|
|
|
|
|
*
|
|
|
|
|
* @return bool
|
|
|
|
|
*/
|
|
|
|
|
public function canShip(): bool{
|
|
|
|
|
return $this->status === self::STATUS_SHIPPING && parent::canShip();
|
|
|
|
|
}
|
|
|
|
|
}
|