fatoority 0.4.3 → 0.5.0
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.
- package/fatoora_ffi.wasm +0 -0
- package/generated/Address.d.mts +4 -0
- package/generated/Address.mjs +45 -0
- package/generated/Adjustment.d.mts +32 -0
- package/generated/Adjustment.mjs +246 -0
- package/generated/AllowanceCharge.d.mts +51 -0
- package/generated/AllowanceCharge.mjs +340 -0
- package/generated/InvoiceBuilder.d.mts +50 -0
- package/generated/InvoiceBuilder.mjs +466 -0
- package/generated/InvoiceData.d.mts +36 -0
- package/generated/InvoiceData.mjs +320 -0
- package/generated/InvoiceLineItem.d.mts +52 -0
- package/generated/InvoiceLineItem.mjs +437 -0
- package/generated/InvoiceNote.d.mts +3 -0
- package/generated/InvoiceNote.mjs +21 -0
- package/generated/InvoiceTotals.d.mts +5 -0
- package/generated/InvoiceTotals.mjs +34 -0
- package/generated/LineItemBuilder.d.mts +70 -0
- package/generated/LineItemBuilder.mjs +616 -0
- package/generated/OriginalInvoiceRef.d.mts +6 -0
- package/generated/OriginalInvoiceRef.mjs +65 -0
- package/generated/Party.d.mts +5 -1
- package/generated/Party.mjs +34 -1
- package/generated/PaymentMeans.d.mts +34 -0
- package/generated/PaymentMeans.mjs +246 -0
- package/generated/TaxExemption.d.mts +20 -0
- package/generated/TaxExemption.mjs +107 -0
- package/generated/VatBreakdown.d.mts +30 -0
- package/generated/VatBreakdown.mjs +205 -0
- package/generated/index.d.mts +12 -0
- package/generated/index.mjs +12 -0
- package/package.json +1 -1
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
// generated by diplomat-tool
|
|
2
|
+
import { Adjustment } from "./Adjustment.mjs"
|
|
2
3
|
import { BindingError } from "./BindingError.mjs"
|
|
4
|
+
import { OriginalInvoiceRef } from "./OriginalInvoiceRef.mjs"
|
|
5
|
+
import { OtherId } from "./OtherId.mjs"
|
|
6
|
+
import { TaxExemption } from "./TaxExemption.mjs"
|
|
7
|
+
import { Text } from "./Text.mjs"
|
|
8
|
+
import { VatBreakdown } from "./VatBreakdown.mjs"
|
|
3
9
|
import wasm from "./diplomat-wasm.mjs";
|
|
4
10
|
import * as diplomatRuntime from "./diplomat-runtime.mjs";
|
|
5
11
|
|
|
@@ -36,6 +42,398 @@ export class InvoiceLineItem {
|
|
|
36
42
|
}
|
|
37
43
|
|
|
38
44
|
|
|
45
|
+
itemGrossPrice() {
|
|
46
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
const result = wasm.fatoora_InvoiceLineItem_item_gross_price(diplomatReceive.buffer, this.ffiValue);
|
|
50
|
+
|
|
51
|
+
try {
|
|
52
|
+
if (!diplomatReceive.resultFlag) {
|
|
53
|
+
const cause = new BindingError(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
|
|
54
|
+
throw new globalThis.Error('BindingError: ' + cause.toString(), { cause });
|
|
55
|
+
}
|
|
56
|
+
return diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer) === 0 ? null : new Text(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
finally {
|
|
60
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
61
|
+
diplomatReceive.free();
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
itemPriceDiscount() {
|
|
66
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
const result = wasm.fatoora_InvoiceLineItem_item_price_discount(diplomatReceive.buffer, this.ffiValue);
|
|
70
|
+
|
|
71
|
+
try {
|
|
72
|
+
if (!diplomatReceive.resultFlag) {
|
|
73
|
+
const cause = new BindingError(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
|
|
74
|
+
throw new globalThis.Error('BindingError: ' + cause.toString(), { cause });
|
|
75
|
+
}
|
|
76
|
+
return diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer) === 0 ? null : new Text(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
finally {
|
|
80
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
81
|
+
diplomatReceive.free();
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
itemPriceBaseQuantity() {
|
|
86
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
const result = wasm.fatoora_InvoiceLineItem_item_price_base_quantity(diplomatReceive.buffer, this.ffiValue);
|
|
90
|
+
|
|
91
|
+
try {
|
|
92
|
+
if (!diplomatReceive.resultFlag) {
|
|
93
|
+
const cause = new BindingError(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
|
|
94
|
+
throw new globalThis.Error('BindingError: ' + cause.toString(), { cause });
|
|
95
|
+
}
|
|
96
|
+
return diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer) === 0 ? null : new Text(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
finally {
|
|
100
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
101
|
+
diplomatReceive.free();
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
itemPriceBaseQuantityUnitCode() {
|
|
106
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
const result = wasm.fatoora_InvoiceLineItem_item_price_base_quantity_unit_code(diplomatReceive.buffer, this.ffiValue);
|
|
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 diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer) === 0 ? null : new Text(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
finally {
|
|
120
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
121
|
+
diplomatReceive.free();
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
adjustmentsLen() {
|
|
126
|
+
|
|
127
|
+
const result = wasm.fatoora_InvoiceLineItem_adjustments_len(this.ffiValue);
|
|
128
|
+
|
|
129
|
+
try {
|
|
130
|
+
return result;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
finally {
|
|
134
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
adjustment(index) {
|
|
139
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
const result = wasm.fatoora_InvoiceLineItem_adjustment(diplomatReceive.buffer, this.ffiValue, index);
|
|
143
|
+
|
|
144
|
+
try {
|
|
145
|
+
if (!diplomatReceive.resultFlag) {
|
|
146
|
+
const cause = new BindingError(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
|
|
147
|
+
throw new globalThis.Error('BindingError: ' + cause.toString(), { cause });
|
|
148
|
+
}
|
|
149
|
+
return new Adjustment(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
finally {
|
|
153
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
154
|
+
diplomatReceive.free();
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
adjustmentIsCharge(index) {
|
|
159
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 1, true);
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
const result = wasm.fatoora_InvoiceLineItem_adjustment_is_charge(diplomatReceive.buffer, this.ffiValue, index);
|
|
163
|
+
|
|
164
|
+
try {
|
|
165
|
+
if (!diplomatReceive.resultFlag) {
|
|
166
|
+
const cause = new BindingError(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
|
|
167
|
+
throw new globalThis.Error('BindingError: ' + cause.toString(), { cause });
|
|
168
|
+
}
|
|
169
|
+
return (new Uint8Array(wasm.memory.buffer, diplomatReceive.buffer, 1))[0] === 1;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
finally {
|
|
173
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
174
|
+
diplomatReceive.free();
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
itemSellerIdentifier() {
|
|
179
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
const result = wasm.fatoora_InvoiceLineItem_item_seller_identifier(diplomatReceive.buffer, this.ffiValue);
|
|
183
|
+
|
|
184
|
+
try {
|
|
185
|
+
if (!diplomatReceive.resultFlag) {
|
|
186
|
+
const cause = new BindingError(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
|
|
187
|
+
throw new globalThis.Error('BindingError: ' + cause.toString(), { cause });
|
|
188
|
+
}
|
|
189
|
+
return diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer) === 0 ? null : new OtherId(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
finally {
|
|
193
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
194
|
+
diplomatReceive.free();
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
itemBuyerIdentifier() {
|
|
199
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
const result = wasm.fatoora_InvoiceLineItem_item_buyer_identifier(diplomatReceive.buffer, this.ffiValue);
|
|
203
|
+
|
|
204
|
+
try {
|
|
205
|
+
if (!diplomatReceive.resultFlag) {
|
|
206
|
+
const cause = new BindingError(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
|
|
207
|
+
throw new globalThis.Error('BindingError: ' + cause.toString(), { cause });
|
|
208
|
+
}
|
|
209
|
+
return diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer) === 0 ? null : new OtherId(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
finally {
|
|
213
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
214
|
+
diplomatReceive.free();
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
itemStandardIdentifier() {
|
|
219
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
const result = wasm.fatoora_InvoiceLineItem_item_standard_identifier(diplomatReceive.buffer, this.ffiValue);
|
|
223
|
+
|
|
224
|
+
try {
|
|
225
|
+
if (!diplomatReceive.resultFlag) {
|
|
226
|
+
const cause = new BindingError(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
|
|
227
|
+
throw new globalThis.Error('BindingError: ' + cause.toString(), { cause });
|
|
228
|
+
}
|
|
229
|
+
return diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer) === 0 ? null : new OtherId(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
finally {
|
|
233
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
234
|
+
diplomatReceive.free();
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
withDocumentReference(reference) {
|
|
239
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
const result = wasm.fatoora_InvoiceLineItem_with_document_reference(diplomatReceive.buffer, this.ffiValue, reference instanceof OriginalInvoiceRef ? reference.ffiValue : typeError('reference', 'OriginalInvoiceRef'));
|
|
243
|
+
|
|
244
|
+
try {
|
|
245
|
+
if (!diplomatReceive.resultFlag) {
|
|
246
|
+
const cause = new BindingError(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
|
|
247
|
+
throw new globalThis.Error('BindingError: ' + cause.toString(), { cause });
|
|
248
|
+
}
|
|
249
|
+
return new InvoiceLineItem(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
finally {
|
|
253
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
254
|
+
diplomatReceive.free();
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
withTaxSubtotal(subtotal) {
|
|
259
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
260
|
+
|
|
261
|
+
|
|
262
|
+
const result = wasm.fatoora_InvoiceLineItem_with_tax_subtotal(diplomatReceive.buffer, this.ffiValue, subtotal instanceof VatBreakdown ? subtotal.ffiValue : typeError('subtotal', 'VatBreakdown'));
|
|
263
|
+
|
|
264
|
+
try {
|
|
265
|
+
if (!diplomatReceive.resultFlag) {
|
|
266
|
+
const cause = new BindingError(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
|
|
267
|
+
throw new globalThis.Error('BindingError: ' + cause.toString(), { cause });
|
|
268
|
+
}
|
|
269
|
+
return new InvoiceLineItem(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
finally {
|
|
273
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
274
|
+
diplomatReceive.free();
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
documentReferencesLen() {
|
|
279
|
+
|
|
280
|
+
const result = wasm.fatoora_InvoiceLineItem_document_references_len(this.ffiValue);
|
|
281
|
+
|
|
282
|
+
try {
|
|
283
|
+
return result;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
finally {
|
|
287
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
documentReference(index) {
|
|
292
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
293
|
+
|
|
294
|
+
|
|
295
|
+
const result = wasm.fatoora_InvoiceLineItem_document_reference(diplomatReceive.buffer, this.ffiValue, index);
|
|
296
|
+
|
|
297
|
+
try {
|
|
298
|
+
if (!diplomatReceive.resultFlag) {
|
|
299
|
+
const cause = new BindingError(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
|
|
300
|
+
throw new globalThis.Error('BindingError: ' + cause.toString(), { cause });
|
|
301
|
+
}
|
|
302
|
+
return new OriginalInvoiceRef(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
finally {
|
|
306
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
307
|
+
diplomatReceive.free();
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
taxSubtotalsLen() {
|
|
312
|
+
|
|
313
|
+
const result = wasm.fatoora_InvoiceLineItem_tax_subtotals_len(this.ffiValue);
|
|
314
|
+
|
|
315
|
+
try {
|
|
316
|
+
return result;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
finally {
|
|
320
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
taxSubtotal(index) {
|
|
325
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
326
|
+
|
|
327
|
+
|
|
328
|
+
const result = wasm.fatoora_InvoiceLineItem_tax_subtotal(diplomatReceive.buffer, this.ffiValue, index);
|
|
329
|
+
|
|
330
|
+
try {
|
|
331
|
+
if (!diplomatReceive.resultFlag) {
|
|
332
|
+
const cause = new BindingError(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
|
|
333
|
+
throw new globalThis.Error('BindingError: ' + cause.toString(), { cause });
|
|
334
|
+
}
|
|
335
|
+
return new VatBreakdown(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
finally {
|
|
339
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
340
|
+
diplomatReceive.free();
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
static new_(description, quantity, unitCode, unitPrice, rate, category) {
|
|
345
|
+
let functionCleanupArena = new diplomatRuntime.CleanupArena();
|
|
346
|
+
|
|
347
|
+
const descriptionSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, description)));
|
|
348
|
+
const quantitySlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, quantity)));
|
|
349
|
+
const unitCodeSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, unitCode)));
|
|
350
|
+
const unitPriceSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, unitPrice)));
|
|
351
|
+
const rateSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, rate)));
|
|
352
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
353
|
+
|
|
354
|
+
|
|
355
|
+
const result = wasm.fatoora_InvoiceLineItem_new(diplomatReceive.buffer, descriptionSlice.ptr, quantitySlice.ptr, unitCodeSlice.ptr, unitPriceSlice.ptr, rateSlice.ptr, category);
|
|
356
|
+
|
|
357
|
+
try {
|
|
358
|
+
if (!diplomatReceive.resultFlag) {
|
|
359
|
+
const cause = new BindingError(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
|
|
360
|
+
throw new globalThis.Error('BindingError: ' + cause.toString(), { cause });
|
|
361
|
+
}
|
|
362
|
+
return new InvoiceLineItem(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
finally {
|
|
366
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
367
|
+
functionCleanupArena.free();
|
|
368
|
+
|
|
369
|
+
diplomatReceive.free();
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
withMetadata(id, exemption) {
|
|
374
|
+
let functionCleanupArena = new diplomatRuntime.CleanupArena();
|
|
375
|
+
|
|
376
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
377
|
+
|
|
378
|
+
|
|
379
|
+
const result = wasm.fatoora_InvoiceLineItem_with_metadata(diplomatReceive.buffer, this.ffiValue, diplomatRuntime.optionToBufferForCalling(wasm, id, 8, 4, functionCleanupArena, (arrayBuffer, offset, jsValue) => [functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.str8(wasm, jsValue)).writePtrLenToArrayBuffer(arrayBuffer, offset + 0)]), exemption instanceof TaxExemption ? exemption.ffiValue : typeError('exemption', 'TaxExemption'));
|
|
380
|
+
|
|
381
|
+
try {
|
|
382
|
+
if (!diplomatReceive.resultFlag) {
|
|
383
|
+
const cause = new BindingError(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
|
|
384
|
+
throw new globalThis.Error('BindingError: ' + cause.toString(), { cause });
|
|
385
|
+
}
|
|
386
|
+
return new InvoiceLineItem(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
finally {
|
|
390
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
391
|
+
functionCleanupArena.free();
|
|
392
|
+
|
|
393
|
+
diplomatReceive.free();
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
id() {
|
|
398
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
399
|
+
|
|
400
|
+
|
|
401
|
+
const result = wasm.fatoora_InvoiceLineItem_id(diplomatReceive.buffer, this.ffiValue);
|
|
402
|
+
|
|
403
|
+
try {
|
|
404
|
+
if (!diplomatReceive.resultFlag) {
|
|
405
|
+
const cause = new BindingError(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
|
|
406
|
+
throw new globalThis.Error('BindingError: ' + cause.toString(), { cause });
|
|
407
|
+
}
|
|
408
|
+
return diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer) === 0 ? null : new Text(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
finally {
|
|
412
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
413
|
+
diplomatReceive.free();
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
exemption() {
|
|
418
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
419
|
+
|
|
420
|
+
|
|
421
|
+
const result = wasm.fatoora_InvoiceLineItem_exemption(diplomatReceive.buffer, this.ffiValue);
|
|
422
|
+
|
|
423
|
+
try {
|
|
424
|
+
if (!diplomatReceive.resultFlag) {
|
|
425
|
+
const cause = new BindingError(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
|
|
426
|
+
throw new globalThis.Error('BindingError: ' + cause.toString(), { cause });
|
|
427
|
+
}
|
|
428
|
+
return new TaxExemption(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
finally {
|
|
432
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
433
|
+
diplomatReceive.free();
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
|
|
39
437
|
description() {
|
|
40
438
|
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
41
439
|
|
|
@@ -197,6 +595,45 @@ export class InvoiceLineItem {
|
|
|
197
595
|
}
|
|
198
596
|
}
|
|
199
597
|
|
|
598
|
+
hasVatRate() {
|
|
599
|
+
|
|
600
|
+
const result = wasm.fatoora_InvoiceLineItem_has_vat_rate(this.ffiValue);
|
|
601
|
+
|
|
602
|
+
try {
|
|
603
|
+
return result;
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
finally {
|
|
607
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
|
|
611
|
+
hasTaxTotal() {
|
|
612
|
+
|
|
613
|
+
const result = wasm.fatoora_InvoiceLineItem_has_tax_total(this.ffiValue);
|
|
614
|
+
|
|
615
|
+
try {
|
|
616
|
+
return result;
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
finally {
|
|
620
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
hasGrossAmount() {
|
|
625
|
+
|
|
626
|
+
const result = wasm.fatoora_InvoiceLineItem_has_gross_amount(this.ffiValue);
|
|
627
|
+
|
|
628
|
+
try {
|
|
629
|
+
return result;
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
finally {
|
|
633
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
634
|
+
}
|
|
635
|
+
}
|
|
636
|
+
|
|
200
637
|
vatCategory() {
|
|
201
638
|
|
|
202
639
|
const result = wasm.fatoora_InvoiceLineItem_vat_category(this.ffiValue);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// generated by diplomat-tool
|
|
2
2
|
import type { BindingError } from "./BindingError.mjs"
|
|
3
|
+
import type { Text } from "./Text.mjs"
|
|
3
4
|
import type { pointer, codepoint } from "./diplomat-runtime.mjs";
|
|
4
5
|
|
|
5
6
|
|
|
@@ -11,6 +12,8 @@ export class InvoiceNote {
|
|
|
11
12
|
constructor();
|
|
12
13
|
|
|
13
14
|
|
|
15
|
+
languageId(): Text | null;
|
|
16
|
+
|
|
14
17
|
language(): string;
|
|
15
18
|
|
|
16
19
|
text(): string;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// generated by diplomat-tool
|
|
2
2
|
import { BindingError } from "./BindingError.mjs"
|
|
3
|
+
import { Text } from "./Text.mjs"
|
|
3
4
|
import wasm from "./diplomat-wasm.mjs";
|
|
4
5
|
import * as diplomatRuntime from "./diplomat-runtime.mjs";
|
|
5
6
|
|
|
@@ -36,6 +37,26 @@ export class InvoiceNote {
|
|
|
36
37
|
}
|
|
37
38
|
|
|
38
39
|
|
|
40
|
+
languageId() {
|
|
41
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
const result = wasm.fatoora_InvoiceNote_language_id(diplomatReceive.buffer, this.ffiValue);
|
|
45
|
+
|
|
46
|
+
try {
|
|
47
|
+
if (!diplomatReceive.resultFlag) {
|
|
48
|
+
const cause = new BindingError(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
|
|
49
|
+
throw new globalThis.Error('BindingError: ' + cause.toString(), { cause });
|
|
50
|
+
}
|
|
51
|
+
return diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer) === 0 ? null : new Text(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
finally {
|
|
55
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
56
|
+
diplomatReceive.free();
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
39
60
|
language() {
|
|
40
61
|
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
41
62
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// generated by diplomat-tool
|
|
2
2
|
import type { BindingError } from "./BindingError.mjs"
|
|
3
|
+
import type { VatBreakdown } from "./VatBreakdown.mjs"
|
|
3
4
|
import type { pointer, codepoint } from "./diplomat-runtime.mjs";
|
|
4
5
|
|
|
5
6
|
|
|
@@ -11,6 +12,10 @@ export class InvoiceTotals {
|
|
|
11
12
|
constructor();
|
|
12
13
|
|
|
13
14
|
|
|
15
|
+
vatBreakdownLen(): number;
|
|
16
|
+
|
|
17
|
+
vatBreakdown(index: number): VatBreakdown;
|
|
18
|
+
|
|
14
19
|
taxInclusive(): string;
|
|
15
20
|
|
|
16
21
|
taxAmount(): string;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// generated by diplomat-tool
|
|
2
2
|
import { BindingError } from "./BindingError.mjs"
|
|
3
|
+
import { VatBreakdown } from "./VatBreakdown.mjs"
|
|
3
4
|
import wasm from "./diplomat-wasm.mjs";
|
|
4
5
|
import * as diplomatRuntime from "./diplomat-runtime.mjs";
|
|
5
6
|
|
|
@@ -36,6 +37,39 @@ export class InvoiceTotals {
|
|
|
36
37
|
}
|
|
37
38
|
|
|
38
39
|
|
|
40
|
+
vatBreakdownLen() {
|
|
41
|
+
|
|
42
|
+
const result = wasm.fatoora_InvoiceTotals_vat_breakdown_len(this.ffiValue);
|
|
43
|
+
|
|
44
|
+
try {
|
|
45
|
+
return result;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
finally {
|
|
49
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
vatBreakdown(index) {
|
|
54
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
const result = wasm.fatoora_InvoiceTotals_vat_breakdown(diplomatReceive.buffer, this.ffiValue, index);
|
|
58
|
+
|
|
59
|
+
try {
|
|
60
|
+
if (!diplomatReceive.resultFlag) {
|
|
61
|
+
const cause = new BindingError(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
|
|
62
|
+
throw new globalThis.Error('BindingError: ' + cause.toString(), { cause });
|
|
63
|
+
}
|
|
64
|
+
return new VatBreakdown(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
finally {
|
|
68
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
69
|
+
diplomatReceive.free();
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
39
73
|
taxInclusive() {
|
|
40
74
|
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
41
75
|
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
// generated by diplomat-tool
|
|
2
|
+
import type { Adjustment } from "./Adjustment.mjs"
|
|
3
|
+
import type { BindingError } from "./BindingError.mjs"
|
|
4
|
+
import type { InvoiceLineItem } from "./InvoiceLineItem.mjs"
|
|
5
|
+
import type { OriginalInvoiceRef } from "./OriginalInvoiceRef.mjs"
|
|
6
|
+
import type { TaxExemption } from "./TaxExemption.mjs"
|
|
7
|
+
import type { VatBreakdown } from "./VatBreakdown.mjs"
|
|
8
|
+
import type { pointer, codepoint } from "./diplomat-runtime.mjs";
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
export class LineItemBuilder {
|
|
13
|
+
/** @internal */
|
|
14
|
+
get ffiValue(): pointer;
|
|
15
|
+
/** @internal */
|
|
16
|
+
constructor();
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
setTaxTotalPresent(present: boolean): void;
|
|
20
|
+
|
|
21
|
+
setGrossAmountPresent(present: boolean): void;
|
|
22
|
+
|
|
23
|
+
static new_(): LineItemBuilder;
|
|
24
|
+
|
|
25
|
+
build(): InvoiceLineItem;
|
|
26
|
+
|
|
27
|
+
setItemName(value: string): void;
|
|
28
|
+
|
|
29
|
+
setInvoicedQuantityUnitCode(value: string): void;
|
|
30
|
+
|
|
31
|
+
setItemPriceBaseQuantityUnitCode(value: string): void;
|
|
32
|
+
|
|
33
|
+
setId(value: string): void;
|
|
34
|
+
|
|
35
|
+
setInvoicedQuantity(value: string): void;
|
|
36
|
+
|
|
37
|
+
setItemNetPrice(value: string): void;
|
|
38
|
+
|
|
39
|
+
setItemGrossPrice(value: string): void;
|
|
40
|
+
|
|
41
|
+
setItemPriceDiscount(value: string): void;
|
|
42
|
+
|
|
43
|
+
setItemPriceBaseQuantity(value: string): void;
|
|
44
|
+
|
|
45
|
+
setLineNetAmount(value: string): void;
|
|
46
|
+
|
|
47
|
+
setLineVatAmount(value: string): void;
|
|
48
|
+
|
|
49
|
+
setLineAmountWithVat(value: string): void;
|
|
50
|
+
|
|
51
|
+
setVatRate(value: string): void;
|
|
52
|
+
|
|
53
|
+
setVatCategory(value: number): void;
|
|
54
|
+
|
|
55
|
+
setExemption(value: TaxExemption): void;
|
|
56
|
+
|
|
57
|
+
addAllowance(value: Adjustment): void;
|
|
58
|
+
|
|
59
|
+
addCharge(value: Adjustment): void;
|
|
60
|
+
|
|
61
|
+
addDocumentReference(value: OriginalInvoiceRef): void;
|
|
62
|
+
|
|
63
|
+
addTaxSubtotal(value: VatBreakdown): void;
|
|
64
|
+
|
|
65
|
+
setItemSellerIdentifier(value: string, scheme: string | null): void;
|
|
66
|
+
|
|
67
|
+
setItemBuyerIdentifier(value: string, scheme: string | null): void;
|
|
68
|
+
|
|
69
|
+
setItemStandardIdentifier(value: string, scheme: string | null): void;
|
|
70
|
+
}
|