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,97 @@
1
+ // File generated from our OpenAPI spec by Stainless.
2
+
3
+ import * as Core from '~/core';
4
+ import { APIResource } from '~/resource';
5
+ import { isRequestOptions } from '~/core';
6
+ import { Page, PageParams } from '~/pagination';
7
+
8
+ export class Documents extends APIResource {
9
+ list(
10
+ documentableType: string,
11
+ id: string,
12
+ query?: DocumentListParams,
13
+ options?: Core.RequestOptions,
14
+ ): Core.PagePromise<DocumentsPage>;
15
+ list(documentableType: string, id: string, options?: Core.RequestOptions): Core.PagePromise<DocumentsPage>;
16
+ list(
17
+ documentableType: string,
18
+ id: string,
19
+ query: DocumentListParams | Core.RequestOptions = {},
20
+ options?: Core.RequestOptions,
21
+ ): Core.PagePromise<DocumentsPage> {
22
+ if (isRequestOptions(query)) {
23
+ return this.list(documentableType, id, {}, query);
24
+ }
25
+
26
+ return this.getAPIList(`/api/${documentableType}/${id}/documents`, DocumentsPage, { query, ...options });
27
+ }
28
+ }
29
+
30
+ export class DocumentsPage extends Page<Document> {}
31
+
32
+ export interface Document {
33
+ created_at?: string;
34
+
35
+ discarded_at?: string | null;
36
+
37
+ /**
38
+ * A category given to the document, can be `null`.
39
+ */
40
+ document_type?: string | null;
41
+
42
+ /**
43
+ * The unique identifier for the associated object.
44
+ */
45
+ documentable_id?: string;
46
+
47
+ /**
48
+ * The type of the associated object. Currently can be one of `payment_order`,
49
+ * `transaction`, `paper_item`, `expected_payment`, `counterparty`, `organization`,
50
+ * `case`, `internal_account` or `external_account`.
51
+ */
52
+ documentable_type?:
53
+ | 'case'
54
+ | 'counterparty'
55
+ | 'expected_payment'
56
+ | 'external_account'
57
+ | 'internal_account'
58
+ | 'organization'
59
+ | 'paper_item'
60
+ | 'payment_order'
61
+ | 'transaction';
62
+
63
+ file?: Document.File;
64
+
65
+ id?: string;
66
+
67
+ /**
68
+ * This field will be true if this object exists in the live environment or false
69
+ * if it exists in the test environment.
70
+ */
71
+ live_mode?: boolean;
72
+
73
+ object?: string;
74
+
75
+ updated_at?: string;
76
+ }
77
+
78
+ export namespace Document {
79
+ export interface File {
80
+ /**
81
+ * The MIME content type of the document.
82
+ */
83
+ content_type?: string;
84
+
85
+ /**
86
+ * The original filename of the document.
87
+ */
88
+ filename?: string;
89
+
90
+ /**
91
+ * The size of the document in bytes.
92
+ */
93
+ size?: number;
94
+ }
95
+ }
96
+
97
+ export interface DocumentListParams extends PageParams {}
@@ -0,0 +1,86 @@
1
+ // File generated from our OpenAPI spec by Stainless.
2
+
3
+ import * as Core from '~/core';
4
+ import { APIResource } from '~/resource';
5
+ import { isRequestOptions } from '~/core';
6
+ import { Page, PageParams } from '~/pagination';
7
+
8
+ export class Events extends APIResource {
9
+ retrieve(id: string, options?: Core.RequestOptions): Promise<Core.APIResponse<Event>> {
10
+ return this.get(`/api/events/${id}`, options);
11
+ }
12
+
13
+ list(query?: EventListParams, options?: Core.RequestOptions): Core.PagePromise<EventsPage>;
14
+ list(options?: Core.RequestOptions): Core.PagePromise<EventsPage>;
15
+ list(
16
+ query: EventListParams | Core.RequestOptions = {},
17
+ options?: Core.RequestOptions,
18
+ ): Core.PagePromise<EventsPage> {
19
+ if (isRequestOptions(query)) {
20
+ return this.list({}, query);
21
+ }
22
+
23
+ return this.getAPIList('/api/events', EventsPage, { query, ...options });
24
+ }
25
+ }
26
+
27
+ export class EventsPage extends Page<Event> {}
28
+
29
+ export interface Event {
30
+ created_at?: string;
31
+
32
+ /**
33
+ * The body of the event.
34
+ */
35
+ data?: unknown;
36
+
37
+ /**
38
+ * The ID of the entity for the event.
39
+ */
40
+ entity_id?: string;
41
+
42
+ /**
43
+ * The name of the event.
44
+ */
45
+ event_name?: string;
46
+
47
+ /**
48
+ * The time of the event.
49
+ */
50
+ event_time?: string;
51
+
52
+ id?: string;
53
+
54
+ /**
55
+ * This field will be true if this object exists in the live environment or false
56
+ * if it exists in the test environment.
57
+ */
58
+ live_mode?: boolean;
59
+
60
+ object?: string;
61
+
62
+ /**
63
+ * The type of resource for the event.
64
+ */
65
+ resource?: string;
66
+
67
+ updated_at?: string;
68
+ }
69
+
70
+ export interface EventListParams extends PageParams {
71
+ entity_id?: string;
72
+
73
+ event_name?: string;
74
+
75
+ /**
76
+ * An inclusive upper bound for when the event occurred
77
+ */
78
+ event_time_end?: string;
79
+
80
+ /**
81
+ * An inclusive lower bound for when the event occurred
82
+ */
83
+ event_time_start?: string;
84
+
85
+ resource?: string;
86
+ }