Skip to content

Commit 395e2b2

Browse files
authored
Merge pull request #213 from robindirksen1/patch-5
Update estimates with recent API-attribute changes
2 parents d690b30 + 0daafe2 commit 395e2b2

File tree

3 files changed

+49
-17
lines changed

3 files changed

+49
-17
lines changed

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

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,14 @@ class Estimate extends Model
3131
*/
3232
protected $fillable = [
3333
'id',
34+
'administration_id',
3435
'contact_id',
3536
'contact',
3637
'estimate_id',
3738
'workflow_id',
3839
'document_style_id',
3940
'identity_id',
41+
'draft_id',
4042
'state',
4143
'estimate_date',
4244
'due_date',
@@ -54,18 +56,22 @@ class Estimate extends Model
5456
'archived_at',
5557
'created_at',
5658
'updated_at',
59+
'public_view_code',
60+
'version',
5761
'pre_text',
5862
'post_text',
5963
'details',
6064
'total_price_excl_tax',
6165
'total_price_excl_tax_base',
6266
'total_price_incl_tax',
6367
'total_price_incl_tax_base',
68+
'total_discount',
6469
'url',
6570
'custom_fields',
6671
'notes',
6772
'attachments',
68-
'public_view_code',
73+
'events',
74+
'tax_totals',
6975
];
7076

7177
/**
@@ -94,6 +100,14 @@ class Estimate extends Model
94100
'entity' => Note::class,
95101
'type' => self::NESTING_TYPE_ARRAY_OF_OBJECTS,
96102
],
103+
'events' => [
104+
'entity' => EstimateEvent::class,
105+
'type' => self::NESTING_TYPE_ARRAY_OF_OBJECTS,
106+
],
107+
'tax_totals' => [
108+
'entity' => EstimateTaxTotal::class,
109+
'type' => self::NESTING_TYPE_ARRAY_OF_OBJECTS,
110+
],
97111
];
98112

99113
/**
@@ -128,20 +142,4 @@ public function sendEstimate($deliveryMethodOrOptions = SendInvoiceOptions::METH
128142

129143
return $this;
130144
}
131-
132-
/**
133-
* Add a note to the current estimate.
134-
*
135-
* @param Note $note
136-
* @return $this
137-
* @throws ApiException
138-
*/
139-
private function addNote(Note $note)
140-
{
141-
$this->connection()->post($this->endpoint . '/' . $this->id . '/notes',
142-
$note->jsonWithNamespace()
143-
);
144-
145-
return $this;
146-
}
147145
}
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 EstimateEvent.
9+
*/
10+
class EstimateEvent 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 EstimateTaxTotal.
9+
*/
10+
class EstimateTaxTotal 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+
}

0 commit comments

Comments
 (0)