mirror of
https://github.com/Sylius/Sylius.git
synced 2026-07-14 09:02:12 +00:00
Determine Order being processable on itself
This commit is contained in:
parent
1d85b6a08e
commit
c19bb1d15b
3 changed files with 18 additions and 0 deletions
|
|
@ -832,4 +832,15 @@ final class OrderSpec extends ObjectBehavior
|
|||
$this->getTaxIncludedTotal()->shouldReturn(1500);
|
||||
$this->getTaxExcludedTotal()->shouldReturn(800);
|
||||
}
|
||||
|
||||
function it_can_be_processed(): void
|
||||
{
|
||||
$this->setState(OrderInterface::STATE_CART);
|
||||
|
||||
$this->canBeProcessed()->shouldReturn(true);
|
||||
|
||||
$this->setState(OrderInterface::STATE_NEW);
|
||||
|
||||
$this->canBeProcessed()->shouldReturn(false);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -315,6 +315,11 @@ class Order implements OrderInterface
|
|||
$this->recalculateTotal();
|
||||
}
|
||||
|
||||
public function canBeProcessed(): bool
|
||||
{
|
||||
return $this->state === self::STATE_CART;
|
||||
}
|
||||
|
||||
/**
|
||||
* Items total + Adjustments total.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -84,4 +84,6 @@ interface OrderInterface extends AdjustableInterface, ResourceInterface, Timesta
|
|||
public function getAdjustmentsTotalRecursively(?string $type = null): int;
|
||||
|
||||
public function removeAdjustmentsRecursively(?string $type = null): void;
|
||||
|
||||
public function canBeProcessed(): bool;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue