@bloque/sdk-accounts 0.0.3
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.
- package/README.md +253 -0
- package/dist/api-types.d.ts +51 -0
- package/dist/bancolombia/client.d.ts +21 -0
- package/dist/bancolombia/types.d.ts +63 -0
- package/dist/card/client.d.ts +21 -0
- package/dist/card/types.d.ts +67 -0
- package/dist/client.d.ts +19 -0
- package/dist/index.cjs +124 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +87 -0
- package/package.json +54 -0
package/README.md
ADDED
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
# @bloque/sdk-accounts
|
|
2
|
+
|
|
3
|
+
Financial accounts and payment methods client for the [Bloque](https://www.bloque.app) platform.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **Virtual Cards**: Create virtual cards instantly
|
|
8
|
+
- **TypeScript First**: Built with TypeScript for complete type safety
|
|
9
|
+
- **Simple API**: Minimal input required - just URN and optional name
|
|
10
|
+
- **Fully Async**: Promise-based API for modern JavaScript workflows
|
|
11
|
+
- **Secure**: PCI-compliant card details URL
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
This package is included in the main `@bloque/sdk` package. You typically don't need to install it separately.
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
bun add @bloque/sdk
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
If you need to use this package standalone:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
bun add @bloque/sdk-accounts @bloque/sdk-core
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Usage
|
|
28
|
+
|
|
29
|
+
### With the Main SDK (Recommended)
|
|
30
|
+
|
|
31
|
+
```typescript
|
|
32
|
+
import { SDK } from '@bloque/sdk';
|
|
33
|
+
|
|
34
|
+
const bloque = new SDK({
|
|
35
|
+
apiKey: process.env.BLOQUE_API_KEY!,
|
|
36
|
+
mode: 'production',
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
// Create a virtual card
|
|
40
|
+
const card = await bloque.accounts.card.create({
|
|
41
|
+
urn: 'did:bloque:user:123',
|
|
42
|
+
name: 'My Virtual Card', // Optional
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
console.log('Card created:', card.urn);
|
|
46
|
+
console.log('Last four digits:', card.lastFour);
|
|
47
|
+
console.log('Card details URL:', card.detailsUrl);
|
|
48
|
+
console.log('Status:', card.status);
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## API Reference
|
|
52
|
+
|
|
53
|
+
### Card Accounts
|
|
54
|
+
|
|
55
|
+
Create virtual cards instantly.
|
|
56
|
+
|
|
57
|
+
#### `card.create(params)`
|
|
58
|
+
|
|
59
|
+
```typescript
|
|
60
|
+
const card = await bloque.accounts.card.create({
|
|
61
|
+
urn: 'did:bloque:user:123',
|
|
62
|
+
name: 'My Virtual Card', // Optional
|
|
63
|
+
});
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
**Parameters**:
|
|
67
|
+
|
|
68
|
+
```typescript
|
|
69
|
+
interface CreateCardParams {
|
|
70
|
+
/**
|
|
71
|
+
* URN of the account holder (user or organization)
|
|
72
|
+
* @example "did:bloque:user:123e4567"
|
|
73
|
+
*/
|
|
74
|
+
urn: string;
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Display name for the card (optional)
|
|
78
|
+
*/
|
|
79
|
+
name?: string;
|
|
80
|
+
}
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
**Returns**:
|
|
84
|
+
|
|
85
|
+
```typescript
|
|
86
|
+
interface CardAccount {
|
|
87
|
+
urn: string; // Unique resource name
|
|
88
|
+
id: string; // Card account ID
|
|
89
|
+
lastFour: string; // Last four digits
|
|
90
|
+
productType: 'CREDIT' | 'DEBIT'; // Card product type
|
|
91
|
+
status: 'active' | 'disabled' | 'frozen' | 'deleted' | 'creation_in_progress' | 'creation_failed';
|
|
92
|
+
cardType: 'VIRTUAL' | 'PHYSICAL'; // Card type
|
|
93
|
+
detailsUrl: string; // PCI-compliant URL to view card details
|
|
94
|
+
ownerUrn: string; // Owner URN
|
|
95
|
+
webhookUrl: string | null; // Webhook URL (if configured)
|
|
96
|
+
metadata?: Record<string, unknown>; // Custom metadata
|
|
97
|
+
createdAt: string; // Creation timestamp (ISO 8601)
|
|
98
|
+
updatedAt: string; // Last update timestamp (ISO 8601)
|
|
99
|
+
}
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
## Complete Examples
|
|
103
|
+
|
|
104
|
+
### Basic Card Creation
|
|
105
|
+
|
|
106
|
+
```typescript
|
|
107
|
+
import { SDK } from '@bloque/sdk';
|
|
108
|
+
|
|
109
|
+
const bloque = new SDK({
|
|
110
|
+
apiKey: process.env.BLOQUE_API_KEY!,
|
|
111
|
+
mode: 'production',
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
// Create a virtual card with just URN
|
|
115
|
+
const card = await bloque.accounts.card.create({
|
|
116
|
+
urn: 'did:bloque:user:123e4567',
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
console.log('Card created:', card.urn);
|
|
120
|
+
console.log('Last four:', card.lastFour);
|
|
121
|
+
console.log('Status:', card.status);
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### Card Creation with Name
|
|
125
|
+
|
|
126
|
+
```typescript
|
|
127
|
+
import { SDK } from '@bloque/sdk';
|
|
128
|
+
|
|
129
|
+
const bloque = new SDK({
|
|
130
|
+
apiKey: process.env.BLOQUE_API_KEY!,
|
|
131
|
+
mode: 'production',
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
// Create a named virtual card
|
|
135
|
+
const card = await bloque.accounts.card.create({
|
|
136
|
+
urn: 'did:bloque:user:123e4567',
|
|
137
|
+
name: 'My Business Card',
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
console.log('Card name:', card.metadata?.name);
|
|
141
|
+
console.log('Card details URL:', card.detailsUrl);
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
### Creating Multiple Cards
|
|
145
|
+
|
|
146
|
+
```typescript
|
|
147
|
+
import { SDK } from '@bloque/sdk';
|
|
148
|
+
|
|
149
|
+
const bloque = new SDK({
|
|
150
|
+
apiKey: process.env.BLOQUE_API_KEY!,
|
|
151
|
+
mode: 'production',
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
const userUrn = 'did:bloque:user:123e4567';
|
|
155
|
+
|
|
156
|
+
// Create multiple cards for the same user
|
|
157
|
+
const personalCard = await bloque.accounts.card.create({
|
|
158
|
+
urn: userUrn,
|
|
159
|
+
name: 'Personal Card',
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
const businessCard = await bloque.accounts.card.create({
|
|
163
|
+
urn: userUrn,
|
|
164
|
+
name: 'Business Card',
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
console.log('Personal card:', personalCard.lastFour);
|
|
168
|
+
console.log('Business card:', businessCard.lastFour);
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
### Error Handling
|
|
172
|
+
|
|
173
|
+
```typescript
|
|
174
|
+
import { SDK } from '@bloque/sdk';
|
|
175
|
+
|
|
176
|
+
const bloque = new SDK({
|
|
177
|
+
apiKey: process.env.BLOQUE_API_KEY!,
|
|
178
|
+
mode: 'production',
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
try {
|
|
182
|
+
const card = await bloque.accounts.card.create({
|
|
183
|
+
urn: 'did:bloque:user:123e4567',
|
|
184
|
+
name: 'My Card',
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
console.log('Card created successfully:', card.urn);
|
|
188
|
+
|
|
189
|
+
// Check if card is ready to use
|
|
190
|
+
if (card.status === 'active') {
|
|
191
|
+
console.log('Card is active and ready to use!');
|
|
192
|
+
} else if (card.status === 'creation_in_progress') {
|
|
193
|
+
console.log('Card is being created...');
|
|
194
|
+
}
|
|
195
|
+
} catch (error) {
|
|
196
|
+
if (error instanceof Error) {
|
|
197
|
+
console.error('Failed to create card:', error.message);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
## TypeScript Support
|
|
203
|
+
|
|
204
|
+
This package is written in TypeScript and includes complete type definitions:
|
|
205
|
+
|
|
206
|
+
```typescript
|
|
207
|
+
import type {
|
|
208
|
+
CardAccount,
|
|
209
|
+
CreateCardParams,
|
|
210
|
+
} from '@bloque/sdk-accounts';
|
|
211
|
+
|
|
212
|
+
// Type-safe card creation
|
|
213
|
+
const params: CreateCardParams = {
|
|
214
|
+
urn: 'did:bloque:user:123e4567',
|
|
215
|
+
name: 'My Card', // Optional
|
|
216
|
+
};
|
|
217
|
+
|
|
218
|
+
const card: CardAccount = await bloque.accounts.card.create(params);
|
|
219
|
+
|
|
220
|
+
// TypeScript infers all card properties with full type safety
|
|
221
|
+
console.log(card.lastFour); // string
|
|
222
|
+
console.log(card.status); // 'active' | 'disabled' | 'frozen' | 'deleted' | 'creation_in_progress' | 'creation_failed'
|
|
223
|
+
console.log(card.cardType); // 'VIRTUAL' | 'PHYSICAL'
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
## Card Status
|
|
227
|
+
|
|
228
|
+
Cards have a status field indicating their current state:
|
|
229
|
+
|
|
230
|
+
- `creation_in_progress`: Card is being created
|
|
231
|
+
- `creation_failed`: Card creation failed
|
|
232
|
+
- `active`: Card is active and ready to use
|
|
233
|
+
- `disabled`: Card has been disabled
|
|
234
|
+
- `frozen`: Card has been temporarily frozen
|
|
235
|
+
- `deleted`: Card has been deleted
|
|
236
|
+
|
|
237
|
+
## Requirements
|
|
238
|
+
|
|
239
|
+
- Node.js 22.x or higher / Bun 1.x or higher
|
|
240
|
+
- TypeScript 5.x or higher (for TypeScript projects)
|
|
241
|
+
|
|
242
|
+
## Links
|
|
243
|
+
|
|
244
|
+
- [Homepage](https://www.bloque.app)
|
|
245
|
+
- [Main SDK Documentation](../sdk/README.md)
|
|
246
|
+
- [GitHub Repository](https://github.com/bloque-app/sdk)
|
|
247
|
+
- [Issue Tracker](https://github.com/bloque-app/sdk/issues)
|
|
248
|
+
|
|
249
|
+
## License
|
|
250
|
+
|
|
251
|
+
[MIT](../../LICENSE)
|
|
252
|
+
|
|
253
|
+
Copyright (c) 2025-present Bloque Copilot Inc.
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
interface Account<TDetails = unknown> {
|
|
2
|
+
id: string;
|
|
3
|
+
urn: string;
|
|
4
|
+
medium: 'bancolombia' | 'card';
|
|
5
|
+
details: TDetails;
|
|
6
|
+
status: 'active' | 'disabled' | 'frozen' | 'deleted' | 'creation_in_progress' | 'creation_failed';
|
|
7
|
+
owner_urn: string;
|
|
8
|
+
created_at: string;
|
|
9
|
+
updated_at: string;
|
|
10
|
+
webhook_url: string | null;
|
|
11
|
+
metadata?: Record<string, unknown>;
|
|
12
|
+
}
|
|
13
|
+
export type CardType = 'VIRTUAL' | 'PHYSICAL';
|
|
14
|
+
export interface CreateAccountRequest<TInput = unknown> {
|
|
15
|
+
holder_urn: string;
|
|
16
|
+
input: TInput;
|
|
17
|
+
metadata?: Record<string, unknown>;
|
|
18
|
+
webhook_url?: string;
|
|
19
|
+
}
|
|
20
|
+
export type CreateCardAccountInput = {
|
|
21
|
+
create: {
|
|
22
|
+
card_type: CardType;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
export interface CreateAccountResponse<TDetails = unknown> {
|
|
26
|
+
result: {
|
|
27
|
+
account: Account<TDetails>;
|
|
28
|
+
};
|
|
29
|
+
req_id: string;
|
|
30
|
+
}
|
|
31
|
+
export type CardDetails = {
|
|
32
|
+
id: string;
|
|
33
|
+
email: string;
|
|
34
|
+
operational_country: 'COL';
|
|
35
|
+
client_id: string;
|
|
36
|
+
card_id: string;
|
|
37
|
+
card_last_four: string;
|
|
38
|
+
card_provider: 'VISA';
|
|
39
|
+
card_product_type: 'CREDIT';
|
|
40
|
+
card_status: 'ACTIVE';
|
|
41
|
+
card_url_details: string;
|
|
42
|
+
card_type: CardType;
|
|
43
|
+
user_id: string;
|
|
44
|
+
};
|
|
45
|
+
export type BancolombiaDetails = {
|
|
46
|
+
id: string;
|
|
47
|
+
reference_code: string;
|
|
48
|
+
payment_agreement_code: string;
|
|
49
|
+
network: string[];
|
|
50
|
+
};
|
|
51
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { HttpClient } from '@bloque/sdk-core';
|
|
2
|
+
import type { BancolombiaAccount, CreateBancolombiaAccountParams } from './types';
|
|
3
|
+
export declare class BancolombiaClient {
|
|
4
|
+
private readonly httpClient;
|
|
5
|
+
constructor(httpClient: HttpClient);
|
|
6
|
+
/**
|
|
7
|
+
* Create a new Bancolombia account
|
|
8
|
+
*
|
|
9
|
+
* @param params - Bancolombia account creation parameters
|
|
10
|
+
* @returns Promise resolving to the created Bancolombia account
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```typescript
|
|
14
|
+
* const account = await bloque.accounts.bancolombia.create({
|
|
15
|
+
* urn: 'did:bloque:user:123',
|
|
16
|
+
* name: 'Main Account'
|
|
17
|
+
* });
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
create(params: CreateBancolombiaAccountParams): Promise<BancolombiaAccount>;
|
|
21
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
export interface CreateBancolombiaAccountParams {
|
|
2
|
+
/**
|
|
3
|
+
* URN of the account holder (user or organization)
|
|
4
|
+
*
|
|
5
|
+
* @example "did:bloque:user:123e4567"
|
|
6
|
+
*/
|
|
7
|
+
urn: string;
|
|
8
|
+
/**
|
|
9
|
+
* Display name for the card
|
|
10
|
+
*/
|
|
11
|
+
name?: string;
|
|
12
|
+
/**
|
|
13
|
+
* URN of an existing card to link with the Bancolombia account
|
|
14
|
+
*
|
|
15
|
+
* @example "did:bloque:card:123e4567"
|
|
16
|
+
*/
|
|
17
|
+
cardUrn?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Custom metadata to attach to the Bancolombia account
|
|
20
|
+
*/
|
|
21
|
+
metadata?: Record<string, unknown>;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Bancolombia account response
|
|
25
|
+
*/
|
|
26
|
+
export interface BancolombiaAccount {
|
|
27
|
+
/**
|
|
28
|
+
* Unique resource name for the Bancolombia account
|
|
29
|
+
*/
|
|
30
|
+
urn: string;
|
|
31
|
+
/**
|
|
32
|
+
* Account ID
|
|
33
|
+
*/
|
|
34
|
+
id: string;
|
|
35
|
+
/**
|
|
36
|
+
* Reference code for the Bancolombia account
|
|
37
|
+
*/
|
|
38
|
+
referenceCode: string;
|
|
39
|
+
/**
|
|
40
|
+
* Account status
|
|
41
|
+
*/
|
|
42
|
+
status: 'creation_in_progress' | 'active' | 'disabled' | 'frozen' | 'deleted' | 'creation_failed';
|
|
43
|
+
/**
|
|
44
|
+
* Owner URN
|
|
45
|
+
*/
|
|
46
|
+
ownerUrn: string;
|
|
47
|
+
/**
|
|
48
|
+
* Webhook URL (if configured)
|
|
49
|
+
*/
|
|
50
|
+
webhookUrl: string | null;
|
|
51
|
+
/**
|
|
52
|
+
* Custom metadata
|
|
53
|
+
*/
|
|
54
|
+
metadata?: Record<string, unknown>;
|
|
55
|
+
/**
|
|
56
|
+
* Creation timestamp
|
|
57
|
+
*/
|
|
58
|
+
createdAt: string;
|
|
59
|
+
/**
|
|
60
|
+
* Last update timestamp
|
|
61
|
+
*/
|
|
62
|
+
updatedAt: string;
|
|
63
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { HttpClient } from '@bloque/sdk-core';
|
|
2
|
+
import type { CardAccount, CreateCardParams } from './types';
|
|
3
|
+
export declare class CardClient {
|
|
4
|
+
private readonly httpClient;
|
|
5
|
+
constructor(httpClient: HttpClient);
|
|
6
|
+
/**
|
|
7
|
+
* Create a new card account
|
|
8
|
+
*
|
|
9
|
+
* @param params - Card creation parameters
|
|
10
|
+
* @returns Promise resolving to the created card account
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```typescript
|
|
14
|
+
* const card = await bloque.accounts.card.create({
|
|
15
|
+
* urn: 'did:bloque:user:123',
|
|
16
|
+
* name: 'My Card',
|
|
17
|
+
* });
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
create(params: CreateCardParams): Promise<CardAccount>;
|
|
21
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import type { CardType } from '../api-types';
|
|
2
|
+
export interface CreateCardParams {
|
|
3
|
+
/**
|
|
4
|
+
* URN of the account holder (user or organization)
|
|
5
|
+
*
|
|
6
|
+
* @example "did:bloque:user:123e4567"
|
|
7
|
+
*/
|
|
8
|
+
urn: string;
|
|
9
|
+
/**
|
|
10
|
+
* Display name for the card
|
|
11
|
+
*/
|
|
12
|
+
name?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Custom metadata to associate with the card
|
|
15
|
+
*/
|
|
16
|
+
metadata?: Record<string, unknown>;
|
|
17
|
+
}
|
|
18
|
+
export interface CardAccount {
|
|
19
|
+
/**
|
|
20
|
+
* Unique resource name for the card account
|
|
21
|
+
*/
|
|
22
|
+
urn: string;
|
|
23
|
+
/**
|
|
24
|
+
* Card account ID
|
|
25
|
+
*/
|
|
26
|
+
id: string;
|
|
27
|
+
/**
|
|
28
|
+
* Last four digits of the card
|
|
29
|
+
*/
|
|
30
|
+
lastFour: string;
|
|
31
|
+
/**
|
|
32
|
+
* Type of card product (CREDIT, DEBIT)
|
|
33
|
+
*/
|
|
34
|
+
productType: 'CREDIT' | 'DEBIT';
|
|
35
|
+
/**
|
|
36
|
+
* Current status of the card
|
|
37
|
+
*/
|
|
38
|
+
status: 'active' | 'disabled' | 'frozen' | 'deleted' | 'creation_in_progress' | 'creation_failed';
|
|
39
|
+
/**
|
|
40
|
+
* Type of card (VIRTUAL, PHYSICAL)
|
|
41
|
+
*/
|
|
42
|
+
cardType: CardType;
|
|
43
|
+
/**
|
|
44
|
+
* URL to view card details (PCI-compliant)
|
|
45
|
+
*/
|
|
46
|
+
detailsUrl: string;
|
|
47
|
+
/**
|
|
48
|
+
* Owner URN
|
|
49
|
+
*/
|
|
50
|
+
ownerUrn: string;
|
|
51
|
+
/**
|
|
52
|
+
* Webhook URL (if configured)
|
|
53
|
+
*/
|
|
54
|
+
webhookUrl: string | null;
|
|
55
|
+
/**
|
|
56
|
+
* Custom metadata
|
|
57
|
+
*/
|
|
58
|
+
metadata?: Record<string, unknown>;
|
|
59
|
+
/**
|
|
60
|
+
* Creation timestamp
|
|
61
|
+
*/
|
|
62
|
+
createdAt: string;
|
|
63
|
+
/**
|
|
64
|
+
* Last update timestamp
|
|
65
|
+
*/
|
|
66
|
+
updatedAt: string;
|
|
67
|
+
}
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { HttpClient } from '@bloque/sdk-core';
|
|
2
|
+
import { BancolombiaClient } from './bancolombia/client';
|
|
3
|
+
import { CardClient } from './card/client';
|
|
4
|
+
/**
|
|
5
|
+
* Accounts client for managing financial accounts and payment methods
|
|
6
|
+
*
|
|
7
|
+
* Provides access to various account types through specialized sub-clients:
|
|
8
|
+
* - card: Credit/debit cards
|
|
9
|
+
* - virtual: Virtual accounts
|
|
10
|
+
* - bancolombia: Bancolombia accounts
|
|
11
|
+
* - us: US bank accounts
|
|
12
|
+
* - polygon: Polygon wallets
|
|
13
|
+
*/
|
|
14
|
+
export declare class AccountsClient {
|
|
15
|
+
private readonly httpClient;
|
|
16
|
+
readonly bancolombia: BancolombiaClient;
|
|
17
|
+
readonly card: CardClient;
|
|
18
|
+
constructor(httpClient: HttpClient);
|
|
19
|
+
}
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
AccountsClient: ()=>AccountsClient,
|
|
28
|
+
CardClient: ()=>CardClient
|
|
29
|
+
});
|
|
30
|
+
class CardClient {
|
|
31
|
+
httpClient;
|
|
32
|
+
constructor(httpClient){
|
|
33
|
+
this.httpClient = httpClient;
|
|
34
|
+
}
|
|
35
|
+
async create(params) {
|
|
36
|
+
const request = {
|
|
37
|
+
holder_urn: params.urn,
|
|
38
|
+
input: {
|
|
39
|
+
create: {
|
|
40
|
+
card_type: 'VIRTUAL'
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
metadata: {
|
|
44
|
+
source: "sdk-typescript",
|
|
45
|
+
name: params.name,
|
|
46
|
+
...params.metadata
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
const response = await this.httpClient.request({
|
|
50
|
+
method: 'POST',
|
|
51
|
+
path: '/api/mediums/card',
|
|
52
|
+
body: request
|
|
53
|
+
});
|
|
54
|
+
const account = response.result.account;
|
|
55
|
+
return {
|
|
56
|
+
urn: account.urn,
|
|
57
|
+
id: account.id,
|
|
58
|
+
lastFour: account.details.card_last_four,
|
|
59
|
+
productType: account.details.card_product_type,
|
|
60
|
+
status: account.status,
|
|
61
|
+
cardType: account.details.card_type,
|
|
62
|
+
detailsUrl: account.details.card_url_details,
|
|
63
|
+
ownerUrn: account.owner_urn,
|
|
64
|
+
webhookUrl: account.webhook_url,
|
|
65
|
+
metadata: account.metadata,
|
|
66
|
+
createdAt: account.created_at,
|
|
67
|
+
updatedAt: account.updated_at
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
class BancolombiaClient {
|
|
72
|
+
httpClient;
|
|
73
|
+
constructor(httpClient){
|
|
74
|
+
this.httpClient = httpClient;
|
|
75
|
+
}
|
|
76
|
+
async create(params) {
|
|
77
|
+
const request = {
|
|
78
|
+
holder_urn: params.urn,
|
|
79
|
+
input: {},
|
|
80
|
+
metadata: {
|
|
81
|
+
source: "sdk-typescript",
|
|
82
|
+
name: params.name,
|
|
83
|
+
card_urn: params.cardUrn,
|
|
84
|
+
...params.metadata
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
const response = await this.httpClient.request({
|
|
88
|
+
method: 'POST',
|
|
89
|
+
path: '/api/mediums/bancolombia',
|
|
90
|
+
body: request
|
|
91
|
+
});
|
|
92
|
+
const account = response.result.account;
|
|
93
|
+
return {
|
|
94
|
+
urn: account.urn,
|
|
95
|
+
id: account.id,
|
|
96
|
+
referenceCode: account.details.reference_code,
|
|
97
|
+
status: account.status,
|
|
98
|
+
ownerUrn: account.owner_urn,
|
|
99
|
+
webhookUrl: account.webhook_url,
|
|
100
|
+
metadata: account.metadata,
|
|
101
|
+
createdAt: account.created_at,
|
|
102
|
+
updatedAt: account.updated_at
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
class AccountsClient {
|
|
107
|
+
httpClient;
|
|
108
|
+
bancolombia;
|
|
109
|
+
card;
|
|
110
|
+
constructor(httpClient){
|
|
111
|
+
this.httpClient = httpClient;
|
|
112
|
+
this.bancolombia = new BancolombiaClient(this.httpClient);
|
|
113
|
+
this.card = new CardClient(this.httpClient);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
exports.AccountsClient = __webpack_exports__.AccountsClient;
|
|
117
|
+
exports.CardClient = __webpack_exports__.CardClient;
|
|
118
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
119
|
+
"AccountsClient",
|
|
120
|
+
"CardClient"
|
|
121
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
122
|
+
Object.defineProperty(exports, '__esModule', {
|
|
123
|
+
value: true
|
|
124
|
+
});
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
class CardClient {
|
|
2
|
+
httpClient;
|
|
3
|
+
constructor(httpClient){
|
|
4
|
+
this.httpClient = httpClient;
|
|
5
|
+
}
|
|
6
|
+
async create(params) {
|
|
7
|
+
const request = {
|
|
8
|
+
holder_urn: params.urn,
|
|
9
|
+
input: {
|
|
10
|
+
create: {
|
|
11
|
+
card_type: 'VIRTUAL'
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
metadata: {
|
|
15
|
+
source: "sdk-typescript",
|
|
16
|
+
name: params.name,
|
|
17
|
+
...params.metadata
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
const response = await this.httpClient.request({
|
|
21
|
+
method: 'POST',
|
|
22
|
+
path: '/api/mediums/card',
|
|
23
|
+
body: request
|
|
24
|
+
});
|
|
25
|
+
const account = response.result.account;
|
|
26
|
+
return {
|
|
27
|
+
urn: account.urn,
|
|
28
|
+
id: account.id,
|
|
29
|
+
lastFour: account.details.card_last_four,
|
|
30
|
+
productType: account.details.card_product_type,
|
|
31
|
+
status: account.status,
|
|
32
|
+
cardType: account.details.card_type,
|
|
33
|
+
detailsUrl: account.details.card_url_details,
|
|
34
|
+
ownerUrn: account.owner_urn,
|
|
35
|
+
webhookUrl: account.webhook_url,
|
|
36
|
+
metadata: account.metadata,
|
|
37
|
+
createdAt: account.created_at,
|
|
38
|
+
updatedAt: account.updated_at
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
class BancolombiaClient {
|
|
43
|
+
httpClient;
|
|
44
|
+
constructor(httpClient){
|
|
45
|
+
this.httpClient = httpClient;
|
|
46
|
+
}
|
|
47
|
+
async create(params) {
|
|
48
|
+
const request = {
|
|
49
|
+
holder_urn: params.urn,
|
|
50
|
+
input: {},
|
|
51
|
+
metadata: {
|
|
52
|
+
source: "sdk-typescript",
|
|
53
|
+
name: params.name,
|
|
54
|
+
card_urn: params.cardUrn,
|
|
55
|
+
...params.metadata
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
const response = await this.httpClient.request({
|
|
59
|
+
method: 'POST',
|
|
60
|
+
path: '/api/mediums/bancolombia',
|
|
61
|
+
body: request
|
|
62
|
+
});
|
|
63
|
+
const account = response.result.account;
|
|
64
|
+
return {
|
|
65
|
+
urn: account.urn,
|
|
66
|
+
id: account.id,
|
|
67
|
+
referenceCode: account.details.reference_code,
|
|
68
|
+
status: account.status,
|
|
69
|
+
ownerUrn: account.owner_urn,
|
|
70
|
+
webhookUrl: account.webhook_url,
|
|
71
|
+
metadata: account.metadata,
|
|
72
|
+
createdAt: account.created_at,
|
|
73
|
+
updatedAt: account.updated_at
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
class AccountsClient {
|
|
78
|
+
httpClient;
|
|
79
|
+
bancolombia;
|
|
80
|
+
card;
|
|
81
|
+
constructor(httpClient){
|
|
82
|
+
this.httpClient = httpClient;
|
|
83
|
+
this.bancolombia = new BancolombiaClient(this.httpClient);
|
|
84
|
+
this.card = new CardClient(this.httpClient);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
export { AccountsClient, CardClient };
|
package/package.json
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@bloque/sdk-accounts",
|
|
3
|
+
"version": "0.0.3",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"bloque",
|
|
7
|
+
"sdk",
|
|
8
|
+
"api",
|
|
9
|
+
"accounts",
|
|
10
|
+
"payments"
|
|
11
|
+
],
|
|
12
|
+
"license": "MIT",
|
|
13
|
+
"publishConfig": {
|
|
14
|
+
"access": "public",
|
|
15
|
+
"provenance": true
|
|
16
|
+
},
|
|
17
|
+
"homepage": "git+https://github.com/bloque-app/sdk.git#readme",
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "git+https://github.com/bloque-app/sdk.git",
|
|
21
|
+
"directory": "packages/accounts"
|
|
22
|
+
},
|
|
23
|
+
"exports": {
|
|
24
|
+
".": {
|
|
25
|
+
"types": "./dist/index.d.ts",
|
|
26
|
+
"import": "./dist/index.js",
|
|
27
|
+
"require": "./dist/index.cjs"
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"main": "./dist/index.cjs",
|
|
31
|
+
"types": "./dist/index.d.ts",
|
|
32
|
+
"files": [
|
|
33
|
+
"dist"
|
|
34
|
+
],
|
|
35
|
+
"engines": {
|
|
36
|
+
"node": ">=22"
|
|
37
|
+
},
|
|
38
|
+
"scripts": {
|
|
39
|
+
"build": "rslib build",
|
|
40
|
+
"dev": "rslib build --watch",
|
|
41
|
+
"clean": "rm -rf node_modules && rm -rf dist",
|
|
42
|
+
"check": "biome check --write",
|
|
43
|
+
"typecheck": "tsgo --noEmit"
|
|
44
|
+
},
|
|
45
|
+
"dependencies": {
|
|
46
|
+
"@bloque/sdk-core": "workspace:*"
|
|
47
|
+
},
|
|
48
|
+
"devDependencies": {
|
|
49
|
+
"@rslib/core": "catalog:",
|
|
50
|
+
"@types/node": "catalog:",
|
|
51
|
+
"@typescript/native-preview": "catalog:",
|
|
52
|
+
"typescript": "catalog:"
|
|
53
|
+
}
|
|
54
|
+
}
|