示例#1
0
 /**
  * Adds the new payment and delivery values to the order status log.
  *
  * @param MShop_Order_Item_Interface $item Order item object
  */
 protected function _addStatus(MShop_Order_Item_Interface $item)
 {
     $statusManager = MShop_Factory::createManager($this->_getContext(), 'order/status');
     $statusItem = $statusManager->createItem();
     $statusItem->setParentId($item->getId());
     if ($item->getPaymentStatus() != $item->oldPaymentStatus) {
         $statusItem->setId(null);
         $statusItem->setType(MShop_Order_Item_Status_Abstract::STATUS_PAYMENT);
         $statusItem->setValue($item->getPaymentStatus());
         $statusManager->saveItem($statusItem, false);
     }
     if ($item->getDeliveryStatus() != $item->oldDeliveryStatus) {
         $statusItem->setId(null);
         $statusItem->setType(MShop_Order_Item_Status_Abstract::STATUS_DELIVERY);
         $statusItem->setValue($item->getDeliveryStatus());
         $statusManager->saveItem($statusItem, false);
     }
 }
示例#2
0
 /**
  * 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 MShop_Order_Item_Interface $orderItem Order item object
  */
 public function update(MShop_Order_Item_Interface $orderItem)
 {
     switch ($orderItem->getPaymentStatus()) {
         case MShop_Order_Item_Abstract::PAY_DELETED:
         case MShop_Order_Item_Abstract::PAY_CANCELED:
         case MShop_Order_Item_Abstract::PAY_REFUSED:
         case MShop_Order_Item_Abstract::PAY_REFUND:
             $this->unblock($orderItem);
             break;
         case MShop_Order_Item_Abstract::PAY_PENDING:
         case MShop_Order_Item_Abstract::PAY_AUTHORIZED:
         case MShop_Order_Item_Abstract::PAY_RECEIVED:
             $this->block($orderItem);
             break;
     }
 }