/** * Adds the new payment and delivery values to the order status log. * * @param \Aimeos\MShop\Order\Item\Iface $item Order item object */ protected function addStatus(\Aimeos\MShop\Order\Item\Iface $item) { $statusManager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'order/status'); $statusItem = $statusManager->createItem(); $statusItem->setParentId($item->getId()); if ($item->getPaymentStatus() != $item->oldPaymentStatus) { $statusItem->setId(null); $statusItem->setType(\Aimeos\MShop\Order\Item\Status\Base::STATUS_PAYMENT); $statusItem->setValue($item->getPaymentStatus()); $statusManager->saveItem($statusItem, false); } if ($item->getDeliveryStatus() != $item->oldDeliveryStatus) { $statusItem->setId(null); $statusItem->setType(\Aimeos\MShop\Order\Item\Status\Base::STATUS_DELIVERY); $statusItem->setValue($item->getDeliveryStatus()); $statusManager->saveItem($statusItem, false); } }
/** * Blocks or frees the resources listed in the order if necessary. * * After payment status updates, the resources like products or coupon * codes listed in the order must be blocked or unblocked. This method * cares about executing the appropriate action depending on the payment * status. * * It's save to call this method multiple times for one order. In this case, * the actions will be executed only once. All subsequent calls will do * nothing as long as the payment status hasn't changed in the meantime. * * @param \Aimeos\MShop\Order\Item\Iface $orderItem Order item object */ public function update(\Aimeos\MShop\Order\Item\Iface $orderItem) { switch ($orderItem->getPaymentStatus()) { case \Aimeos\MShop\Order\Item\Base::PAY_DELETED: case \Aimeos\MShop\Order\Item\Base::PAY_CANCELED: case \Aimeos\MShop\Order\Item\Base::PAY_REFUSED: case \Aimeos\MShop\Order\Item\Base::PAY_REFUND: $this->unblock($orderItem); break; case \Aimeos\MShop\Order\Item\Base::PAY_PENDING: case \Aimeos\MShop\Order\Item\Base::PAY_AUTHORIZED: case \Aimeos\MShop\Order\Item\Base::PAY_RECEIVED: $this->block($orderItem); break; } }