fatoority 0.4.4 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,9 +1,11 @@
1
1
  // generated by diplomat-tool
2
+ import { AllowanceCharge } from "./AllowanceCharge.mjs"
2
3
  import { BindingError } from "./BindingError.mjs"
3
4
  import { InvoiceLineItem } from "./InvoiceLineItem.mjs"
4
5
  import { InvoiceNote } from "./InvoiceNote.mjs"
5
6
  import { OriginalInvoiceRef } from "./OriginalInvoiceRef.mjs"
6
7
  import { Party } from "./Party.mjs"
8
+ import { PaymentMeans } from "./PaymentMeans.mjs"
7
9
  import { Text } from "./Text.mjs"
8
10
  import wasm from "./diplomat-wasm.mjs";
9
11
  import * as diplomatRuntime from "./diplomat-runtime.mjs";
@@ -41,6 +43,258 @@ export class InvoiceData {
41
43
  }
42
44
 
43
45
 
46
+ issueTime() {
47
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
48
+
49
+ const write = new diplomatRuntime.DiplomatWriteBuf(wasm);
50
+
51
+
52
+ const result = wasm.fatoora_InvoiceData_issue_time(diplomatReceive.buffer, this.ffiValue, write.buffer);
53
+
54
+ try {
55
+ if (!diplomatReceive.resultFlag) {
56
+ const cause = new BindingError(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
57
+ throw new globalThis.Error('BindingError: ' + cause.toString(), { cause });
58
+ }
59
+ return write.readString8();
60
+ }
61
+
62
+ finally {
63
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
64
+ diplomatReceive.free();
65
+ write.free();
66
+ }
67
+ }
68
+
69
+ issueDate() {
70
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
71
+
72
+ const write = new diplomatRuntime.DiplomatWriteBuf(wasm);
73
+
74
+
75
+ const result = wasm.fatoora_InvoiceData_issue_date(diplomatReceive.buffer, this.ffiValue, write.buffer);
76
+
77
+ try {
78
+ if (!diplomatReceive.resultFlag) {
79
+ const cause = new BindingError(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
80
+ throw new globalThis.Error('BindingError: ' + cause.toString(), { cause });
81
+ }
82
+ return write.readString8();
83
+ }
84
+
85
+ finally {
86
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
87
+ diplomatReceive.free();
88
+ write.free();
89
+ }
90
+ }
91
+
92
+ paymentMeansLen() {
93
+
94
+ const result = wasm.fatoora_InvoiceData_payment_means_len(this.ffiValue);
95
+
96
+ try {
97
+ return result;
98
+ }
99
+
100
+ finally {
101
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
102
+ }
103
+ }
104
+
105
+ paymentMeans(index) {
106
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
107
+
108
+
109
+ const result = wasm.fatoora_InvoiceData_payment_means(diplomatReceive.buffer, this.ffiValue, index);
110
+
111
+ try {
112
+ if (!diplomatReceive.resultFlag) {
113
+ const cause = new BindingError(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
114
+ throw new globalThis.Error('BindingError: ' + cause.toString(), { cause });
115
+ }
116
+ return new PaymentMeans(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
117
+ }
118
+
119
+ finally {
120
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
121
+ diplomatReceive.free();
122
+ }
123
+ }
124
+
125
+ purchaseOrderId() {
126
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
127
+
128
+
129
+ const result = wasm.fatoora_InvoiceData_purchase_order_id(diplomatReceive.buffer, this.ffiValue);
130
+
131
+ try {
132
+ if (!diplomatReceive.resultFlag) {
133
+ const cause = new BindingError(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
134
+ throw new globalThis.Error('BindingError: ' + cause.toString(), { cause });
135
+ }
136
+ return diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer) === 0 ? null : new Text(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
137
+ }
138
+
139
+ finally {
140
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
141
+ diplomatReceive.free();
142
+ }
143
+ }
144
+
145
+ contractId() {
146
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
147
+
148
+
149
+ const result = wasm.fatoora_InvoiceData_contract_id(diplomatReceive.buffer, this.ffiValue);
150
+
151
+ try {
152
+ if (!diplomatReceive.resultFlag) {
153
+ const cause = new BindingError(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
154
+ throw new globalThis.Error('BindingError: ' + cause.toString(), { cause });
155
+ }
156
+ return diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer) === 0 ? null : new Text(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
157
+ }
158
+
159
+ finally {
160
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
161
+ diplomatReceive.free();
162
+ }
163
+ }
164
+
165
+ paymentInstruction() {
166
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
167
+
168
+
169
+ const result = wasm.fatoora_InvoiceData_payment_instruction(diplomatReceive.buffer, this.ffiValue);
170
+
171
+ try {
172
+ if (!diplomatReceive.resultFlag) {
173
+ const cause = new BindingError(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
174
+ throw new globalThis.Error('BindingError: ' + cause.toString(), { cause });
175
+ }
176
+ return diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer) === 0 ? null : new Text(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
177
+ }
178
+
179
+ finally {
180
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
181
+ diplomatReceive.free();
182
+ }
183
+ }
184
+
185
+ actualDeliveryDate() {
186
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
187
+
188
+
189
+ const result = wasm.fatoora_InvoiceData_actual_delivery_date(diplomatReceive.buffer, this.ffiValue);
190
+
191
+ try {
192
+ if (!diplomatReceive.resultFlag) {
193
+ const cause = new BindingError(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
194
+ throw new globalThis.Error('BindingError: ' + cause.toString(), { cause });
195
+ }
196
+ return diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer) === 0 ? null : new Text(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
197
+ }
198
+
199
+ finally {
200
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
201
+ diplomatReceive.free();
202
+ }
203
+ }
204
+
205
+ latestDeliveryDate() {
206
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
207
+
208
+
209
+ const result = wasm.fatoora_InvoiceData_latest_delivery_date(diplomatReceive.buffer, this.ffiValue);
210
+
211
+ try {
212
+ if (!diplomatReceive.resultFlag) {
213
+ const cause = new BindingError(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
214
+ throw new globalThis.Error('BindingError: ' + cause.toString(), { cause });
215
+ }
216
+ return diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer) === 0 ? null : new Text(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
217
+ }
218
+
219
+ finally {
220
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
221
+ diplomatReceive.free();
222
+ }
223
+ }
224
+
225
+ taxCurrency() {
226
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
227
+
228
+
229
+ const result = wasm.fatoora_InvoiceData_tax_currency(diplomatReceive.buffer, this.ffiValue);
230
+
231
+ try {
232
+ if (!diplomatReceive.resultFlag) {
233
+ const cause = new BindingError(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
234
+ throw new globalThis.Error('BindingError: ' + cause.toString(), { cause });
235
+ }
236
+ return diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer) === 0 ? null : new Text(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
237
+ }
238
+
239
+ finally {
240
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
241
+ diplomatReceive.free();
242
+ }
243
+ }
244
+
245
+ taxCurrencyAmount() {
246
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
247
+
248
+
249
+ const result = wasm.fatoora_InvoiceData_tax_currency_amount(diplomatReceive.buffer, this.ffiValue);
250
+
251
+ try {
252
+ if (!diplomatReceive.resultFlag) {
253
+ const cause = new BindingError(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
254
+ throw new globalThis.Error('BindingError: ' + cause.toString(), { cause });
255
+ }
256
+ return diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer) === 0 ? null : new Text(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
257
+ }
258
+
259
+ finally {
260
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
261
+ diplomatReceive.free();
262
+ }
263
+ }
264
+
265
+ adjustmentsLen() {
266
+
267
+ const result = wasm.fatoora_InvoiceData_adjustments_len(this.ffiValue);
268
+
269
+ try {
270
+ return result;
271
+ }
272
+
273
+ finally {
274
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
275
+ }
276
+ }
277
+
278
+ adjustment(index) {
279
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
280
+
281
+
282
+ const result = wasm.fatoora_InvoiceData_adjustment(diplomatReceive.buffer, this.ffiValue, index);
283
+
284
+ try {
285
+ if (!diplomatReceive.resultFlag) {
286
+ const cause = new BindingError(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
287
+ throw new globalThis.Error('BindingError: ' + cause.toString(), { cause });
288
+ }
289
+ return new AllowanceCharge(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
290
+ }
291
+
292
+ finally {
293
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
294
+ diplomatReceive.free();
295
+ }
296
+ }
297
+
44
298
  id() {
45
299
  const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
46
300
 
@@ -443,6 +697,72 @@ export class InvoiceData {
443
697
  }
444
698
  }
445
699
 
700
+ notesLen() {
701
+
702
+ const result = wasm.fatoora_InvoiceData_notes_len(this.ffiValue);
703
+
704
+ try {
705
+ return result;
706
+ }
707
+
708
+ finally {
709
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
710
+ }
711
+ }
712
+
713
+ noteAt(index) {
714
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
715
+
716
+
717
+ const result = wasm.fatoora_InvoiceData_note_at(diplomatReceive.buffer, this.ffiValue, index);
718
+
719
+ try {
720
+ if (!diplomatReceive.resultFlag) {
721
+ const cause = new BindingError(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
722
+ throw new globalThis.Error('BindingError: ' + cause.toString(), { cause });
723
+ }
724
+ return new InvoiceNote(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
725
+ }
726
+
727
+ finally {
728
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
729
+ diplomatReceive.free();
730
+ }
731
+ }
732
+
733
+ billingReferencesLen() {
734
+
735
+ const result = wasm.fatoora_InvoiceData_billing_references_len(this.ffiValue);
736
+
737
+ try {
738
+ return result;
739
+ }
740
+
741
+ finally {
742
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
743
+ }
744
+ }
745
+
746
+ billingReference(index) {
747
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
748
+
749
+
750
+ const result = wasm.fatoora_InvoiceData_billing_reference(diplomatReceive.buffer, this.ffiValue, index);
751
+
752
+ try {
753
+ if (!diplomatReceive.resultFlag) {
754
+ const cause = new BindingError(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
755
+ throw new globalThis.Error('BindingError: ' + cause.toString(), { cause });
756
+ }
757
+ return new OriginalInvoiceRef(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
758
+ }
759
+
760
+ finally {
761
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
762
+ diplomatReceive.free();
763
+ }
764
+ }
765
+
446
766
  constructor(symbol, ptr, selfEdge) {
447
767
  return this.#internalConstructor(...arguments)
448
768
  }
@@ -1,5 +1,11 @@
1
1
  // generated by diplomat-tool
2
+ import type { Adjustment } from "./Adjustment.mjs"
2
3
  import type { BindingError } from "./BindingError.mjs"
4
+ import type { OriginalInvoiceRef } from "./OriginalInvoiceRef.mjs"
5
+ import type { OtherId } from "./OtherId.mjs"
6
+ import type { TaxExemption } from "./TaxExemption.mjs"
7
+ import type { Text } from "./Text.mjs"
8
+ import type { VatBreakdown } from "./VatBreakdown.mjs"
3
9
  import type { pointer, codepoint } from "./diplomat-runtime.mjs";
4
10
 
5
11
 
@@ -11,6 +17,46 @@ export class InvoiceLineItem {
11
17
  constructor();
12
18
 
13
19
 
20
+ itemGrossPrice(): Text | null;
21
+
22
+ itemPriceDiscount(): Text | null;
23
+
24
+ itemPriceBaseQuantity(): Text | null;
25
+
26
+ itemPriceBaseQuantityUnitCode(): Text | null;
27
+
28
+ adjustmentsLen(): number;
29
+
30
+ adjustment(index: number): Adjustment;
31
+
32
+ adjustmentIsCharge(index: number): boolean;
33
+
34
+ itemSellerIdentifier(): OtherId | null;
35
+
36
+ itemBuyerIdentifier(): OtherId | null;
37
+
38
+ itemStandardIdentifier(): OtherId | null;
39
+
40
+ withDocumentReference(reference: OriginalInvoiceRef): InvoiceLineItem;
41
+
42
+ withTaxSubtotal(subtotal: VatBreakdown): InvoiceLineItem;
43
+
44
+ documentReferencesLen(): number;
45
+
46
+ documentReference(index: number): OriginalInvoiceRef;
47
+
48
+ taxSubtotalsLen(): number;
49
+
50
+ taxSubtotal(index: number): VatBreakdown;
51
+
52
+ static new_(description: string, quantity: string, unitCode: string, unitPrice: string, rate: string, category: number): InvoiceLineItem;
53
+
54
+ withMetadata(id: string | null, exemption: TaxExemption): InvoiceLineItem;
55
+
56
+ id(): Text | null;
57
+
58
+ exemption(): TaxExemption;
59
+
14
60
  description(): string;
15
61
 
16
62
  unitCode(): string;
@@ -25,5 +71,11 @@ export class InvoiceLineItem {
25
71
 
26
72
  vatAmount(): string;
27
73
 
74
+ hasVatRate(): boolean;
75
+
76
+ hasTaxTotal(): boolean;
77
+
78
+ hasGrossAmount(): boolean;
79
+
28
80
  vatCategory(): number;
29
81
  }