File tree Expand file tree Collapse file tree 2 files changed +17
-3
lines changed Expand file tree Collapse file tree 2 files changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -21,12 +21,15 @@ trait CreatesWithType
21
21
* @throws RequestException
22
22
* @throws UnknownAPIMethodException
23
23
*/
24
- public function create (EntityTypeEnum $ entityType , EntityData $ data ): EntityData
24
+ public function create (EntityTypeEnum $ entityType , EntityData $ data, array $ extraData = [] ): EntityData
25
25
{
26
26
$ response = $ this ->call (
27
27
action: static ::CREATE ,
28
28
urlParams: ['type ' => $ entityType ->toUrlVariable ()],
29
- bodyData: [$ entityType ->value => $ data ->toCreateData ()->toArray ()]
29
+ bodyData: [
30
+ $ entityType ->value => $ data ->toCreateData ()->toArray (),
31
+ ...$ extraData ,
32
+ ]
30
33
);
31
34
32
35
return $ this ->responseToDataObject ($ response [$ entityType ->value ]);
Original file line number Diff line number Diff line change 19
19
use Squarebit \InvoiceXpress \API \Endpoints \Concerns \RelatedDocuments ;
20
20
use Squarebit \InvoiceXpress \API \Endpoints \Concerns \SendsByEmail ;
21
21
use Squarebit \InvoiceXpress \API \Endpoints \Concerns \UpdatesWithType ;
22
+ use Squarebit \InvoiceXpress \Enums \EntityTypeEnum ;
22
23
23
24
/**
24
25
* @template-extends Endpoint<InvoiceData>
@@ -29,7 +30,7 @@ class InvoicesEndpoint extends Endpoint
29
30
use ChangesState;
30
31
31
32
/** @use CreatesWithType<InvoiceData> */
32
- use CreatesWithType;
33
+ use CreatesWithType { create as createWithType; }
33
34
34
35
use GeneratesAndCancelsPayment;
35
36
use GeneratesPDF;
@@ -60,4 +61,14 @@ protected function getEndpointName(): string
60
61
{
61
62
return static ::ENDPOINT_CONFIG ;
62
63
}
64
+
65
+ public function create (EntityTypeEnum $ entityType , InvoiceData $ data , ?string $ proprietaryUid = null ): InvoiceData
66
+ {
67
+ $ extra = [];
68
+ if ($ proprietaryUid ) {
69
+ $ extra ['proprietary_uid ' ] = $ proprietaryUid ;
70
+ }
71
+
72
+ return $ this ->createWithType ($ entityType , $ data , $ extra );
73
+ }
63
74
}
You can’t perform that action at this time.
0 commit comments