/**
  * @expectedException \Magento\Framework\Exception\NoSuchEntityException
  * @expectedExceptionMessage Requested entity doesn't exist
  */
 public function testGetEntityNoId()
 {
     $id = 1;
     $entity = $this->getMockBuilder('Magento\\Sales\\Model\\Order\\Invoice')->disableOriginalConstructor()->getMock();
     $entity->expects($this->once())->method('load')->with($id)->willReturn($entity);
     $entity->expects($this->once())->method('getEntityId')->willReturn(null);
     $this->invoiceMetadata->expects($this->once())->method('getNewInstance')->willReturn($entity);
     $this->assertNull($entity, $this->invoice->get($id));
 }
Esempio n. 2
0
 /**
  * Invoke InvoiceCapture service
  *
  * @param int $id
  * @return bool
  * @throws \Magento\Framework\Exception\NoSuchEntityException
  */
 public function invoke($id)
 {
     return (bool) $this->invoiceRepository->get($id)->capture();
 }
Esempio n. 3
0
 /**
  * Invoke getInvoice service
  *
  * @param int $id
  * @return \Magento\Sales\Service\V1\Data\Invoice
  * @throws \Magento\Framework\Exception\NoSuchEntityException
  */
 public function invoke($id)
 {
     return $this->invoiceMapper->extractDto($this->invoiceRepository->get($id));
 }
Esempio n. 4
0
 /**
  * Invoke notifyUser service
  *
  * @param int $id
  * @return bool
  */
 public function invoke($id)
 {
     /** @var \Magento\Sales\Model\Order\Invoice $invoice */
     $invoice = $this->invoiceRepository->get($id);
     return $this->invoiceNotifier->notify($invoice);
 }