/**
  * Perform persist operations for one entity
  *
  * @param OrderItemInterface $entity
  * @return OrderItemInterface
  */
 public function save(OrderItemInterface $entity)
 {
     if ($entity->getProductOption()) {
         $request = $this->getBuyRequest($entity);
         $entity->setProductOptions(['info_buyRequest' => $request->toArray()]);
     }
     $this->metadata->getMapper()->save($entity);
     $this->registry[$entity->getEntityId()] = $entity;
     return $this->registry[$entity->getEntityId()];
 }
 /**
  * Performs persist operations for a specified order address.
  *
  * @param \Magento\Sales\Api\Data\OrderAddressInterface $entity
  * @return \Magento\Sales\Api\Data\OrderAddressInterface
  * @throws CouldNotSaveException
  */
 public function save(\Magento\Sales\Api\Data\OrderAddressInterface $entity)
 {
     try {
         $this->metadata->getMapper()->save($entity);
         $this->registry[$entity->getEntityId()] = $entity;
     } catch (\Exception $e) {
         throw new CouldNotSaveException(__('Could not save order address'), $e);
     }
     return $this->registry[$entity->getEntityId()];
 }
 /**
  * Perform persist operations for one entity
  *
  * @param \Magento\Sales\Api\Data\InvoiceInterface $entity
  * @return \Magento\Sales\Api\Data\InvoiceInterface
  */
 public function save(\Magento\Sales\Api\Data\InvoiceInterface $entity)
 {
     $this->metadata->getMapper()->save($entity);
     $this->registry[$entity->getEntityId()] = $entity;
     return $this->registry[$entity->getEntityId()];
 }
 /**
  * {@inheritdoc}
  */
 public function save(\Magento\Sales\Api\Data\TransactionInterface $entity)
 {
     $this->metaData->getMapper()->save($entity);
     $this->entityStorage->add($entity);
     return $this->entityStorage->get($entity->getTransactionId());
 }
 /**
  * Performs persist operations for a specified order payment.
  *
  * @param \Magento\Sales\Api\Data\OrderPaymentInterface $entity The order payment ID.
  * @return \Magento\Sales\Api\Data\OrderPaymentInterface Order payment interface.
  */
 public function save(\Magento\Sales\Api\Data\OrderPaymentInterface $entity)
 {
     $this->metaData->getMapper()->save($entity);
     return $entity;
 }