/**
* Process OrderState for Order
*
* @param CoreShopOrder $order
* @param null $locale
* @return bool
* @throws \Exception
*/
public function processStep(CoreShopOrder $order, $locale = null)
{
$emailDocument = $this->getEmailDocument($locale);
$emailParameters = array("order" => $order, "newOrderStatus" => $this, "user" => $order->getCustomer());
if ($this->getAccepted()) {
}
if ($this->getShipped()) {
}
if ($this->getPaid()) {
Plugin::actionHook("paymentConfirmation", array("order" => $order));
}
Plugin::actionHook("orderStatusUpdate", array("newOrderStatus" => $this, "order" => $order));
if ($this->getEmail() && $emailDocument instanceof Document\Email) {
$mail = new Mail();
$mail->setDocument($emailDocument);
$mail->setParams($emailParameters);
$mail->addTo($order->getCustomer()->getEmail(), $order->getCustomer()->getFirstname() . " " . $order->getCustomer()->getLastname());
Tool::addAdminToMail($mail);
$mail->send();
}
$order->setOrderState($this);
$order->save();
return true;
//TODO: Stock Management
}