@rowbind/sdk 0.0.0-stage → 0.1.0-canary.104
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/README.md +537 -2
- package/dist/generated/catalog.d.ts +22 -0
- package/dist/generated/catalog.js +7 -0
- package/dist/generated/http.d.ts +1740 -0
- package/dist/generated/http.js +843 -0
- package/dist/generated/raw.d.ts +39 -0
- package/dist/generated/raw.js +14 -0
- package/dist/generated/validators.d.ts +1411 -0
- package/dist/generated/validators.js +993 -0
- package/dist/http-error.d.ts +5 -0
- package/dist/http-error.js +2 -0
- package/dist/http-request.d.ts +17 -0
- package/dist/http-request.js +73 -0
- package/dist/index.d.ts +622 -0
- package/dist/index.js +256 -0
- package/dist/inputs.d.ts +145 -0
- package/dist/inputs.js +46 -0
- package/dist/ledger.d.ts +98 -0
- package/dist/ledger.js +218 -0
- package/dist/raw-invoice-query.d.ts +2 -0
- package/dist/raw-invoice-query.js +10 -0
- package/dist/transport.d.ts +344 -0
- package/dist/transport.js +276 -0
- package/dist/wire.d.ts +16 -0
- package/dist/wire.js +8 -0
- package/examples/catalog-invoice.mts +30 -0
- package/examples/connection-health.mts +21 -0
- package/examples/department-quickbooks/example.mts +12 -0
- package/examples/department-quickbooks/tsconfig.json +4 -0
- package/examples/facturar.mts +34 -0
- package/examples/first-customer.mts +72 -0
- package/examples/invoice-balances.mts +60 -0
- package/examples/invoice-settlement.mts +86 -0
- package/examples/invoice-sync.mts +46 -0
- package/examples/invoice-traces.mts +65 -0
- package/examples/invoice.mts +27 -0
- package/examples/mixed-providers/example.mts +12 -0
- package/examples/mixed-providers/tsconfig.json +4 -0
- package/examples/native-query.mts +28 -0
- package/examples/native-quickstart.mts +46 -0
- package/examples/observed-payments.mts +29 -0
- package/examples/quickstart.mts +11 -0
- package/examples/reimbursement-batch.mts +36 -0
- package/examples/resume-invoice.mts +52 -0
- package/examples/tsconfig.editor.json +11 -0
- package/examples/webhook-receiver.mts +142 -0
- package/package.json +61 -5
|
@@ -0,0 +1,843 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated by orval 🍺
|
|
3
|
+
* Do not edit manually.
|
|
4
|
+
* Rowbind Integration API
|
|
5
|
+
* Authenticate from the SaaS backend with its project key. The sandbox Worker supports companies, consent, invoices, received payments, credit memos, reimbursement batches, managed invoice and received-payment sync, payment matching, and signed notifications in simulated books. The standalone pilot supports connections, invoices and operation receipts.
|
|
6
|
+
* OpenAPI spec version: 0.2.0
|
|
7
|
+
*/
|
|
8
|
+
import { sendToRowbind } from '../http-request.js';
|
|
9
|
+
export const CatalogKind = {
|
|
10
|
+
customer: 'customer',
|
|
11
|
+
item: 'item',
|
|
12
|
+
};
|
|
13
|
+
export const ConnectSessionRequestProvider = {
|
|
14
|
+
quickbooksDesktop: 'quickbooksDesktop',
|
|
15
|
+
netsuite: 'netsuite',
|
|
16
|
+
};
|
|
17
|
+
export const CreatedConnectSessionProvider = {
|
|
18
|
+
quickbooksDesktop: 'quickbooksDesktop',
|
|
19
|
+
netsuite: 'netsuite',
|
|
20
|
+
};
|
|
21
|
+
export const CreatedConnectSessionStatus = {
|
|
22
|
+
pending: 'pending',
|
|
23
|
+
};
|
|
24
|
+
export const ConnectSessionProvider = {
|
|
25
|
+
quickbooksDesktop: 'quickbooksDesktop',
|
|
26
|
+
netsuite: 'netsuite',
|
|
27
|
+
};
|
|
28
|
+
export const ConnectSessionStatus = {
|
|
29
|
+
pending: 'pending',
|
|
30
|
+
connected: 'connected',
|
|
31
|
+
expired: 'expired',
|
|
32
|
+
};
|
|
33
|
+
export const ConnectionHealthProvider = {
|
|
34
|
+
quickbooksDesktop: 'quickbooksDesktop',
|
|
35
|
+
netsuite: 'netsuite',
|
|
36
|
+
};
|
|
37
|
+
export const ConnectionHealthAuthorization = {
|
|
38
|
+
authorized: 'authorized',
|
|
39
|
+
unrecorded: 'unrecorded',
|
|
40
|
+
};
|
|
41
|
+
export const ConnectionHealthStatus = {
|
|
42
|
+
unchecked: 'unchecked',
|
|
43
|
+
verified: 'verified',
|
|
44
|
+
offline: 'offline',
|
|
45
|
+
wrong_book: 'wrong_book',
|
|
46
|
+
permission_denied: 'permission_denied',
|
|
47
|
+
book_diverged: 'book_diverged',
|
|
48
|
+
};
|
|
49
|
+
export const ConnectionHealthCapability = {
|
|
50
|
+
'invoices:read': 'invoices:read',
|
|
51
|
+
};
|
|
52
|
+
export const ConnectionHealthNextAction = {
|
|
53
|
+
run_check: 'run_check',
|
|
54
|
+
none: 'none',
|
|
55
|
+
restore_connection: 'restore_connection',
|
|
56
|
+
open_authorized_book: 'open_authorized_book',
|
|
57
|
+
restore_permissions: 'restore_permissions',
|
|
58
|
+
authorize_connection: 'authorize_connection',
|
|
59
|
+
reconcile_book: 'reconcile_book',
|
|
60
|
+
};
|
|
61
|
+
export const QuickBooksConnectionProvider = {
|
|
62
|
+
quickbooksDesktop: 'quickbooksDesktop',
|
|
63
|
+
};
|
|
64
|
+
export const NetSuiteConnectionProvider = {
|
|
65
|
+
netsuite: 'netsuite',
|
|
66
|
+
};
|
|
67
|
+
export const InvoiceRequestCurrency = {
|
|
68
|
+
USD: 'USD',
|
|
69
|
+
};
|
|
70
|
+
export const ReceivedPaymentRequestCurrency = {
|
|
71
|
+
USD: 'USD',
|
|
72
|
+
};
|
|
73
|
+
export const CreditMemoRequestCurrency = {
|
|
74
|
+
USD: 'USD',
|
|
75
|
+
};
|
|
76
|
+
export const CreditApplicationRequestCurrency = {
|
|
77
|
+
USD: 'USD',
|
|
78
|
+
};
|
|
79
|
+
export const ReceivedPaymentRecordKind = {
|
|
80
|
+
received_payment: 'received_payment',
|
|
81
|
+
};
|
|
82
|
+
export const ReceivedPaymentRecordCurrency = {
|
|
83
|
+
USD: 'USD',
|
|
84
|
+
};
|
|
85
|
+
export const CreditMemoRecordKind = {
|
|
86
|
+
credit_memo: 'credit_memo',
|
|
87
|
+
};
|
|
88
|
+
export const CreditMemoRecordCurrency = {
|
|
89
|
+
USD: 'USD',
|
|
90
|
+
};
|
|
91
|
+
export const CreditApplicationRecordKind = {
|
|
92
|
+
credit_application: 'credit_application',
|
|
93
|
+
};
|
|
94
|
+
export const CreditApplicationRecordCurrency = {
|
|
95
|
+
USD: 'USD',
|
|
96
|
+
};
|
|
97
|
+
export const PendingOperationStatus = {
|
|
98
|
+
pending: 'pending',
|
|
99
|
+
};
|
|
100
|
+
export const InvoiceRecoveryEntryCode = {
|
|
101
|
+
intent_accepted: 'intent_accepted',
|
|
102
|
+
dispatch_claimed: 'dispatch_claimed',
|
|
103
|
+
book_unavailable: 'book_unavailable',
|
|
104
|
+
book_diverged: 'book_diverged',
|
|
105
|
+
no_candidate: 'no_candidate',
|
|
106
|
+
multiple_candidates: 'multiple_candidates',
|
|
107
|
+
readback_changed: 'readback_changed',
|
|
108
|
+
record_verified: 'record_verified',
|
|
109
|
+
record_mismatch: 'record_mismatch',
|
|
110
|
+
storage_error: 'storage_error',
|
|
111
|
+
internal_error: 'internal_error',
|
|
112
|
+
};
|
|
113
|
+
export const InvoiceRecoveryEntryPhase = {
|
|
114
|
+
admission: 'admission',
|
|
115
|
+
dispatch: 'dispatch',
|
|
116
|
+
verification: 'verification',
|
|
117
|
+
};
|
|
118
|
+
export const InvoiceRecoveryEntryCertainty = {
|
|
119
|
+
not_sent: 'not_sent',
|
|
120
|
+
unknown: 'unknown',
|
|
121
|
+
verified: 'verified',
|
|
122
|
+
mismatch: 'mismatch',
|
|
123
|
+
};
|
|
124
|
+
export const InvoiceRecoveryEntryOwner = {
|
|
125
|
+
rowbind: 'rowbind',
|
|
126
|
+
erp_admin: 'erp_admin',
|
|
127
|
+
saas: 'saas',
|
|
128
|
+
none: 'none',
|
|
129
|
+
};
|
|
130
|
+
export const InvoiceRecoveryEntryNextAction = {
|
|
131
|
+
dispatch_once: 'dispatch_once',
|
|
132
|
+
resume_operation: 'resume_operation',
|
|
133
|
+
verify_original_book: 'verify_original_book',
|
|
134
|
+
restore_original_book: 'restore_original_book',
|
|
135
|
+
reconcile_book: 'reconcile_book',
|
|
136
|
+
review_candidates: 'review_candidates',
|
|
137
|
+
review_mismatch: 'review_mismatch',
|
|
138
|
+
none: 'none',
|
|
139
|
+
};
|
|
140
|
+
export const VerifiedOperationStatus = {
|
|
141
|
+
verified: 'verified',
|
|
142
|
+
};
|
|
143
|
+
export const InvoiceRecordKind = {
|
|
144
|
+
invoice: 'invoice',
|
|
145
|
+
};
|
|
146
|
+
export const InvoiceRecordCurrency = {
|
|
147
|
+
USD: 'USD',
|
|
148
|
+
};
|
|
149
|
+
export const FailedOperationStatus = {
|
|
150
|
+
rejected: 'rejected',
|
|
151
|
+
verification_mismatch: 'verification_mismatch',
|
|
152
|
+
};
|
|
153
|
+
export const InvoiceRequestTraceOutcome = {
|
|
154
|
+
admitted: 'admitted',
|
|
155
|
+
replayed: 'replayed',
|
|
156
|
+
conflict: 'conflict',
|
|
157
|
+
rejected: 'rejected',
|
|
158
|
+
};
|
|
159
|
+
export const ReimbursementBillInputKind = {
|
|
160
|
+
vendor_bill: 'vendor_bill',
|
|
161
|
+
};
|
|
162
|
+
export const ReimbursementPaymentInputKind = {
|
|
163
|
+
bill_payment: 'bill_payment',
|
|
164
|
+
};
|
|
165
|
+
export const BatchRequestCurrency = {
|
|
166
|
+
USD: 'USD',
|
|
167
|
+
};
|
|
168
|
+
export const BatchRowDiagnosisCode = {
|
|
169
|
+
queued: 'queued',
|
|
170
|
+
awaiting_bills: 'awaiting_bills',
|
|
171
|
+
dispatch_claimed: 'dispatch_claimed',
|
|
172
|
+
source_offline: 'source_offline',
|
|
173
|
+
wrong_book: 'wrong_book',
|
|
174
|
+
book_diverged: 'book_diverged',
|
|
175
|
+
source_record_missing: 'source_record_missing',
|
|
176
|
+
source_record_mismatch: 'source_record_mismatch',
|
|
177
|
+
bills_changed: 'bills_changed',
|
|
178
|
+
storage_error: 'storage_error',
|
|
179
|
+
internal_error: 'internal_error',
|
|
180
|
+
record_verified: 'record_verified',
|
|
181
|
+
};
|
|
182
|
+
export const BatchRowDiagnosisCertainty = {
|
|
183
|
+
not_sent: 'not_sent',
|
|
184
|
+
unknown: 'unknown',
|
|
185
|
+
verified: 'verified',
|
|
186
|
+
};
|
|
187
|
+
export const BatchRowDiagnosisNextAction = {
|
|
188
|
+
dispatch_once: 'dispatch_once',
|
|
189
|
+
wait_for_bills: 'wait_for_bills',
|
|
190
|
+
verify_original_book: 'verify_original_book',
|
|
191
|
+
restore_connection: 'restore_connection',
|
|
192
|
+
open_authorized_book: 'open_authorized_book',
|
|
193
|
+
reconcile_book: 'reconcile_book',
|
|
194
|
+
review_mismatch: 'review_mismatch',
|
|
195
|
+
review_bills: 'review_bills',
|
|
196
|
+
resume_operation: 'resume_operation',
|
|
197
|
+
none: 'none',
|
|
198
|
+
};
|
|
199
|
+
export const BatchRowDiagnosisOwner = {
|
|
200
|
+
rowbind: 'rowbind',
|
|
201
|
+
erp_admin: 'erp_admin',
|
|
202
|
+
saas: 'saas',
|
|
203
|
+
none: 'none',
|
|
204
|
+
};
|
|
205
|
+
export const BatchRowDiagnosisRequiredEvidence = {
|
|
206
|
+
none: 'none',
|
|
207
|
+
verified_dependencies: 'verified_dependencies',
|
|
208
|
+
authorized_book: 'authorized_book',
|
|
209
|
+
consistent_book: 'consistent_book',
|
|
210
|
+
open_bills: 'open_bills',
|
|
211
|
+
native_bill: 'native_bill',
|
|
212
|
+
native_payment_and_applications: 'native_payment_and_applications',
|
|
213
|
+
};
|
|
214
|
+
export const BatchRowKind = {
|
|
215
|
+
vendor_bill: 'vendor_bill',
|
|
216
|
+
bill_payment: 'bill_payment',
|
|
217
|
+
};
|
|
218
|
+
export const BatchRowStatus = {
|
|
219
|
+
pending: 'pending',
|
|
220
|
+
blocked: 'blocked',
|
|
221
|
+
verified: 'verified',
|
|
222
|
+
};
|
|
223
|
+
export const ReimbursementBatchStatus = {
|
|
224
|
+
pending: 'pending',
|
|
225
|
+
verified: 'verified',
|
|
226
|
+
};
|
|
227
|
+
export const InvoiceSyncStatusResource = {
|
|
228
|
+
invoices: 'invoices',
|
|
229
|
+
};
|
|
230
|
+
export const InvoiceSyncStatusStatus = {
|
|
231
|
+
initializing: 'initializing',
|
|
232
|
+
syncing: 'syncing',
|
|
233
|
+
current: 'current',
|
|
234
|
+
unavailable: 'unavailable',
|
|
235
|
+
};
|
|
236
|
+
export const InvoiceSyncStatusLastFailure = {
|
|
237
|
+
source_offline: 'source_offline',
|
|
238
|
+
wrong_book: 'wrong_book',
|
|
239
|
+
permission_denied: 'permission_denied',
|
|
240
|
+
book_diverged: 'book_diverged',
|
|
241
|
+
storage_error: 'storage_error',
|
|
242
|
+
source_history_gap: 'source_history_gap',
|
|
243
|
+
};
|
|
244
|
+
export const PaymentSyncStatusResource = {
|
|
245
|
+
received_payments: 'received_payments',
|
|
246
|
+
};
|
|
247
|
+
export const PaymentSyncStatusStatus = {
|
|
248
|
+
initializing: 'initializing',
|
|
249
|
+
syncing: 'syncing',
|
|
250
|
+
current: 'current',
|
|
251
|
+
unavailable: 'unavailable',
|
|
252
|
+
};
|
|
253
|
+
export const PaymentSyncStatusLastFailure = {
|
|
254
|
+
source_offline: 'source_offline',
|
|
255
|
+
wrong_book: 'wrong_book',
|
|
256
|
+
book_diverged: 'book_diverged',
|
|
257
|
+
page_lost: 'page_lost',
|
|
258
|
+
storage_error: 'storage_error',
|
|
259
|
+
};
|
|
260
|
+
export const SyncedInvoiceStatus = {
|
|
261
|
+
voided: 'voided',
|
|
262
|
+
};
|
|
263
|
+
export const ObservedPaymentStatus = {
|
|
264
|
+
pending_match: 'pending_match',
|
|
265
|
+
matched: 'matched',
|
|
266
|
+
};
|
|
267
|
+
export const ObservedPaymentProvider = {
|
|
268
|
+
quickbooksDesktop: 'quickbooksDesktop',
|
|
269
|
+
netsuite: 'netsuite',
|
|
270
|
+
};
|
|
271
|
+
export const ObservedPaymentCurrency = {
|
|
272
|
+
USD: 'USD',
|
|
273
|
+
};
|
|
274
|
+
export const InvoiceWebhookEventType = {
|
|
275
|
+
operationverified: 'operation.verified',
|
|
276
|
+
invoicecreated: 'invoice.created',
|
|
277
|
+
invoiceupdated: 'invoice.updated',
|
|
278
|
+
invoicevoided: 'invoice.voided',
|
|
279
|
+
invoicedeleted: 'invoice.deleted',
|
|
280
|
+
paymentmatched: 'payment.matched',
|
|
281
|
+
};
|
|
282
|
+
export const VerifiedOperationDeliveryStatus = {
|
|
283
|
+
pending: 'pending',
|
|
284
|
+
delivered: 'delivered',
|
|
285
|
+
dead_letter: 'dead_letter',
|
|
286
|
+
};
|
|
287
|
+
export const CreatedInvoiceDeliveryEventType = {
|
|
288
|
+
invoicecreated: 'invoice.created',
|
|
289
|
+
};
|
|
290
|
+
export const CreatedInvoiceDeliveryStatus = {
|
|
291
|
+
pending: 'pending',
|
|
292
|
+
delivered: 'delivered',
|
|
293
|
+
dead_letter: 'dead_letter',
|
|
294
|
+
};
|
|
295
|
+
export const UpdatedInvoiceDeliveryEventType = {
|
|
296
|
+
invoiceupdated: 'invoice.updated',
|
|
297
|
+
};
|
|
298
|
+
export const UpdatedInvoiceDeliveryStatus = {
|
|
299
|
+
pending: 'pending',
|
|
300
|
+
delivered: 'delivered',
|
|
301
|
+
dead_letter: 'dead_letter',
|
|
302
|
+
};
|
|
303
|
+
export const VoidedInvoiceDeliveryEventType = {
|
|
304
|
+
invoicevoided: 'invoice.voided',
|
|
305
|
+
};
|
|
306
|
+
export const VoidedInvoiceDeliveryStatus = {
|
|
307
|
+
pending: 'pending',
|
|
308
|
+
delivered: 'delivered',
|
|
309
|
+
dead_letter: 'dead_letter',
|
|
310
|
+
};
|
|
311
|
+
export const DeletedInvoiceDeliveryEventType = {
|
|
312
|
+
invoicedeleted: 'invoice.deleted',
|
|
313
|
+
};
|
|
314
|
+
export const DeletedInvoiceDeliveryStatus = {
|
|
315
|
+
pending: 'pending',
|
|
316
|
+
delivered: 'delivered',
|
|
317
|
+
dead_letter: 'dead_letter',
|
|
318
|
+
};
|
|
319
|
+
export const MatchedPaymentDeliveryEventType = {
|
|
320
|
+
paymentmatched: 'payment.matched',
|
|
321
|
+
};
|
|
322
|
+
export const MatchedPaymentDeliveryStatus = {
|
|
323
|
+
pending: 'pending',
|
|
324
|
+
delivered: 'delivered',
|
|
325
|
+
dead_letter: 'dead_letter',
|
|
326
|
+
};
|
|
327
|
+
export const InvoiceRevisionEventDataProvider = {
|
|
328
|
+
quickbooksDesktop: 'quickbooksDesktop',
|
|
329
|
+
netsuite: 'netsuite',
|
|
330
|
+
};
|
|
331
|
+
export const InvoiceRevisionEventDataStatus = {
|
|
332
|
+
voided: 'voided',
|
|
333
|
+
};
|
|
334
|
+
export const InvoiceCreatedEventType = {
|
|
335
|
+
invoicecreated: 'invoice.created',
|
|
336
|
+
};
|
|
337
|
+
export const InvoiceCreatedEventVersion = {
|
|
338
|
+
NUMBER_1: 1,
|
|
339
|
+
};
|
|
340
|
+
export const InvoiceUpdatedEventType = {
|
|
341
|
+
invoiceupdated: 'invoice.updated',
|
|
342
|
+
};
|
|
343
|
+
export const InvoiceUpdatedEventVersion = {
|
|
344
|
+
NUMBER_1: 1,
|
|
345
|
+
};
|
|
346
|
+
export const InvoiceVoidedEventType = {
|
|
347
|
+
invoicevoided: 'invoice.voided',
|
|
348
|
+
};
|
|
349
|
+
export const InvoiceVoidedEventVersion = {
|
|
350
|
+
NUMBER_1: 1,
|
|
351
|
+
};
|
|
352
|
+
export const InvoiceVoidedEventDataStatus = {
|
|
353
|
+
voided: 'voided',
|
|
354
|
+
};
|
|
355
|
+
export const DeletedInvoiceDataProvider = {
|
|
356
|
+
quickbooksDesktop: 'quickbooksDesktop',
|
|
357
|
+
netsuite: 'netsuite',
|
|
358
|
+
};
|
|
359
|
+
export const InvoiceDeletedEventType = {
|
|
360
|
+
invoicedeleted: 'invoice.deleted',
|
|
361
|
+
};
|
|
362
|
+
export const InvoiceDeletedEventVersion = {
|
|
363
|
+
NUMBER_1: 1,
|
|
364
|
+
};
|
|
365
|
+
export const PaymentMatchedEventType = {
|
|
366
|
+
paymentmatched: 'payment.matched',
|
|
367
|
+
};
|
|
368
|
+
export const PaymentMatchedEventVersion = {
|
|
369
|
+
NUMBER_1: 1,
|
|
370
|
+
};
|
|
371
|
+
export const PaymentMatchedEventDataProvider = {
|
|
372
|
+
quickbooksDesktop: 'quickbooksDesktop',
|
|
373
|
+
netsuite: 'netsuite',
|
|
374
|
+
};
|
|
375
|
+
export const PaymentMatchedEventDataCurrency = {
|
|
376
|
+
USD: 'USD',
|
|
377
|
+
};
|
|
378
|
+
const getHeaders = (...sources) => {
|
|
379
|
+
const seen = new Set();
|
|
380
|
+
const layers = [];
|
|
381
|
+
for (const source of sources.reverse()) {
|
|
382
|
+
if (!source)
|
|
383
|
+
continue;
|
|
384
|
+
const entries = source instanceof Headers
|
|
385
|
+
? source.entries()
|
|
386
|
+
: Symbol.iterator in source
|
|
387
|
+
? Array.from(source, (entry) => Array.from(entry))
|
|
388
|
+
: Object.entries(source);
|
|
389
|
+
const layer = [];
|
|
390
|
+
for (const [name, value] of entries) {
|
|
391
|
+
if (value !== undefined && !seen.has(name.toLowerCase()))
|
|
392
|
+
layer.push([name, typeof value === 'object' ? value : String(value)]);
|
|
393
|
+
}
|
|
394
|
+
for (const [name] of layer)
|
|
395
|
+
seen.add(name.toLowerCase());
|
|
396
|
+
layers.push(layer);
|
|
397
|
+
}
|
|
398
|
+
return Object.fromEntries(layers.reverse().flat());
|
|
399
|
+
};
|
|
400
|
+
export const getSearchCatalogUrl = (id, kind, params) => {
|
|
401
|
+
const normalizedParams = new URLSearchParams();
|
|
402
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
403
|
+
if (value !== undefined) {
|
|
404
|
+
normalizedParams.append(key, value === null ? 'null' : String(value));
|
|
405
|
+
}
|
|
406
|
+
});
|
|
407
|
+
const stringifiedParams = normalizedParams.toString();
|
|
408
|
+
return stringifiedParams.length > 0 ? `/v1/connections/${encodeURIComponent(String(id))}/catalog/${encodeURIComponent(String(kind))}?${stringifiedParams}` : `/v1/connections/${encodeURIComponent(String(id))}/catalog/${encodeURIComponent(String(kind))}`;
|
|
409
|
+
};
|
|
410
|
+
/**
|
|
411
|
+
* Requires catalog:read. Search by a literal substring of the display name, item SKU or native ID. Enrolled books refresh active customers and sale items automatically. Each completed scan replaces the previous results for that record type. Up to 50 candidates are returned in native ID order. Identical names can identify different records. Continue with nextCursor and the same book, kind and query. Simulated books include sample records. For an enrolled connector the operator imports the catalog for its exact book and target fingerprint.
|
|
412
|
+
* @summary Find native customers or items in a connected sandbox book
|
|
413
|
+
*/
|
|
414
|
+
export const searchCatalog = async (id, kind, params, options) => {
|
|
415
|
+
return sendToRowbind(getSearchCatalogUrl(id, kind, params), {
|
|
416
|
+
...options,
|
|
417
|
+
method: 'GET'
|
|
418
|
+
});
|
|
419
|
+
};
|
|
420
|
+
export const getLinkCatalogUrl = (id, kind) => {
|
|
421
|
+
return `/v1/connections/${encodeURIComponent(String(id))}/catalog/${encodeURIComponent(String(kind))}/links`;
|
|
422
|
+
};
|
|
423
|
+
/**
|
|
424
|
+
* Requires invoices:write. Select a native ID from the same book and catalog kind. An identical replay returns the original link. An existing link cannot be reassigned. Use the externalId as customerRef.externalId or itemRef.externalId on invoice creation. For an enrolled connector the selected native IDs are pinned at invoice admission and checked again on ERP readback.
|
|
425
|
+
* @summary Link a SaaS reference to a native customer or item
|
|
426
|
+
*/
|
|
427
|
+
export const linkCatalog = async (id, kind, catalogLinkRequest, options) => {
|
|
428
|
+
return sendToRowbind(getLinkCatalogUrl(id, kind), {
|
|
429
|
+
...options,
|
|
430
|
+
method: 'PUT',
|
|
431
|
+
headers: getHeaders({ 'Content-Type': 'application/json' }, options?.headers),
|
|
432
|
+
body: JSON.stringify(catalogLinkRequest)
|
|
433
|
+
});
|
|
434
|
+
};
|
|
435
|
+
export const getQueryRawUrl = (id) => {
|
|
436
|
+
return `/v1/connections/${encodeURIComponent(String(id))}/raw/query`;
|
|
437
|
+
};
|
|
438
|
+
/**
|
|
439
|
+
* Requires raw:query. Submit a read-only qbXML query fragment or SuiteQL query for the selected provider. Supported queries depend on the connector. Returns one native XML response or a page of SuiteQL rows. Request the next page explicitly using the same query and limit.
|
|
440
|
+
* @summary Query an authorized book in its native language
|
|
441
|
+
*/
|
|
442
|
+
export const queryRaw = async (id, rawQueryRequest, options) => {
|
|
443
|
+
return sendToRowbind(getQueryRawUrl(id), {
|
|
444
|
+
...options,
|
|
445
|
+
method: 'POST',
|
|
446
|
+
headers: getHeaders({ 'Content-Type': 'application/json' }, options?.headers),
|
|
447
|
+
body: JSON.stringify(rawQueryRequest)
|
|
448
|
+
});
|
|
449
|
+
};
|
|
450
|
+
export const getReadRawUrl = (id) => {
|
|
451
|
+
return `/v1/connections/${encodeURIComponent(String(id))}/raw/read`;
|
|
452
|
+
};
|
|
453
|
+
/**
|
|
454
|
+
* Requires raw:read. The sandbox accepts one qbXML InvoiceQueryRq fragment containing a single TxnID, or a SuiteTalk GET on /services/rest/record/v1/invoice/{nativeId}. It returns the simulated book's current native fields and a fresh X-Request-Id header. This operation cannot dispatch writes.
|
|
455
|
+
* @summary Read a native invoice from a consenting sandbox book
|
|
456
|
+
*/
|
|
457
|
+
export const readRaw = async (id, rawReadRequest, options) => {
|
|
458
|
+
return sendToRowbind(getReadRawUrl(id), {
|
|
459
|
+
...options,
|
|
460
|
+
method: 'POST',
|
|
461
|
+
headers: getHeaders({ 'Content-Type': 'application/json' }, options?.headers),
|
|
462
|
+
body: JSON.stringify(rawReadRequest)
|
|
463
|
+
});
|
|
464
|
+
};
|
|
465
|
+
export const getCreateReceivedPaymentUrl = () => {
|
|
466
|
+
return `/v1/received-payments`;
|
|
467
|
+
};
|
|
468
|
+
/**
|
|
469
|
+
* Requires receivables:write. Record money already received from the mapped customer and apply it to their invoice in the selected sandbox book. Read the operation for the verified invoice balance.
|
|
470
|
+
* @summary Record a received payment applied to an invoice
|
|
471
|
+
*/
|
|
472
|
+
export const createReceivedPayment = async (receivedPaymentRequest, headers, options) => {
|
|
473
|
+
return sendToRowbind(getCreateReceivedPaymentUrl(), {
|
|
474
|
+
...options,
|
|
475
|
+
method: 'POST',
|
|
476
|
+
headers: getHeaders({ 'Content-Type': 'application/json' }, headers, options?.headers),
|
|
477
|
+
body: JSON.stringify(receivedPaymentRequest)
|
|
478
|
+
});
|
|
479
|
+
};
|
|
480
|
+
export const getCreateCreditMemoUrl = () => {
|
|
481
|
+
return `/v1/credit-memos`;
|
|
482
|
+
};
|
|
483
|
+
/**
|
|
484
|
+
* Requires receivables:write. Issue credit to the mapped customer. The credit remains available until explicitly applied to an invoice. Read the operation for its native credit memo ID.
|
|
485
|
+
* @summary Issue available credit to a customer
|
|
486
|
+
*/
|
|
487
|
+
export const createCreditMemo = async (creditMemoRequest, headers, options) => {
|
|
488
|
+
return sendToRowbind(getCreateCreditMemoUrl(), {
|
|
489
|
+
...options,
|
|
490
|
+
method: 'POST',
|
|
491
|
+
headers: getHeaders({ 'Content-Type': 'application/json' }, headers, options?.headers),
|
|
492
|
+
body: JSON.stringify(creditMemoRequest)
|
|
493
|
+
});
|
|
494
|
+
};
|
|
495
|
+
export const getApplyCreditMemoUrl = (id) => {
|
|
496
|
+
return `/v1/credit-memos/${encodeURIComponent(String(id))}/applications`;
|
|
497
|
+
};
|
|
498
|
+
/**
|
|
499
|
+
* Requires receivables:write. Use the native credit memo ID and an invoice belonging to the same customer, currency and book. The application receipt includes the remaining credit and invoice balance.
|
|
500
|
+
* @summary Apply existing credit to an invoice
|
|
501
|
+
*/
|
|
502
|
+
export const applyCreditMemo = async (id, creditApplicationRequest, headers, options) => {
|
|
503
|
+
return sendToRowbind(getApplyCreditMemoUrl(id), {
|
|
504
|
+
...options,
|
|
505
|
+
method: 'POST',
|
|
506
|
+
headers: getHeaders({ 'Content-Type': 'application/json' }, headers, options?.headers),
|
|
507
|
+
body: JSON.stringify(creditApplicationRequest)
|
|
508
|
+
});
|
|
509
|
+
};
|
|
510
|
+
export const getCreateBatchUrl = () => {
|
|
511
|
+
return `/v1/batches`;
|
|
512
|
+
};
|
|
513
|
+
/**
|
|
514
|
+
* Sandbox. Requires batches:write and a stable Idempotency-Key for this connection. Use the employee-clearing vendor and USD. Supply 1 to 25 positive vendor bills followed by one payment whose dependsOn names every bill key exactly once. All row keys must be distinct. The Worker processes the admitted rows asynchronously.
|
|
515
|
+
* @summary Admit a batch of employee reimbursements
|
|
516
|
+
*/
|
|
517
|
+
export const createBatch = async (batchRequest, headers, options) => {
|
|
518
|
+
return sendToRowbind(getCreateBatchUrl(), {
|
|
519
|
+
...options,
|
|
520
|
+
method: 'POST',
|
|
521
|
+
headers: getHeaders({ 'Content-Type': 'application/json' }, headers, options?.headers),
|
|
522
|
+
body: JSON.stringify(batchRequest)
|
|
523
|
+
});
|
|
524
|
+
};
|
|
525
|
+
export const getRetrieveBatchUrl = (id) => {
|
|
526
|
+
return `/v1/batches/${encodeURIComponent(String(id))}`;
|
|
527
|
+
};
|
|
528
|
+
/**
|
|
529
|
+
* Requires batches:read. Read the saved batch ID after a restart. Each verified bill exposes its native ID and the last confirmed balance. The payment waits for its bills.
|
|
530
|
+
* @summary Read the status of a batch and each row
|
|
531
|
+
*/
|
|
532
|
+
export const retrieveBatch = async (id, options) => {
|
|
533
|
+
return sendToRowbind(getRetrieveBatchUrl(id), {
|
|
534
|
+
...options,
|
|
535
|
+
method: 'GET'
|
|
536
|
+
});
|
|
537
|
+
};
|
|
538
|
+
export const getCreateWebhookEndpointUrl = () => {
|
|
539
|
+
return `/v1/webhook-endpoints`;
|
|
540
|
+
};
|
|
541
|
+
/**
|
|
542
|
+
* Requires webhooks:manage. The sandbox operator configures a receiver alias and signing secret for this project. Omitting eventType selects operation.verified. Use invoice.created for new invoices, invoice.updated for edits, invoice.voided for confirmed voids, invoice.deleted for confirmed deletions, and payment.matched for confirmed payment matches. Sync publishes invoice events observed after its initial cutoff. Reusing an alias adds the selected event type to the same receiver. Repeating a subscription is idempotent.
|
|
543
|
+
* @summary Subscribe a sandbox receiver to an event type
|
|
544
|
+
*/
|
|
545
|
+
export const createWebhookEndpoint = async (webhookEndpointRequest, options) => {
|
|
546
|
+
return sendToRowbind(getCreateWebhookEndpointUrl(), {
|
|
547
|
+
...options,
|
|
548
|
+
method: 'POST',
|
|
549
|
+
headers: getHeaders({ 'Content-Type': 'application/json' }, options?.headers),
|
|
550
|
+
body: JSON.stringify(webhookEndpointRequest)
|
|
551
|
+
});
|
|
552
|
+
};
|
|
553
|
+
export const getListWebhookDeliveriesUrl = (id) => {
|
|
554
|
+
return `/v1/webhook-endpoints/${encodeURIComponent(String(id))}/deliveries`;
|
|
555
|
+
};
|
|
556
|
+
/**
|
|
557
|
+
* Requires webhooks:manage. Returns the most recent 50 deliveries and the last HTTP status when the receiver returned one.
|
|
558
|
+
* @summary Read recent deliveries to a sandbox receiver
|
|
559
|
+
*/
|
|
560
|
+
export const listWebhookDeliveries = async (id, options) => {
|
|
561
|
+
return sendToRowbind(getListWebhookDeliveriesUrl(id), {
|
|
562
|
+
...options,
|
|
563
|
+
method: 'GET'
|
|
564
|
+
});
|
|
565
|
+
};
|
|
566
|
+
export const getReplayWebhookDeliveryUrl = (id, eventId) => {
|
|
567
|
+
return `/v1/webhook-endpoints/${encodeURIComponent(String(id))}/deliveries/${encodeURIComponent(String(eventId))}/replay`;
|
|
568
|
+
};
|
|
569
|
+
/**
|
|
570
|
+
* Requires webhooks:manage. Enqueues the same event for this endpoint. If a delivery is pending or in flight the request coalesces with it.
|
|
571
|
+
* @summary Request another delivery of the same event
|
|
572
|
+
*/
|
|
573
|
+
export const replayWebhookDelivery = async (id, eventId, options) => {
|
|
574
|
+
return sendToRowbind(getReplayWebhookDeliveryUrl(id, eventId), {
|
|
575
|
+
...options,
|
|
576
|
+
method: 'POST'
|
|
577
|
+
});
|
|
578
|
+
};
|
|
579
|
+
export const getCreateCompanyUrl = () => {
|
|
580
|
+
return `/v1/companies`;
|
|
581
|
+
};
|
|
582
|
+
/**
|
|
583
|
+
* @summary Create or recover a customer by its external ID
|
|
584
|
+
*/
|
|
585
|
+
export const createCompany = async (companyRequest, options) => {
|
|
586
|
+
return sendToRowbind(getCreateCompanyUrl(), {
|
|
587
|
+
...options,
|
|
588
|
+
method: 'POST',
|
|
589
|
+
headers: getHeaders({ 'Content-Type': 'application/json' }, options?.headers),
|
|
590
|
+
body: JSON.stringify(companyRequest)
|
|
591
|
+
});
|
|
592
|
+
};
|
|
593
|
+
export const getCreateConnectSessionUrl = () => {
|
|
594
|
+
return `/v1/connect/sessions`;
|
|
595
|
+
};
|
|
596
|
+
/**
|
|
597
|
+
* @summary Create a sandbox consent link for the customer administrator
|
|
598
|
+
*/
|
|
599
|
+
export const createConnectSession = async (connectSessionRequest, options) => {
|
|
600
|
+
return sendToRowbind(getCreateConnectSessionUrl(), {
|
|
601
|
+
...options,
|
|
602
|
+
method: 'POST',
|
|
603
|
+
headers: getHeaders({ 'Content-Type': 'application/json' }, options?.headers),
|
|
604
|
+
body: JSON.stringify(connectSessionRequest)
|
|
605
|
+
});
|
|
606
|
+
};
|
|
607
|
+
export const getRetrieveConnectSessionUrl = (id) => {
|
|
608
|
+
return `/v1/connect/sessions/${encodeURIComponent(String(id))}`;
|
|
609
|
+
};
|
|
610
|
+
/**
|
|
611
|
+
* @summary Check consent and retrieve the authorized connection ID
|
|
612
|
+
*/
|
|
613
|
+
export const retrieveConnectSession = async (id, options) => {
|
|
614
|
+
return sendToRowbind(getRetrieveConnectSessionUrl(id), {
|
|
615
|
+
...options,
|
|
616
|
+
method: 'GET'
|
|
617
|
+
});
|
|
618
|
+
};
|
|
619
|
+
export const getListConnectionsUrl = () => {
|
|
620
|
+
return `/v1/connections`;
|
|
621
|
+
};
|
|
622
|
+
/**
|
|
623
|
+
* @summary List the project's ERP connections
|
|
624
|
+
*/
|
|
625
|
+
export const listConnections = async (options) => {
|
|
626
|
+
return sendToRowbind(getListConnectionsUrl(), {
|
|
627
|
+
...options,
|
|
628
|
+
method: 'GET'
|
|
629
|
+
});
|
|
630
|
+
};
|
|
631
|
+
export const getRetrieveConnectionUrl = (id) => {
|
|
632
|
+
return `/v1/connections/${encodeURIComponent(String(id))}`;
|
|
633
|
+
};
|
|
634
|
+
/**
|
|
635
|
+
* @summary Retrieve an ERP connection
|
|
636
|
+
*/
|
|
637
|
+
export const retrieveConnection = async (id, options) => {
|
|
638
|
+
return sendToRowbind(getRetrieveConnectionUrl(id), {
|
|
639
|
+
...options,
|
|
640
|
+
method: 'GET'
|
|
641
|
+
});
|
|
642
|
+
};
|
|
643
|
+
export const getRetrieveConnectionHealthUrl = (id) => {
|
|
644
|
+
return `/v1/connections/${encodeURIComponent(String(id))}/health`;
|
|
645
|
+
};
|
|
646
|
+
/**
|
|
647
|
+
* Requires connections:read. Returns the latest stored evidence from an explicit check, an invoice readback or a managed invoice sync. Reading this endpoint never contacts the ERP.
|
|
648
|
+
* @summary Read the latest connection health observation
|
|
649
|
+
*/
|
|
650
|
+
export const retrieveConnectionHealth = async (id, options) => {
|
|
651
|
+
return sendToRowbind(getRetrieveConnectionHealthUrl(id), {
|
|
652
|
+
...options,
|
|
653
|
+
method: 'GET'
|
|
654
|
+
});
|
|
655
|
+
};
|
|
656
|
+
export const getCheckConnectionHealthUrl = (id) => {
|
|
657
|
+
return `/v1/connections/${encodeURIComponent(String(id))}/health/check`;
|
|
658
|
+
};
|
|
659
|
+
/**
|
|
660
|
+
* Requires connections:read. Checks book identity, invoice read access and continuity with previously verified evidence. After book_diverged, reconcile the book and run this check to resume work. An unsuccessful check preserves the previous verified read time. An unrecorded authorization requires Connect before verification.
|
|
661
|
+
* @summary Check access to invoices in the authorized sandbox book
|
|
662
|
+
*/
|
|
663
|
+
export const checkConnectionHealth = async (id, options) => {
|
|
664
|
+
return sendToRowbind(getCheckConnectionHealthUrl(id), {
|
|
665
|
+
...options,
|
|
666
|
+
method: 'POST'
|
|
667
|
+
});
|
|
668
|
+
};
|
|
669
|
+
export const getEnableInvoiceSyncUrl = (id) => {
|
|
670
|
+
return `/v1/connections/${encodeURIComponent(String(id))}/sync/invoices`;
|
|
671
|
+
};
|
|
672
|
+
/**
|
|
673
|
+
* Requires sync:write. Starts the initial scan. Repeating this call preserves the existing cursor and coverage.
|
|
674
|
+
* @summary Enable managed invoice sync for a sandbox book
|
|
675
|
+
*/
|
|
676
|
+
export const enableInvoiceSync = async (id, options) => {
|
|
677
|
+
return sendToRowbind(getEnableInvoiceSyncUrl(id), {
|
|
678
|
+
...options,
|
|
679
|
+
method: 'PUT'
|
|
680
|
+
});
|
|
681
|
+
};
|
|
682
|
+
export const getRetrieveInvoiceSyncUrl = (id) => {
|
|
683
|
+
return `/v1/connections/${encodeURIComponent(String(id))}/sync/invoices`;
|
|
684
|
+
};
|
|
685
|
+
/**
|
|
686
|
+
* Requires sync:read. Returns the latest committed coverage. Before the first complete scan coveredThrough is null. During an interruption it remains at the last completed scan.
|
|
687
|
+
* @summary Read invoice sync coverage for a sandbox book
|
|
688
|
+
*/
|
|
689
|
+
export const retrieveInvoiceSync = async (id, options) => {
|
|
690
|
+
return sendToRowbind(getRetrieveInvoiceSyncUrl(id), {
|
|
691
|
+
...options,
|
|
692
|
+
method: 'GET'
|
|
693
|
+
});
|
|
694
|
+
};
|
|
695
|
+
export const getEnableReceivedPaymentSyncUrl = (id) => {
|
|
696
|
+
return `/v1/connections/${encodeURIComponent(String(id))}/sync/received-payments`;
|
|
697
|
+
};
|
|
698
|
+
/**
|
|
699
|
+
* Requires sync:write. Starts the initial scan. Repeating this call preserves the existing cursor and coverage.
|
|
700
|
+
* @summary Enable managed received-payment sync for a sandbox book
|
|
701
|
+
*/
|
|
702
|
+
export const enableReceivedPaymentSync = async (id, options) => {
|
|
703
|
+
return sendToRowbind(getEnableReceivedPaymentSyncUrl(id), {
|
|
704
|
+
...options,
|
|
705
|
+
method: 'PUT'
|
|
706
|
+
});
|
|
707
|
+
};
|
|
708
|
+
export const getRetrieveReceivedPaymentSyncUrl = (id) => {
|
|
709
|
+
return `/v1/connections/${encodeURIComponent(String(id))}/sync/received-payments`;
|
|
710
|
+
};
|
|
711
|
+
/**
|
|
712
|
+
* Requires sync:read. Returns the latest committed coverage. Before the first complete scan coveredThrough is null. During an interruption it remains at the last completed scan. A successful scan clears lastFailure.
|
|
713
|
+
* @summary Read received-payment sync coverage for a sandbox book
|
|
714
|
+
*/
|
|
715
|
+
export const retrieveReceivedPaymentSync = async (id, options) => {
|
|
716
|
+
return sendToRowbind(getRetrieveReceivedPaymentSyncUrl(id), {
|
|
717
|
+
...options,
|
|
718
|
+
method: 'GET'
|
|
719
|
+
});
|
|
720
|
+
};
|
|
721
|
+
export const getListSyncedInvoicesUrl = (id, params) => {
|
|
722
|
+
const normalizedParams = new URLSearchParams();
|
|
723
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
724
|
+
if (value !== undefined) {
|
|
725
|
+
normalizedParams.append(key, value === null ? 'null' : String(value));
|
|
726
|
+
}
|
|
727
|
+
});
|
|
728
|
+
const stringifiedParams = normalizedParams.toString();
|
|
729
|
+
return stringifiedParams.length > 0 ? `/v1/connections/${encodeURIComponent(String(id))}/invoices?${stringifiedParams}` : `/v1/connections/${encodeURIComponent(String(id))}/invoices`;
|
|
730
|
+
};
|
|
731
|
+
/**
|
|
732
|
+
* Requires sync:read. The first page pins the latest complete snapshot for this sandbox connection. Pass nextCursor as after to keep the same cutoff on subsequent pages. Subscribe to invoice.created, invoice.updated, invoice.voided, and invoice.deleted before starting the import. Voided invoices remain in the snapshot with status voided. A confirmed deletion removes the invoice from subsequent snapshots. After the import, apply the absolute balance and observed details as one invoice revision. Keep the latest revision per invoice so a late page or redelivery cannot overwrite a newer edit.
|
|
733
|
+
* @summary Page through invoices at a completed sync cutoff
|
|
734
|
+
*/
|
|
735
|
+
export const listSyncedInvoices = async (id, params, options) => {
|
|
736
|
+
return sendToRowbind(getListSyncedInvoicesUrl(id, params), {
|
|
737
|
+
...options,
|
|
738
|
+
method: 'GET'
|
|
739
|
+
});
|
|
740
|
+
};
|
|
741
|
+
export const getListObservedPaymentsUrl = (id, params) => {
|
|
742
|
+
const normalizedParams = new URLSearchParams();
|
|
743
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
744
|
+
if (value !== undefined) {
|
|
745
|
+
normalizedParams.append(key, value === null ? 'null' : String(value));
|
|
746
|
+
}
|
|
747
|
+
});
|
|
748
|
+
const stringifiedParams = normalizedParams.toString();
|
|
749
|
+
return stringifiedParams.length > 0 ? `/v1/connections/${encodeURIComponent(String(id))}/observed-payments?${stringifiedParams}` : `/v1/connections/${encodeURIComponent(String(id))}/observed-payments`;
|
|
750
|
+
};
|
|
751
|
+
/**
|
|
752
|
+
* Requires sync:read. Use nextCursor as after for the next page. Each cursor is an observation ID from this connection.
|
|
753
|
+
* @summary List received payments observed in a sandbox book
|
|
754
|
+
*/
|
|
755
|
+
export const listObservedPayments = async (id, params, options) => {
|
|
756
|
+
return sendToRowbind(getListObservedPaymentsUrl(id, params), {
|
|
757
|
+
...options,
|
|
758
|
+
method: 'GET'
|
|
759
|
+
});
|
|
760
|
+
};
|
|
761
|
+
export const getMatchObservedPaymentUrl = (id) => {
|
|
762
|
+
return `/v1/observed-payments/${encodeURIComponent(String(id))}/match`;
|
|
763
|
+
};
|
|
764
|
+
/**
|
|
765
|
+
* Requires receivables:match. Use the externalReference of the verified invoice in the original book. Confirming the same association again returns the matched observation. This operation associates existing cash with the SaaS invoice.
|
|
766
|
+
* @summary Confirm the SaaS invoice for an observed payment
|
|
767
|
+
*/
|
|
768
|
+
export const matchObservedPayment = async (id, matchObservedPaymentRequest, options) => {
|
|
769
|
+
return sendToRowbind(getMatchObservedPaymentUrl(id), {
|
|
770
|
+
...options,
|
|
771
|
+
method: 'PUT',
|
|
772
|
+
headers: getHeaders({ 'Content-Type': 'application/json' }, options?.headers),
|
|
773
|
+
body: JSON.stringify(matchObservedPaymentRequest)
|
|
774
|
+
});
|
|
775
|
+
};
|
|
776
|
+
export const getCreateInvoiceUrl = () => {
|
|
777
|
+
return `/v1/invoices`;
|
|
778
|
+
};
|
|
779
|
+
/**
|
|
780
|
+
* The service persists an operation before acknowledging it. Replay the same key and payload on the same connection and book configuration to recover the original operation ID. Poll that operation for the ERP readback. The JSON body is limited to 65536 bytes.
|
|
781
|
+
* @summary Admit one invoice intent for one connection
|
|
782
|
+
*/
|
|
783
|
+
export const createInvoice = async (invoiceRequest, headers, options) => {
|
|
784
|
+
return sendToRowbind(getCreateInvoiceUrl(), {
|
|
785
|
+
...options,
|
|
786
|
+
method: 'POST',
|
|
787
|
+
headers: getHeaders({ 'Content-Type': 'application/json' }, headers, options?.headers),
|
|
788
|
+
body: JSON.stringify(invoiceRequest)
|
|
789
|
+
});
|
|
790
|
+
};
|
|
791
|
+
export const getListInvoiceTracesUrl = (params) => {
|
|
792
|
+
const normalizedParams = new URLSearchParams();
|
|
793
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
794
|
+
if (value !== undefined) {
|
|
795
|
+
normalizedParams.append(key, value === null ? 'null' : String(value));
|
|
796
|
+
}
|
|
797
|
+
});
|
|
798
|
+
const stringifiedParams = normalizedParams.toString();
|
|
799
|
+
return stringifiedParams.length > 0 ? `/v1/invoice-traces?${stringifiedParams}` : `/v1/invoice-traces`;
|
|
800
|
+
};
|
|
801
|
+
/**
|
|
802
|
+
* Requires operations:read. Supply exactly one of requestId, reference or operationId. Search is exact within the authenticated project and environment. A reference searches the original admitted operation; different operations can have the same reference. Rejections without an operation are searchable by request ID. Returns up to 50 recorded requests in increasing recording order. Earlier requests without recorded traces have no entries. An unknown selector or cursor returns an empty page.
|
|
803
|
+
* @summary Find requests to create an invoice
|
|
804
|
+
*/
|
|
805
|
+
export const listInvoiceTraces = async (params, options) => {
|
|
806
|
+
return sendToRowbind(getListInvoiceTracesUrl(params), {
|
|
807
|
+
...options,
|
|
808
|
+
method: 'GET'
|
|
809
|
+
});
|
|
810
|
+
};
|
|
811
|
+
export const getRetrieveInvoiceRecoveryUrl = (id, params) => {
|
|
812
|
+
const normalizedParams = new URLSearchParams();
|
|
813
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
814
|
+
if (value !== undefined) {
|
|
815
|
+
normalizedParams.append(key, value === null ? 'null' : String(value));
|
|
816
|
+
}
|
|
817
|
+
});
|
|
818
|
+
const stringifiedParams = normalizedParams.toString();
|
|
819
|
+
return stringifiedParams.length > 0 ? `/v1/operations/${encodeURIComponent(String(id))}/recovery?${stringifiedParams}` : `/v1/operations/${encodeURIComponent(String(id))}/recovery`;
|
|
820
|
+
};
|
|
821
|
+
/**
|
|
822
|
+
* Requires operations:read. Returns up to 50 entries in increasing sequence order. Pass nextCursor as after to continue. Historical invoices may have no recorded entries. Reading this endpoint never sends a command to the book.
|
|
823
|
+
* @summary Read the durable recovery history of a sandbox invoice
|
|
824
|
+
*/
|
|
825
|
+
export const retrieveInvoiceRecovery = async (id, params, options) => {
|
|
826
|
+
return sendToRowbind(getRetrieveInvoiceRecoveryUrl(id, params), {
|
|
827
|
+
...options,
|
|
828
|
+
method: 'GET'
|
|
829
|
+
});
|
|
830
|
+
};
|
|
831
|
+
export const getRetrieveOperationUrl = (id) => {
|
|
832
|
+
return `/v1/operations/${encodeURIComponent(String(id))}`;
|
|
833
|
+
};
|
|
834
|
+
/**
|
|
835
|
+
* Requires operations:read. The Worker returns the stored receipt for this project. The invoice pilot can request another reconciliation read against the original book.
|
|
836
|
+
* @summary Read the operation and its accounting verification result
|
|
837
|
+
*/
|
|
838
|
+
export const retrieveOperation = async (id, options) => {
|
|
839
|
+
return sendToRowbind(getRetrieveOperationUrl(id), {
|
|
840
|
+
...options,
|
|
841
|
+
method: 'GET'
|
|
842
|
+
});
|
|
843
|
+
};
|