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,237 @@
1
+ // File generated from our OpenAPI spec by Stainless.
2
+
3
+ import ModernTreasury from '~/index';
4
+ const modernTreasury = new ModernTreasury({
5
+ apiKey: 'something1234',
6
+ baseURL: 'http://127.0.0.1:4010',
7
+ organizationId: 'c40c0b40-11d3-42ee-8f2e-18ee8b8239aa',
8
+ });
9
+
10
+ describe('resource counterparties', () => {
11
+ test('create: only required params', async () => {
12
+ const response = await modernTreasury.counterparties.create({ name: 'string' });
13
+ });
14
+
15
+ test('create: required and optional params', async () => {
16
+ const response = await modernTreasury.counterparties.create({
17
+ name: 'string',
18
+ accounts: [
19
+ {
20
+ account_type: 'checking',
21
+ party_type: 'business',
22
+ party_address: {
23
+ line1: 'string',
24
+ line2: 'string',
25
+ locality: 'string',
26
+ region: 'string',
27
+ postal_code: 'string',
28
+ country: 'string',
29
+ },
30
+ name: 'string',
31
+ account_details: [
32
+ { account_number: 'string', account_number_type: 'iban' },
33
+ { account_number: 'string', account_number_type: 'iban' },
34
+ { account_number: 'string', account_number_type: 'iban' },
35
+ ],
36
+ routing_details: [
37
+ { routing_number: 'string', routing_number_type: 'aba', payment_type: 'ach' },
38
+ { routing_number: 'string', routing_number_type: 'aba', payment_type: 'ach' },
39
+ { routing_number: 'string', routing_number_type: 'aba', payment_type: 'ach' },
40
+ ],
41
+ metadata: {},
42
+ party_name: 'string',
43
+ party_identifier: 'string',
44
+ plaid_processor_token: 'string',
45
+ contact_details: [
46
+ { contact_identifier: 'string', contact_identifier_type: 'email' },
47
+ { contact_identifier: 'string', contact_identifier_type: 'email' },
48
+ { contact_identifier: 'string', contact_identifier_type: 'email' },
49
+ ],
50
+ },
51
+ {
52
+ account_type: 'checking',
53
+ party_type: 'business',
54
+ party_address: {
55
+ line1: 'string',
56
+ line2: 'string',
57
+ locality: 'string',
58
+ region: 'string',
59
+ postal_code: 'string',
60
+ country: 'string',
61
+ },
62
+ name: 'string',
63
+ account_details: [
64
+ { account_number: 'string', account_number_type: 'iban' },
65
+ { account_number: 'string', account_number_type: 'iban' },
66
+ { account_number: 'string', account_number_type: 'iban' },
67
+ ],
68
+ routing_details: [
69
+ { routing_number: 'string', routing_number_type: 'aba', payment_type: 'ach' },
70
+ { routing_number: 'string', routing_number_type: 'aba', payment_type: 'ach' },
71
+ { routing_number: 'string', routing_number_type: 'aba', payment_type: 'ach' },
72
+ ],
73
+ metadata: {},
74
+ party_name: 'string',
75
+ party_identifier: 'string',
76
+ plaid_processor_token: 'string',
77
+ contact_details: [
78
+ { contact_identifier: 'string', contact_identifier_type: 'email' },
79
+ { contact_identifier: 'string', contact_identifier_type: 'email' },
80
+ { contact_identifier: 'string', contact_identifier_type: 'email' },
81
+ ],
82
+ },
83
+ {
84
+ account_type: 'checking',
85
+ party_type: 'business',
86
+ party_address: {
87
+ line1: 'string',
88
+ line2: 'string',
89
+ locality: 'string',
90
+ region: 'string',
91
+ postal_code: 'string',
92
+ country: 'string',
93
+ },
94
+ name: 'string',
95
+ account_details: [
96
+ { account_number: 'string', account_number_type: 'iban' },
97
+ { account_number: 'string', account_number_type: 'iban' },
98
+ { account_number: 'string', account_number_type: 'iban' },
99
+ ],
100
+ routing_details: [
101
+ { routing_number: 'string', routing_number_type: 'aba', payment_type: 'ach' },
102
+ { routing_number: 'string', routing_number_type: 'aba', payment_type: 'ach' },
103
+ { routing_number: 'string', routing_number_type: 'aba', payment_type: 'ach' },
104
+ ],
105
+ metadata: {},
106
+ party_name: 'string',
107
+ party_identifier: 'string',
108
+ plaid_processor_token: 'string',
109
+ contact_details: [
110
+ { contact_identifier: 'string', contact_identifier_type: 'email' },
111
+ { contact_identifier: 'string', contact_identifier_type: 'email' },
112
+ { contact_identifier: 'string', contact_identifier_type: 'email' },
113
+ ],
114
+ },
115
+ ],
116
+ email: 'dev@stainlessapi.com',
117
+ metadata: {},
118
+ send_remittance_advice: true,
119
+ ledger_type: 'customer',
120
+ taxpayer_identifier: 'string',
121
+ });
122
+ });
123
+
124
+ test('retrieve', async () => {
125
+ const response = await modernTreasury.counterparties.retrieve('string');
126
+ });
127
+
128
+ test('retrieve: request options instead of params are passed correctly', async () => {
129
+ // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
130
+ await expect(
131
+ modernTreasury.counterparties.retrieve('string', { path: '/_stainless_unknown_path' }),
132
+ ).rejects.toThrow(ModernTreasury.NotFoundError);
133
+ });
134
+
135
+ test('update: only required params', async () => {
136
+ const response = await modernTreasury.counterparties.update('string');
137
+ });
138
+
139
+ test('update: required and optional params', async () => {
140
+ const response = await modernTreasury.counterparties.update('string', {
141
+ name: 'string',
142
+ email: 'dev@stainlessapi.com',
143
+ metadata: {},
144
+ send_remittance_advice: true,
145
+ taxpayer_identifier: 'string',
146
+ });
147
+ });
148
+
149
+ test('update: request options instead of params are passed correctly', async () => {
150
+ // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
151
+ await expect(
152
+ modernTreasury.counterparties.update('string', { path: '/_stainless_unknown_path' }),
153
+ ).rejects.toThrow(ModernTreasury.NotFoundError);
154
+ });
155
+
156
+ test('update: request options and params are passed correctly', async () => {
157
+ // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
158
+ await expect(
159
+ modernTreasury.counterparties.update(
160
+ 'string',
161
+ {
162
+ name: 'string',
163
+ email: 'dev@stainlessapi.com',
164
+ metadata: {},
165
+ send_remittance_advice: true,
166
+ taxpayer_identifier: 'string',
167
+ },
168
+ { path: '/_stainless_unknown_path' },
169
+ ),
170
+ ).rejects.toThrow(ModernTreasury.NotFoundError);
171
+ });
172
+
173
+ test('list: only required params', async () => {
174
+ const response = await modernTreasury.counterparties.list();
175
+ });
176
+
177
+ test('list: required and optional params', async () => {
178
+ const response = await modernTreasury.counterparties.list({
179
+ after_cursor: 'string',
180
+ per_page: 0,
181
+ name: 'string',
182
+ email: 'dev@stainlessapi.com',
183
+ metadata: {},
184
+ created_at_lower_bound: '2019-12-27T18:11:19.117Z',
185
+ created_at_upper_bound: '2019-12-27T18:11:19.117Z',
186
+ });
187
+ });
188
+
189
+ test('list: request options instead of params are passed correctly', async () => {
190
+ // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
191
+ await expect(modernTreasury.counterparties.list({ path: '/_stainless_unknown_path' })).rejects.toThrow(
192
+ ModernTreasury.NotFoundError,
193
+ );
194
+ });
195
+
196
+ test('list: request options and params are passed correctly', async () => {
197
+ // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
198
+ await expect(
199
+ modernTreasury.counterparties.list(
200
+ {
201
+ after_cursor: 'string',
202
+ per_page: 0,
203
+ name: 'string',
204
+ email: 'dev@stainlessapi.com',
205
+ metadata: {},
206
+ created_at_lower_bound: '2019-12-27T18:11:19.117Z',
207
+ created_at_upper_bound: '2019-12-27T18:11:19.117Z',
208
+ },
209
+ { path: '/_stainless_unknown_path' },
210
+ ),
211
+ ).rejects.toThrow(ModernTreasury.NotFoundError);
212
+ });
213
+
214
+ test('delete', async () => {
215
+ const response = await modernTreasury.counterparties.del('string');
216
+ });
217
+
218
+ test('delete: request options instead of params are passed correctly', async () => {
219
+ // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
220
+ await expect(
221
+ modernTreasury.counterparties.del('string', { path: '/_stainless_unknown_path' }),
222
+ ).rejects.toThrow(ModernTreasury.NotFoundError);
223
+ });
224
+
225
+ test('collect_account: only required params', async () => {
226
+ const response = await modernTreasury.counterparties.collectAccount('string', { direction: 'credit' });
227
+ });
228
+
229
+ test('collect_account: required and optional params', async () => {
230
+ const response = await modernTreasury.counterparties.collectAccount('string', {
231
+ direction: 'credit',
232
+ send_email: true,
233
+ fields: ['name', 'name', 'name'],
234
+ custom_redirect: 'https://example.com',
235
+ });
236
+ });
237
+ });
@@ -0,0 +1,40 @@
1
+ // File generated from our OpenAPI spec by Stainless.
2
+
3
+ import ModernTreasury from '~/index';
4
+ const modernTreasury = new ModernTreasury({
5
+ apiKey: 'something1234',
6
+ baseURL: 'http://127.0.0.1:4010',
7
+ organizationId: 'c40c0b40-11d3-42ee-8f2e-18ee8b8239aa',
8
+ });
9
+
10
+ describe('resource documents', () => {
11
+ test('list: only required params', async () => {
12
+ const response = await modernTreasury.documents.list('cases', 'string');
13
+ });
14
+
15
+ test('list: required and optional params', async () => {
16
+ const response = await modernTreasury.documents.list('cases', 'string', {
17
+ after_cursor: 'string',
18
+ per_page: 0,
19
+ });
20
+ });
21
+
22
+ test('list: request options instead of params are passed correctly', async () => {
23
+ // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
24
+ await expect(
25
+ modernTreasury.documents.list('cases', 'string', { path: '/_stainless_unknown_path' }),
26
+ ).rejects.toThrow(ModernTreasury.NotFoundError);
27
+ });
28
+
29
+ test('list: request options and params are passed correctly', async () => {
30
+ // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
31
+ await expect(
32
+ modernTreasury.documents.list(
33
+ 'cases',
34
+ 'string',
35
+ { after_cursor: 'string', per_page: 0 },
36
+ { path: '/_stainless_unknown_path' },
37
+ ),
38
+ ).rejects.toThrow(ModernTreasury.NotFoundError);
39
+ });
40
+ });
@@ -0,0 +1,62 @@
1
+ // File generated from our OpenAPI spec by Stainless.
2
+
3
+ import ModernTreasury from '~/index';
4
+ const modernTreasury = new ModernTreasury({
5
+ apiKey: 'something1234',
6
+ baseURL: 'http://127.0.0.1:4010',
7
+ organizationId: 'c40c0b40-11d3-42ee-8f2e-18ee8b8239aa',
8
+ });
9
+
10
+ describe('resource events', () => {
11
+ test('retrieve', async () => {
12
+ const response = await modernTreasury.events.retrieve('string');
13
+ });
14
+
15
+ test('retrieve: request options instead of params are passed correctly', async () => {
16
+ // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
17
+ await expect(
18
+ modernTreasury.events.retrieve('string', { path: '/_stainless_unknown_path' }),
19
+ ).rejects.toThrow(ModernTreasury.NotFoundError);
20
+ });
21
+
22
+ test('list: only required params', async () => {
23
+ const response = await modernTreasury.events.list();
24
+ });
25
+
26
+ test('list: required and optional params', async () => {
27
+ const response = await modernTreasury.events.list({
28
+ after_cursor: 'string',
29
+ per_page: 0,
30
+ event_time_start: '2019-12-27T18:11:19.117Z',
31
+ event_time_end: '2019-12-27T18:11:19.117Z',
32
+ resource: 'string',
33
+ entity_id: 'string',
34
+ event_name: 'string',
35
+ });
36
+ });
37
+
38
+ test('list: request options instead of params are passed correctly', async () => {
39
+ // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
40
+ await expect(modernTreasury.events.list({ path: '/_stainless_unknown_path' })).rejects.toThrow(
41
+ ModernTreasury.NotFoundError,
42
+ );
43
+ });
44
+
45
+ test('list: request options and params are passed correctly', async () => {
46
+ // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
47
+ await expect(
48
+ modernTreasury.events.list(
49
+ {
50
+ after_cursor: 'string',
51
+ per_page: 0,
52
+ event_time_start: '2019-12-27T18:11:19.117Z',
53
+ event_time_end: '2019-12-27T18:11:19.117Z',
54
+ resource: 'string',
55
+ entity_id: 'string',
56
+ event_name: 'string',
57
+ },
58
+ { path: '/_stainless_unknown_path' },
59
+ ),
60
+ ).rejects.toThrow(ModernTreasury.NotFoundError);
61
+ });
62
+ });
@@ -0,0 +1,138 @@
1
+ // File generated from our OpenAPI spec by Stainless.
2
+
3
+ import ModernTreasury from '~/index';
4
+ const modernTreasury = new ModernTreasury({
5
+ apiKey: 'something1234',
6
+ baseURL: 'http://127.0.0.1:4010',
7
+ organizationId: 'c40c0b40-11d3-42ee-8f2e-18ee8b8239aa',
8
+ });
9
+
10
+ describe('resource expected_payments', () => {
11
+ test('create: only required params', async () => {
12
+ const response = await modernTreasury.expectedPayments.create({
13
+ amount_upper_bound: 0,
14
+ amount_lower_bound: 0,
15
+ direction: 'credit',
16
+ internal_account_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
17
+ });
18
+ });
19
+
20
+ test('create: required and optional params', async () => {
21
+ const response = await modernTreasury.expectedPayments.create({
22
+ amount_upper_bound: 0,
23
+ amount_lower_bound: 0,
24
+ direction: 'credit',
25
+ internal_account_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
26
+ type: 'ach',
27
+ currency: 'AED',
28
+ date_upper_bound: '2019-12-27',
29
+ date_lower_bound: '2019-12-27',
30
+ description: 'string',
31
+ statement_descriptor: 'string',
32
+ metadata: {},
33
+ counterparty_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
34
+ remittance_information: 'string',
35
+ line_items: [
36
+ { amount: 0, metadata: {}, description: 'string', accounting_category_id: 'string' },
37
+ { amount: 0, metadata: {}, description: 'string', accounting_category_id: 'string' },
38
+ { amount: 0, metadata: {}, description: 'string', accounting_category_id: 'string' },
39
+ ],
40
+ });
41
+ });
42
+
43
+ test('retrieve', async () => {
44
+ const response = await modernTreasury.expectedPayments.retrieve('string');
45
+ });
46
+
47
+ test('retrieve: request options instead of params are passed correctly', async () => {
48
+ // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
49
+ await expect(
50
+ modernTreasury.expectedPayments.retrieve('string', { path: '/_stainless_unknown_path' }),
51
+ ).rejects.toThrow(ModernTreasury.NotFoundError);
52
+ });
53
+
54
+ test('update: only required params', async () => {
55
+ const response = await modernTreasury.expectedPayments.update('string', {
56
+ amount_upper_bound: 0,
57
+ amount_lower_bound: 0,
58
+ direction: 'credit',
59
+ internal_account_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
60
+ });
61
+ });
62
+
63
+ test('update: required and optional params', async () => {
64
+ const response = await modernTreasury.expectedPayments.update('string', {
65
+ amount_upper_bound: 0,
66
+ amount_lower_bound: 0,
67
+ direction: 'credit',
68
+ internal_account_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
69
+ type: 'ach',
70
+ currency: 'AED',
71
+ date_upper_bound: '2019-12-27',
72
+ date_lower_bound: '2019-12-27',
73
+ description: 'string',
74
+ statement_descriptor: 'string',
75
+ metadata: {},
76
+ counterparty_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
77
+ remittance_information: 'string',
78
+ });
79
+ });
80
+
81
+ test('list: only required params', async () => {
82
+ const response = await modernTreasury.expectedPayments.list();
83
+ });
84
+
85
+ test('list: required and optional params', async () => {
86
+ const response = await modernTreasury.expectedPayments.list({
87
+ after_cursor: 'string',
88
+ per_page: 0,
89
+ status: 'archived',
90
+ internal_account_id: 'string',
91
+ direction: 'credit',
92
+ type: 'ach',
93
+ counterparty_id: 'string',
94
+ metadata: {},
95
+ created_at_lower_bound: '2019-12-27T18:11:19.117Z',
96
+ created_at_upper_bound: '2019-12-27T18:11:19.117Z',
97
+ });
98
+ });
99
+
100
+ test('list: request options instead of params are passed correctly', async () => {
101
+ // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
102
+ await expect(modernTreasury.expectedPayments.list({ path: '/_stainless_unknown_path' })).rejects.toThrow(
103
+ ModernTreasury.NotFoundError,
104
+ );
105
+ });
106
+
107
+ test('list: request options and params are passed correctly', async () => {
108
+ // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
109
+ await expect(
110
+ modernTreasury.expectedPayments.list(
111
+ {
112
+ after_cursor: 'string',
113
+ per_page: 0,
114
+ status: 'archived',
115
+ internal_account_id: 'string',
116
+ direction: 'credit',
117
+ type: 'ach',
118
+ counterparty_id: 'string',
119
+ metadata: {},
120
+ created_at_lower_bound: '2019-12-27T18:11:19.117Z',
121
+ created_at_upper_bound: '2019-12-27T18:11:19.117Z',
122
+ },
123
+ { path: '/_stainless_unknown_path' },
124
+ ),
125
+ ).rejects.toThrow(ModernTreasury.NotFoundError);
126
+ });
127
+
128
+ test('delete', async () => {
129
+ const response = await modernTreasury.expectedPayments.del('string');
130
+ });
131
+
132
+ test('delete: request options instead of params are passed correctly', async () => {
133
+ // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
134
+ await expect(
135
+ modernTreasury.expectedPayments.del('string', { path: '/_stainless_unknown_path' }),
136
+ ).rejects.toThrow(ModernTreasury.NotFoundError);
137
+ });
138
+ });
@@ -0,0 +1,210 @@
1
+ // File generated from our OpenAPI spec by Stainless.
2
+
3
+ import ModernTreasury from '~/index';
4
+ const modernTreasury = new ModernTreasury({
5
+ apiKey: 'something1234',
6
+ baseURL: 'http://127.0.0.1:4010',
7
+ organizationId: 'c40c0b40-11d3-42ee-8f2e-18ee8b8239aa',
8
+ });
9
+
10
+ describe('resource external_accounts', () => {
11
+ test('create: only required params', async () => {
12
+ const response = await modernTreasury.externalAccounts.create({
13
+ counterparty_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
14
+ });
15
+ });
16
+
17
+ test('create: required and optional params', async () => {
18
+ const response = await modernTreasury.externalAccounts.create({
19
+ account_type: 'checking',
20
+ party_type: 'business',
21
+ party_address: {
22
+ line1: 'string',
23
+ line2: 'string',
24
+ locality: 'string',
25
+ region: 'string',
26
+ postal_code: 'string',
27
+ country: 'string',
28
+ },
29
+ name: 'string',
30
+ counterparty_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
31
+ account_details: [
32
+ { account_number: 'string', account_number_type: 'iban' },
33
+ { account_number: 'string', account_number_type: 'iban' },
34
+ { account_number: 'string', account_number_type: 'iban' },
35
+ ],
36
+ routing_details: [
37
+ { routing_number: 'string', routing_number_type: 'aba', payment_type: 'ach' },
38
+ { routing_number: 'string', routing_number_type: 'aba', payment_type: 'ach' },
39
+ { routing_number: 'string', routing_number_type: 'aba', payment_type: 'ach' },
40
+ ],
41
+ metadata: {},
42
+ party_name: 'string',
43
+ party_identifier: 'string',
44
+ plaid_processor_token: 'string',
45
+ contact_details: [
46
+ { contact_identifier: 'string', contact_identifier_type: 'email' },
47
+ { contact_identifier: 'string', contact_identifier_type: 'email' },
48
+ { contact_identifier: 'string', contact_identifier_type: 'email' },
49
+ ],
50
+ });
51
+ });
52
+
53
+ test('retrieve', async () => {
54
+ const response = await modernTreasury.externalAccounts.retrieve('string');
55
+ });
56
+
57
+ test('retrieve: request options instead of params are passed correctly', async () => {
58
+ // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
59
+ await expect(
60
+ modernTreasury.externalAccounts.retrieve('string', { path: '/_stainless_unknown_path' }),
61
+ ).rejects.toThrow(ModernTreasury.NotFoundError);
62
+ });
63
+
64
+ test('update: only required params', async () => {
65
+ const response = await modernTreasury.externalAccounts.update('string');
66
+ });
67
+
68
+ test('update: required and optional params', async () => {
69
+ const response = await modernTreasury.externalAccounts.update('string', {
70
+ party_type: 'business',
71
+ account_type: 'checking',
72
+ counterparty_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
73
+ name: 'string',
74
+ party_name: 'string',
75
+ party_address: {
76
+ line1: 'string',
77
+ line2: 'string',
78
+ locality: 'string',
79
+ region: 'string',
80
+ postal_code: 'string',
81
+ country: 'string',
82
+ },
83
+ metadata: {},
84
+ });
85
+ });
86
+
87
+ test('update: request options instead of params are passed correctly', async () => {
88
+ // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
89
+ await expect(
90
+ modernTreasury.externalAccounts.update('string', { path: '/_stainless_unknown_path' }),
91
+ ).rejects.toThrow(ModernTreasury.NotFoundError);
92
+ });
93
+
94
+ test('update: request options and params are passed correctly', async () => {
95
+ // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
96
+ await expect(
97
+ modernTreasury.externalAccounts.update(
98
+ 'string',
99
+ {
100
+ party_type: 'business',
101
+ account_type: 'checking',
102
+ counterparty_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
103
+ name: 'string',
104
+ party_name: 'string',
105
+ party_address: {
106
+ line1: 'string',
107
+ line2: 'string',
108
+ locality: 'string',
109
+ region: 'string',
110
+ postal_code: 'string',
111
+ country: 'string',
112
+ },
113
+ metadata: {},
114
+ },
115
+ { path: '/_stainless_unknown_path' },
116
+ ),
117
+ ).rejects.toThrow(ModernTreasury.NotFoundError);
118
+ });
119
+
120
+ test('list: only required params', async () => {
121
+ const response = await modernTreasury.externalAccounts.list();
122
+ });
123
+
124
+ test('list: required and optional params', async () => {
125
+ const response = await modernTreasury.externalAccounts.list({
126
+ after_cursor: 'string',
127
+ per_page: 0,
128
+ party_name: 'string',
129
+ counterparty_id: 'string',
130
+ metadata: {},
131
+ });
132
+ });
133
+
134
+ test('list: request options instead of params are passed correctly', async () => {
135
+ // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
136
+ await expect(modernTreasury.externalAccounts.list({ path: '/_stainless_unknown_path' })).rejects.toThrow(
137
+ ModernTreasury.NotFoundError,
138
+ );
139
+ });
140
+
141
+ test('list: request options and params are passed correctly', async () => {
142
+ // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
143
+ await expect(
144
+ modernTreasury.externalAccounts.list(
145
+ {
146
+ after_cursor: 'string',
147
+ per_page: 0,
148
+ party_name: 'string',
149
+ counterparty_id: 'string',
150
+ metadata: {},
151
+ },
152
+ { path: '/_stainless_unknown_path' },
153
+ ),
154
+ ).rejects.toThrow(ModernTreasury.NotFoundError);
155
+ });
156
+
157
+ test('delete', async () => {
158
+ const response = await modernTreasury.externalAccounts.del('string');
159
+ });
160
+
161
+ test('delete: request options instead of params are passed correctly', async () => {
162
+ // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
163
+ await expect(
164
+ modernTreasury.externalAccounts.del('string', { path: '/_stainless_unknown_path' }),
165
+ ).rejects.toThrow(ModernTreasury.NotFoundError);
166
+ });
167
+
168
+ test('complete_verification: only required params', async () => {
169
+ const response = await modernTreasury.externalAccounts.completeVerification('string');
170
+ });
171
+
172
+ test('complete_verification: required and optional params', async () => {
173
+ const response = await modernTreasury.externalAccounts.completeVerification('string', {
174
+ amounts: [0, 0],
175
+ });
176
+ });
177
+
178
+ test('complete_verification: request options instead of params are passed correctly', async () => {
179
+ // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
180
+ await expect(
181
+ modernTreasury.externalAccounts.completeVerification('string', { path: '/_stainless_unknown_path' }),
182
+ ).rejects.toThrow(ModernTreasury.NotFoundError);
183
+ });
184
+
185
+ test('complete_verification: request options and params are passed correctly', async () => {
186
+ // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
187
+ await expect(
188
+ modernTreasury.externalAccounts.completeVerification(
189
+ 'string',
190
+ { amounts: [0, 0] },
191
+ { path: '/_stainless_unknown_path' },
192
+ ),
193
+ ).rejects.toThrow(ModernTreasury.NotFoundError);
194
+ });
195
+
196
+ test('verify: only required params', async () => {
197
+ const response = await modernTreasury.externalAccounts.verify('string', {
198
+ originating_account_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
199
+ payment_type: 'ach',
200
+ });
201
+ });
202
+
203
+ test('verify: required and optional params', async () => {
204
+ const response = await modernTreasury.externalAccounts.verify('string', {
205
+ originating_account_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
206
+ payment_type: 'ach',
207
+ currency: 'AED',
208
+ });
209
+ });
210
+ });