Completes Order Steps on Unity

This commit is contained in:
Fairuz
2021-08-05 10:52:26 +08:00
parent 503a550637
commit 06efb4c169
26 changed files with 208 additions and 78 deletions
@@ -38,7 +38,15 @@ class UpdatesOrderCurrentStepProcessor
$order = $this->fetchesOrder->execute(['id'=>$order_object->getId()]);
$order_steps = $this->fetchesOrderSteps->execute(['order_id'=>$order_object->getId(), 'status'=> OrderStatus::PROCESSING, 'order_by' => 'sequence', 'per_page' => 1]);
//Count steps / obligations that pending
$order_steps_processing = $this->fetchesOrderSteps->getRepository()->where(['order_id'=>$order_object->getId(), 'status'=> OrderStatus::PROCESSING])->count();
//If no more steps / obligations, then update Order status to complete (Contract fullfilled)
if($order_steps_processing==0){
$order_object->setStatus(OrderStatus::COMPLETE);
}else{
$order_object->setStatus($order->status);
}
$order_object->setCurrentStep($currentStep);