/**
  * @covers Moneybird\RecurringTemplate::save
  */
 public function testSave()
 {
     $details = new RecurringTemplate_Detail_Array();
     $details->append(new RecurringTemplate_Detail(array('amount' => 5, 'description' => 'My template line', 'price' => 20, 'taxRateId' => self::$taxRateId)));
     $details->append(new RecurringTemplate_Detail(array('amount' => 1, 'description' => 'My second template line', 'price' => 12, 'taxRateId' => self::$taxRateId)));
     $template = new RecurringTemplate(array('poNumber' => 'PO Number', 'details' => $details, 'frequencyType' => RecurringTemplate::FREQUENCY_YEAR), self::$contact);
     $template->save($this->service);
     $this->assertInstanceOf('Moneybird\\RecurringTemplate', $template);
     self::$templateId = $template->id;
     $this->assertNotNull(self::$templateId);
     $this->assertGreaterThan(0, self::$templateId);
     $template->details[0]->setDeleted();
     $template->save($this->service);
     $this->assertEquals(1, count($template->details));
 }
예제 #2
0
 /**
  * @covers Moneybird\Contact::createRecurringTemplate
  */
 public function testCreateRecurringTemplate()
 {
     $details = new RecurringTemplate_Detail_Array();
     $details->append(new RecurringTemplate_Detail(array('amount' => 5, 'description' => 'My invoice line', 'price' => 20, 'tax' => 0.19)));
     $details->append(new RecurringTemplate_Detail(array('amount' => 1, 'description' => 'My second invoice line', 'price' => 12, 'tax' => 0.19)));
     $template = $this->object->createRecurringTemplate(array('details' => $details, 'frequencyType' => RecurringTemplate::FREQUENCY_YEAR));
     $template->save($this->apiConnector->getService('RecurringTemplate'));
 }