@apideck/unify 0.39.7 → 0.40.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.
Files changed (102) hide show
  1. package/jsr.json +1 -1
  2. package/lib/config.d.ts +4 -4
  3. package/lib/config.js +4 -4
  4. package/lib/config.js.map +1 -1
  5. package/lib/encodings.d.ts +1 -0
  6. package/lib/encodings.d.ts.map +1 -1
  7. package/lib/encodings.js +7 -0
  8. package/lib/encodings.js.map +1 -1
  9. package/package.json +2 -6
  10. package/src/lib/config.ts +4 -4
  11. package/src/lib/encodings.ts +9 -0
  12. package/src/__tests__/activities.test.ts +0 -1141
  13. package/src/__tests__/agedcreditors.test.ts +0 -280
  14. package/src/__tests__/ageddebtors.test.ts +0 -280
  15. package/src/__tests__/apideckcompanies.test.ts +0 -1082
  16. package/src/__tests__/apideckcustomers.test.ts +0 -364
  17. package/src/__tests__/apideckdepartments.test.ts +0 -497
  18. package/src/__tests__/apiresources.test.ts +0 -62
  19. package/src/__tests__/apis.test.ts +0 -216
  20. package/src/__tests__/applicants.test.ts +0 -1445
  21. package/src/__tests__/applications.test.ts +0 -515
  22. package/src/__tests__/assertions.ts +0 -13
  23. package/src/__tests__/attachments.test.ts +0 -371
  24. package/src/__tests__/balancesheet.test.ts +0 -453
  25. package/src/__tests__/bankaccounts.test.ts +0 -324
  26. package/src/__tests__/bankfeedaccounts.test.ts +0 -343
  27. package/src/__tests__/bankfeedstatements.test.ts +0 -408
  28. package/src/__tests__/billpayments.test.ts +0 -1031
  29. package/src/__tests__/bills.test.ts +0 -1630
  30. package/src/__tests__/categories.test.ts +0 -127
  31. package/src/__tests__/collections.test.ts +0 -120
  32. package/src/__tests__/collectiontags.test.ts +0 -68
  33. package/src/__tests__/collectionticketcomments.test.ts +0 -501
  34. package/src/__tests__/collectiontickets.test.ts +0 -627
  35. package/src/__tests__/collectionusers.test.ts +0 -126
  36. package/src/__tests__/companies.test.ts +0 -1642
  37. package/src/__tests__/companyinfo.test.ts +0 -219
  38. package/src/__tests__/connectionconsent.test.ts +0 -89
  39. package/src/__tests__/connectionconsents.test.ts +0 -31
  40. package/src/__tests__/connectioncustommappings.test.ts +0 -69
  41. package/src/__tests__/connections.test.ts +0 -2127
  42. package/src/__tests__/connectionsettings.test.ts +0 -687
  43. package/src/__tests__/connectordocs.test.ts +0 -29
  44. package/src/__tests__/connectors.test.ts +0 -753
  45. package/src/__tests__/consumerrequestcounts.test.ts +0 -42
  46. package/src/__tests__/consumers.test.ts +0 -523
  47. package/src/__tests__/contacts.test.ts +0 -1421
  48. package/src/__tests__/createcallback.test.ts +0 -36
  49. package/src/__tests__/creditnotes.test.ts +0 -2040
  50. package/src/__tests__/customers.test.ts +0 -1600
  51. package/src/__tests__/customfields.test.ts +0 -52
  52. package/src/__tests__/custommappings.test.ts +0 -65
  53. package/src/__tests__/customobjects.test.ts +0 -408
  54. package/src/__tests__/customobjectschemas.test.ts +0 -734
  55. package/src/__tests__/departments.test.ts +0 -529
  56. package/src/__tests__/drivegroups.test.ts +0 -496
  57. package/src/__tests__/drives.test.ts +0 -487
  58. package/src/__tests__/employeepayrolls.test.ts +0 -491
  59. package/src/__tests__/employees.test.ts +0 -2968
  60. package/src/__tests__/employeeschedules.test.ts +0 -457
  61. package/src/__tests__/eventlogs.test.ts +0 -158
  62. package/src/__tests__/expensecategories.test.ts +0 -324
  63. package/src/__tests__/expensereports.test.ts +0 -634
  64. package/src/__tests__/expenses.test.ts +0 -867
  65. package/src/__tests__/files.test.ts +0 -506
  66. package/src/__tests__/files.ts +0 -56
  67. package/src/__tests__/folders.test.ts +0 -390
  68. package/src/__tests__/invoiceitems.test.ts +0 -855
  69. package/src/__tests__/invoices.test.ts +0 -2173
  70. package/src/__tests__/jobs.test.ts +0 -1150
  71. package/src/__tests__/journalentries.test.ts +0 -1542
  72. package/src/__tests__/leads.test.ts +0 -1341
  73. package/src/__tests__/ledgeraccounts.test.ts +0 -829
  74. package/src/__tests__/locations.test.ts +0 -856
  75. package/src/__tests__/logs.test.ts +0 -137
  76. package/src/__tests__/messages.test.ts +0 -588
  77. package/src/__tests__/notes.test.ts +0 -523
  78. package/src/__tests__/opportunities.test.ts +0 -718
  79. package/src/__tests__/orders.test.ts +0 -854
  80. package/src/__tests__/payments.test.ts +0 -867
  81. package/src/__tests__/payrolls.test.ts +0 -485
  82. package/src/__tests__/pipelines.test.ts +0 -574
  83. package/src/__tests__/products.test.ts +0 -509
  84. package/src/__tests__/profitandloss.test.ts +0 -223
  85. package/src/__tests__/projects.test.ts +0 -480
  86. package/src/__tests__/proxy.test.ts +0 -41
  87. package/src/__tests__/purchaseorders.test.ts +0 -2139
  88. package/src/__tests__/quotes.test.ts +0 -678
  89. package/src/__tests__/refunds.test.ts +0 -812
  90. package/src/__tests__/sessions.test.ts +0 -72
  91. package/src/__tests__/sharedlinks.test.ts +0 -511
  92. package/src/__tests__/stores.test.ts +0 -41
  93. package/src/__tests__/subsidiaries.test.ts +0 -496
  94. package/src/__tests__/suppliers.test.ts +0 -1574
  95. package/src/__tests__/taxrates.test.ts +0 -701
  96. package/src/__tests__/testclient.ts +0 -48
  97. package/src/__tests__/timeoffrequests.test.ts +0 -588
  98. package/src/__tests__/trackingcategories.test.ts +0 -515
  99. package/src/__tests__/uploadsessions.test.ts +0 -221
  100. package/src/__tests__/users.test.ts +0 -1020
  101. package/src/__tests__/validateconnection.test.ts +0 -34
  102. package/src/__tests__/webhooks.test.ts +0 -254
@@ -1,812 +0,0 @@
1
- /*
2
- * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
- */
4
-
5
- import { expect, test } from "vitest";
6
- import { Apideck } from "../index.js";
7
- import { createTestHTTPClient } from "./testclient.js";
8
-
9
- test("Refunds Accounting Refunds All", async () => {
10
- const testHttpClient = createTestHTTPClient("accounting.refundsAll");
11
-
12
- const apideck = new Apideck({
13
- serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080",
14
- httpClient: testHttpClient,
15
- apiKey: process.env["APIDECK_API_KEY"] ?? "value",
16
- });
17
-
18
- const result = await apideck.accounting.refunds.list({
19
- consumerId: "test-consumer",
20
- appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
21
- serviceId: "salesforce",
22
- filter: {
23
- updatedSince: new Date("2020-09-30T07:43:32.000Z"),
24
- customerId: "123abc",
25
- },
26
- sort: {
27
- by: "updated_at",
28
- direction: "desc",
29
- },
30
- passThrough: {
31
- "search": "San Francisco",
32
- },
33
- fields: "id,updated_at",
34
- });
35
- expect(result.httpMeta.response.status).toBe(200);
36
- expect(result.getRefundsResponse).toBeDefined();
37
- expect(result.getRefundsResponse).toEqual({
38
- statusCode: 200,
39
- status: "OK",
40
- service: "quickbooks",
41
- resource: "refunds",
42
- operation: "all",
43
- data: [],
44
- meta: {
45
- itemsOnPage: 50,
46
- cursors: {
47
- previous: "em9oby1jcm06OnBhZ2U6OjE=",
48
- current: "em9oby1jcm06OnBhZ2U6OjI=",
49
- next: "em9oby1jcm06OnBhZ2U6OjM=",
50
- },
51
- },
52
- links: {
53
- previous:
54
- "https://unify.apideck.com/crm/companies?cursor=em9oby1jcm06OnBhZ2U6OjE%3D",
55
- current: "https://unify.apideck.com/crm/companies",
56
- next:
57
- "https://unify.apideck.com/crm/companies?cursor=em9oby1jcm06OnBhZ2U6OjM",
58
- },
59
- });
60
- });
61
-
62
- test("Refunds Accounting Refunds Add", async () => {
63
- const testHttpClient = createTestHTTPClient("accounting.refundsAdd");
64
-
65
- const apideck = new Apideck({
66
- serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080",
67
- httpClient: testHttpClient,
68
- apiKey: process.env["APIDECK_API_KEY"] ?? "value",
69
- });
70
-
71
- const result = await apideck.accounting.refunds.create({
72
- consumerId: "test-consumer",
73
- appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
74
- serviceId: "salesforce",
75
- refund: {
76
- number: "RF-00001",
77
- customer: null,
78
- companyId: "12345",
79
- currency: "USD",
80
- currencyRate: 0.69,
81
- taxInclusive: true,
82
- subTotal: 250,
83
- totalAmount: 49.99,
84
- totalTax: 25,
85
- refundDate: new Date("2021-05-01T12:00:00.000Z"),
86
- status: "paid",
87
- type: "refund_receipt",
88
- paymentMethod: "cash",
89
- paymentMethodReference: "123456",
90
- paymentMethodId: "12345",
91
- account: {
92
- id: "123456",
93
- name: "Bank account",
94
- nominalCode: "N091",
95
- code: "453",
96
- parentId: "123456",
97
- displayId: "123456",
98
- },
99
- lineItems: [
100
- {
101
- id: "12345",
102
- rowId: "12345",
103
- code: "120-C",
104
- lineNumber: 1,
105
- description:
106
- "Model Y is a fully electric, mid-size SUV, with seating for up to seven, dual motor AWD and unparalleled protection.",
107
- type: "sales_item",
108
- taxAmount: 27500,
109
- totalAmount: 27500,
110
- quantity: 1,
111
- unitPrice: 27500.5,
112
- unitOfMeasure: "pc.",
113
- discountPercentage: 0.01,
114
- discountAmount: 19.99,
115
- serviceDate: new Date("2024-01-15"),
116
- categoryId: "12345",
117
- locationId: "12345",
118
- departmentId: "12345",
119
- subsidiaryId: "12345",
120
- shippingId: "12345",
121
- memo: "Some memo",
122
- prepaid: true,
123
- item: {
124
- id: "12344",
125
- code: "120-C",
126
- name: "Model Y",
127
- },
128
- taxApplicableOn: "Domestic_Purchase_of_Goods_and_Services",
129
- taxRecoverability: "Fully_Recoverable",
130
- taxMethod: "Due_to_Supplier",
131
- worktags: [
132
- {
133
- id: "123456",
134
- value: "New York",
135
- },
136
- ],
137
- taxRate: {
138
- id: "123456",
139
- code: "N-T",
140
- rate: 10,
141
- },
142
- trackingCategories: [
143
- {
144
- id: "123456",
145
- code: "100",
146
- name: "New York",
147
- parentId: "123456",
148
- parentName: "New York",
149
- },
150
- ],
151
- ledgerAccount: {
152
- id: "123456",
153
- name: "Bank account",
154
- nominalCode: "N091",
155
- code: "453",
156
- parentId: "123456",
157
- displayId: "123456",
158
- },
159
- customFields: [
160
- {
161
- id: "2389328923893298",
162
- name: "employee_level",
163
- description: "Employee Level",
164
- value: "Uses Salesforce and Marketo",
165
- },
166
- ],
167
- rowVersion: "1-12345",
168
- },
169
- ],
170
- allocations: [
171
- {
172
- id: "123456",
173
- amount: 49.99,
174
- allocationId: "123456",
175
- },
176
- ],
177
- taxCode: "1234",
178
- discountPercentage: 5.5,
179
- discountAmount: 25,
180
- note: "Refund for returned items",
181
- customerMemo: "Thank you for your business and have a great day!",
182
- reference: "REF-123456",
183
- billingAddress: {
184
- id: "123",
185
- type: "primary",
186
- string: "25 Spring Street, Blackburn, VIC 3130",
187
- name: "HQ US",
188
- line1: "Main street",
189
- line2: "apt #",
190
- line3: "Suite #",
191
- line4: "delivery instructions",
192
- line5: "Attention: Finance Dept",
193
- streetNumber: "25",
194
- city: "San Francisco",
195
- state: "CA",
196
- postalCode: "94104",
197
- country: "US",
198
- latitude: "40.759211",
199
- longitude: "-73.984638",
200
- county: "Santa Clara",
201
- contactName: "Elon Musk",
202
- salutation: "Mr",
203
- phoneNumber: "111-111-1111",
204
- fax: "122-111-1111",
205
- email: "elon@musk.com",
206
- website: "https://elonmusk.com",
207
- notes: "Address notes or delivery instructions.",
208
- rowVersion: "1-12345",
209
- },
210
- shippingAddress: {
211
- id: "123",
212
- type: "primary",
213
- string: "25 Spring Street, Blackburn, VIC 3130",
214
- name: "HQ US",
215
- line1: "Main street",
216
- line2: "apt #",
217
- line3: "Suite #",
218
- line4: "delivery instructions",
219
- line5: "Attention: Finance Dept",
220
- streetNumber: "25",
221
- city: "San Francisco",
222
- state: "CA",
223
- postalCode: "94104",
224
- country: "US",
225
- latitude: "40.759211",
226
- longitude: "-73.984638",
227
- county: "Santa Clara",
228
- contactName: "Elon Musk",
229
- salutation: "Mr",
230
- phoneNumber: "111-111-1111",
231
- fax: "122-111-1111",
232
- email: "elon@musk.com",
233
- website: "https://elonmusk.com",
234
- notes: "Address notes or delivery instructions.",
235
- rowVersion: "1-12345",
236
- },
237
- department: {
238
- displayId: "123456",
239
- name: "Acme Inc.",
240
- },
241
- location: {
242
- id: "123456",
243
- displayId: "123456",
244
- name: "New York Office",
245
- },
246
- trackingCategories: [
247
- {
248
- id: "123456",
249
- code: "100",
250
- name: "New York",
251
- parentId: "123456",
252
- parentName: "New York",
253
- },
254
- ],
255
- customFields: [
256
- {
257
- id: "2389328923893298",
258
- name: "employee_level",
259
- description: "Employee Level",
260
- value: "Uses Salesforce and Marketo",
261
- },
262
- ],
263
- rowVersion: "1-12345",
264
- passThrough: [
265
- {
266
- serviceId: "<id>",
267
- extendPaths: [
268
- {
269
- path: "$.nested.property",
270
- value: {
271
- "TaxClassificationRef": {
272
- "value": "EUC-99990201-V1-00020000",
273
- },
274
- },
275
- },
276
- ],
277
- },
278
- ],
279
- },
280
- });
281
- expect(result.httpMeta.response.status).toBe(201);
282
- expect(result.createRefundResponse).toBeDefined();
283
- expect(result.createRefundResponse).toEqual({
284
- statusCode: 200,
285
- status: "OK",
286
- service: "quickbooks",
287
- resource: "refunds",
288
- operation: "add",
289
- data: {
290
- id: "12345",
291
- },
292
- });
293
- });
294
-
295
- test("Refunds Accounting Refunds One", async () => {
296
- const testHttpClient = createTestHTTPClient("accounting.refundsOne");
297
-
298
- const apideck = new Apideck({
299
- serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080",
300
- httpClient: testHttpClient,
301
- apiKey: process.env["APIDECK_API_KEY"] ?? "value",
302
- });
303
-
304
- const result = await apideck.accounting.refunds.get({
305
- id: "<id>",
306
- consumerId: "test-consumer",
307
- appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
308
- serviceId: "salesforce",
309
- fields: "id,updated_at",
310
- });
311
- expect(result.httpMeta.response.status).toBe(200);
312
- expect(result.getRefundResponse).toBeDefined();
313
- expect(result.getRefundResponse).toEqual({
314
- statusCode: 200,
315
- status: "OK",
316
- service: "quickbooks",
317
- resource: "refunds",
318
- operation: "one",
319
- data: {
320
- id: "123456",
321
- number: "RF-00001",
322
- customer: {
323
- id: "12345",
324
- displayId: "CUST00101",
325
- displayName: "Windsurf Shop",
326
- companyName: "The boring company",
327
- email: "boring@boring.com",
328
- },
329
- companyId: "12345",
330
- currency: "USD",
331
- currencyRate: 0.69,
332
- taxInclusive: true,
333
- subTotal: 250,
334
- totalAmount: 49.99,
335
- totalTax: 25,
336
- refundDate: new Date("2021-05-01T12:00:00.000Z"),
337
- status: "paid",
338
- type: "refund_receipt",
339
- paymentMethod: "cash",
340
- paymentMethodReference: "123456",
341
- paymentMethodId: "12345",
342
- account: {
343
- id: "123456",
344
- name: "Bank account",
345
- nominalCode: "N091",
346
- code: "453",
347
- parentId: "123456",
348
- displayId: "123456",
349
- },
350
- lineItems: [
351
- {
352
- id: "12345",
353
- rowId: "12345",
354
- code: "120-C",
355
- lineNumber: 1,
356
- description:
357
- "Model Y is a fully electric, mid-size SUV, with seating for up to seven, dual motor AWD and unparalleled protection.",
358
- type: "sales_item",
359
- taxAmount: 27500,
360
- totalAmount: 27500,
361
- quantity: 1,
362
- unitPrice: 27500.5,
363
- unitOfMeasure: "pc.",
364
- discountPercentage: 0.01,
365
- discountAmount: 19.99,
366
- serviceDate: new Date("2024-01-15"),
367
- categoryId: "12345",
368
- locationId: "12345",
369
- departmentId: "12345",
370
- subsidiaryId: "12345",
371
- shippingId: "12345",
372
- memo: "Some memo",
373
- prepaid: true,
374
- item: {
375
- id: "12344",
376
- code: "120-C",
377
- name: "Model Y",
378
- },
379
- taxApplicableOn: "Domestic_Purchase_of_Goods_and_Services",
380
- taxRecoverability: "Fully_Recoverable",
381
- taxMethod: "Due_to_Supplier",
382
- worktags: [
383
- {
384
- id: "123456",
385
- value: "New York",
386
- },
387
- ],
388
- taxRate: {
389
- id: "123456",
390
- code: "N-T",
391
- name: "GST on Purchases",
392
- rate: 10,
393
- },
394
- trackingCategories: [
395
- {
396
- id: "123456",
397
- code: "100",
398
- name: "New York",
399
- parentId: "123456",
400
- parentName: "New York",
401
- },
402
- ],
403
- ledgerAccount: {
404
- id: "123456",
405
- name: "Bank account",
406
- nominalCode: "N091",
407
- code: "453",
408
- parentId: "123456",
409
- displayId: "123456",
410
- },
411
- customFields: [
412
- {
413
- id: "2389328923893298",
414
- name: "employee_level",
415
- description: "Employee Level",
416
- value: "Uses Salesforce and Marketo",
417
- },
418
- ],
419
- rowVersion: "1-12345",
420
- updatedBy: "12345",
421
- createdBy: "12345",
422
- createdAt: new Date("2020-09-30T07:43:32.000Z"),
423
- updatedAt: new Date("2020-09-30T07:43:32.000Z"),
424
- },
425
- ],
426
- allocations: [
427
- {
428
- id: "123456",
429
- code: "N091",
430
- amount: 49.99,
431
- allocationId: "123456",
432
- },
433
- ],
434
- taxCode: "1234",
435
- discountPercentage: 5.5,
436
- discountAmount: 25,
437
- note: "Refund for returned items",
438
- customerMemo: "Thank you for your business and have a great day!",
439
- reference: "REF-123456",
440
- billingAddress: {
441
- id: "123",
442
- type: "primary",
443
- string: "25 Spring Street, Blackburn, VIC 3130",
444
- name: "HQ US",
445
- line1: "Main street",
446
- line2: "apt #",
447
- line3: "Suite #",
448
- line4: "delivery instructions",
449
- line5: "Attention: Finance Dept",
450
- streetNumber: "25",
451
- city: "San Francisco",
452
- state: "CA",
453
- postalCode: "94104",
454
- country: "US",
455
- latitude: "40.759211",
456
- longitude: "-73.984638",
457
- county: "Santa Clara",
458
- contactName: "Elon Musk",
459
- salutation: "Mr",
460
- phoneNumber: "111-111-1111",
461
- fax: "122-111-1111",
462
- email: "elon@musk.com",
463
- website: "https://elonmusk.com",
464
- notes: "Address notes or delivery instructions.",
465
- rowVersion: "1-12345",
466
- },
467
- shippingAddress: {
468
- id: "123",
469
- type: "primary",
470
- string: "25 Spring Street, Blackburn, VIC 3130",
471
- name: "HQ US",
472
- line1: "Main street",
473
- line2: "apt #",
474
- line3: "Suite #",
475
- line4: "delivery instructions",
476
- line5: "Attention: Finance Dept",
477
- streetNumber: "25",
478
- city: "San Francisco",
479
- state: "CA",
480
- postalCode: "94104",
481
- country: "US",
482
- latitude: "40.759211",
483
- longitude: "-73.984638",
484
- county: "Santa Clara",
485
- contactName: "Elon Musk",
486
- salutation: "Mr",
487
- phoneNumber: "111-111-1111",
488
- fax: "122-111-1111",
489
- email: "elon@musk.com",
490
- website: "https://elonmusk.com",
491
- notes: "Address notes or delivery instructions.",
492
- rowVersion: "1-12345",
493
- },
494
- department: {
495
- id: "12345",
496
- displayId: "123456",
497
- name: "Acme Inc.",
498
- downstreamId: "12345",
499
- },
500
- location: {
501
- id: "123456",
502
- displayId: "123456",
503
- name: "New York Office",
504
- downstreamId: "12345",
505
- },
506
- trackingCategories: [
507
- {
508
- id: "123456",
509
- code: "100",
510
- name: "New York",
511
- parentId: "123456",
512
- parentName: "New York",
513
- },
514
- ],
515
- customFields: [
516
- {
517
- id: "2389328923893298",
518
- name: "employee_level",
519
- description: "Employee Level",
520
- value: "Uses Salesforce and Marketo",
521
- },
522
- ],
523
- rowVersion: "1-12345",
524
- updatedBy: "12345",
525
- createdBy: "12345",
526
- updatedAt: new Date("2020-09-30T07:43:32.000Z"),
527
- createdAt: new Date("2020-09-30T07:43:32.000Z"),
528
- passThrough: [
529
- {
530
- serviceId: "<id>",
531
- extendPaths: [
532
- {
533
- path: "$.nested.property",
534
- value: {
535
- "TaxClassificationRef": {
536
- "value": "EUC-99990201-V1-00020000",
537
- },
538
- },
539
- },
540
- ],
541
- },
542
- ],
543
- },
544
- });
545
- });
546
-
547
- test("Refunds Accounting Refunds Update", async () => {
548
- const testHttpClient = createTestHTTPClient("accounting.refundsUpdate");
549
-
550
- const apideck = new Apideck({
551
- serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080",
552
- httpClient: testHttpClient,
553
- apiKey: process.env["APIDECK_API_KEY"] ?? "value",
554
- });
555
-
556
- const result = await apideck.accounting.refunds.update({
557
- id: "<id>",
558
- consumerId: "test-consumer",
559
- appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
560
- serviceId: "salesforce",
561
- refund: {
562
- number: "RF-00001",
563
- customer: {
564
- id: "12345",
565
- displayName: "Windsurf Shop",
566
- email: "boring@boring.com",
567
- },
568
- companyId: "12345",
569
- currency: "USD",
570
- currencyRate: 0.69,
571
- taxInclusive: true,
572
- subTotal: 250,
573
- totalAmount: 49.99,
574
- totalTax: 25,
575
- refundDate: new Date("2021-05-01T12:00:00.000Z"),
576
- status: "paid",
577
- type: "refund_receipt",
578
- paymentMethod: "cash",
579
- paymentMethodReference: "123456",
580
- paymentMethodId: "12345",
581
- account: {
582
- id: "123456",
583
- name: "Bank account",
584
- nominalCode: "N091",
585
- code: "453",
586
- parentId: "123456",
587
- displayId: "123456",
588
- },
589
- lineItems: [
590
- {
591
- id: "12345",
592
- rowId: "12345",
593
- code: "120-C",
594
- lineNumber: 1,
595
- description:
596
- "Model Y is a fully electric, mid-size SUV, with seating for up to seven, dual motor AWD and unparalleled protection.",
597
- type: "sales_item",
598
- taxAmount: 27500,
599
- totalAmount: 27500,
600
- quantity: 1,
601
- unitPrice: 27500.5,
602
- unitOfMeasure: "pc.",
603
- discountPercentage: 0.01,
604
- discountAmount: 19.99,
605
- serviceDate: new Date("2024-01-15"),
606
- categoryId: "12345",
607
- locationId: "12345",
608
- departmentId: "12345",
609
- subsidiaryId: "12345",
610
- shippingId: "12345",
611
- memo: "Some memo",
612
- prepaid: true,
613
- item: {
614
- id: "12344",
615
- code: "120-C",
616
- name: "Model Y",
617
- },
618
- taxApplicableOn: "Domestic_Purchase_of_Goods_and_Services",
619
- taxRecoverability: "Fully_Recoverable",
620
- taxMethod: "Due_to_Supplier",
621
- worktags: [
622
- {
623
- id: "123456",
624
- value: "New York",
625
- },
626
- ],
627
- taxRate: {
628
- id: "123456",
629
- code: "N-T",
630
- rate: 10,
631
- },
632
- trackingCategories: [
633
- {
634
- id: "123456",
635
- code: "100",
636
- name: "New York",
637
- parentId: "123456",
638
- parentName: "New York",
639
- },
640
- ],
641
- ledgerAccount: {
642
- id: "123456",
643
- name: "Bank account",
644
- nominalCode: "N091",
645
- code: "453",
646
- parentId: "123456",
647
- displayId: "123456",
648
- },
649
- customFields: [
650
- {
651
- id: "2389328923893298",
652
- name: "employee_level",
653
- description: "Employee Level",
654
- value: "Uses Salesforce and Marketo",
655
- },
656
- ],
657
- rowVersion: "1-12345",
658
- },
659
- ],
660
- allocations: [
661
- {
662
- id: "123456",
663
- amount: 49.99,
664
- allocationId: "123456",
665
- },
666
- ],
667
- taxCode: "1234",
668
- discountPercentage: 5.5,
669
- discountAmount: 25,
670
- note: "Refund for returned items",
671
- customerMemo: "Thank you for your business and have a great day!",
672
- reference: "REF-123456",
673
- billingAddress: {
674
- id: "123",
675
- type: "primary",
676
- string: "25 Spring Street, Blackburn, VIC 3130",
677
- name: "HQ US",
678
- line1: "Main street",
679
- line2: "apt #",
680
- line3: "Suite #",
681
- line4: "delivery instructions",
682
- line5: "Attention: Finance Dept",
683
- streetNumber: "25",
684
- city: "San Francisco",
685
- state: "CA",
686
- postalCode: "94104",
687
- country: "US",
688
- latitude: "40.759211",
689
- longitude: "-73.984638",
690
- county: "Santa Clara",
691
- contactName: "Elon Musk",
692
- salutation: "Mr",
693
- phoneNumber: "111-111-1111",
694
- fax: "122-111-1111",
695
- email: "elon@musk.com",
696
- website: "https://elonmusk.com",
697
- notes: "Address notes or delivery instructions.",
698
- rowVersion: "1-12345",
699
- },
700
- shippingAddress: {
701
- id: "123",
702
- type: "primary",
703
- string: "25 Spring Street, Blackburn, VIC 3130",
704
- name: "HQ US",
705
- line1: "Main street",
706
- line2: "apt #",
707
- line3: "Suite #",
708
- line4: "delivery instructions",
709
- line5: "Attention: Finance Dept",
710
- streetNumber: "25",
711
- city: "San Francisco",
712
- state: "CA",
713
- postalCode: "94104",
714
- country: "US",
715
- latitude: "40.759211",
716
- longitude: "-73.984638",
717
- county: "Santa Clara",
718
- contactName: "Elon Musk",
719
- salutation: "Mr",
720
- phoneNumber: "111-111-1111",
721
- fax: "122-111-1111",
722
- email: "elon@musk.com",
723
- website: "https://elonmusk.com",
724
- notes: "Address notes or delivery instructions.",
725
- rowVersion: "1-12345",
726
- },
727
- department: {
728
- displayId: "123456",
729
- name: "Acme Inc.",
730
- },
731
- location: {
732
- id: "123456",
733
- displayId: "123456",
734
- name: "New York Office",
735
- },
736
- trackingCategories: [
737
- {
738
- id: "123456",
739
- code: "100",
740
- name: "New York",
741
- parentId: "123456",
742
- parentName: "New York",
743
- },
744
- ],
745
- customFields: [
746
- {
747
- id: "2389328923893298",
748
- name: "employee_level",
749
- description: "Employee Level",
750
- value: "Uses Salesforce and Marketo",
751
- },
752
- ],
753
- rowVersion: "1-12345",
754
- passThrough: [
755
- {
756
- serviceId: "<id>",
757
- extendPaths: [
758
- {
759
- path: "$.nested.property",
760
- value: {
761
- "TaxClassificationRef": {
762
- "value": "EUC-99990201-V1-00020000",
763
- },
764
- },
765
- },
766
- ],
767
- },
768
- ],
769
- },
770
- });
771
- expect(result.httpMeta.response.status).toBe(200);
772
- expect(result.updateRefundResponse).toBeDefined();
773
- expect(result.updateRefundResponse).toEqual({
774
- statusCode: 200,
775
- status: "OK",
776
- service: "quickbooks",
777
- resource: "refunds",
778
- operation: "update",
779
- data: {
780
- id: "12345",
781
- },
782
- });
783
- });
784
-
785
- test("Refunds Accounting Refunds Delete", async () => {
786
- const testHttpClient = createTestHTTPClient("accounting.refundsDelete");
787
-
788
- const apideck = new Apideck({
789
- serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080",
790
- httpClient: testHttpClient,
791
- apiKey: process.env["APIDECK_API_KEY"] ?? "value",
792
- });
793
-
794
- const result = await apideck.accounting.refunds.delete({
795
- id: "<id>",
796
- consumerId: "test-consumer",
797
- appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
798
- serviceId: "salesforce",
799
- });
800
- expect(result.httpMeta.response.status).toBe(200);
801
- expect(result.deleteRefundResponse).toBeDefined();
802
- expect(result.deleteRefundResponse).toEqual({
803
- statusCode: 200,
804
- status: "OK",
805
- service: "quickbooks",
806
- resource: "refunds",
807
- operation: "delete",
808
- data: {
809
- id: "12345",
810
- },
811
- });
812
- });