Skip to content

Commit 044dc29

Browse files
authored
Merge pull request #187 from dennisameling/master
Add missing properties to SalesInvoice model
2 parents 7bd11f5 + 6f3c1d2 commit 044dc29

File tree

6 files changed

+92
-3
lines changed

6 files changed

+92
-3
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
dist: trusty
12
language: php
23

34
php:
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php
2+
3+
namespace Picqer\Financials\Moneybird\Entities\Generic;
4+
5+
use Picqer\Financials\Moneybird\Model;
6+
7+
/**
8+
* Class Event.
9+
*/
10+
abstract class Event extends Model
11+
{
12+
/**
13+
* @var array
14+
*/
15+
protected $fillable = [
16+
'administration_id',
17+
'user_id',
18+
'action',
19+
'link_entity_id',
20+
'link_entity_type',
21+
'data',
22+
'created_at',
23+
'updated_at',
24+
];
25+
}

src/Picqer/Financials/Moneybird/Entities/SalesInvoice.php

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,42 +29,51 @@ class SalesInvoice extends Model
2929
*/
3030
protected $fillable = [
3131
'id',
32+
'administration_id',
3233
'contact_id',
3334
'contact',
3435
'invoice_id',
3536
'invoice_sequence_id',
37+
'recurring_sales_invoice_id',
3638
'workflow_id',
3739
'document_style_id',
3840
'identity_id',
41+
'draft_id',
3942
'state',
4043
'invoice_date',
4144
'due_date',
4245
'first_due_interval',
4346
'payment_conditions',
47+
'payment_reference',
4448
'reference',
4549
'language',
4650
'currency',
47-
'prices_are_incl_tax',
4851
'discount',
4952
'original_sales_invoice_id',
53+
'paused',
5054
'paid_at',
5155
'sent_at',
5256
'created_at',
5357
'updated_at',
58+
'public_view_code',
59+
'version',
5460
'details',
5561
'payments',
5662
'total_paid',
5763
'total_unpaid',
64+
'total_unpaid_base',
65+
'prices_are_incl_tax',
5866
'total_price_excl_tax',
5967
'total_price_excl_tax_base',
6068
'total_price_incl_tax',
6169
'total_price_incl_tax_base',
70+
'total_discount',
6271
'url',
6372
'custom_fields',
6473
'notes',
6574
'attachments',
66-
'version',
67-
'public_view_code',
75+
'events',
76+
'tax_totals',
6877
];
6978

7079
/**
@@ -104,6 +113,14 @@ class SalesInvoice extends Model
104113
'entity' => Note::class,
105114
'type' => self::NESTING_TYPE_ARRAY_OF_OBJECTS,
106115
],
116+
'events' => [
117+
'entity' => SalesInvoiceEvent::class,
118+
'type' => self::NESTING_TYPE_ARRAY_OF_OBJECTS,
119+
],
120+
'tax_totals' => [
121+
'entity' => SalesInvoiceTaxTotal::class,
122+
'type' => self::NESTING_TYPE_ARRAY_OF_OBJECTS,
123+
],
107124
];
108125

109126
/**
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?php
2+
3+
namespace Picqer\Financials\Moneybird\Entities;
4+
5+
use Picqer\Financials\Moneybird\Entities\Generic\Event;
6+
7+
/**
8+
* Class SalesInvoiceEvent.
9+
*/
10+
class SalesInvoiceEvent extends Event
11+
{
12+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?php
2+
3+
namespace Picqer\Financials\Moneybird\Entities;
4+
5+
use Picqer\Financials\Moneybird\Model;
6+
7+
/**
8+
* Class SalesInvoiceTaxTotal.
9+
*/
10+
class SalesInvoiceTaxTotal extends Model
11+
{
12+
/**
13+
* @var array
14+
*/
15+
protected $fillable = [
16+
'tax_rate_id',
17+
'taxable_amount',
18+
'taxable_amount_base',
19+
'tax_amount',
20+
'tax_amount_base',
21+
];
22+
}

tests/EntityTest.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,12 @@
2323
use Picqer\Financials\Moneybird\Entities\FinancialAccount;
2424
use Picqer\Financials\Moneybird\Entities\TypelessDocument;
2525
use Picqer\Financials\Moneybird\Entities\FinancialMutation;
26+
use Picqer\Financials\Moneybird\Entities\SalesInvoiceEvent;
2627
use Picqer\Financials\Moneybird\Entities\ContactCustomField;
2728
use Picqer\Financials\Moneybird\Entities\SalesInvoiceDetail;
2829
use Picqer\Financials\Moneybird\Entities\SalesInvoicePayment;
2930
use Picqer\Financials\Moneybird\Entities\SalesInvoiceReminder;
31+
use Picqer\Financials\Moneybird\Entities\SalesInvoiceTaxTotal;
3032
use Picqer\Financials\Moneybird\Entities\PurchaseInvoiceDetail;
3133
use Picqer\Financials\Moneybird\Entities\RecurringSalesInvoice;
3234
use Picqer\Financials\Moneybird\Entities\GeneralJournalDocument;
@@ -161,6 +163,11 @@ public function testSalesInvoiceDetailEntity()
161163
$this->performEntityTest(SalesInvoiceDetail::class);
162164
}
163165

166+
public function testSalesInvoiceEventEntity()
167+
{
168+
$this->performEntityTest(SalesInvoiceEvent::class);
169+
}
170+
164171
public function testSalesInvoicePaymentEntity()
165172
{
166173
$this->performEntityTest(SalesInvoicePayment::class);
@@ -171,6 +178,11 @@ public function testSalesInvoiceReminderEntity()
171178
$this->performEntityTest(SalesInvoiceReminder::class);
172179
}
173180

181+
public function testSalesInvoiceTaxTotalEntity()
182+
{
183+
$this->performEntityTest(SalesInvoiceTaxTotal::class);
184+
}
185+
174186
public function testNoteEntity()
175187
{
176188
$this->performEntityTest(Note::class);

0 commit comments

Comments
 (0)