@augustusbank/typescript-sdk 0.13.0 → 0.15.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 (53) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/client.d.mts +5 -2
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +5 -2
  5. package/client.d.ts.map +1 -1
  6. package/client.js +3 -0
  7. package/client.js.map +1 -1
  8. package/client.mjs +4 -1
  9. package/client.mjs.map +1 -1
  10. package/package.json +1 -1
  11. package/resources/account-openings.d.mts +204 -0
  12. package/resources/account-openings.d.mts.map +1 -0
  13. package/resources/account-openings.d.ts +204 -0
  14. package/resources/account-openings.d.ts.map +1 -0
  15. package/resources/account-openings.js +16 -0
  16. package/resources/account-openings.js.map +1 -0
  17. package/resources/account-openings.mjs +12 -0
  18. package/resources/account-openings.mjs.map +1 -0
  19. package/resources/api-keys.d.mts +1 -1
  20. package/resources/api-keys.d.mts.map +1 -1
  21. package/resources/api-keys.d.ts +1 -1
  22. package/resources/api-keys.d.ts.map +1 -1
  23. package/resources/index.d.mts +2 -1
  24. package/resources/index.d.mts.map +1 -1
  25. package/resources/index.d.ts +2 -1
  26. package/resources/index.d.ts.map +1 -1
  27. package/resources/index.js +3 -1
  28. package/resources/index.js.map +1 -1
  29. package/resources/index.mjs +2 -1
  30. package/resources/index.mjs.map +1 -1
  31. package/resources/returns.d.mts +160 -1
  32. package/resources/returns.d.mts.map +1 -1
  33. package/resources/returns.d.ts +160 -1
  34. package/resources/returns.d.ts.map +1 -1
  35. package/resources/returns.js +13 -0
  36. package/resources/returns.js.map +1 -1
  37. package/resources/returns.mjs +13 -0
  38. package/resources/returns.mjs.map +1 -1
  39. package/resources/scopes.d.mts +1 -1
  40. package/resources/scopes.d.mts.map +1 -1
  41. package/resources/scopes.d.ts +1 -1
  42. package/resources/scopes.d.ts.map +1 -1
  43. package/src/client.ts +31 -2
  44. package/src/resources/account-openings.ts +1016 -0
  45. package/src/resources/api-keys.ts +1 -0
  46. package/src/resources/index.ts +14 -1
  47. package/src/resources/returns.ts +236 -1
  48. package/src/resources/scopes.ts +1 -0
  49. package/src/version.ts +1 -1
  50. package/version.d.mts +1 -1
  51. package/version.d.ts +1 -1
  52. package/version.js +1 -1
  53. package/version.mjs +1 -1
@@ -64,6 +64,7 @@ export interface APIKeyIntrospectResponse {
64
64
  | 'quotes:read'
65
65
  | 'accounts:read'
66
66
  | 'accounts:write'
67
+ | 'account_openings:write'
67
68
  | 'account_programs:read'
68
69
  | 'webhook_subscriptions:read'
69
70
  | 'webhook_subscriptions:write'
@@ -2,6 +2,11 @@
2
2
 
3
3
  export { APIKeys, type APIKeyIntrospectResponse } from './api-keys';
4
4
  export { APIVersions, type APIVersionListResponse } from './api-versions';
5
+ export {
6
+ AccountOpenings,
7
+ type AccountOpeningCreateResponse,
8
+ type AccountOpeningCreateParams,
9
+ } from './account-openings';
5
10
  export {
6
11
  AccountPrograms,
7
12
  type AccountProgramRetrieveResponse,
@@ -57,7 +62,15 @@ export {
57
62
  type PayoutListResponsesCursorPage,
58
63
  } from './payouts';
59
64
  export { Quotes, type QuoteRetrieveResponse } from './quotes/quotes';
60
- export { Returns, type ReturnRetrieveResponse } from './returns';
65
+ export {
66
+ Returns,
67
+ type ReturnCreateResponse,
68
+ type ReturnRetrieveResponse,
69
+ type ReturnListResponse,
70
+ type ReturnCreateParams,
71
+ type ReturnListParams,
72
+ type ReturnListResponsesCursorPage,
73
+ } from './returns';
61
74
  export { Scopes, type ScopeListResponse } from './scopes';
62
75
  export {
63
76
  WebhookDeliveries,
@@ -2,16 +2,119 @@
2
2
 
3
3
  import { APIResource } from '../core/resource';
4
4
  import { APIPromise } from '../core/api-promise';
5
+ import { CursorPage, type CursorPageParams, PagePromise } from '../core/pagination';
5
6
  import { RequestOptions } from '../internal/request-options';
6
7
  import { path } from '../internal/utils/path';
7
8
 
8
9
  export class Returns extends APIResource {
10
+ /**
11
+ * Initiates a return of funds from a deposit to the source.
12
+ */
13
+ create(body: ReturnCreateParams, options?: RequestOptions): APIPromise<ReturnCreateResponse> {
14
+ return this._client.post('/v1/returns', { body, ...options });
15
+ }
16
+
9
17
  /**
10
18
  * Retrieves a return by ID.
11
19
  */
12
20
  retrieve(id: string, options?: RequestOptions): APIPromise<ReturnRetrieveResponse> {
13
21
  return this._client.get(path`/v1/returns/${id}`, options);
14
22
  }
23
+
24
+ /**
25
+ * Lists deposit returns for the merchant with cursor-based pagination.
26
+ */
27
+ list(
28
+ query: ReturnListParams | null | undefined = {},
29
+ options?: RequestOptions,
30
+ ): PagePromise<ReturnListResponsesCursorPage, ReturnListResponse> {
31
+ return this._client.getAPIList('/v1/returns', CursorPage<ReturnListResponse>, { query, ...options });
32
+ }
33
+ }
34
+
35
+ export type ReturnListResponsesCursorPage = CursorPage<ReturnListResponse>;
36
+
37
+ export interface ReturnCreateResponse {
38
+ /**
39
+ * Unique identifier of the return.
40
+ */
41
+ id: string;
42
+
43
+ /**
44
+ * Amount as a string decimal (e.g. "100.50").
45
+ */
46
+ amount: string;
47
+
48
+ /**
49
+ * ISO 8601 UTC timestamp when the return was created.
50
+ */
51
+ created_at: string;
52
+
53
+ /**
54
+ * Currency code (ISO 4217 currency code or crypto currency code).
55
+ */
56
+ currency: 'EUR' | 'GBP' | 'USD' | 'USDC' | 'BTC';
57
+
58
+ /**
59
+ * ID of the parent deposit.
60
+ */
61
+ deposit_id: string;
62
+
63
+ /**
64
+ * Failure details when status is failed, otherwise null.
65
+ */
66
+ failure: ReturnCreateResponse.Failure | null;
67
+
68
+ /**
69
+ * Current status of the return.
70
+ */
71
+ status: 'pending' | 'paid' | 'failed' | 'returned';
72
+
73
+ /**
74
+ * Type of the resource.
75
+ */
76
+ type: 'return';
77
+
78
+ /**
79
+ * ISO 8601 UTC timestamp when the return was last updated.
80
+ */
81
+ updated_at: string;
82
+ }
83
+
84
+ export namespace ReturnCreateResponse {
85
+ /**
86
+ * Failure details when status is failed, otherwise null.
87
+ */
88
+ export interface Failure {
89
+ /**
90
+ * Failure code.
91
+ */
92
+ code:
93
+ | 'account_closed'
94
+ | 'account_blocked'
95
+ | 'insufficient_funds'
96
+ | 'invalid_account_format'
97
+ | 'invalid_instruction'
98
+ | 'invalid_amount'
99
+ | 'invalid_time'
100
+ | 'duplicate_transaction'
101
+ | 'payee_verification_failed'
102
+ | 'system_error'
103
+ | 'provider_system_error'
104
+ | 'rejected_by_correspondent_bank'
105
+ | 'blocked_by_review'
106
+ | 'unknown';
107
+
108
+ /**
109
+ * Human-readable description of the failure.
110
+ */
111
+ message: string;
112
+
113
+ /**
114
+ * Whether the return can be retried.
115
+ */
116
+ retry: boolean;
117
+ }
15
118
  }
16
119
 
17
120
  export interface ReturnRetrieveResponse {
@@ -97,6 +200,138 @@ export namespace ReturnRetrieveResponse {
97
200
  }
98
201
  }
99
202
 
203
+ export interface ReturnListResponse {
204
+ /**
205
+ * Unique identifier of the return.
206
+ */
207
+ id: string;
208
+
209
+ /**
210
+ * Amount as a string decimal (e.g. "100.50").
211
+ */
212
+ amount: string;
213
+
214
+ /**
215
+ * ISO 8601 UTC timestamp when the return was created.
216
+ */
217
+ created_at: string;
218
+
219
+ /**
220
+ * Currency code (ISO 4217 currency code or crypto currency code).
221
+ */
222
+ currency: 'EUR' | 'GBP' | 'USD' | 'USDC' | 'BTC';
223
+
224
+ /**
225
+ * ID of the parent deposit.
226
+ */
227
+ deposit_id: string;
228
+
229
+ /**
230
+ * Failure details when status is failed, otherwise null.
231
+ */
232
+ failure: ReturnListResponse.Failure | null;
233
+
234
+ /**
235
+ * Current status of the return.
236
+ */
237
+ status: 'pending' | 'paid' | 'failed' | 'returned';
238
+
239
+ /**
240
+ * Type of the resource.
241
+ */
242
+ type: 'return';
243
+
244
+ /**
245
+ * ISO 8601 UTC timestamp when the return was last updated.
246
+ */
247
+ updated_at: string;
248
+ }
249
+
250
+ export namespace ReturnListResponse {
251
+ /**
252
+ * Failure details when status is failed, otherwise null.
253
+ */
254
+ export interface Failure {
255
+ /**
256
+ * Failure code.
257
+ */
258
+ code:
259
+ | 'account_closed'
260
+ | 'account_blocked'
261
+ | 'insufficient_funds'
262
+ | 'invalid_account_format'
263
+ | 'invalid_instruction'
264
+ | 'invalid_amount'
265
+ | 'invalid_time'
266
+ | 'duplicate_transaction'
267
+ | 'payee_verification_failed'
268
+ | 'system_error'
269
+ | 'provider_system_error'
270
+ | 'rejected_by_correspondent_bank'
271
+ | 'blocked_by_review'
272
+ | 'unknown';
273
+
274
+ /**
275
+ * Human-readable description of the failure.
276
+ */
277
+ message: string;
278
+
279
+ /**
280
+ * Whether the return can be retried.
281
+ */
282
+ retry: boolean;
283
+ }
284
+ }
285
+
286
+ export interface ReturnCreateParams {
287
+ /**
288
+ * Deposit to return funds from.
289
+ */
290
+ deposit_id: string;
291
+
292
+ /**
293
+ * Payment rail when the deposit allows multiple schemes.
294
+ */
295
+ rail?: 'sepa_instant' | 'sepa' | 'faster_payments';
296
+ }
297
+
298
+ export interface ReturnListParams extends CursorPageParams {
299
+ created_at?: ReturnListParams.CreatedAt;
300
+
301
+ /**
302
+ * Filter returns belonging to this deposit.
303
+ */
304
+ deposit_id?: string;
305
+
306
+ /**
307
+ * Current status of the return.
308
+ */
309
+ status?: 'pending' | 'paid' | 'failed' | 'returned';
310
+ }
311
+
312
+ export namespace ReturnListParams {
313
+ export interface CreatedAt {
314
+ /**
315
+ * Include returns whose created_at is greater than or equal to this ISO 8601
316
+ * timestamp.
317
+ */
318
+ gte?: string;
319
+
320
+ /**
321
+ * Include returns whose created_at is less than or equal to this ISO 8601
322
+ * timestamp.
323
+ */
324
+ lte?: string;
325
+ }
326
+ }
327
+
100
328
  export declare namespace Returns {
101
- export { type ReturnRetrieveResponse as ReturnRetrieveResponse };
329
+ export {
330
+ type ReturnCreateResponse as ReturnCreateResponse,
331
+ type ReturnRetrieveResponse as ReturnRetrieveResponse,
332
+ type ReturnListResponse as ReturnListResponse,
333
+ type ReturnListResponsesCursorPage as ReturnListResponsesCursorPage,
334
+ type ReturnCreateParams as ReturnCreateParams,
335
+ type ReturnListParams as ReturnListParams,
336
+ };
102
337
  }
@@ -39,6 +39,7 @@ export namespace ScopeListResponse {
39
39
  | 'quotes:read'
40
40
  | 'accounts:read'
41
41
  | 'accounts:write'
42
+ | 'account_openings:write'
42
43
  | 'account_programs:read'
43
44
  | 'webhook_subscriptions:read'
44
45
  | 'webhook_subscriptions:write'
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '0.13.0'; // x-release-please-version
1
+ export const VERSION = '0.15.0'; // x-release-please-version
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.13.0";
1
+ export declare const VERSION = "0.15.0";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.13.0";
1
+ export declare const VERSION = "0.15.0";
2
2
  //# sourceMappingURL=version.d.ts.map
package/version.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
- exports.VERSION = '0.13.0'; // x-release-please-version
4
+ exports.VERSION = '0.15.0'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '0.13.0'; // x-release-please-version
1
+ export const VERSION = '0.15.0'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map