modern-treasury 0.0.1

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 (169) hide show
  1. package/.eslintrc.js +10 -0
  2. package/.prettierrc +6 -0
  3. package/LICENSE +7 -0
  4. package/README.md +198 -0
  5. package/build +10 -0
  6. package/core.ts +746 -0
  7. package/dist/cjs/core.d.ts +215 -0
  8. package/dist/cjs/core.js +815 -0
  9. package/dist/cjs/core.js.map +1 -0
  10. package/dist/cjs/index.d.ts +118 -0
  11. package/dist/cjs/index.js +128 -0
  12. package/dist/cjs/index.js.map +1 -0
  13. package/dist/cjs/pagination.d.ts +14 -0
  14. package/dist/cjs/pagination.js +22 -0
  15. package/dist/cjs/pagination.js.map +1 -0
  16. package/dist/cjs/resource.d.ts +11 -0
  17. package/dist/cjs/resource.js +16 -0
  18. package/dist/cjs/resource.js.map +1 -0
  19. package/dist/cjs/resources/counterparties.d.ts +500 -0
  20. package/dist/cjs/resources/counterparties.js +57 -0
  21. package/dist/cjs/resources/counterparties.js.map +1 -0
  22. package/dist/cjs/resources/documents.d.ts +66 -0
  23. package/dist/cjs/resources/documents.js +23 -0
  24. package/dist/cjs/resources/documents.js.map +1 -0
  25. package/dist/cjs/resources/events.d.ts +53 -0
  26. package/dist/cjs/resources/events.js +22 -0
  27. package/dist/cjs/resources/events.js.map +1 -0
  28. package/dist/cjs/resources/expected-payments.d.ts +928 -0
  29. package/dist/cjs/resources/expected-payments.js +31 -0
  30. package/dist/cjs/resources/expected-payments.js.map +1 -0
  31. package/dist/cjs/resources/external-accounts.d.ts +597 -0
  32. package/dist/cjs/resources/external-accounts.js +51 -0
  33. package/dist/cjs/resources/external-accounts.js.map +1 -0
  34. package/dist/cjs/resources/incoming-payment-details.d.ts +487 -0
  35. package/dist/cjs/resources/incoming-payment-details.js +35 -0
  36. package/dist/cjs/resources/incoming-payment-details.js.map +1 -0
  37. package/dist/cjs/resources/index.d.ts +15 -0
  38. package/dist/cjs/resources/index.js +46 -0
  39. package/dist/cjs/resources/index.js.map +1 -0
  40. package/dist/cjs/resources/internal-accounts.d.ts +666 -0
  41. package/dist/cjs/resources/internal-accounts.js +31 -0
  42. package/dist/cjs/resources/internal-accounts.js.map +1 -0
  43. package/dist/cjs/resources/line-items.d.ts +90 -0
  44. package/dist/cjs/resources/line-items.js +38 -0
  45. package/dist/cjs/resources/line-items.js.map +1 -0
  46. package/dist/cjs/resources/paper-items.d.ts +279 -0
  47. package/dist/cjs/resources/paper-items.js +25 -0
  48. package/dist/cjs/resources/paper-items.js.map +1 -0
  49. package/dist/cjs/resources/payment-orders/index.d.ts +2 -0
  50. package/dist/cjs/resources/payment-orders/index.js +33 -0
  51. package/dist/cjs/resources/payment-orders/index.js.map +1 -0
  52. package/dist/cjs/resources/payment-orders/payment-orders.d.ts +2180 -0
  53. package/dist/cjs/resources/payment-orders/payment-orders.js +56 -0
  54. package/dist/cjs/resources/payment-orders/payment-orders.js.map +1 -0
  55. package/dist/cjs/resources/payment-orders/reversals.d.ts +46 -0
  56. package/dist/cjs/resources/payment-orders/reversals.js +23 -0
  57. package/dist/cjs/resources/payment-orders/reversals.js.map +1 -0
  58. package/dist/cjs/resources/returns.d.ts +487 -0
  59. package/dist/cjs/resources/returns.js +31 -0
  60. package/dist/cjs/resources/returns.js.map +1 -0
  61. package/dist/cjs/resources/top-level.d.ts +3 -0
  62. package/dist/cjs/resources/top-level.js +4 -0
  63. package/dist/cjs/resources/top-level.js.map +1 -0
  64. package/dist/cjs/resources/transactions.d.ts +377 -0
  65. package/dist/cjs/resources/transactions.js +31 -0
  66. package/dist/cjs/resources/transactions.js.map +1 -0
  67. package/dist/cjs/resources/validations.d.ts +97 -0
  68. package/dist/cjs/resources/validations.js +16 -0
  69. package/dist/cjs/resources/validations.js.map +1 -0
  70. package/dist/cjs/resources/webhooks.d.ts +31 -0
  71. package/dist/cjs/resources/webhooks.js +44 -0
  72. package/dist/cjs/resources/webhooks.js.map +1 -0
  73. package/dist/cjs/tests/api-resources/counterparties.test.d.ts +1 -0
  74. package/dist/cjs/tests/api-resources/counterparties.test.js +275 -0
  75. package/dist/cjs/tests/api-resources/counterparties.test.js.map +1 -0
  76. package/dist/cjs/tests/api-resources/documents.test.d.ts +1 -0
  77. package/dist/cjs/tests/api-resources/documents.test.js +78 -0
  78. package/dist/cjs/tests/api-resources/documents.test.js.map +1 -0
  79. package/dist/cjs/tests/api-resources/events.test.d.ts +1 -0
  80. package/dist/cjs/tests/api-resources/events.test.js +100 -0
  81. package/dist/cjs/tests/api-resources/events.test.js.map +1 -0
  82. package/dist/cjs/tests/api-resources/expected-payments.test.d.ts +1 -0
  83. package/dist/cjs/tests/api-resources/expected-payments.test.js +176 -0
  84. package/dist/cjs/tests/api-resources/expected-payments.test.js.map +1 -0
  85. package/dist/cjs/tests/api-resources/external-accounts.test.d.ts +1 -0
  86. package/dist/cjs/tests/api-resources/external-accounts.test.js +248 -0
  87. package/dist/cjs/tests/api-resources/external-accounts.test.js.map +1 -0
  88. package/dist/cjs/tests/api-resources/incoming-payment-details.test.d.ts +1 -0
  89. package/dist/cjs/tests/api-resources/incoming-payment-details.test.js +130 -0
  90. package/dist/cjs/tests/api-resources/incoming-payment-details.test.js.map +1 -0
  91. package/dist/cjs/tests/api-resources/internal-accounts.test.d.ts +1 -0
  92. package/dist/cjs/tests/api-resources/internal-accounts.test.js +144 -0
  93. package/dist/cjs/tests/api-resources/internal-accounts.test.js.map +1 -0
  94. package/dist/cjs/tests/api-resources/line-items.test.d.ts +1 -0
  95. package/dist/cjs/tests/api-resources/line-items.test.js +123 -0
  96. package/dist/cjs/tests/api-resources/line-items.test.js.map +1 -0
  97. package/dist/cjs/tests/api-resources/paper-items.test.d.ts +1 -0
  98. package/dist/cjs/tests/api-resources/paper-items.test.js +96 -0
  99. package/dist/cjs/tests/api-resources/paper-items.test.js.map +1 -0
  100. package/dist/cjs/tests/api-resources/payment-orders/payment-orders.test.d.ts +1 -0
  101. package/dist/cjs/tests/api-resources/payment-orders/payment-orders.test.js +77 -0
  102. package/dist/cjs/tests/api-resources/payment-orders/payment-orders.test.js.map +1 -0
  103. package/dist/cjs/tests/api-resources/returns.test.d.ts +1 -0
  104. package/dist/cjs/tests/api-resources/returns.test.js +116 -0
  105. package/dist/cjs/tests/api-resources/returns.test.js.map +1 -0
  106. package/dist/cjs/tests/api-resources/top-level.test.d.ts +1 -0
  107. package/dist/cjs/tests/api-resources/top-level.test.js +59 -0
  108. package/dist/cjs/tests/api-resources/top-level.test.js.map +1 -0
  109. package/dist/cjs/tests/api-resources/transactions.test.d.ts +1 -0
  110. package/dist/cjs/tests/api-resources/transactions.test.js +134 -0
  111. package/dist/cjs/tests/api-resources/transactions.test.js.map +1 -0
  112. package/dist/cjs/tests/api-resources/validations.test.d.ts +1 -0
  113. package/dist/cjs/tests/api-resources/validations.test.js +62 -0
  114. package/dist/cjs/tests/api-resources/validations.test.js.map +1 -0
  115. package/dist/cjs/tests/api-resources/webhooks.test.d.ts +1 -0
  116. package/dist/cjs/tests/api-resources/webhooks.test.js +100 -0
  117. package/dist/cjs/tests/api-resources/webhooks.test.js.map +1 -0
  118. package/dist/cjs/tests/form.test.d.ts +1 -0
  119. package/dist/cjs/tests/form.test.js +61 -0
  120. package/dist/cjs/tests/form.test.js.map +1 -0
  121. package/dist/cjs/tests/index.test.d.ts +1 -0
  122. package/dist/cjs/tests/index.test.js +57 -0
  123. package/dist/cjs/tests/index.test.js.map +1 -0
  124. package/dist/cjs/tests/responses.test.d.ts +1 -0
  125. package/dist/cjs/tests/responses.test.js +60 -0
  126. package/dist/cjs/tests/responses.test.js.map +1 -0
  127. package/index.ts +175 -0
  128. package/jest.config.js +8 -0
  129. package/package.json +47 -0
  130. package/pagination.ts +36 -0
  131. package/resource.ts +22 -0
  132. package/resources/counterparties.ts +666 -0
  133. package/resources/documents.ts +97 -0
  134. package/resources/events.ts +86 -0
  135. package/resources/expected-payments.ts +1016 -0
  136. package/resources/external-accounts.ts +762 -0
  137. package/resources/incoming-payment-details.ts +592 -0
  138. package/resources/index.ts +16 -0
  139. package/resources/internal-accounts.ts +774 -0
  140. package/resources/line-items.ts +138 -0
  141. package/resources/paper-items.ts +317 -0
  142. package/resources/payment-orders/index.ts +3 -0
  143. package/resources/payment-orders/payment-orders.ts +2486 -0
  144. package/resources/payment-orders/reversals.ts +72 -0
  145. package/resources/returns.ts +545 -0
  146. package/resources/top-level.ts +5 -0
  147. package/resources/transactions.ts +441 -0
  148. package/resources/validations.ts +115 -0
  149. package/resources/webhooks.ts +48 -0
  150. package/tests/api-resources/counterparties.test.ts +237 -0
  151. package/tests/api-resources/documents.test.ts +40 -0
  152. package/tests/api-resources/events.test.ts +62 -0
  153. package/tests/api-resources/expected-payments.test.ts +138 -0
  154. package/tests/api-resources/external-accounts.test.ts +210 -0
  155. package/tests/api-resources/incoming-payment-details.test.ts +92 -0
  156. package/tests/api-resources/internal-accounts.test.ts +103 -0
  157. package/tests/api-resources/line-items.test.ts +85 -0
  158. package/tests/api-resources/paper-items.test.ts +58 -0
  159. package/tests/api-resources/payment-orders/payment-orders.test.ts +39 -0
  160. package/tests/api-resources/returns.test.ts +78 -0
  161. package/tests/api-resources/top-level.test.ts +21 -0
  162. package/tests/api-resources/transactions.test.ts +96 -0
  163. package/tests/api-resources/validations.test.ts +24 -0
  164. package/tests/api-resources/webhooks.test.ts +102 -0
  165. package/tests/form.test.ts +27 -0
  166. package/tests/index.test.ts +62 -0
  167. package/tests/responses.test.ts +25 -0
  168. package/tsconfig.cjs.json +8 -0
  169. package/tsconfig.json +36 -0
@@ -0,0 +1,500 @@
1
+ import * as Core from '../core';
2
+ import { APIResource } from '../resource';
3
+ import { Page, PageParams } from '../pagination';
4
+ export declare class Counterparties extends APIResource {
5
+ /**
6
+ * Create a new counterparty.
7
+ */
8
+ create(
9
+ body: CounterpartyCreateParams,
10
+ options?: Core.RequestOptions,
11
+ ): Promise<Core.APIResponse<Counterparty>>;
12
+ /**
13
+ * Get details on a single counterparty.
14
+ */
15
+ retrieve(id: string, options?: Core.RequestOptions): Promise<Core.APIResponse<Counterparty>>;
16
+ /**
17
+ * Updates a given counterparty with new information.
18
+ */
19
+ update(
20
+ id: string,
21
+ body?: CounterpartyUpdateParams,
22
+ options?: Core.RequestOptions,
23
+ ): Promise<Core.APIResponse<Counterparty>>;
24
+ update(id: string, options?: Core.RequestOptions): Promise<Core.APIResponse<Counterparty>>;
25
+ /**
26
+ * Get a paginated list of all counterparties.
27
+ */
28
+ list(query?: CounterpartyListParams, options?: Core.RequestOptions): Core.PagePromise<CounterpartiesPage>;
29
+ list(options?: Core.RequestOptions): Core.PagePromise<CounterpartiesPage>;
30
+ /**
31
+ * Deletes a given counterparty.
32
+ */
33
+ del(id: string, options?: Core.RequestOptions): Promise<void>;
34
+ /**
35
+ * Send an email requesting account details.
36
+ */
37
+ collectAccount(
38
+ id: string,
39
+ body: CounterpartyCollectAccountParams,
40
+ options?: Core.RequestOptions,
41
+ ): Promise<Core.APIResponse<CounterpartyCollectAccountResponse>>;
42
+ }
43
+ export declare class CounterpartiesPage extends Page<Counterparty> {}
44
+ export interface Counterparty {
45
+ /**
46
+ * The accounts for this counterparty.
47
+ */
48
+ accounts?: Array<Counterparty.Accounts>;
49
+ created_at?: string;
50
+ discarded_at?: string | null;
51
+ /**
52
+ * The counterparty's email.
53
+ */
54
+ email?: string | null;
55
+ id?: string;
56
+ /**
57
+ * This field will be true if this object exists in the live environment or false
58
+ * if it exists in the test environment.
59
+ */
60
+ live_mode?: boolean;
61
+ /**
62
+ * Additional data represented as key-value pairs. Both the key and value must be
63
+ * strings.
64
+ */
65
+ metadata?: Record<string, string>;
66
+ /**
67
+ * A human friendly name for this counterparty.
68
+ */
69
+ name?: string;
70
+ object?: string;
71
+ /**
72
+ * Send an email to the counterparty whenever an associated payment order is sent
73
+ * to the bank.
74
+ */
75
+ send_remittance_advice?: boolean;
76
+ updated_at?: string;
77
+ }
78
+ export declare namespace Counterparty {
79
+ interface Accounts {
80
+ account_details?: Array<Accounts.AccountDetails>;
81
+ /**
82
+ * Can be `checking`, `savings` or `other`.
83
+ */
84
+ account_type?: 'checking' | 'other' | 'savings';
85
+ contact_details?: Array<Accounts.ContactDetails>;
86
+ created_at?: string;
87
+ discarded_at?: string | null;
88
+ id?: string;
89
+ /**
90
+ * This field will be true if this object exists in the live environment or false
91
+ * if it exists in the test environment.
92
+ */
93
+ live_mode?: boolean;
94
+ /**
95
+ * Additional data represented as key-value pairs. Both the key and value must be
96
+ * strings.
97
+ */
98
+ metadata?: Record<string, string>;
99
+ /**
100
+ * A nickname for the external account. This is only for internal usage and won't
101
+ * affect any payments
102
+ */
103
+ name?: string | null;
104
+ object?: string;
105
+ /**
106
+ * The address associated with the owner or `null`.
107
+ */
108
+ party_address?: Accounts.PartyAddress | null;
109
+ /**
110
+ * The legal name of the entity which owns the account.
111
+ */
112
+ party_name?: string;
113
+ /**
114
+ * Either `individual` or `business`.
115
+ */
116
+ party_type?: 'business' | 'individual' | null;
117
+ routing_details?: Array<Accounts.RoutingDetails>;
118
+ updated_at?: string;
119
+ verification_status?: 'pending_verification' | 'unverified' | 'verified';
120
+ }
121
+ namespace Accounts {
122
+ interface PartyAddress {
123
+ /**
124
+ * Country code conforms to [ISO 3166-1 alpha-2]
125
+ */
126
+ country?: string | null;
127
+ created_at?: string;
128
+ id?: string;
129
+ line1?: string | null;
130
+ line2?: string | null;
131
+ /**
132
+ * This field will be true if this object exists in the live environment or false
133
+ * if it exists in the test environment.
134
+ */
135
+ live_mode?: boolean;
136
+ /**
137
+ * Locality or City.
138
+ */
139
+ locality?: string | null;
140
+ object?: string;
141
+ /**
142
+ * The postal code of the address.
143
+ */
144
+ postal_code?: string | null;
145
+ /**
146
+ * Region or State.
147
+ */
148
+ region?: string | null;
149
+ updated_at?: string;
150
+ }
151
+ interface AccountDetails {
152
+ account_number?: string;
153
+ /**
154
+ * Supports iban and clabe, otherwise other if the bank account number is in a
155
+ * generic format.
156
+ */
157
+ account_number_type?: 'iban' | 'clabe' | 'wallet_address' | 'pan' | 'other';
158
+ created_at?: string;
159
+ discarded_at?: string | null;
160
+ id?: string;
161
+ /**
162
+ * This field will be true if this object exists in the live environment or false
163
+ * if it exists in the test environment.
164
+ */
165
+ live_mode?: boolean;
166
+ object?: string;
167
+ updated_at?: string;
168
+ }
169
+ interface RoutingDetails {
170
+ bank_address?: RoutingDetails.BankAddress | null;
171
+ bank_name?: string;
172
+ created_at?: string;
173
+ discarded_at?: string | null;
174
+ id?: string;
175
+ /**
176
+ * This field will be true if this object exists in the live environment or false
177
+ * if it exists in the test environment.
178
+ */
179
+ live_mode?: boolean;
180
+ object?: string;
181
+ /**
182
+ * If the routing detail is to be used for a specific payment type this field will
183
+ * be populated, otherwise null.
184
+ */
185
+ payment_type?:
186
+ | 'ach'
187
+ | 'au_becs'
188
+ | 'bacs'
189
+ | 'book'
190
+ | 'card'
191
+ | 'check'
192
+ | 'eft'
193
+ | 'interac'
194
+ | 'provxchange'
195
+ | 'rtp'
196
+ | 'sen'
197
+ | 'sepa'
198
+ | 'signet'
199
+ | 'wire'
200
+ | null;
201
+ /**
202
+ * The routing number of the bank.
203
+ */
204
+ routing_number?: string;
205
+ routing_number_type?:
206
+ | 'aba'
207
+ | 'swift'
208
+ | 'au_bsb'
209
+ | 'ca_cpa'
210
+ | 'cnaps'
211
+ | 'gb_sort_code'
212
+ | 'in_ifsc'
213
+ | 'my_branch_code'
214
+ | 'br_codigo';
215
+ updated_at?: string;
216
+ }
217
+ namespace RoutingDetails {
218
+ interface BankAddress {
219
+ /**
220
+ * Country code conforms to [ISO 3166-1 alpha-2]
221
+ */
222
+ country?: string | null;
223
+ created_at?: string;
224
+ id?: string;
225
+ line1?: string | null;
226
+ line2?: string | null;
227
+ /**
228
+ * This field will be true if this object exists in the live environment or false
229
+ * if it exists in the test environment.
230
+ */
231
+ live_mode?: boolean;
232
+ /**
233
+ * Locality or City.
234
+ */
235
+ locality?: string | null;
236
+ object?: string;
237
+ /**
238
+ * The postal code of the address.
239
+ */
240
+ postal_code?: string | null;
241
+ /**
242
+ * Region or State.
243
+ */
244
+ region?: string | null;
245
+ updated_at?: string;
246
+ }
247
+ }
248
+ interface ContactDetails {
249
+ contact_identifier?: string;
250
+ contact_identifier_type?: 'email' | 'phone_number';
251
+ created_at?: string;
252
+ discarded_at?: string | null;
253
+ id?: string;
254
+ /**
255
+ * This field will be true if this object exists in the live environment or false
256
+ * if it exists in the test environment.
257
+ */
258
+ live_mode?: boolean;
259
+ object?: string;
260
+ updated_at?: string;
261
+ }
262
+ }
263
+ }
264
+ export interface CounterpartyCollectAccountResponse {
265
+ /**
266
+ * This is the link to the secure Modern Treasury form. By default, Modern Treasury
267
+ * will send an email to your counterparty that includes a link to this form.
268
+ * However, if `send_email` is passed as `false` in the body then Modern Treasury
269
+ * will not send the email and you can send it to the counterparty directly.
270
+ */
271
+ form_link?: string;
272
+ /**
273
+ * The id of the existing counterparty.
274
+ */
275
+ id?: string;
276
+ /**
277
+ * This field will be `true` if an email requesting account details has already
278
+ * been sent to this counterparty.
279
+ */
280
+ is_resend?: boolean;
281
+ }
282
+ export interface CounterpartyCreateParams {
283
+ /**
284
+ * A human friendly name for this counterparty.
285
+ */
286
+ name: string;
287
+ /**
288
+ * The accounts for this counterparty.
289
+ */
290
+ accounts?: Array<CounterpartyCreateParams.Accounts>;
291
+ /**
292
+ * The counterparty's email.
293
+ */
294
+ email?: string | null;
295
+ /**
296
+ * An optional type to auto-sync the counterparty to your ledger. Either `customer`
297
+ * or `vendor`.
298
+ */
299
+ ledger_type?: 'customer' | 'vendor';
300
+ /**
301
+ * Additional data represented as key-value pairs. Both the key and value must be
302
+ * strings.
303
+ */
304
+ metadata?: Record<string, string>;
305
+ /**
306
+ * Send an email to the counterparty whenever an associated payment order is sent
307
+ * to the bank.
308
+ */
309
+ send_remittance_advice?: boolean;
310
+ /**
311
+ * Either a valid SSN or EIN.
312
+ */
313
+ taxpayer_identifier?: string;
314
+ }
315
+ export declare namespace CounterpartyCreateParams {
316
+ interface Accounts {
317
+ account_details?: Array<Accounts.AccountDetails>;
318
+ /**
319
+ * Can be `checking`, `savings` or `other`.
320
+ */
321
+ account_type?: 'checking' | 'other' | 'savings';
322
+ contact_details?: Array<Accounts.ContactDetails>;
323
+ /**
324
+ * Additional data represented as key-value pairs. Both the key and value must be
325
+ * strings.
326
+ */
327
+ metadata?: Record<string, string>;
328
+ /**
329
+ * A nickname for the external account. This is only for internal usage and won't
330
+ * affect any payments
331
+ */
332
+ name?: string | null;
333
+ /**
334
+ * Required if receiving wire payments.
335
+ */
336
+ party_address?: Accounts.PartyAddress;
337
+ party_identifier?: string;
338
+ /**
339
+ * If this value isn't provided, it will be inherited from the counterparty's name.
340
+ */
341
+ party_name?: string;
342
+ /**
343
+ * Either `individual` or `business`.
344
+ */
345
+ party_type?: 'business' | 'individual' | null;
346
+ /**
347
+ * If you've enabled the Modern Treasury + Plaid integration in your Plaid account,
348
+ * you can pass the processor token in this field.
349
+ */
350
+ plaid_processor_token?: string;
351
+ routing_details?: Array<Accounts.RoutingDetails>;
352
+ }
353
+ namespace Accounts {
354
+ interface PartyAddress {
355
+ /**
356
+ * Country code conforms to [ISO 3166-1 alpha-2]
357
+ */
358
+ country?: string | null;
359
+ line1?: string | null;
360
+ line2?: string | null;
361
+ /**
362
+ * Locality or City.
363
+ */
364
+ locality?: string | null;
365
+ /**
366
+ * The postal code of the address.
367
+ */
368
+ postal_code?: string | null;
369
+ /**
370
+ * Region or State.
371
+ */
372
+ region?: string | null;
373
+ }
374
+ interface AccountDetails {
375
+ account_number: string;
376
+ account_number_type?: 'iban' | 'clabe' | 'wallet_address' | 'pan' | 'other';
377
+ }
378
+ interface RoutingDetails {
379
+ routing_number: string;
380
+ routing_number_type:
381
+ | 'aba'
382
+ | 'swift'
383
+ | 'au_bsb'
384
+ | 'ca_cpa'
385
+ | 'cnaps'
386
+ | 'gb_sort_code'
387
+ | 'in_ifsc'
388
+ | 'my_branch_code'
389
+ | 'br_codigo';
390
+ payment_type?:
391
+ | 'ach'
392
+ | 'au_becs'
393
+ | 'bacs'
394
+ | 'book'
395
+ | 'card'
396
+ | 'check'
397
+ | 'eft'
398
+ | 'interac'
399
+ | 'provxchange'
400
+ | 'rtp'
401
+ | 'sen'
402
+ | 'sepa'
403
+ | 'signet'
404
+ | 'wire';
405
+ }
406
+ interface ContactDetails {
407
+ contact_identifier?: string;
408
+ contact_identifier_type?: 'email' | 'phone_number';
409
+ }
410
+ }
411
+ }
412
+ export interface CounterpartyUpdateParams {
413
+ /**
414
+ * A new email for the counterparty.
415
+ */
416
+ email?: string;
417
+ /**
418
+ * Additional data in the form of key-value pairs. Pairs can be removed by passing
419
+ * an empty string or `null` as the value.
420
+ */
421
+ metadata?: Record<string, string>;
422
+ /**
423
+ * A new name for the counterparty. Will only update if passed.
424
+ */
425
+ name?: string;
426
+ /**
427
+ * If this is `true`, Modern Treasury will send an email to the counterparty
428
+ * whenever an associated payment order is sent to the bank.
429
+ */
430
+ send_remittance_advice?: boolean;
431
+ /**
432
+ * Either a valid SSN or EIN.
433
+ */
434
+ taxpayer_identifier?: string;
435
+ }
436
+ export interface CounterpartyListParams extends PageParams {
437
+ /**
438
+ * Used to return counterparties created after some datetime.
439
+ */
440
+ created_at_lower_bound?: string;
441
+ /**
442
+ * Used to return counterparties created before some datetime.
443
+ */
444
+ created_at_upper_bound?: string;
445
+ /**
446
+ * Performs a partial string match of the email field. This is also case
447
+ * insensitive.
448
+ */
449
+ email?: string;
450
+ /**
451
+ * For example, if you want to query for records with metadata key `Type` and value
452
+ * `Loan`, the query would be `metadata%5BType%5D=Loan`. This encodes the query
453
+ * parameters.
454
+ */
455
+ metadata?: Record<string, string>;
456
+ /**
457
+ * Performs a partial string match of the name field. This is also case
458
+ * insensitive.
459
+ */
460
+ name?: string;
461
+ }
462
+ export interface CounterpartyCollectAccountParams {
463
+ /**
464
+ * One of `credit` or `debit`. Use `credit` when you want to pay a counterparty.
465
+ * Use `debit` when you need to charge a counterparty. This field helps us send a
466
+ * more tailored email to your counterparties."
467
+ */
468
+ direction: 'credit' | 'debit';
469
+ /**
470
+ * The URL you want your customer to visit upon filling out the form. By default,
471
+ * they will be sent to a Modern Treasury landing page. This must be a valid HTTPS
472
+ * URL if set.
473
+ */
474
+ custom_redirect?: string;
475
+ /**
476
+ * The list of fields you want on the form. This field is optional and if it is not
477
+ * set, will default to [\"nameOnAccount\", \"accountType\", \"accountNumber\",
478
+ * \"routingNumber\", \"address\"]. The full list of options is [\"name\",
479
+ * \"nameOnAccount\", \"taxpayerIdentifier\", \"accountType\", \"accountNumber\",
480
+ * \"routingNumber\", \"address\", \"ibanNumber\", \"swiftCode\"].
481
+ */
482
+ fields?: Array<
483
+ | 'name'
484
+ | 'nameOnAccount'
485
+ | 'taxpayerIdentifier'
486
+ | 'accountType'
487
+ | 'accountNumber'
488
+ | 'routingNumber'
489
+ | 'address'
490
+ | 'ibanNumber'
491
+ | 'swiftCode'
492
+ >;
493
+ /**
494
+ * By default, Modern Treasury will send an email to your counterparty that
495
+ * includes a link to the form they must fill out. However, if you would like to
496
+ * send the counterparty the link, you can set this parameter to `false`. The JSON
497
+ * body will include the link to the secure Modern Treasury form.
498
+ */
499
+ send_email?: boolean;
500
+ }
@@ -0,0 +1,57 @@
1
+ 'use strict';
2
+ // File generated from our OpenAPI spec by Stainless.
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+ exports.CounterpartiesPage = exports.Counterparties = void 0;
5
+ const resource_1 = require('../resource');
6
+ const core_1 = require('../core');
7
+ const pagination_1 = require('../pagination');
8
+ class Counterparties extends resource_1.APIResource {
9
+ /**
10
+ * Create a new counterparty.
11
+ */
12
+ create(body, options) {
13
+ return this.post('/api/counterparties', Object.assign({ body }, options));
14
+ }
15
+ /**
16
+ * Get details on a single counterparty.
17
+ */
18
+ retrieve(id, options) {
19
+ return this.get(`/api/counterparties/${id}`, options);
20
+ }
21
+ update(id, body = {}, options) {
22
+ if ((0, core_1.isRequestOptions)(body)) {
23
+ return this.update(id, {}, body);
24
+ }
25
+ return this.patch(`/api/counterparties/${id}`, Object.assign({ body }, options));
26
+ }
27
+ list(query = {}, options) {
28
+ if ((0, core_1.isRequestOptions)(query)) {
29
+ return this.list({}, query);
30
+ }
31
+ return this.getAPIList('/api/counterparties', CounterpartiesPage, Object.assign({ query }, options));
32
+ }
33
+ /**
34
+ * Deletes a given counterparty.
35
+ */
36
+ del(id, options) {
37
+ return this.delete(
38
+ `/api/counterparties/${id}`,
39
+ Object.assign(Object.assign({}, options), {
40
+ headers: Object.assign(
41
+ { Accept: '' },
42
+ options === null || options === void 0 ? void 0 : options.headers,
43
+ ),
44
+ }),
45
+ );
46
+ }
47
+ /**
48
+ * Send an email requesting account details.
49
+ */
50
+ collectAccount(id, body, options) {
51
+ return this.post(`/api/counterparties/${id}/collect_account`, Object.assign({ body }, options));
52
+ }
53
+ }
54
+ exports.Counterparties = Counterparties;
55
+ class CounterpartiesPage extends pagination_1.Page {}
56
+ exports.CounterpartiesPage = CounterpartiesPage;
57
+ //# sourceMappingURL=counterparties.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"counterparties.js","sourceRoot":"","sources":["../../../resources/counterparties.ts"],"names":[],"mappings":";AAAA,qDAAqD;;;AAGrD,yCAAyC;AACzC,iCAA0C;AAC1C,6CAAgD;AAEhD,MAAa,cAAe,SAAQ,sBAAW;IAC7C;;OAEG;IACH,MAAM,CACJ,IAA8B,EAC9B,OAA6B;QAE7B,OAAO,IAAI,CAAC,IAAI,CAAC,qBAAqB,kBAAI,IAAI,IAAK,OAAO,EAAG,CAAC;IAChE,CAAC;IAED;;OAEG;IACH,QAAQ,CAAC,EAAU,EAAE,OAA6B;QAChD,OAAO,IAAI,CAAC,GAAG,CAAC,uBAAuB,EAAE,EAAE,EAAE,OAAO,CAAC,CAAC;IACxD,CAAC;IAWD,MAAM,CACJ,EAAU,EACV,OAAuD,EAAE,EACzD,OAA6B;QAE7B,IAAI,IAAA,uBAAgB,EAAC,IAAI,CAAC,EAAE;YAC1B,OAAO,IAAI,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,EAAE,IAAI,CAAC,CAAC;SAClC;QAED,OAAO,IAAI,CAAC,KAAK,CAAC,uBAAuB,EAAE,EAAE,kBAAI,IAAI,IAAK,OAAO,EAAG,CAAC;IACvE,CAAC;IAOD,IAAI,CACF,QAAsD,EAAE,EACxD,OAA6B;QAE7B,IAAI,IAAA,uBAAgB,EAAC,KAAK,CAAC,EAAE;YAC3B,OAAO,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;SAC7B;QAED,OAAO,IAAI,CAAC,UAAU,CAAC,qBAAqB,EAAE,kBAAkB,kBAAI,KAAK,IAAK,OAAO,EAAG,CAAC;IAC3F,CAAC;IAED;;OAEG;IACH,GAAG,CAAC,EAAU,EAAE,OAA6B;QAC3C,OAAO,IAAI,CAAC,MAAM,CAAC,uBAAuB,EAAE,EAAE,kCACzC,OAAO,KACV,OAAO,kBAAI,MAAM,EAAE,EAAE,IAAK,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,OAAO,KAC1C,CAAC;IACL,CAAC;IAED;;OAEG;IACH,cAAc,CACZ,EAAU,EACV,IAAsC,EACtC,OAA6B;QAE7B,OAAO,IAAI,CAAC,IAAI,CAAC,uBAAuB,EAAE,kBAAkB,kBAAI,IAAI,IAAK,OAAO,EAAG,CAAC;IACtF,CAAC;CACF;AA3ED,wCA2EC;AAED,MAAa,kBAAmB,SAAQ,iBAAkB;CAAG;AAA7D,gDAA6D"}
@@ -0,0 +1,66 @@
1
+ import * as Core from '../core';
2
+ import { APIResource } from '../resource';
3
+ import { Page, PageParams } from '../pagination';
4
+ export declare class Documents extends APIResource {
5
+ list(
6
+ documentableType: string,
7
+ id: string,
8
+ query?: DocumentListParams,
9
+ options?: Core.RequestOptions,
10
+ ): Core.PagePromise<DocumentsPage>;
11
+ list(documentableType: string, id: string, options?: Core.RequestOptions): Core.PagePromise<DocumentsPage>;
12
+ }
13
+ export declare class DocumentsPage extends Page<Document> {}
14
+ export interface Document {
15
+ created_at?: string;
16
+ discarded_at?: string | null;
17
+ /**
18
+ * A category given to the document, can be `null`.
19
+ */
20
+ document_type?: string | null;
21
+ /**
22
+ * The unique identifier for the associated object.
23
+ */
24
+ documentable_id?: string;
25
+ /**
26
+ * The type of the associated object. Currently can be one of `payment_order`,
27
+ * `transaction`, `paper_item`, `expected_payment`, `counterparty`, `organization`,
28
+ * `case`, `internal_account` or `external_account`.
29
+ */
30
+ documentable_type?:
31
+ | 'case'
32
+ | 'counterparty'
33
+ | 'expected_payment'
34
+ | 'external_account'
35
+ | 'internal_account'
36
+ | 'organization'
37
+ | 'paper_item'
38
+ | 'payment_order'
39
+ | 'transaction';
40
+ file?: Document.File;
41
+ id?: string;
42
+ /**
43
+ * This field will be true if this object exists in the live environment or false
44
+ * if it exists in the test environment.
45
+ */
46
+ live_mode?: boolean;
47
+ object?: string;
48
+ updated_at?: string;
49
+ }
50
+ export declare namespace Document {
51
+ interface File {
52
+ /**
53
+ * The MIME content type of the document.
54
+ */
55
+ content_type?: string;
56
+ /**
57
+ * The original filename of the document.
58
+ */
59
+ filename?: string;
60
+ /**
61
+ * The size of the document in bytes.
62
+ */
63
+ size?: number;
64
+ }
65
+ }
66
+ export interface DocumentListParams extends PageParams {}
@@ -0,0 +1,23 @@
1
+ 'use strict';
2
+ // File generated from our OpenAPI spec by Stainless.
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+ exports.DocumentsPage = exports.Documents = void 0;
5
+ const resource_1 = require('../resource');
6
+ const core_1 = require('../core');
7
+ const pagination_1 = require('../pagination');
8
+ class Documents extends resource_1.APIResource {
9
+ list(documentableType, id, query = {}, options) {
10
+ if ((0, core_1.isRequestOptions)(query)) {
11
+ return this.list(documentableType, id, {}, query);
12
+ }
13
+ return this.getAPIList(
14
+ `/api/${documentableType}/${id}/documents`,
15
+ DocumentsPage,
16
+ Object.assign({ query }, options),
17
+ );
18
+ }
19
+ }
20
+ exports.Documents = Documents;
21
+ class DocumentsPage extends pagination_1.Page {}
22
+ exports.DocumentsPage = DocumentsPage;
23
+ //# sourceMappingURL=documents.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"documents.js","sourceRoot":"","sources":["../../../resources/documents.ts"],"names":[],"mappings":";AAAA,qDAAqD;;;AAGrD,yCAAyC;AACzC,iCAA0C;AAC1C,6CAAgD;AAEhD,MAAa,SAAU,SAAQ,sBAAW;IAQxC,IAAI,CACF,gBAAwB,EACxB,EAAU,EACV,QAAkD,EAAE,EACpD,OAA6B;QAE7B,IAAI,IAAA,uBAAgB,EAAC,KAAK,CAAC,EAAE;YAC3B,OAAO,IAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE,EAAE,EAAE,EAAE,EAAE,KAAK,CAAC,CAAC;SACnD;QAED,OAAO,IAAI,CAAC,UAAU,CAAC,QAAQ,gBAAgB,IAAI,EAAE,YAAY,EAAE,aAAa,kBAAI,KAAK,IAAK,OAAO,EAAG,CAAC;IAC3G,CAAC;CACF;AApBD,8BAoBC;AAED,MAAa,aAAc,SAAQ,iBAAc;CAAG;AAApD,sCAAoD"}