Ejemplo n.º 1
0
 /**
  * @covers Moneybird\Invoice::settle
  */
 public function testSettle()
 {
     $this->assertEquals(4.16, $this->object->totalUnpaid);
     $details = new Invoice\Detail\ArrayObject();
     $details->append(new Invoice\Detail(array('amount' => -1, 'description' => 'My credit line', 'price' => 2.5, 'taxRateId' => self::$taxRateId)));
     $invoice = new Invoice(array('poNumber' => 'PO Number', 'details' => $details, 'pricesAreInclTax' => true), self::$contact);
     $invoice->save($this->service);
     $invoice->markAsSent($this->service);
     $this->object->settle($this->service, $invoice);
     $this->assertEquals(1.66, $this->object->totalUnpaid);
     $this->assertEquals(0, $invoice->totalUnpaid);
     $invoice->delete($this->service);
 }
Ejemplo n.º 2
0
 /**
  * @covers Moneybird\Contact::createInvoice
  */
 public function testCreateInvoice()
 {
     $details = new Invoice\Detail\ArrayObject();
     $details->append(new Invoice\Detail(array('amount' => 5, 'description' => 'My invoice line', 'price' => 20, 'tax' => 0.19)));
     $details->append(new Invoice\Detail(array('amount' => 1, 'description' => 'My second invoice line', 'price' => 12, 'tax' => 0.19)));
     $invoice = $this->object->createInvoice(array('details' => $details));
     $invoice->save($this->apiConnector->getService('Invoice'));
 }