Esempio n. 1
0
 public function createOneProvider()
 {
     /** @var InvoiceItem $invoiceItem1 */
     $invoiceItem1 = new InvoiceItem();
     $invoiceItem1->setDescription('1 Month of Support');
     $invoiceItem1->setItemType(InvoiceItem::ITEM_TYPE_SERVICES);
     $invoiceItem1->setPrice(500.0);
     $invoiceItem1->setQuantity(1);
     /** @var InvoiceItem $invoiceItem2 */
     $invoiceItem2 = new InvoiceItem();
     $invoiceItem2->setDescription('SuperSoftware License (per host)');
     $invoiceItem2->setItemType(InvoiceItem::ITEM_TYPE_PRODUCTS);
     $invoiceItem2->setPrice(150.0);
     $invoiceItem2->setQuantity(3);
     return [[["setSendNewInvoiceEmails" => false, "setPaymentTermsInDays" => 30, "setDatedOn" => new \DateTime('+1 week'), "setDueOn" => new \DateTime('+1 month'), "setInvoiceItems" => [$invoiceItem1, $invoiceItem2]]]];
 }
 public function setUp()
 {
     parent::setUp();
     self::$invoices = [];
     self::$contacts = [];
     self::$projects = [];
     $this->api->connect();
     /** @var Contact $contact1 */
     $contact1 = $this->api->contact();
     $contact1->setOrganisationName('Totally Cool Ltd.');
     $contact1->save();
     self::$contacts[] = $contact1;
     /** @var Contact $contact2 */
     $contact2 = $this->api->contact();
     $contact2->setOrganisationName('Totally Not Cool PLC.');
     $contact2->save();
     self::$contacts[] = $contact2;
     /** @var Project $project1 */
     $project1 = $this->api->project();
     $project1->setName('Retainer');
     $project1->setContact($contact1);
     $project1->setStatus('Active');
     $project1->setCurrency('GBP');
     $project1->setBudgetUnits('Hours');
     $project1->save();
     self::$projects[] = $project1;
     /** @var Project $project2 */
     $project2 = $this->api->project();
     $project2->setName('New Build');
     $project2->setContact($contact2);
     $project2->setStatus('Active');
     $project2->setCurrency('GBP');
     $project2->setBudgetUnits('Hours');
     $project2->save();
     self::$projects[] = $project2;
     /** @var InvoiceItem $invoiceItem1 */
     $invoiceItem1 = new InvoiceItem();
     $invoiceItem1->setDescription('1 Month of Support');
     $invoiceItem1->setItemType(InvoiceItem::ITEM_TYPE_SERVICES);
     $invoiceItem1->setPrice(500.0);
     $invoiceItem1->setQuantity(1);
     /** @var InvoiceItem $invoiceItem2 */
     $invoiceItem2 = new InvoiceItem();
     $invoiceItem2->setDescription('SuperSoftware License (per host)');
     $invoiceItem2->setItemType(InvoiceItem::ITEM_TYPE_PRODUCTS);
     $invoiceItem2->setPrice(150.0);
     $invoiceItem2->setQuantity(3);
     /** @var Invoice $invoice1 */
     $invoice1 = $this->api->invoice();
     $invoice1->setContact($contact1);
     $invoice1->setProject($project1);
     $invoice1->setPaymentTermsInDays(30);
     $invoice1->setDatedOn(new \DateTime('-1 day'));
     $invoice1->setDueOn(new \DateTime('+1 month'));
     $invoice1->setInvoiceItems([$invoiceItem1, $invoiceItem2]);
     $invoice1->save();
     self::$invoices[] = $invoice1;
     //$invoice1->markAsSent();
     /** @var InvoiceItem $invoiceItem3 */
     $invoiceItem3 = new InvoiceItem();
     $invoiceItem3->setDescription('1 Month of Support');
     $invoiceItem3->setItemType(InvoiceItem::ITEM_TYPE_DAYS);
     $invoiceItem3->setQuantity(3);
     $invoiceItem3->setPrice(80);
     $invoiceItem3->setQuantity(1);
     /** @var Invoice $invoice2 */
     $invoice2 = $this->api->invoice();
     $invoice2->setContact($contact2);
     $invoice2->setProject($project2);
     $invoice2->setPaymentTermsInDays(10);
     $invoice2->setDatedOn(new \DateTime('-1 day'));
     $invoice2->setDueOn(new \DateTime('+1 month'));
     $invoice2->setInvoiceItems([$invoiceItem3]);
     $invoice2->save();
     self::$invoices[] = $invoice2;
 }