@bloque/sdk-accounts 0.0.22 → 0.0.24

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.
@@ -0,0 +1,104 @@
1
+ /**
2
+ * Parameters for creating a virtual account
3
+ */
4
+ export interface CreateVirtualAccountParams {
5
+ /**
6
+ * URN of the account holder (user or organization)
7
+ *
8
+ * @example "did:bloque:user:123e4567"
9
+ */
10
+ holderUrn?: string;
11
+ /**
12
+ * Account holder's first name
13
+ *
14
+ * @example "John"
15
+ */
16
+ firstName: string;
17
+ /**
18
+ * Account holder's last name
19
+ *
20
+ * @example "Doe"
21
+ */
22
+ lastName: string;
23
+ /**
24
+ * Ledger account ID to associate with the virtual account
25
+ * If not provided, a new ledger account will be created automatically
26
+ */
27
+ ledgerId?: string;
28
+ /**
29
+ * Webhook URL to receive account events
30
+ */
31
+ webhookUrl?: string;
32
+ /**
33
+ * Custom metadata to attach to the virtual account
34
+ * Must be a Record<string, string> (all values must be strings)
35
+ */
36
+ metadata?: Record<string, string>;
37
+ }
38
+ /**
39
+ * Parameters for updating virtual account metadata
40
+ */
41
+ export interface UpdateVirtualMetadataParams {
42
+ /**
43
+ * URN of the virtual account to update
44
+ *
45
+ * @example "did:bloque:mediums:virtual:account:123e4567"
46
+ */
47
+ urn: string;
48
+ /**
49
+ * Metadata to update
50
+ * Note: 'source' is a reserved field and cannot be modified
51
+ */
52
+ metadata: Record<string, string> & {
53
+ source?: never;
54
+ };
55
+ }
56
+ /**
57
+ * Virtual account response
58
+ */
59
+ export interface VirtualAccount {
60
+ /**
61
+ * Unique resource name for the virtual account
62
+ */
63
+ urn: string;
64
+ /**
65
+ * Account ID
66
+ */
67
+ id: string;
68
+ /**
69
+ * Account holder's first name
70
+ */
71
+ firstName: string;
72
+ /**
73
+ * Account holder's last name
74
+ */
75
+ lastName: string;
76
+ /**
77
+ * Account status
78
+ */
79
+ status: 'creation_in_progress' | 'active' | 'disabled' | 'frozen' | 'deleted' | 'creation_failed';
80
+ /**
81
+ * Owner URN
82
+ */
83
+ ownerUrn: string;
84
+ /**
85
+ * Ledger account ID associated with the virtual account
86
+ */
87
+ ledgerId: string;
88
+ /**
89
+ * Webhook URL (if configured)
90
+ */
91
+ webhookUrl: string | null;
92
+ /**
93
+ * Custom metadata
94
+ */
95
+ metadata?: Record<string, string>;
96
+ /**
97
+ * Creation timestamp
98
+ */
99
+ createdAt: string;
100
+ /**
101
+ * Last update timestamp
102
+ */
103
+ updatedAt: string;
104
+ }
@@ -0,0 +1,90 @@
1
+ import { BaseClient } from '@bloque/sdk-core';
2
+ import type { CreateVirtualAccountParams, UpdateVirtualMetadataParams, VirtualAccount } from './types';
3
+ export declare class VirtualClient extends BaseClient {
4
+ /**
5
+ * Create a new virtual account
6
+ *
7
+ * Virtual accounts are simple testing accounts requiring only basic personal information.
8
+ * They're useful for development and testing purposes.
9
+ *
10
+ * @param params - Virtual account creation parameters
11
+ * @returns Promise resolving to the created virtual account
12
+ *
13
+ * @example
14
+ * ```typescript
15
+ * const account = await bloque.accounts.virtual.create({
16
+ * firstName: 'John',
17
+ * lastName: 'Doe'
18
+ * });
19
+ * ```
20
+ */
21
+ create(params: CreateVirtualAccountParams): Promise<VirtualAccount>;
22
+ /**
23
+ * Update virtual account metadata
24
+ *
25
+ * @param params - Metadata update parameters
26
+ * @returns Promise resolving to the updated virtual account
27
+ *
28
+ * @example
29
+ * ```typescript
30
+ * const account = await bloque.accounts.virtual.updateMetadata({
31
+ * urn: 'did:bloque:mediums:virtual:account:123',
32
+ * metadata: {
33
+ * updated_by: 'admin',
34
+ * update_reason: 'testing_update'
35
+ * }
36
+ * });
37
+ * ```
38
+ */
39
+ updateMetadata(params: UpdateVirtualMetadataParams): Promise<VirtualAccount>;
40
+ /**
41
+ * Activate a virtual account
42
+ *
43
+ * @param urn - Virtual account URN
44
+ * @returns Promise resolving to the updated virtual account
45
+ *
46
+ * @example
47
+ * ```typescript
48
+ * const account = await bloque.accounts.virtual.activate(
49
+ * 'did:bloque:mediums:virtual:account:123'
50
+ * );
51
+ * ```
52
+ */
53
+ activate(urn: string): Promise<VirtualAccount>;
54
+ /**
55
+ * Freeze a virtual account
56
+ *
57
+ * @param urn - Virtual account URN
58
+ * @returns Promise resolving to the updated virtual account
59
+ *
60
+ * @example
61
+ * ```typescript
62
+ * const account = await bloque.accounts.virtual.freeze(
63
+ * 'did:bloque:mediums:virtual:account:123'
64
+ * );
65
+ * ```
66
+ */
67
+ freeze(urn: string): Promise<VirtualAccount>;
68
+ /**
69
+ * Disable a virtual account
70
+ *
71
+ * @param urn - Virtual account URN
72
+ * @returns Promise resolving to the updated virtual account
73
+ *
74
+ * @example
75
+ * ```typescript
76
+ * const account = await bloque.accounts.virtual.disable(
77
+ * 'did:bloque:mediums:virtual:account:123'
78
+ * );
79
+ * ```
80
+ */
81
+ disable(urn: string): Promise<VirtualAccount>;
82
+ /**
83
+ * Private method to update virtual account status
84
+ */
85
+ private _updateStatus;
86
+ /**
87
+ * Private method to map API response to VirtualAccount
88
+ */
89
+ private _mapAccountResponse;
90
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bloque/sdk-accounts",
3
- "version": "0.0.22",
3
+ "version": "0.0.24",
4
4
  "type": "module",
5
5
  "keywords": [
6
6
  "bloque",
@@ -36,6 +36,6 @@
36
36
  "node": ">=22"
37
37
  },
38
38
  "dependencies": {
39
- "@bloque/sdk-core": "0.0.22"
39
+ "@bloque/sdk-core": "0.0.24"
40
40
  }
41
41
  }
@@ -1,65 +0,0 @@
1
- export type AccountStatus = 'active' | 'disabled' | 'frozen' | 'deleted' | 'creation_in_progress' | 'creation_failed';
2
- interface Account<TDetails = unknown> {
3
- id: string;
4
- urn: string;
5
- medium: 'bancolombia' | 'card';
6
- details: TDetails;
7
- ledger_account_id: string;
8
- status: AccountStatus;
9
- owner_urn: string;
10
- created_at: string;
11
- updated_at: string;
12
- webhook_url: string | null;
13
- metadata?: Record<string, unknown>;
14
- }
15
- export type CardType = 'VIRTUAL' | 'PHYSICAL';
16
- export interface CreateAccountRequest<TInput = unknown> {
17
- holder_urn: string;
18
- ledger_account_id?: string;
19
- input: TInput;
20
- metadata?: Record<string, unknown>;
21
- webhook_url?: string;
22
- }
23
- export type CreateCardAccountInput = {
24
- create: {
25
- card_type: CardType;
26
- };
27
- };
28
- export interface CreateAccountResponse<TDetails = unknown> {
29
- result: {
30
- account: Account<TDetails>;
31
- };
32
- req_id: string;
33
- }
34
- export type CardDetails = {
35
- id: string;
36
- email: string;
37
- operational_country: 'COL';
38
- client_id: string;
39
- card_id: string;
40
- card_last_four: string;
41
- card_provider: 'VISA';
42
- card_product_type: 'CREDIT';
43
- card_status: 'ACTIVE';
44
- card_url_details: string;
45
- card_type: CardType;
46
- user_id: string;
47
- };
48
- export type BancolombiaDetails = {
49
- id: string;
50
- reference_code: string;
51
- payment_agreement_code: string;
52
- network: string[];
53
- };
54
- export interface UpdateAccountRequest<TInput = unknown> {
55
- input?: TInput;
56
- metadata?: Record<string, unknown>;
57
- status?: AccountStatus;
58
- }
59
- export interface UpdateAccountResponse<TDetails = unknown> {
60
- result: {
61
- account: Account<TDetails>;
62
- };
63
- req_id: string;
64
- }
65
- export {};
package/dist/client.d.ts DELETED
@@ -1,19 +0,0 @@
1
- import type { HttpClient } from '@bloque/sdk-core';
2
- import { BaseClient } from '@bloque/sdk-core';
3
- import { BancolombiaClient } from './bancolombia/client';
4
- import { CardClient } from './card/client';
5
- /**
6
- * Accounts client for managing financial accounts and payment methods
7
- *
8
- * Provides access to various account types through specialized sub-clients:
9
- * - card: Credit/debit cards
10
- * - virtual: Virtual accounts
11
- * - bancolombia: Bancolombia accounts
12
- * - us: US bank accounts
13
- * - polygon: Polygon wallets
14
- */
15
- export declare class AccountsClient extends BaseClient {
16
- readonly bancolombia: BancolombiaClient;
17
- readonly card: CardClient;
18
- constructor(httpClient: HttpClient);
19
- }