fatoority 0.4.4 → 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,7 +1,14 @@
|
|
|
1
1
|
// generated by diplomat-tool
|
|
2
2
|
import { Address } from "./Address.mjs"
|
|
3
|
+
import { Adjustment } from "./Adjustment.mjs"
|
|
4
|
+
import { AllowanceCharge } from "./AllowanceCharge.mjs"
|
|
3
5
|
import { BindingError } from "./BindingError.mjs"
|
|
4
6
|
import { FinalizedInvoice } from "./FinalizedInvoice.mjs"
|
|
7
|
+
import { InvoiceLineItem } from "./InvoiceLineItem.mjs"
|
|
8
|
+
import { OriginalInvoiceRef } from "./OriginalInvoiceRef.mjs"
|
|
9
|
+
import { PaymentMeans } from "./PaymentMeans.mjs"
|
|
10
|
+
import { TaxExemption } from "./TaxExemption.mjs"
|
|
11
|
+
import { VatBreakdown } from "./VatBreakdown.mjs"
|
|
5
12
|
import wasm from "./diplomat-wasm.mjs";
|
|
6
13
|
import * as diplomatRuntime from "./diplomat-runtime.mjs";
|
|
7
14
|
|
|
@@ -38,6 +45,398 @@ export class InvoiceBuilder {
|
|
|
38
45
|
}
|
|
39
46
|
|
|
40
47
|
|
|
48
|
+
addSellerIdentifier(value, scheme) {
|
|
49
|
+
let functionCleanupArena = new diplomatRuntime.CleanupArena();
|
|
50
|
+
|
|
51
|
+
const valueSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, value)));
|
|
52
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
const result = wasm.fatoora_InvoiceBuilder_add_seller_identifier(diplomatReceive.buffer, this.ffiValue, valueSlice.ptr, diplomatRuntime.optionToBufferForCalling(wasm, scheme, 8, 4, functionCleanupArena, (arrayBuffer, offset, jsValue) => [functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.str8(wasm, jsValue)).writePtrLenToArrayBuffer(arrayBuffer, offset + 0)]));
|
|
56
|
+
|
|
57
|
+
try {
|
|
58
|
+
if (!diplomatReceive.resultFlag) {
|
|
59
|
+
const cause = new BindingError(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
|
|
60
|
+
throw new globalThis.Error('BindingError: ' + cause.toString(), { cause });
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
finally {
|
|
65
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
66
|
+
functionCleanupArena.free();
|
|
67
|
+
|
|
68
|
+
diplomatReceive.free();
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
addBuyerIdentifier(value, scheme) {
|
|
73
|
+
let functionCleanupArena = new diplomatRuntime.CleanupArena();
|
|
74
|
+
|
|
75
|
+
const valueSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, value)));
|
|
76
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
const result = wasm.fatoora_InvoiceBuilder_add_buyer_identifier(diplomatReceive.buffer, this.ffiValue, valueSlice.ptr, diplomatRuntime.optionToBufferForCalling(wasm, scheme, 8, 4, functionCleanupArena, (arrayBuffer, offset, jsValue) => [functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.str8(wasm, jsValue)).writePtrLenToArrayBuffer(arrayBuffer, offset + 0)]));
|
|
80
|
+
|
|
81
|
+
try {
|
|
82
|
+
if (!diplomatReceive.resultFlag) {
|
|
83
|
+
const cause = new BindingError(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
|
|
84
|
+
throw new globalThis.Error('BindingError: ' + cause.toString(), { cause });
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
finally {
|
|
89
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
90
|
+
functionCleanupArena.free();
|
|
91
|
+
|
|
92
|
+
diplomatReceive.free();
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
addVatBreakdown(value) {
|
|
97
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
const result = wasm.fatoora_InvoiceBuilder_add_vat_breakdown(diplomatReceive.buffer, this.ffiValue, value instanceof VatBreakdown ? value.ffiValue : typeError('value', 'VatBreakdown'));
|
|
101
|
+
|
|
102
|
+
try {
|
|
103
|
+
if (!diplomatReceive.resultFlag) {
|
|
104
|
+
const cause = new BindingError(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
|
|
105
|
+
throw new globalThis.Error('BindingError: ' + cause.toString(), { cause });
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
finally {
|
|
110
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
111
|
+
diplomatReceive.free();
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
addPaymentMeans(value) {
|
|
116
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
const result = wasm.fatoora_InvoiceBuilder_add_payment_means(diplomatReceive.buffer, this.ffiValue, value instanceof PaymentMeans ? value.ffiValue : typeError('value', 'PaymentMeans'));
|
|
120
|
+
|
|
121
|
+
try {
|
|
122
|
+
if (!diplomatReceive.resultFlag) {
|
|
123
|
+
const cause = new BindingError(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
|
|
124
|
+
throw new globalThis.Error('BindingError: ' + cause.toString(), { cause });
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
finally {
|
|
129
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
130
|
+
diplomatReceive.free();
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
addNote(language, value) {
|
|
135
|
+
let functionCleanupArena = new diplomatRuntime.CleanupArena();
|
|
136
|
+
|
|
137
|
+
const valueSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, value)));
|
|
138
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
const result = wasm.fatoora_InvoiceBuilder_add_note(diplomatReceive.buffer, this.ffiValue, diplomatRuntime.optionToBufferForCalling(wasm, language, 8, 4, functionCleanupArena, (arrayBuffer, offset, jsValue) => [functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.str8(wasm, jsValue)).writePtrLenToArrayBuffer(arrayBuffer, offset + 0)]), valueSlice.ptr);
|
|
142
|
+
|
|
143
|
+
try {
|
|
144
|
+
if (!diplomatReceive.resultFlag) {
|
|
145
|
+
const cause = new BindingError(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
|
|
146
|
+
throw new globalThis.Error('BindingError: ' + cause.toString(), { cause });
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
finally {
|
|
151
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
152
|
+
functionCleanupArena.free();
|
|
153
|
+
|
|
154
|
+
diplomatReceive.free();
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
addDocumentAdjustment(charge, value, category, rate, exemption) {
|
|
159
|
+
let functionCleanupArena = new diplomatRuntime.CleanupArena();
|
|
160
|
+
|
|
161
|
+
const rateSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, rate)));
|
|
162
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
const result = wasm.fatoora_InvoiceBuilder_add_document_adjustment(diplomatReceive.buffer, this.ffiValue, charge, value instanceof Adjustment ? value.ffiValue : typeError('value', 'Adjustment'), category, rateSlice.ptr, exemption instanceof TaxExemption ? exemption.ffiValue : typeError('exemption', 'TaxExemption'));
|
|
166
|
+
|
|
167
|
+
try {
|
|
168
|
+
if (!diplomatReceive.resultFlag) {
|
|
169
|
+
const cause = new BindingError(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
|
|
170
|
+
throw new globalThis.Error('BindingError: ' + cause.toString(), { cause });
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
finally {
|
|
175
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
176
|
+
functionCleanupArena.free();
|
|
177
|
+
|
|
178
|
+
diplomatReceive.free();
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
setBuyerWithoutAddress(name, vatId, otherId, scheme) {
|
|
183
|
+
let functionCleanupArena = new diplomatRuntime.CleanupArena();
|
|
184
|
+
|
|
185
|
+
const nameSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, name)));
|
|
186
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
const result = wasm.fatoora_InvoiceBuilder_set_buyer_without_address(diplomatReceive.buffer, this.ffiValue, nameSlice.ptr, diplomatRuntime.optionToBufferForCalling(wasm, vatId, 8, 4, functionCleanupArena, (arrayBuffer, offset, jsValue) => [functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.str8(wasm, jsValue)).writePtrLenToArrayBuffer(arrayBuffer, offset + 0)]), diplomatRuntime.optionToBufferForCalling(wasm, otherId, 8, 4, functionCleanupArena, (arrayBuffer, offset, jsValue) => [functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.str8(wasm, jsValue)).writePtrLenToArrayBuffer(arrayBuffer, offset + 0)]), diplomatRuntime.optionToBufferForCalling(wasm, scheme, 8, 4, functionCleanupArena, (arrayBuffer, offset, jsValue) => [functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.str8(wasm, jsValue)).writePtrLenToArrayBuffer(arrayBuffer, offset + 0)]));
|
|
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
|
+
}
|
|
197
|
+
|
|
198
|
+
finally {
|
|
199
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
200
|
+
functionCleanupArena.free();
|
|
201
|
+
|
|
202
|
+
diplomatReceive.free();
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* Construct a credit or debit note with a complete billing reference.
|
|
208
|
+
*/
|
|
209
|
+
static newWithReference(kind, subtype, reference, reason) {
|
|
210
|
+
let functionCleanupArena = new diplomatRuntime.CleanupArena();
|
|
211
|
+
|
|
212
|
+
const reasonSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, reason)));
|
|
213
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
const result = wasm.fatoora_InvoiceBuilder_new_with_reference(diplomatReceive.buffer, kind, subtype, reference instanceof OriginalInvoiceRef ? reference.ffiValue : typeError('reference', 'OriginalInvoiceRef'), reasonSlice.ptr);
|
|
217
|
+
|
|
218
|
+
try {
|
|
219
|
+
if (!diplomatReceive.resultFlag) {
|
|
220
|
+
const cause = new BindingError(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
|
|
221
|
+
throw new globalThis.Error('BindingError: ' + cause.toString(), { cause });
|
|
222
|
+
}
|
|
223
|
+
return new InvoiceBuilder(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
finally {
|
|
227
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
228
|
+
functionCleanupArena.free();
|
|
229
|
+
|
|
230
|
+
diplomatReceive.free();
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
setNoteWithoutLanguage(value) {
|
|
235
|
+
let functionCleanupArena = new diplomatRuntime.CleanupArena();
|
|
236
|
+
|
|
237
|
+
const valueSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, value)));
|
|
238
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
const result = wasm.fatoora_InvoiceBuilder_set_note_without_language(diplomatReceive.buffer, this.ffiValue, valueSlice.ptr);
|
|
242
|
+
|
|
243
|
+
try {
|
|
244
|
+
if (!diplomatReceive.resultFlag) {
|
|
245
|
+
const cause = new BindingError(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
|
|
246
|
+
throw new globalThis.Error('BindingError: ' + cause.toString(), { cause });
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
finally {
|
|
251
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
252
|
+
functionCleanupArena.free();
|
|
253
|
+
|
|
254
|
+
diplomatReceive.free();
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
setPaymentInstruction(instruction) {
|
|
259
|
+
let functionCleanupArena = new diplomatRuntime.CleanupArena();
|
|
260
|
+
|
|
261
|
+
const instructionSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, instruction)));
|
|
262
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
263
|
+
|
|
264
|
+
|
|
265
|
+
const result = wasm.fatoora_InvoiceBuilder_set_payment_instruction(diplomatReceive.buffer, this.ffiValue, instructionSlice.ptr);
|
|
266
|
+
|
|
267
|
+
try {
|
|
268
|
+
if (!diplomatReceive.resultFlag) {
|
|
269
|
+
const cause = new BindingError(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
|
|
270
|
+
throw new globalThis.Error('BindingError: ' + cause.toString(), { cause });
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
finally {
|
|
275
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
276
|
+
functionCleanupArena.free();
|
|
277
|
+
|
|
278
|
+
diplomatReceive.free();
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
setPrepaidAmount(amount) {
|
|
283
|
+
let functionCleanupArena = new diplomatRuntime.CleanupArena();
|
|
284
|
+
|
|
285
|
+
const amountSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, amount)));
|
|
286
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
287
|
+
|
|
288
|
+
|
|
289
|
+
const result = wasm.fatoora_InvoiceBuilder_set_prepaid_amount(diplomatReceive.buffer, this.ffiValue, amountSlice.ptr);
|
|
290
|
+
|
|
291
|
+
try {
|
|
292
|
+
if (!diplomatReceive.resultFlag) {
|
|
293
|
+
const cause = new BindingError(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
|
|
294
|
+
throw new globalThis.Error('BindingError: ' + cause.toString(), { cause });
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
finally {
|
|
299
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
300
|
+
functionCleanupArena.free();
|
|
301
|
+
|
|
302
|
+
diplomatReceive.free();
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
setPayableRoundingAmount(amount) {
|
|
307
|
+
let functionCleanupArena = new diplomatRuntime.CleanupArena();
|
|
308
|
+
|
|
309
|
+
const amountSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, amount)));
|
|
310
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
311
|
+
|
|
312
|
+
|
|
313
|
+
const result = wasm.fatoora_InvoiceBuilder_set_payable_rounding_amount(diplomatReceive.buffer, this.ffiValue, amountSlice.ptr);
|
|
314
|
+
|
|
315
|
+
try {
|
|
316
|
+
if (!diplomatReceive.resultFlag) {
|
|
317
|
+
const cause = new BindingError(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
|
|
318
|
+
throw new globalThis.Error('BindingError: ' + cause.toString(), { cause });
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
finally {
|
|
323
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
324
|
+
functionCleanupArena.free();
|
|
325
|
+
|
|
326
|
+
diplomatReceive.free();
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
setDelivery(actual, latest) {
|
|
331
|
+
let functionCleanupArena = new diplomatRuntime.CleanupArena();
|
|
332
|
+
|
|
333
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
334
|
+
|
|
335
|
+
|
|
336
|
+
const result = wasm.fatoora_InvoiceBuilder_set_delivery(diplomatReceive.buffer, this.ffiValue, diplomatRuntime.optionToBufferForCalling(wasm, actual, 8, 4, functionCleanupArena, (arrayBuffer, offset, jsValue) => [functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.str8(wasm, jsValue)).writePtrLenToArrayBuffer(arrayBuffer, offset + 0)]), diplomatRuntime.optionToBufferForCalling(wasm, latest, 8, 4, functionCleanupArena, (arrayBuffer, offset, jsValue) => [functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.str8(wasm, jsValue)).writePtrLenToArrayBuffer(arrayBuffer, offset + 0)]));
|
|
337
|
+
|
|
338
|
+
try {
|
|
339
|
+
if (!diplomatReceive.resultFlag) {
|
|
340
|
+
const cause = new BindingError(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
|
|
341
|
+
throw new globalThis.Error('BindingError: ' + cause.toString(), { cause });
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
finally {
|
|
346
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
347
|
+
functionCleanupArena.free();
|
|
348
|
+
|
|
349
|
+
diplomatReceive.free();
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
setTaxCurrency(currency, amount) {
|
|
354
|
+
let functionCleanupArena = new diplomatRuntime.CleanupArena();
|
|
355
|
+
|
|
356
|
+
const currencySlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, currency)));
|
|
357
|
+
const amountSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, amount)));
|
|
358
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
359
|
+
|
|
360
|
+
|
|
361
|
+
const result = wasm.fatoora_InvoiceBuilder_set_tax_currency(diplomatReceive.buffer, this.ffiValue, currencySlice.ptr, amountSlice.ptr);
|
|
362
|
+
|
|
363
|
+
try {
|
|
364
|
+
if (!diplomatReceive.resultFlag) {
|
|
365
|
+
const cause = new BindingError(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
|
|
366
|
+
throw new globalThis.Error('BindingError: ' + cause.toString(), { cause });
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
finally {
|
|
371
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
372
|
+
functionCleanupArena.free();
|
|
373
|
+
|
|
374
|
+
diplomatReceive.free();
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
setTaxExemption(category, rate, exemption) {
|
|
379
|
+
let functionCleanupArena = new diplomatRuntime.CleanupArena();
|
|
380
|
+
|
|
381
|
+
const rateSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, rate)));
|
|
382
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
383
|
+
|
|
384
|
+
|
|
385
|
+
const result = wasm.fatoora_InvoiceBuilder_set_tax_exemption(diplomatReceive.buffer, this.ffiValue, category, rateSlice.ptr, exemption instanceof TaxExemption ? exemption.ffiValue : typeError('exemption', 'TaxExemption'));
|
|
386
|
+
|
|
387
|
+
try {
|
|
388
|
+
if (!diplomatReceive.resultFlag) {
|
|
389
|
+
const cause = new BindingError(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
|
|
390
|
+
throw new globalThis.Error('BindingError: ' + cause.toString(), { cause });
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
finally {
|
|
395
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
396
|
+
functionCleanupArena.free();
|
|
397
|
+
|
|
398
|
+
diplomatReceive.free();
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
addAdjustment(adjustment) {
|
|
403
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
404
|
+
|
|
405
|
+
|
|
406
|
+
const result = wasm.fatoora_InvoiceBuilder_add_adjustment(diplomatReceive.buffer, this.ffiValue, adjustment instanceof AllowanceCharge ? adjustment.ffiValue : typeError('adjustment', 'AllowanceCharge'));
|
|
407
|
+
|
|
408
|
+
try {
|
|
409
|
+
if (!diplomatReceive.resultFlag) {
|
|
410
|
+
const cause = new BindingError(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
|
|
411
|
+
throw new globalThis.Error('BindingError: ' + cause.toString(), { cause });
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
finally {
|
|
416
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
417
|
+
diplomatReceive.free();
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
addItem(item) {
|
|
422
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
423
|
+
|
|
424
|
+
|
|
425
|
+
const result = wasm.fatoora_InvoiceBuilder_add_item(diplomatReceive.buffer, this.ffiValue, item instanceof InvoiceLineItem ? item.ffiValue : typeError('item', 'InvoiceLineItem'));
|
|
426
|
+
|
|
427
|
+
try {
|
|
428
|
+
if (!diplomatReceive.resultFlag) {
|
|
429
|
+
const cause = new BindingError(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
|
|
430
|
+
throw new globalThis.Error('BindingError: ' + cause.toString(), { cause });
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
finally {
|
|
435
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
436
|
+
diplomatReceive.free();
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
|
|
41
440
|
static new_(kind, subtype, originalId, originalUuid, originalDate, reason) {
|
|
42
441
|
let functionCleanupArena = new diplomatRuntime.CleanupArena();
|
|
43
442
|
|
|
@@ -62,6 +461,73 @@ export class InvoiceBuilder {
|
|
|
62
461
|
}
|
|
63
462
|
}
|
|
64
463
|
|
|
464
|
+
addBillingReference(value) {
|
|
465
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
466
|
+
|
|
467
|
+
|
|
468
|
+
const result = wasm.fatoora_InvoiceBuilder_add_billing_reference(diplomatReceive.buffer, this.ffiValue, value instanceof OriginalInvoiceRef ? value.ffiValue : typeError('value', 'OriginalInvoiceRef'));
|
|
469
|
+
|
|
470
|
+
try {
|
|
471
|
+
if (!diplomatReceive.resultFlag) {
|
|
472
|
+
const cause = new BindingError(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
|
|
473
|
+
throw new globalThis.Error('BindingError: ' + cause.toString(), { cause });
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
finally {
|
|
478
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
479
|
+
diplomatReceive.free();
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
setPurchaseOrderId(value) {
|
|
484
|
+
let functionCleanupArena = new diplomatRuntime.CleanupArena();
|
|
485
|
+
|
|
486
|
+
const valueSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, value)));
|
|
487
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
488
|
+
|
|
489
|
+
|
|
490
|
+
const result = wasm.fatoora_InvoiceBuilder_set_purchase_order_id(diplomatReceive.buffer, this.ffiValue, valueSlice.ptr);
|
|
491
|
+
|
|
492
|
+
try {
|
|
493
|
+
if (!diplomatReceive.resultFlag) {
|
|
494
|
+
const cause = new BindingError(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
|
|
495
|
+
throw new globalThis.Error('BindingError: ' + cause.toString(), { cause });
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
finally {
|
|
500
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
501
|
+
functionCleanupArena.free();
|
|
502
|
+
|
|
503
|
+
diplomatReceive.free();
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
setContractId(value) {
|
|
508
|
+
let functionCleanupArena = new diplomatRuntime.CleanupArena();
|
|
509
|
+
|
|
510
|
+
const valueSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, value)));
|
|
511
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
512
|
+
|
|
513
|
+
|
|
514
|
+
const result = wasm.fatoora_InvoiceBuilder_set_contract_id(diplomatReceive.buffer, this.ffiValue, valueSlice.ptr);
|
|
515
|
+
|
|
516
|
+
try {
|
|
517
|
+
if (!diplomatReceive.resultFlag) {
|
|
518
|
+
const cause = new BindingError(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
|
|
519
|
+
throw new globalThis.Error('BindingError: ' + cause.toString(), { cause });
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
finally {
|
|
524
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
525
|
+
functionCleanupArena.free();
|
|
526
|
+
|
|
527
|
+
diplomatReceive.free();
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
|
|
65
531
|
setId(value) {
|
|
66
532
|
let functionCleanupArena = new diplomatRuntime.CleanupArena();
|
|
67
533
|
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
// generated by diplomat-tool
|
|
2
|
+
import type { AllowanceCharge } from "./AllowanceCharge.mjs"
|
|
2
3
|
import type { BindingError } from "./BindingError.mjs"
|
|
3
4
|
import type { InvoiceLineItem } from "./InvoiceLineItem.mjs"
|
|
4
5
|
import type { InvoiceNote } from "./InvoiceNote.mjs"
|
|
5
6
|
import type { OriginalInvoiceRef } from "./OriginalInvoiceRef.mjs"
|
|
6
7
|
import type { Party } from "./Party.mjs"
|
|
8
|
+
import type { PaymentMeans } from "./PaymentMeans.mjs"
|
|
7
9
|
import type { Text } from "./Text.mjs"
|
|
8
10
|
import type { pointer, codepoint } from "./diplomat-runtime.mjs";
|
|
9
11
|
|
|
@@ -16,6 +18,32 @@ export class InvoiceData {
|
|
|
16
18
|
constructor();
|
|
17
19
|
|
|
18
20
|
|
|
21
|
+
issueTime(): string;
|
|
22
|
+
|
|
23
|
+
issueDate(): string;
|
|
24
|
+
|
|
25
|
+
paymentMeansLen(): number;
|
|
26
|
+
|
|
27
|
+
paymentMeans(index: number): PaymentMeans;
|
|
28
|
+
|
|
29
|
+
purchaseOrderId(): Text | null;
|
|
30
|
+
|
|
31
|
+
contractId(): Text | null;
|
|
32
|
+
|
|
33
|
+
paymentInstruction(): Text | null;
|
|
34
|
+
|
|
35
|
+
actualDeliveryDate(): Text | null;
|
|
36
|
+
|
|
37
|
+
latestDeliveryDate(): Text | null;
|
|
38
|
+
|
|
39
|
+
taxCurrency(): Text | null;
|
|
40
|
+
|
|
41
|
+
taxCurrencyAmount(): Text | null;
|
|
42
|
+
|
|
43
|
+
adjustmentsLen(): number;
|
|
44
|
+
|
|
45
|
+
adjustment(index: number): AllowanceCharge;
|
|
46
|
+
|
|
19
47
|
id(): string;
|
|
20
48
|
|
|
21
49
|
uuid(): string;
|
|
@@ -57,4 +85,12 @@ export class InvoiceData {
|
|
|
57
85
|
originalInvoiceRef(): OriginalInvoiceRef | null;
|
|
58
86
|
|
|
59
87
|
originalInvoiceReason(): Text | null;
|
|
88
|
+
|
|
89
|
+
notesLen(): number;
|
|
90
|
+
|
|
91
|
+
noteAt(index: number): InvoiceNote;
|
|
92
|
+
|
|
93
|
+
billingReferencesLen(): number;
|
|
94
|
+
|
|
95
|
+
billingReference(index: number): OriginalInvoiceRef;
|
|
60
96
|
}
|