@getivy/node-sdk 0.1.0-alpha.9 → 1.0.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 (150) hide show
  1. package/CHANGELOG.md +326 -0
  2. package/README.md +16 -26
  3. package/_shims/index.d.ts +2 -0
  4. package/_shims/index.js +5 -1
  5. package/_shims/index.mjs +5 -1
  6. package/core.d.ts +19 -5
  7. package/core.d.ts.map +1 -1
  8. package/core.js +25 -15
  9. package/core.js.map +1 -1
  10. package/core.mjs +26 -16
  11. package/core.mjs.map +1 -1
  12. package/index.d.mts +30 -18
  13. package/index.d.ts +30 -18
  14. package/index.d.ts.map +1 -1
  15. package/index.js +21 -8
  16. package/index.js.map +1 -1
  17. package/index.mjs +21 -8
  18. package/index.mjs.map +1 -1
  19. package/package.json +11 -33
  20. package/resource.d.ts +1 -1
  21. package/resource.d.ts.map +1 -1
  22. package/resource.js.map +1 -1
  23. package/resource.mjs.map +1 -1
  24. package/resources/balance.d.ts +8 -5
  25. package/resources/balance.d.ts.map +1 -1
  26. package/resources/banks.d.ts +82 -67
  27. package/resources/banks.d.ts.map +1 -1
  28. package/resources/beneficiary-payouts.d.ts +61 -0
  29. package/resources/beneficiary-payouts.d.ts.map +1 -0
  30. package/resources/beneficiary-payouts.js +16 -0
  31. package/resources/beneficiary-payouts.js.map +1 -0
  32. package/resources/beneficiary-payouts.mjs +12 -0
  33. package/resources/beneficiary-payouts.mjs.map +1 -0
  34. package/resources/capabilities.d.ts +1 -10
  35. package/resources/capabilities.d.ts.map +1 -1
  36. package/resources/charges.d.ts +28 -19
  37. package/resources/charges.d.ts.map +1 -1
  38. package/resources/checkoutsession.d.ts +275 -1360
  39. package/resources/checkoutsession.d.ts.map +1 -1
  40. package/resources/customers.d.ts +140 -10
  41. package/resources/customers.d.ts.map +1 -1
  42. package/resources/customers.js +9 -2
  43. package/resources/customers.js.map +1 -1
  44. package/resources/customers.mjs +9 -2
  45. package/resources/customers.mjs.map +1 -1
  46. package/resources/deposits.d.ts +165 -0
  47. package/resources/deposits.d.ts.map +1 -0
  48. package/resources/deposits.js +15 -0
  49. package/resources/deposits.js.map +1 -0
  50. package/resources/deposits.mjs +11 -0
  51. package/resources/deposits.mjs.map +1 -0
  52. package/resources/fx.d.ts +90 -0
  53. package/resources/fx.d.ts.map +1 -0
  54. package/resources/fx.js +22 -0
  55. package/resources/fx.js.map +1 -0
  56. package/resources/fx.mjs +18 -0
  57. package/resources/fx.mjs.map +1 -0
  58. package/resources/index.d.ts +11 -8
  59. package/resources/index.d.ts.map +1 -1
  60. package/resources/index.js +11 -5
  61. package/resources/index.js.map +1 -1
  62. package/resources/index.mjs +5 -2
  63. package/resources/index.mjs.map +1 -1
  64. package/resources/mandates.d.ts +55 -17
  65. package/resources/mandates.d.ts.map +1 -1
  66. package/resources/orders.d.ts +720 -743
  67. package/resources/orders.d.ts.map +1 -1
  68. package/resources/orders.js +13 -3
  69. package/resources/orders.js.map +1 -1
  70. package/resources/orders.mjs +13 -3
  71. package/resources/orders.mjs.map +1 -1
  72. package/resources/payouts.d.ts +219 -103
  73. package/resources/payouts.d.ts.map +1 -1
  74. package/resources/payouts.js +3 -4
  75. package/resources/payouts.js.map +1 -1
  76. package/resources/payouts.mjs +3 -4
  77. package/resources/payouts.mjs.map +1 -1
  78. package/resources/refunds.d.ts +53 -97
  79. package/resources/refunds.d.ts.map +1 -1
  80. package/resources/refunds.js +8 -12
  81. package/resources/refunds.js.map +1 -1
  82. package/resources/refunds.mjs +8 -12
  83. package/resources/refunds.mjs.map +1 -1
  84. package/resources/returns.d.ts +104 -0
  85. package/resources/returns.d.ts.map +1 -0
  86. package/resources/returns.js +21 -0
  87. package/resources/returns.js.map +1 -0
  88. package/resources/returns.mjs +17 -0
  89. package/resources/returns.mjs.map +1 -0
  90. package/resources/subaccounts.d.ts +15 -5
  91. package/resources/subaccounts.d.ts.map +1 -1
  92. package/resources/subaccounts.js.map +1 -1
  93. package/resources/subaccounts.mjs.map +1 -1
  94. package/resources/transactions.d.ts +174 -0
  95. package/resources/transactions.d.ts.map +1 -0
  96. package/resources/transactions.js +15 -0
  97. package/resources/transactions.js.map +1 -0
  98. package/resources/transactions.mjs +11 -0
  99. package/resources/transactions.mjs.map +1 -0
  100. package/resources.d.ts +2 -0
  101. package/resources.d.ts.map +1 -0
  102. package/resources.js +18 -0
  103. package/resources.js.map +1 -0
  104. package/resources.mjs +2 -0
  105. package/resources.mjs.map +1 -0
  106. package/src/_shims/index.d.ts +2 -0
  107. package/src/_shims/index.js +5 -1
  108. package/src/_shims/index.mjs +5 -1
  109. package/src/core.ts +44 -16
  110. package/src/index.ts +100 -63
  111. package/src/resource.ts +1 -1
  112. package/src/resources/balance.ts +8 -5
  113. package/src/resources/banks.ts +130 -67
  114. package/src/resources/beneficiary-payouts.ts +78 -0
  115. package/src/resources/capabilities.ts +1 -10
  116. package/src/resources/charges.ts +30 -21
  117. package/src/resources/checkoutsession.ts +1224 -3096
  118. package/src/resources/customers.ts +164 -9
  119. package/src/resources/deposits.ts +231 -0
  120. package/src/resources/fx.ts +119 -0
  121. package/src/resources/index.ts +31 -28
  122. package/src/resources/mandates.ts +79 -17
  123. package/src/resources/orders.ts +1449 -1075
  124. package/src/resources/payouts.ts +273 -103
  125. package/src/resources/refunds.ts +70 -111
  126. package/src/resources/returns.ts +140 -0
  127. package/src/resources/subaccounts.ts +26 -4
  128. package/src/resources/transactions.ts +234 -0
  129. package/src/resources.ts +1 -0
  130. package/src/version.ts +1 -1
  131. package/version.d.ts +1 -1
  132. package/version.d.ts.map +1 -1
  133. package/version.js +1 -1
  134. package/version.js.map +1 -1
  135. package/version.mjs +1 -1
  136. package/version.mjs.map +1 -1
  137. package/resources/reports.d.ts +0 -120
  138. package/resources/reports.d.ts.map +0 -1
  139. package/resources/reports.js +0 -31
  140. package/resources/reports.js.map +0 -1
  141. package/resources/reports.mjs +0 -27
  142. package/resources/reports.mjs.map +0 -1
  143. package/resources/webhooksubscription.d.ts +0 -155
  144. package/resources/webhooksubscription.d.ts.map +0 -1
  145. package/resources/webhooksubscription.js +0 -42
  146. package/resources/webhooksubscription.js.map +0 -1
  147. package/resources/webhooksubscription.mjs +0 -38
  148. package/resources/webhooksubscription.mjs.map +0 -1
  149. package/src/resources/reports.ts +0 -172
  150. package/src/resources/webhooksubscription.ts +0 -353
@@ -5,72 +5,88 @@ import * as Core from '../core';
5
5
 
6
6
  export class Payouts extends APIResource {
7
7
  /**
8
- * Create a Customer Payout to a customer's bank account for withdrawals or similar
9
- * purposes.
8
+ * Create a payout for a merchant.
10
9
  */
11
- create(body: PayoutCreateParams, options?: Core.RequestOptions): Core.APIPromise<PublicUserPayout> {
10
+ create(body: PayoutCreateParams, options?: Core.RequestOptions): Core.APIPromise<Payout> {
12
11
  return this._client.post('/api/service/payout/create', { body, ...options });
13
12
  }
14
13
 
15
14
  /**
16
- * Retrieve a Customer Payout by id
15
+ * Retrieve a payout object by id.
17
16
  */
18
- retrieve(body: PayoutRetrieveParams, options?: Core.RequestOptions): Core.APIPromise<PublicUserPayout> {
17
+ retrieve(
18
+ body: PayoutRetrieveParams,
19
+ options?: Core.RequestOptions,
20
+ ): Core.APIPromise<PayoutRetrieveResponse> {
19
21
  return this._client.post('/api/service/payout/retrieve', { body, ...options });
20
22
  }
21
23
 
22
24
  /**
23
- * List all Customer Payouts made by this merchant account.
25
+ * List payouts for a merchant.
24
26
  */
25
27
  list(body: PayoutListParams, options?: Core.RequestOptions): Core.APIPromise<PayoutListResponse> {
26
28
  return this._client.post('/api/service/payout/list', { body, ...options });
27
29
  }
28
30
  }
29
31
 
30
- export interface PublicUserPayout {
32
+ export interface Payout {
33
+ /**
34
+ * The payout ID
35
+ */
31
36
  id: string;
32
37
 
38
+ /**
39
+ * The payout amount
40
+ */
33
41
  amount: number;
34
42
 
35
- currency: 'EUR' | 'GBP' | 'PLN';
43
+ /**
44
+ * The payout created at
45
+ */
46
+ createdAt: unknown;
47
+
48
+ /**
49
+ * The payout currency
50
+ */
51
+ currency: 'EUR' | 'GBP' | 'PLN' | 'SEK' | 'DKK';
52
+
53
+ /**
54
+ * The payout destination
55
+ */
56
+ destination: Payout.Destination;
36
57
 
37
58
  /**
38
- * The validation logic is based on the "type" field. For example, if "type" is set
39
- * to "iban", the "iban" object must be filled out.
59
+ * The payout status
40
60
  */
41
- destination: PublicUserPayout.Destination;
61
+ status: 'paid' | 'pending' | 'in_transit' | 'failed' | 'canceled';
42
62
 
43
- status: 'paid' | 'pending' | 'failed';
63
+ /**
64
+ * The payout type
65
+ */
66
+ type: 'beneficiary' | 'customer';
44
67
 
45
- createdAt?: string;
68
+ /**
69
+ * The payout updated at
70
+ */
71
+ updatedAt: unknown;
46
72
 
47
73
  /**
48
- * Any key-value pairs, which will be stored to the object. See
49
- * [here](https://docs.getivy.de/reference/metadata) for more info.
74
+ * The payout metadata
50
75
  */
51
- metadata?: Record<string, unknown>;
76
+ metadata?: { [key: string]: unknown };
52
77
 
53
- updatedAt?: string;
78
+ /**
79
+ * The payout payment reference
80
+ */
81
+ paymentReference?: string;
54
82
  }
55
83
 
56
- export namespace PublicUserPayout {
84
+ export namespace Payout {
57
85
  /**
58
- * The validation logic is based on the "type" field. For example, if "type" is set
59
- * to "iban", the "iban" object must be filled out.
86
+ * The payout destination
60
87
  */
61
88
  export interface Destination {
62
- /**
63
- * The type of the financial address. The actual destination is determined by this
64
- * field which can be either "iban", "sortCode", "bankCode", or "bban". The
65
- * validation will fail if you set e.g. type="iban", but then not fill any values
66
- * in the "iban" object.
67
- *
68
- * - iban: The IBAN of the account
69
- * - sort_code: The sort code of the account
70
- * - bank_code: The bank code of the account
71
- * - bban: The BBAN of the account
72
- */
73
- type: string;
89
+ type: 'iban' | 'sort_code' | 'bank_code' | 'bban';
74
90
 
75
91
  bankCode?: Destination.BankCode;
76
92
 
@@ -83,9 +99,6 @@ export namespace PublicUserPayout {
83
99
 
84
100
  export namespace Destination {
85
101
  export interface BankCode {
86
- /**
87
- * The name of the account holder.
88
- */
89
102
  accountHolderName: string;
90
103
 
91
104
  accountNumber: string;
@@ -94,9 +107,6 @@ export namespace PublicUserPayout {
94
107
  }
95
108
 
96
109
  export interface Bban {
97
- /**
98
- * The name of the account holder.
99
- */
100
110
  accountHolderName: string;
101
111
 
102
112
  bban: string;
@@ -105,9 +115,6 @@ export namespace PublicUserPayout {
105
115
  }
106
116
 
107
117
  export interface Iban {
108
- /**
109
- * The name of the account holder.
110
- */
111
118
  accountHolderName: string;
112
119
 
113
120
  iban: string;
@@ -116,9 +123,6 @@ export namespace PublicUserPayout {
116
123
  }
117
124
 
118
125
  export interface SortCode {
119
- /**
120
- * The name of the account holder.
121
- */
122
126
  accountHolderName: string;
123
127
 
124
128
  accountNumber: string;
@@ -128,87 +132,268 @@ export namespace PublicUserPayout {
128
132
  }
129
133
  }
130
134
 
131
- export interface PayoutListResponse {
135
+ export interface PayoutRetrieveResponse {
132
136
  /**
133
- * The total number of items
137
+ * The payout ID
134
138
  */
135
- count: number;
139
+ id: string;
136
140
 
137
141
  /**
138
- * Whether there are more items to retrieve
142
+ * The payout amount
139
143
  */
140
- hasNext: boolean;
144
+ amount: number;
145
+
146
+ /**
147
+ * The payout created at
148
+ */
149
+ createdAt: unknown;
150
+
151
+ /**
152
+ * The payout currency
153
+ */
154
+ currency: 'EUR' | 'GBP' | 'PLN' | 'SEK' | 'DKK';
155
+
156
+ /**
157
+ * The payout destination
158
+ */
159
+ destination: PayoutRetrieveResponse.Destination;
160
+
161
+ /**
162
+ * The payout status
163
+ */
164
+ status: 'paid' | 'pending' | 'in_transit' | 'failed' | 'canceled';
165
+
166
+ /**
167
+ * The payout type
168
+ */
169
+ type: 'beneficiary' | 'customer';
170
+
171
+ /**
172
+ * The payout updated at
173
+ */
174
+ updatedAt: unknown;
141
175
 
142
- items: Array<PublicUserPayout>;
176
+ /**
177
+ * The payout metadata
178
+ */
179
+ metadata?: { [key: string]: unknown };
143
180
 
144
181
  /**
145
- * The number of items skipped
182
+ * The payout payment reference
146
183
  */
184
+ paymentReference?: string;
185
+ }
186
+
187
+ export namespace PayoutRetrieveResponse {
188
+ /**
189
+ * The payout destination
190
+ */
191
+ export interface Destination {
192
+ type: 'iban' | 'sort_code' | 'bank_code' | 'bban';
193
+
194
+ bankCode?: Destination.BankCode;
195
+
196
+ bban?: Destination.Bban;
197
+
198
+ iban?: Destination.Iban;
199
+
200
+ sortCode?: Destination.SortCode;
201
+ }
202
+
203
+ export namespace Destination {
204
+ export interface BankCode {
205
+ accountHolderName: string;
206
+
207
+ accountNumber: string;
208
+
209
+ code: string;
210
+ }
211
+
212
+ export interface Bban {
213
+ accountHolderName: string;
214
+
215
+ bban: string;
216
+
217
+ bic?: string;
218
+ }
219
+
220
+ export interface Iban {
221
+ accountHolderName: string;
222
+
223
+ iban: string;
224
+
225
+ bic?: string;
226
+ }
227
+
228
+ export interface SortCode {
229
+ accountHolderName: string;
230
+
231
+ accountNumber: string;
232
+
233
+ sortCode: string;
234
+ }
235
+ }
236
+ }
237
+
238
+ export interface PayoutListResponse {
239
+ count: number;
240
+
241
+ hasNext: boolean;
242
+
243
+ items: Array<PayoutListResponse.Item>;
244
+
147
245
  skip: number;
148
246
  }
149
247
 
248
+ export namespace PayoutListResponse {
249
+ export interface Item {
250
+ /**
251
+ * The payout ID
252
+ */
253
+ id: string;
254
+
255
+ /**
256
+ * The payout amount
257
+ */
258
+ amount: number;
259
+
260
+ /**
261
+ * The payout created at
262
+ */
263
+ createdAt: unknown;
264
+
265
+ /**
266
+ * The payout currency
267
+ */
268
+ currency: 'EUR' | 'GBP' | 'PLN' | 'SEK' | 'DKK';
269
+
270
+ /**
271
+ * The payout destination
272
+ */
273
+ destination: Item.Destination;
274
+
275
+ /**
276
+ * The payout status
277
+ */
278
+ status: 'paid' | 'pending' | 'in_transit' | 'failed' | 'canceled';
279
+
280
+ /**
281
+ * The payout type
282
+ */
283
+ type: 'beneficiary' | 'customer';
284
+
285
+ /**
286
+ * The payout updated at
287
+ */
288
+ updatedAt: unknown;
289
+
290
+ /**
291
+ * The payout metadata
292
+ */
293
+ metadata?: { [key: string]: unknown };
294
+
295
+ /**
296
+ * The payout payment reference
297
+ */
298
+ paymentReference?: string;
299
+ }
300
+
301
+ export namespace Item {
302
+ /**
303
+ * The payout destination
304
+ */
305
+ export interface Destination {
306
+ type: 'iban' | 'sort_code' | 'bank_code' | 'bban';
307
+
308
+ bankCode?: Destination.BankCode;
309
+
310
+ bban?: Destination.Bban;
311
+
312
+ iban?: Destination.Iban;
313
+
314
+ sortCode?: Destination.SortCode;
315
+ }
316
+
317
+ export namespace Destination {
318
+ export interface BankCode {
319
+ accountHolderName: string;
320
+
321
+ accountNumber: string;
322
+
323
+ code: string;
324
+ }
325
+
326
+ export interface Bban {
327
+ accountHolderName: string;
328
+
329
+ bban: string;
330
+
331
+ bic?: string;
332
+ }
333
+
334
+ export interface Iban {
335
+ accountHolderName: string;
336
+
337
+ iban: string;
338
+
339
+ bic?: string;
340
+ }
341
+
342
+ export interface SortCode {
343
+ accountHolderName: string;
344
+
345
+ accountNumber: string;
346
+
347
+ sortCode: string;
348
+ }
349
+ }
350
+ }
351
+ }
352
+
150
353
  export interface PayoutCreateParams {
151
354
  /**
152
- * The amount of the customer payout
355
+ * The payout amount in decimal format. The minimum amount is 0.01.
153
356
  */
154
357
  amount: number;
155
358
 
156
359
  /**
157
- * The currency of the customer payout
360
+ * The payout currency
158
361
  */
159
- currency: 'EUR' | 'GBP' | 'PLN';
362
+ currency: 'EUR' | 'GBP' | 'PLN' | 'SEK' | 'DKK';
160
363
 
161
364
  /**
162
- * The destination of the customer payout.
365
+ * The payout destination
163
366
  */
164
367
  destination: PayoutCreateParams.Destination;
165
368
 
166
369
  /**
167
- * The metadata of the customer payout
370
+ * This can be used to store any additional information you need to associate with
371
+ * this payout.
168
372
  */
169
- metadata?: Record<string, unknown>;
373
+ metadata?: { [key: string]: unknown };
170
374
 
171
375
  /**
172
- * The payment reference of the customer payout. The customer will see this
173
- * reference in their bank statement.
376
+ * The payout payment reference. This is visible to the receiving party, if
377
+ * possible.
174
378
  */
175
379
  paymentReference?: string;
176
380
  }
177
381
 
178
382
  export namespace PayoutCreateParams {
179
383
  /**
180
- * The destination of the customer payout.
384
+ * The payout destination
181
385
  */
182
386
  export interface Destination {
183
- /**
184
- * Used for open-loop customer payouts. Disabled by default for merchants.
185
- */
186
- financialAddress?: Destination.FinancialAddress;
387
+ financialAddress?: Destination.FinancialAddress | null;
187
388
 
188
- /**
189
- * For closed-loop customer payouts. The destination account will be taken from the
190
- * payer of this order.
191
- */
192
389
  orderId?: string;
390
+
391
+ type?: 'beneficiary';
193
392
  }
194
393
 
195
394
  export namespace Destination {
196
- /**
197
- * Used for open-loop customer payouts. Disabled by default for merchants.
198
- */
199
395
  export interface FinancialAddress {
200
- /**
201
- * The type of the financial address. The actual destination is determined by this
202
- * field which can be either "iban", "sortCode", "bankCode", or "bban". The
203
- * validation will fail if you set e.g. type="iban", but then not fill any values
204
- * in the "iban" object.
205
- *
206
- * - iban: The IBAN of the account
207
- * - sort_code: The sort code of the account
208
- * - bank_code: The bank code of the account
209
- * - bban: The BBAN of the account
210
- */
211
- type: string;
396
+ type: 'iban' | 'sort_code' | 'bank_code' | 'bban';
212
397
 
213
398
  bankCode?: FinancialAddress.BankCode;
214
399
 
@@ -221,9 +406,6 @@ export namespace PayoutCreateParams {
221
406
 
222
407
  export namespace FinancialAddress {
223
408
  export interface BankCode {
224
- /**
225
- * The name of the account holder.
226
- */
227
409
  accountHolderName: string;
228
410
 
229
411
  accountNumber: string;
@@ -232,9 +414,6 @@ export namespace PayoutCreateParams {
232
414
  }
233
415
 
234
416
  export interface Bban {
235
- /**
236
- * The name of the account holder.
237
- */
238
417
  accountHolderName: string;
239
418
 
240
419
  bban: string;
@@ -243,9 +422,6 @@ export namespace PayoutCreateParams {
243
422
  }
244
423
 
245
424
  export interface Iban {
246
- /**
247
- * The name of the account holder.
248
- */
249
425
  accountHolderName: string;
250
426
 
251
427
  iban: string;
@@ -254,9 +430,6 @@ export namespace PayoutCreateParams {
254
430
  }
255
431
 
256
432
  export interface SortCode {
257
- /**
258
- * The name of the account holder.
259
- */
260
433
  accountHolderName: string;
261
434
 
262
435
  accountNumber: string;
@@ -269,26 +442,23 @@ export namespace PayoutCreateParams {
269
442
 
270
443
  export interface PayoutRetrieveParams {
271
444
  /**
272
- * The unique identifier of the Customer Payout
445
+ * The payout ID
273
446
  */
274
447
  id: string;
275
448
  }
276
449
 
277
450
  export interface PayoutListParams {
278
- /**
279
- * The number of items to retrieve
280
- */
281
451
  limit?: number;
282
452
 
283
- /**
284
- * The number of items to skip
285
- */
286
453
  skip?: number;
454
+
455
+ type?: 'customer-payout' | 'beneficiary-payout';
287
456
  }
288
457
 
289
458
  export declare namespace Payouts {
290
459
  export {
291
- type PublicUserPayout as PublicUserPayout,
460
+ type Payout as Payout,
461
+ type PayoutRetrieveResponse as PayoutRetrieveResponse,
292
462
  type PayoutListResponse as PayoutListResponse,
293
463
  type PayoutCreateParams as PayoutCreateParams,
294
464
  type PayoutRetrieveParams as PayoutRetrieveParams,