@fiddupay/fiddupay-node 2.4.4 → 2.4.6
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 +33 -2
- package/dist/src/client.d.ts +19 -0
- package/dist/src/client.d.ts.map +1 -0
- package/dist/src/client.js +148 -0
- package/dist/src/client.js.map +1 -0
- package/dist/src/errors/index.d.ts +28 -0
- package/dist/src/errors/index.d.ts.map +1 -0
- package/dist/src/errors/index.js +59 -0
- package/dist/src/errors/index.js.map +1 -0
- package/dist/src/index.d.ts +41 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +98 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/resources/analytics.d.ts +23 -0
- package/dist/src/resources/analytics.d.ts.map +1 -0
- package/dist/src/resources/analytics.js +36 -0
- package/dist/src/resources/analytics.js.map +1 -0
- package/dist/src/resources/balances.d.ts +23 -0
- package/dist/src/resources/balances.d.ts.map +1 -0
- package/dist/src/resources/balances.js +54 -0
- package/dist/src/resources/balances.js.map +1 -0
- package/dist/src/resources/contact.d.ts +19 -0
- package/dist/src/resources/contact.d.ts.map +1 -0
- package/dist/src/resources/contact.js +17 -0
- package/dist/src/resources/contact.js.map +1 -0
- package/dist/src/resources/customers.d.ts +104 -0
- package/dist/src/resources/customers.d.ts.map +1 -0
- package/dist/src/resources/customers.js +106 -0
- package/dist/src/resources/customers.js.map +1 -0
- package/dist/src/resources/invoices.d.ts +14 -0
- package/dist/src/resources/invoices.d.ts.map +1 -0
- package/dist/src/resources/invoices.js +19 -0
- package/dist/src/resources/invoices.js.map +1 -0
- package/dist/src/resources/merchants.d.ts +102 -0
- package/dist/src/resources/merchants.d.ts.map +1 -0
- package/dist/src/resources/merchants.js +104 -0
- package/dist/src/resources/merchants.js.map +1 -0
- package/dist/src/resources/payments.d.ts +71 -0
- package/dist/src/resources/payments.d.ts.map +1 -0
- package/dist/src/resources/payments.js +206 -0
- package/dist/src/resources/payments.js.map +1 -0
- package/dist/src/resources/refunds.d.ts +31 -0
- package/dist/src/resources/refunds.d.ts.map +1 -0
- package/dist/src/resources/refunds.js +66 -0
- package/dist/src/resources/refunds.js.map +1 -0
- package/dist/src/resources/sandbox.d.ts +11 -0
- package/dist/src/resources/sandbox.d.ts.map +1 -0
- package/dist/src/resources/sandbox.js +16 -0
- package/dist/src/resources/sandbox.js.map +1 -0
- package/dist/src/resources/security.d.ts +56 -0
- package/dist/src/resources/security.d.ts.map +1 -0
- package/dist/src/resources/security.js +70 -0
- package/dist/src/resources/security.js.map +1 -0
- package/dist/src/resources/transactions.d.ts +25 -0
- package/dist/src/resources/transactions.d.ts.map +1 -0
- package/dist/src/resources/transactions.js +21 -0
- package/dist/src/resources/transactions.js.map +1 -0
- package/dist/src/resources/wallets.d.ts +64 -0
- package/dist/src/resources/wallets.d.ts.map +1 -0
- package/dist/src/resources/wallets.js +78 -0
- package/dist/src/resources/wallets.js.map +1 -0
- package/dist/src/resources/webhooks.d.ts +17 -0
- package/dist/src/resources/webhooks.d.ts.map +1 -0
- package/dist/src/resources/webhooks.js +130 -0
- package/dist/src/resources/webhooks.js.map +1 -0
- package/dist/src/resources/withdrawals.d.ts +39 -0
- package/dist/src/resources/withdrawals.d.ts.map +1 -0
- package/dist/src/resources/withdrawals.js +69 -0
- package/dist/src/resources/withdrawals.js.map +1 -0
- package/dist/src/types/index.d.ts +531 -0
- package/dist/src/types/index.d.ts.map +1 -0
- package/dist/src/types/index.js +8 -0
- package/dist/src/types/index.js.map +1 -0
- package/dist/tests/error-handling.test.d.ts +2 -0
- package/dist/tests/error-handling.test.d.ts.map +1 -0
- package/dist/tests/error-handling.test.js +168 -0
- package/dist/tests/error-handling.test.js.map +1 -0
- package/dist/tests/fiddupay.test.d.ts +2 -0
- package/dist/tests/fiddupay.test.d.ts.map +1 -0
- package/dist/tests/fiddupay.test.js +336 -0
- package/dist/tests/fiddupay.test.js.map +1 -0
- package/dist/tests/sdk-integration.test.d.ts +2 -0
- package/dist/tests/sdk-integration.test.d.ts.map +1 -0
- package/dist/tests/sdk-integration.test.js +229 -0
- package/dist/tests/sdk-integration.test.js.map +1 -0
- package/dist/tests/setup.d.ts +2 -0
- package/dist/tests/setup.d.ts.map +1 -0
- package/dist/tests/setup.js +22 -0
- package/dist/tests/setup.js.map +1 -0
- package/dist/tests/webhooks.test.d.ts +2 -0
- package/dist/tests/webhooks.test.d.ts.map +1 -0
- package/dist/tests/webhooks.test.js +63 -0
- package/dist/tests/webhooks.test.js.map +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
# FidduPay Node.js SDK v2.4.
|
|
1
|
+
# FidduPay Node.js SDK v2.4.6
|
|
2
2
|
|
|
3
|
-
[](https://github.com/fiddupay/fiddupay-node)
|
|
4
4
|
[](https://www.npmjs.com/package/@fiddupay/fiddupay-node)
|
|
5
5
|
[](https://github.com/fiddupay/fiddupay-node/actions)
|
|
6
6
|
[](https://opensource.org/licenses/MIT)
|
|
@@ -185,6 +185,10 @@ await client.wallets.setup({
|
|
|
185
185
|
is_active: true
|
|
186
186
|
});
|
|
187
187
|
|
|
188
|
+
// Wallet Security locks (New in v2.4.6)
|
|
189
|
+
await client.security.toggleWalletLock(true); // Lock master wallets
|
|
190
|
+
await client.security.toggleCustomerWalletLock(true); // Lock customer wallets
|
|
191
|
+
|
|
188
192
|
```
|
|
189
193
|
|
|
190
194
|
## Refund Operations
|
|
@@ -201,6 +205,33 @@ const refund = await client.refunds.create({
|
|
|
201
205
|
const refunds = await client.refunds.list({
|
|
202
206
|
paymentId: 'pay_123'
|
|
203
207
|
});
|
|
208
|
+
|
|
209
|
+
## Customer Management
|
|
210
|
+
|
|
211
|
+
```typescript
|
|
212
|
+
// Register a customer
|
|
213
|
+
const customer = await client.customers.register({
|
|
214
|
+
external_id: 'user_123',
|
|
215
|
+
email: 'user@example.com'
|
|
216
|
+
});
|
|
217
|
+
|
|
218
|
+
// Provision wallets
|
|
219
|
+
await client.customers.createWallets('user_123', {
|
|
220
|
+
external_id: 'user_123',
|
|
221
|
+
networks: ['evm', 'solana']
|
|
222
|
+
});
|
|
223
|
+
|
|
224
|
+
// Update permissions (New in v2.4.6)
|
|
225
|
+
await client.customers.updatePermissions('user_123', {
|
|
226
|
+
can_withdraw: true,
|
|
227
|
+
withdrawal_limit: '500.0'
|
|
228
|
+
});
|
|
229
|
+
|
|
230
|
+
// Sweep funds to master wallet
|
|
231
|
+
await client.customers.sweep('user_123', {
|
|
232
|
+
crypto_type: 'USDT_ETH'
|
|
233
|
+
});
|
|
234
|
+
```
|
|
204
235
|
```
|
|
205
236
|
|
|
206
237
|
## Analytics
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { FidduPayConfig, RequestOptions } from './types';
|
|
2
|
+
export declare class HttpClient {
|
|
3
|
+
private client;
|
|
4
|
+
private apiKey;
|
|
5
|
+
private maxRetries;
|
|
6
|
+
constructor(config: FidduPayConfig);
|
|
7
|
+
private getBaseURL;
|
|
8
|
+
private setupInterceptors;
|
|
9
|
+
private handleAPIError;
|
|
10
|
+
private generateRequestId;
|
|
11
|
+
private sleep;
|
|
12
|
+
request<T>(method: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH', path: string, data?: any, options?: RequestOptions): Promise<T>;
|
|
13
|
+
get<T>(path: string, options?: RequestOptions): Promise<T>;
|
|
14
|
+
post<T>(path: string, data?: any, options?: RequestOptions): Promise<T>;
|
|
15
|
+
put<T>(path: string, data?: any, options?: RequestOptions): Promise<T>;
|
|
16
|
+
delete<T>(path: string, options?: RequestOptions): Promise<T>;
|
|
17
|
+
patch<T>(path: string, data?: any, options?: RequestOptions): Promise<T>;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,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(mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.HttpClient = void 0;
|
|
7
|
+
const axios_1 = __importDefault(require("axios"));
|
|
8
|
+
const errors_1 = require("./errors");
|
|
9
|
+
class HttpClient {
|
|
10
|
+
constructor(config) {
|
|
11
|
+
this.apiKey = config.apiKey;
|
|
12
|
+
this.maxRetries = config.maxRetries || 3;
|
|
13
|
+
const baseURL = config.baseURL || this.getBaseURL(config.environment || 'sandbox');
|
|
14
|
+
this.client = axios_1.default.create({
|
|
15
|
+
baseURL,
|
|
16
|
+
timeout: config.timeout || 30000,
|
|
17
|
+
headers: {
|
|
18
|
+
'Content-Type': 'application/json',
|
|
19
|
+
'User-Agent': 'FidduPay-Node/1.0.0'
|
|
20
|
+
},
|
|
21
|
+
// Security configurations
|
|
22
|
+
maxRedirects: 0, // Prevent redirect attacks
|
|
23
|
+
validateStatus: (status) => status >= 200 && status < 300,
|
|
24
|
+
});
|
|
25
|
+
this.setupInterceptors();
|
|
26
|
+
}
|
|
27
|
+
getBaseURL(environment) {
|
|
28
|
+
return environment === 'production'
|
|
29
|
+
? 'https://api.fiddupay.com/v1'
|
|
30
|
+
: 'https://api-sandbox.fiddupay.com/v1';
|
|
31
|
+
}
|
|
32
|
+
setupInterceptors() {
|
|
33
|
+
// Request interceptor
|
|
34
|
+
this.client.interceptors.request.use((config) => {
|
|
35
|
+
// Add request ID for tracking
|
|
36
|
+
config.headers['X-Request-ID'] = this.generateRequestId();
|
|
37
|
+
return config;
|
|
38
|
+
}, (error) => Promise.reject(error));
|
|
39
|
+
// Response interceptor
|
|
40
|
+
this.client.interceptors.response.use((response) => response, (error) => {
|
|
41
|
+
if (error.response) {
|
|
42
|
+
return Promise.reject(this.handleAPIError(error.response));
|
|
43
|
+
}
|
|
44
|
+
else if (error.request) {
|
|
45
|
+
return Promise.reject(new errors_1.FidduPayConnectionError('Network request failed'));
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
return Promise.reject(new errors_1.FidduPayConnectionError(error.message));
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
handleAPIError(response) {
|
|
53
|
+
const { status, data } = response;
|
|
54
|
+
const message = data?.error?.message || data?.message || 'API request failed';
|
|
55
|
+
const code = data?.error?.code || data?.code;
|
|
56
|
+
const requestId = response.headers['x-request-id'];
|
|
57
|
+
switch (status) {
|
|
58
|
+
case 401:
|
|
59
|
+
return new errors_1.FidduPayAuthenticationError(message);
|
|
60
|
+
case 429:
|
|
61
|
+
const retryAfter = parseInt(response.headers['retry-after']) || undefined;
|
|
62
|
+
return new errors_1.FidduPayRateLimitError(message, retryAfter);
|
|
63
|
+
default:
|
|
64
|
+
return new errors_1.FidduPayAPIError(message, status, code, requestId);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
generateRequestId() {
|
|
68
|
+
return `req_${Date.now()}_${Math.random().toString(36).slice(2, 11)}`;
|
|
69
|
+
}
|
|
70
|
+
async sleep(ms) {
|
|
71
|
+
return new Promise(resolve => setTimeout(resolve, ms));
|
|
72
|
+
}
|
|
73
|
+
async request(method, path, data, options = {}) {
|
|
74
|
+
const config = {
|
|
75
|
+
method,
|
|
76
|
+
url: path,
|
|
77
|
+
timeout: options.timeout,
|
|
78
|
+
};
|
|
79
|
+
if (data) {
|
|
80
|
+
config.data = data;
|
|
81
|
+
}
|
|
82
|
+
// Don't add Authorization header for registration endpoint or registration key
|
|
83
|
+
if (path !== '/api/v1/merchant/register' && this.apiKey !== 'registration_key') {
|
|
84
|
+
config.headers = {
|
|
85
|
+
'Authorization': `Bearer ${this.apiKey}`
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
if (options.idempotencyKey) {
|
|
89
|
+
config.headers = {
|
|
90
|
+
...config.headers,
|
|
91
|
+
'Idempotency-Key': options.idempotencyKey
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
const maxRetries = options.retries !== undefined ? options.retries : this.maxRetries;
|
|
95
|
+
let lastError;
|
|
96
|
+
for (let attempt = 0; attempt <= maxRetries; attempt++) {
|
|
97
|
+
try {
|
|
98
|
+
const response = await this.client.request(config);
|
|
99
|
+
return response.data;
|
|
100
|
+
}
|
|
101
|
+
catch (error) {
|
|
102
|
+
lastError = error;
|
|
103
|
+
// Don't retry on authentication errors or client errors (4xx except 429)
|
|
104
|
+
if (error instanceof errors_1.FidduPayAuthenticationError) {
|
|
105
|
+
throw error;
|
|
106
|
+
}
|
|
107
|
+
if (error instanceof errors_1.FidduPayAPIError && error.statusCode) {
|
|
108
|
+
if (error.statusCode >= 400 && error.statusCode < 500 && error.statusCode !== 429) {
|
|
109
|
+
throw error;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
// Don't retry on the last attempt
|
|
113
|
+
if (attempt === maxRetries) {
|
|
114
|
+
break;
|
|
115
|
+
}
|
|
116
|
+
// Calculate backoff delay
|
|
117
|
+
const baseDelay = Math.pow(2, attempt) * 1000; // Exponential backoff
|
|
118
|
+
const jitter = Math.random() * 1000; // Add jitter
|
|
119
|
+
const delay = baseDelay + jitter;
|
|
120
|
+
// For rate limit errors, respect the Retry-After header
|
|
121
|
+
if (error instanceof errors_1.FidduPayRateLimitError && error.retryAfter) {
|
|
122
|
+
await this.sleep(error.retryAfter * 1000);
|
|
123
|
+
}
|
|
124
|
+
else {
|
|
125
|
+
await this.sleep(delay);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
throw lastError;
|
|
130
|
+
}
|
|
131
|
+
async get(path, options) {
|
|
132
|
+
return this.request('GET', path, undefined, options);
|
|
133
|
+
}
|
|
134
|
+
async post(path, data, options) {
|
|
135
|
+
return this.request('POST', path, data, options);
|
|
136
|
+
}
|
|
137
|
+
async put(path, data, options) {
|
|
138
|
+
return this.request('PUT', path, data, options);
|
|
139
|
+
}
|
|
140
|
+
async delete(path, options) {
|
|
141
|
+
return this.request('DELETE', path, undefined, options);
|
|
142
|
+
}
|
|
143
|
+
async patch(path, data, options) {
|
|
144
|
+
return this.request('PATCH', path, data, options);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
exports.HttpClient = HttpClient;
|
|
148
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":";;;;;;AAAA,kDAAgF;AAEhF,qCAKkB;AAElB,MAAa,UAAU;IAKrB,YAAY,MAAsB;QAChC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;QAC5B,IAAI,CAAC,UAAU,GAAG,MAAM,CAAC,UAAU,IAAI,CAAC,CAAC;QAEzC,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,IAAI,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,WAAW,IAAI,SAAS,CAAC,CAAC;QAEnF,IAAI,CAAC,MAAM,GAAG,eAAK,CAAC,MAAM,CAAC;YACzB,OAAO;YACP,OAAO,EAAE,MAAM,CAAC,OAAO,IAAI,KAAK;YAChC,OAAO,EAAE;gBACP,cAAc,EAAE,kBAAkB;gBAClC,YAAY,EAAE,qBAAqB;aACpC;YACD,0BAA0B;YAC1B,YAAY,EAAE,CAAC,EAAE,2BAA2B;YAC5C,cAAc,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,IAAI,GAAG,IAAI,MAAM,GAAG,GAAG;SAC1D,CAAC,CAAC;QAEH,IAAI,CAAC,iBAAiB,EAAE,CAAC;IAC3B,CAAC;IAEO,UAAU,CAAC,WAAmB;QACpC,OAAO,WAAW,KAAK,YAAY;YACjC,CAAC,CAAC,6BAA6B;YAC/B,CAAC,CAAC,qCAAqC,CAAC;IAC5C,CAAC;IAEO,iBAAiB;QACvB,sBAAsB;QACtB,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,OAAO,CAAC,GAAG,CAClC,CAAC,MAAM,EA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ly statusCode?: number;
|
|
5
|
+
readonly requestId?: string;
|
|
6
|
+
constructor(message: string, type?: string);
|
|
7
|
+
}
|
|
8
|
+
export declare class FidduPayAPIError extends FidduPayError {
|
|
9
|
+
readonly statusCode: number;
|
|
10
|
+
readonly code?: string;
|
|
11
|
+
readonly requestId?: string;
|
|
12
|
+
constructor(message: string, statusCode: number, code?: string, requestId?: string);
|
|
13
|
+
}
|
|
14
|
+
export declare class FidduPayValidationError extends FidduPayError {
|
|
15
|
+
readonly param?: string;
|
|
16
|
+
constructor(message: string, param?: string);
|
|
17
|
+
}
|
|
18
|
+
export declare class FidduPayAuthenticationError extends FidduPayError {
|
|
19
|
+
constructor(message?: string);
|
|
20
|
+
}
|
|
21
|
+
export declare class FidduPayRateLimitError extends FidduPayError {
|
|
22
|
+
readonly retryAfter?: number;
|
|
23
|
+
constructor(message?: string, retryAfter?: number);
|
|
24
|
+
}
|
|
25
|
+
export declare class FidduPayConnectionError extends FidduPayError {
|
|
26
|
+
constructor(message?: string);
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/errors/index.ts"],"names":[],"mappings":"AAEA,qBAAa,aAAc,SAAQ,KAAK;IACtC,SAAgB,IAAI,EAAE,MAAM,CAAC;IAC7B,SAAgB,IAAI,CAAC,EAAE,MAAM,CAAC;IAC9B,SAAgB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpC,SAAgB,SAAS,CAAC,EAAE,MAAM,CAAC;gBAEvB,OAAO,EAAE,MAAM,EAAE,IAAI,GAAE,MAAyB;CAM7D;AAED,qBAAa,gBAAiB,SAAQ,aAAa;IACjD,SAAgB,UAAU,EAAE,MAAM,CAAC;IACnC,SAAgB,IAAI,CAAC,EAAE,MAAM,CAAC;IAC9B,SAAgB,SAAS,CAAC,EAAE,MAAM,CAAC;gBAGjC,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,MAAM,EAClB,IAAI,CAAC,EAAE,MAAM,EACb,SAAS,CAAC,EAAE,MAAM;CASrB;AAED,qBAAa,uBAAwB,SAAQ,aAAa;IACxD,SAAgB,KAAK,CAAC,EAAE,MAAM,CAAC;gBAEnB,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM;CAM5C;AAED,qBAAa,2BAA4B,SAAQ,aAAa;gBAChD,OAAO,GAAE,MAAmC;CAKzD;AAED,qBAAa,sBAAuB,SAAQ,aAAa;IACvD,SAAgB,UAAU,CAAC,EAAE,MAAM,CAAC;gBAExB,OAAO,GAAE,MAA4B,EAAE,UAAU,CAAC,EAAE,MAAM;CAMvE;AAED,qBAAa,uBAAwB,SAAQ,aAAa;gBAC5C,OAAO,GAAE,MAAoC;CAK1D"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Custom error classes for FidduPay SDK
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.FidduPayConnectionError = exports.FidduPayRateLimitError = exports.FidduPayAuthenticationError = exports.FidduPayValidationError = exports.FidduPayAPIError = exports.FidduPayError = void 0;
|
|
5
|
+
class FidduPayError extends Error {
|
|
6
|
+
constructor(message, type = 'fiddupay_error') {
|
|
7
|
+
super(message);
|
|
8
|
+
this.name = 'FidduPayError';
|
|
9
|
+
this.type = type;
|
|
10
|
+
Object.setPrototypeOf(this, FidduPayError.prototype);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
exports.FidduPayError = FidduPayError;
|
|
14
|
+
class FidduPayAPIError extends FidduPayError {
|
|
15
|
+
constructor(message, statusCode, code, requestId) {
|
|
16
|
+
super(message, 'api_error');
|
|
17
|
+
this.name = 'FidduPayAPIError';
|
|
18
|
+
this.statusCode = statusCode;
|
|
19
|
+
this.code = code;
|
|
20
|
+
this.requestId = requestId;
|
|
21
|
+
Object.setPrototypeOf(this, FidduPayAPIError.prototype);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
exports.FidduPayAPIError = FidduPayAPIError;
|
|
25
|
+
class FidduPayValidationError extends FidduPayError {
|
|
26
|
+
constructor(message, param) {
|
|
27
|
+
super(message, 'validation_error');
|
|
28
|
+
this.name = 'FidduPayValidationError';
|
|
29
|
+
this.param = param;
|
|
30
|
+
Object.setPrototypeOf(this, FidduPayValidationError.prototype);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
exports.FidduPayValidationError = FidduPayValidationError;
|
|
34
|
+
class FidduPayAuthenticationError extends FidduPayError {
|
|
35
|
+
constructor(message = 'Invalid API key provided') {
|
|
36
|
+
super(message, 'authentication_error');
|
|
37
|
+
this.name = 'FidduPayAuthenticationError';
|
|
38
|
+
Object.setPrototypeOf(this, FidduPayAuthenticationError.prototype);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
exports.FidduPayAuthenticationError = FidduPayAuthenticationError;
|
|
42
|
+
class FidduPayRateLimitError extends FidduPayError {
|
|
43
|
+
constructor(message = 'Too many requests', retryAfter) {
|
|
44
|
+
super(message, 'rate_limit_error');
|
|
45
|
+
this.name = 'FidduPayRateLimitError';
|
|
46
|
+
this.retryAfter = retryAfter;
|
|
47
|
+
Object.setPrototypeOf(this, FidduPayRateLimitError.prototype);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
exports.FidduPayRateLimitError = FidduPayRateLimitError;
|
|
51
|
+
class FidduPayConnectionError extends FidduPayError {
|
|
52
|
+
constructor(message = 'Network connection failed') {
|
|
53
|
+
super(message, 'connection_error');
|
|
54
|
+
this.name = 'FidduPayConnectionError';
|
|
55
|
+
Object.setPrototypeOf(this, FidduPayConnectionError.prototype);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
exports.FidduPayConnectionError = FidduPayConnectionError;
|
|
59
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../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AC,cAAc,CAAC,IAAI,EAAE,2BAA2B,CAAC,SAAS,CAAC,CAAC;IACrE,CAAC;CACF;AAND,kEAMC;AAED,MAAa,sBAAuB,SAAQ,aAAa;IAGvD,YAAY,UAAkB,mBAAmB,EAAE,UAAmB;QACpE,KAAK,CAAC,OAAO,EAAE,kBAAkB,CAAC,CAAC;QACnC,IAAI,CAAC,IAAI,GAAG,wBAAwB,CAAC;QACrC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,sBAAsB,CAAC,SAAS,CAAC,CAAC;IAChE,CAAC;CACF;AATD,wDASC;AAED,MAAa,uBAAwB,SAAQ,aAAa;IACxD,YAAY,UAAkB,2BAA2B;QACvD,KAAK,CAAC,OAAO,EAAE,kBAAkB,CAAC,CAAC;QACnC,IAAI,CAAC,IAAI,GAAG,yBAAyB,CAAC;QACtC,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,uBAAuB,CAAC,SAAS,CAAC,CAAC;IACjE,CAAC;CACF;AAND,0DAMC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { FidduPayConfig } from './types';
|
|
2
|
+
import { Payments } from './resources/payments';
|
|
3
|
+
import { Merchants } from './resources/merchants';
|
|
4
|
+
import { Refunds } from './resources/refunds';
|
|
5
|
+
import { AnalyticsResource } from './resources/analytics';
|
|
6
|
+
import { InvoicesResource } from './resources/invoices';
|
|
7
|
+
import { Webhooks } from './resources/webhooks';
|
|
8
|
+
import { Wallets } from './resources/wallets';
|
|
9
|
+
import { Withdrawals } from './resources/withdrawals';
|
|
10
|
+
import { Security } from './resources/security';
|
|
11
|
+
import { Balances, AuditLogs } from './resources/balances';
|
|
12
|
+
import { Customers } from './resources/customers';
|
|
13
|
+
import { Sandbox } from './resources/sandbox';
|
|
14
|
+
import { Contact } from './resources/contact';
|
|
15
|
+
import { Transactions } from './resources/transactions';
|
|
16
|
+
export declare class FidduPayClient {
|
|
17
|
+
private client;
|
|
18
|
+
readonly payments: Payments;
|
|
19
|
+
readonly merchants: Merchants;
|
|
20
|
+
readonly refunds: Refunds;
|
|
21
|
+
readonly analytics: AnalyticsResource;
|
|
22
|
+
readonly invoices: InvoicesResource;
|
|
23
|
+
readonly webhooks: typeof Webhooks;
|
|
24
|
+
readonly wallets: Wallets;
|
|
25
|
+
readonly withdrawals: Withdrawals;
|
|
26
|
+
readonly security: Security;
|
|
27
|
+
readonly customers: Customers;
|
|
28
|
+
readonly balances: Balances;
|
|
29
|
+
readonly auditLogs: AuditLogs;
|
|
30
|
+
readonly sandbox: Sandbox;
|
|
31
|
+
readonly contact: Contact;
|
|
32
|
+
readonly transactions: Transactions;
|
|
33
|
+
constructor(config: FidduPayConfig);
|
|
34
|
+
private validateConfig;
|
|
35
|
+
}
|
|
36
|
+
export * from './types';
|
|
37
|
+
export * from './errors';
|
|
38
|
+
export { Webhooks } from './resources/webhooks';
|
|
39
|
+
export { FidduPayClient as FidduPay };
|
|
40
|
+
export default FidduPayClient;
|
|
41
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAEzC,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACt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__createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.FidduPay = exports.Webhooks = exports.FidduPayClient = void 0;
|
|
18
|
+
const client_1 = require("./client");
|
|
19
|
+
const errors_1 = require("./errors");
|
|
20
|
+
const payments_1 = require("./resources/payments");
|
|
21
|
+
const merchants_1 = require("./resources/merchants");
|
|
22
|
+
const refunds_1 = require("./resources/refunds");
|
|
23
|
+
const analytics_1 = require("./resources/analytics");
|
|
24
|
+
const invoices_1 = require("./resources/invoices");
|
|
25
|
+
const webhooks_1 = require("./resources/webhooks");
|
|
26
|
+
const wallets_1 = require("./resources/wallets");
|
|
27
|
+
const withdrawals_1 = require("./resources/withdrawals");
|
|
28
|
+
const security_1 = require("./resources/security");
|
|
29
|
+
const balances_1 = require("./resources/balances");
|
|
30
|
+
const customers_1 = require("./resources/customers");
|
|
31
|
+
const sandbox_1 = require("./resources/sandbox");
|
|
32
|
+
const contact_1 = require("./resources/contact");
|
|
33
|
+
const transactions_1 = require("./resources/transactions");
|
|
34
|
+
class FidduPayClient {
|
|
35
|
+
constructor(config) {
|
|
36
|
+
this.webhooks = webhooks_1.Webhooks;
|
|
37
|
+
this.validateConfig(config);
|
|
38
|
+
this.client = new client_1.HttpClient(config);
|
|
39
|
+
// Initialize resource classes
|
|
40
|
+
this.payments = new payments_1.Payments(this.client);
|
|
41
|
+
this.merchants = new merchants_1.Merchants(this.client);
|
|
42
|
+
this.refunds = new refunds_1.Refunds(this.client);
|
|
43
|
+
this.analytics = new analytics_1.AnalyticsResource(this.client);
|
|
44
|
+
this.invoices = new invoices_1.InvoicesResource(this.client);
|
|
45
|
+
this.wallets = new wallets_1.Wallets(this.client);
|
|
46
|
+
this.withdrawals = new withdrawals_1.Withdrawals(this.client);
|
|
47
|
+
this.security = new security_1.Security(this.client);
|
|
48
|
+
this.customers = new customers_1.Customers(this.client);
|
|
49
|
+
this.balances = new balances_1.Balances(this.client);
|
|
50
|
+
this.auditLogs = new balances_1.AuditLogs(this.client);
|
|
51
|
+
this.sandbox = new sandbox_1.Sandbox(this.client);
|
|
52
|
+
this.contact = new contact_1.Contact(this.client);
|
|
53
|
+
this.transactions = new transactions_1.Transactions(this.client);
|
|
54
|
+
}
|
|
55
|
+
validateConfig(config) {
|
|
56
|
+
if (!config.apiKey) {
|
|
57
|
+
throw new errors_1.FidduPayValidationError('API key is required');
|
|
58
|
+
}
|
|
59
|
+
// Allow special registration key for merchant registration
|
|
60
|
+
if (config.apiKey === 'registration_key') {
|
|
61
|
+
return; // Skip validation for registration
|
|
62
|
+
}
|
|
63
|
+
// Updated API key validation - must start with sk_ for sandbox or live_ for production
|
|
64
|
+
if (!config.apiKey.startsWith('sk_') && !config.apiKey.startsWith('live_')) {
|
|
65
|
+
throw new errors_1.FidduPayValidationError('Invalid API key format. API key must start with "sk_" (sandbox) or "live_" (production)');
|
|
66
|
+
}
|
|
67
|
+
// Auto-detect environment from API key if not specified
|
|
68
|
+
if (!config.environment) {
|
|
69
|
+
config.environment = config.apiKey.startsWith('sk_') ? 'sandbox' : 'production';
|
|
70
|
+
}
|
|
71
|
+
if (config.environment && !['sandbox', 'production'].includes(config.environment)) {
|
|
72
|
+
throw new errors_1.FidduPayValidationError('Environment must be either "sandbox" or "production"');
|
|
73
|
+
}
|
|
74
|
+
// Validate API key matches environment
|
|
75
|
+
if (config.environment === 'sandbox' && !config.apiKey.startsWith('sk_')) {
|
|
76
|
+
throw new errors_1.FidduPayValidationError('Sandbox environment requires API key starting with "sk_"');
|
|
77
|
+
}
|
|
78
|
+
if (config.environment === 'production' && !config.apiKey.startsWith('live_')) {
|
|
79
|
+
throw new errors_1.FidduPayValidationError('Production environment requires API key starting with "live_"');
|
|
80
|
+
}
|
|
81
|
+
if (config.timeout && (config.timeout < 1000 || config.timeout > 60000)) {
|
|
82
|
+
throw new errors_1.FidduPayValidationError('Timeout must be between 1000ms and 60000ms');
|
|
83
|
+
}
|
|
84
|
+
if (config.maxRetries && (config.maxRetries < 0 || config.maxRetries > 10)) {
|
|
85
|
+
throw new errors_1.FidduPayValidationError('Max retries must be between 0 and 10');
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
exports.FidduPayClient = FidduPayClient;
|
|
90
|
+
exports.FidduPay = FidduPayClient;
|
|
91
|
+
// Export everything
|
|
92
|
+
__exportStar(require("./types"), exports);
|
|
93
|
+
__exportStar(require("./errors"), exports);
|
|
94
|
+
var webhooks_2 = require("./resources/webhooks");
|
|
95
|
+
Object.defineProperty(exports, "Webhooks", { enumerable: true, get: function () { return webhooks_2.Webhooks; } });
|
|
96
|
+
// Default export
|
|
97
|
+
exports.default = FidduPayClient;
|
|
98
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,qCAAsC;AAEtC,qCAAmD;AACnD,mDAAgD;AAChD,qDAAkD;AAClD,iDAA8C;AAC9C,qDAA0D;AAC1D,mDAAwD;AACxD,mDAAgD;AAChD,iDAA8C;AAC9C,yDAAsD;AACtD,mDAAg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,CAAC,CAAC;QAChG,CAAC;QAED,IAAI,MAAM,CAAC,WAAW,KAAK,YAAY,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;YAC9E,MAAM,IAAI,gCAAuB,CAAC,+DAA+D,CAAC,CAAC;QACrG,CAAC;QAED,IAAI,MAAM,CAAC,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,GAAG,IAAI,IAAI,MAAM,CAAC,OAAO,GAAG,KAAK,CAAC,EAAE,CAAC;YACxE,MAAM,IAAI,gCAAuB,CAAC,4CAA4C,CAAC,CAAC;QAClF,CAAC;QAED,IAAI,MAAM,CAAC,UAAU,IAAI,CAAC,MAAM,CAAC,UAAU,GAAG,CAAC,IAAI,MAAM,CAAC,UAAU,GAAG,EAAE,CAAC,EAAE,CAAC;YAC3E,MAAM,IAAI,gCAAuB,CAAC,sCAAsC,CAAC,CAAC;QAC5E,CAAC;IACH,CAAC;CACF;AAlFD,wCAkFC;AAQ0B,kCAAQ;AANnC,oBAAoB;AACpB,0CAAwB;AACxB,2CAAyB;AACzB,iDAAgD;AAAvC,oGAAA,QAAQ,OAAA;AAKjB,iBAAiB;AACjB,kBAAe,cAAc,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { HttpClient } from '../client';
|
|
2
|
+
import { Analytics, RequestOptions } from '../types';
|
|
3
|
+
export declare class AnalyticsResource {
|
|
4
|
+
private client;
|
|
5
|
+
constructor(client: HttpClient);
|
|
6
|
+
/**
|
|
7
|
+
* Get analytics data
|
|
8
|
+
*/
|
|
9
|
+
retrieve(params?: {
|
|
10
|
+
from_date?: string;
|
|
11
|
+
to_date?: string;
|
|
12
|
+
granularity?: 'day' | 'week' | 'month';
|
|
13
|
+
}, options?: RequestOptions): Promise<Analytics>;
|
|
14
|
+
/**
|
|
15
|
+
* Export analytics data
|
|
16
|
+
*/
|
|
17
|
+
export(params: {
|
|
18
|
+
format?: 'csv' | 'json' | 'xlsx';
|
|
19
|
+
from_date: string;
|
|
20
|
+
to_date: string;
|
|
21
|
+
}, options?: RequestOptions): Promise<string>;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=analytics.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"analytics.d.ts","sourceRoot":"","sources":["../../../src/resources/analytics.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAErD,qBAAa,iBAAiB;IAChB,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,UAAU;IAEtC;;OAEG;IACG,QAAQ,CAAC,MAAM,CAAC,EAAE;QACtB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,WAAW,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,OAAO,CAAC;KACxC,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,SAAS,CAAC;IAahD;;OAEG;IACG,MAAM,CAAC,MAAM,EAAE;QACnB,MAAM,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,MAAM,CAAC;QACjC,SAAS,EAAE,MAAM,CAAC;QAClB,OAAO,EAAE,MAAM,CAAC;KACjB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC;CAQ9C"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AnalyticsResource = void 0;
|
|
4
|
+
class AnalyticsResource {
|
|
5
|
+
constructor(client) {
|
|
6
|
+
this.client = client;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Get analytics data
|
|
10
|
+
*/
|
|
11
|
+
async retrieve(params, options) {
|
|
12
|
+
const queryParams = new URLSearchParams();
|
|
13
|
+
if (params?.from_date)
|
|
14
|
+
queryParams.append('from_date', params.from_date);
|
|
15
|
+
if (params?.to_date)
|
|
16
|
+
queryParams.append('to_date', params.to_date);
|
|
17
|
+
if (params?.granularity)
|
|
18
|
+
queryParams.append('granularity', params.granularity);
|
|
19
|
+
const query = queryParams.toString();
|
|
20
|
+
const path = query ? `/api/v1/merchants/analytics?${query}` : '/api/v1/merchants/analytics';
|
|
21
|
+
return this.client.request('GET', path);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Export analytics data
|
|
25
|
+
*/
|
|
26
|
+
async export(params, options) {
|
|
27
|
+
const queryParams = new URLSearchParams();
|
|
28
|
+
if (params.format)
|
|
29
|
+
queryParams.append('format', params.format);
|
|
30
|
+
queryParams.append('from_date', params.from_date);
|
|
31
|
+
queryParams.append('to_date', params.to_date);
|
|
32
|
+
return this.client.request('GET', `/api/v1/merchants/analytics/export?${queryParams.toString()}`);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
exports.AnalyticsResource = AnalyticsResource;
|
|
36
|
+
//# sourceMappingURL=analytics.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"analytics.js","sourceRoot":"","sources":["../../../src/resources/analytics.ts"],"names":[],"mappings":";;;AAGA,MAAa,iBAAiB;IAC5B,YAAoB,MAAkB;QAAlB,WAAM,GAAN,MAAM,CAAY;IAAI,CAAC;IAE3C;;OAEG;IACH,KAAK,CAAC,QAAQ,CAAC,MAId,EAAE,OAAwB;QACzB,MAAM,WAAW,GAAG,IAAI,eAAe,EAAE,CAAC;QAE1C,IAAI,MAAM,EAAE,SAAS;YAAE,WAAW,CAAC,MAAM,CAAC,WAAW,EAAE,MAAM,CAAC,SAAS,CAAC,CAAC;QACzE,IAAI,MAAM,EAAE,OAAO;YAAE,WAAW,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;QACnE,IAAI,MAAM,EAAE,WAAW;YAAE,WAAW,CAAC,MAAM,CAAC,aAAa,EAAE,MAAM,CAAC,WAAW,CAAC,CAAC;QAE/E,MAAM,KAAK,GAAG,WAAW,CAAC,QAAQ,EAAE,CAAC;QACrC,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,+BAA+B,KAAK,EAAE,CAAC,CAAC,CAAC,6BAA6B,CAAC;QAE5F,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAY,KAAK,EAAE,IAAI,CAAC,CAAC;IACrD,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,MAAM,CAAC,MAIZ,EAAE,OAAwB;QACzB,MAAM,WAAW,GAAG,IAAI,eAAe,EAAE,CAAC;QAC1C,IAAI,MAAM,CAAC,MAAM;YAAE,WAAW,CAAC,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;QAC/D,WAAW,CAAC,MAAM,CAAC,WAAW,EAAE,MAAM,CAAC,SAAS,CAAC,CAAC;QAClD,WAAW,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;QAE9C,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,sCAAsC,WAAW,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;IACpG,CAAC;CACF;AAtCD,8CAsCC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { HttpClient } from '../client';
|
|
2
|
+
import { Balance, BalanceHistory, AuditLog, ListAuditLogsParams, ListBalanceHistoryParams, PaginatedResponse } from '../types';
|
|
3
|
+
export declare class Balances {
|
|
4
|
+
private client;
|
|
5
|
+
constructor(client: HttpClient);
|
|
6
|
+
/**
|
|
7
|
+
* Get current balance
|
|
8
|
+
*/
|
|
9
|
+
get(): Promise<Balance>;
|
|
10
|
+
/**
|
|
11
|
+
* Get balance history
|
|
12
|
+
*/
|
|
13
|
+
getHistory(params?: ListBalanceHistoryParams): Promise<PaginatedResponse<BalanceHistory>>;
|
|
14
|
+
}
|
|
15
|
+
export declare class AuditLogs {
|
|
16
|
+
private client;
|
|
17
|
+
constructor(client: HttpClient);
|
|
18
|
+
/**
|
|
19
|
+
* Get audit logs
|
|
20
|
+
*/
|
|
21
|
+
list(params?: ListAuditLogsParams): Promise<PaginatedResponse<AuditLog>>;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=balances.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"balances.d.ts","sourceRoot":"","sources":["../../../src/resources/balances.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EACL,OAAO,EACP,cAAc,EACd,QAAQ,EACR,mBAAmB,EACnB,wBAAwB,EACxB,iBAAiB,EAClB,MAAM,UAAU,CAAC;AAElB,qBAAa,QAAQ;IACP,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,UAAU;IAEtC;;OAEG;IACG,GAAG,IAAI,OAAO,CAAC,OAAO,CAAC;IAI7B;;OAEG;IACG,UAAU,CAAC,MAAM,CAAC,EAAE,wBAAwB,GAAG,OAAO,CAAC,iBAAiB,CAAC,cAAc,CAAC,CAAC;CAUhG;AAED,qBAAa,SAAS;IACR,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,UAAU;IAEtC;;OAEG;IACG,IAAI,CAAC,MAAM,CAAC,EAAE,mBAAmB,GAAG,OAAO,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC;CAY/E"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AuditLogs = exports.Balances = void 0;
|
|
4
|
+
class Balances {
|
|
5
|
+
constructor(client) {
|
|
6
|
+
this.client = client;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Get current balance
|
|
10
|
+
*/
|
|
11
|
+
async get() {
|
|
12
|
+
return this.client.request('GET', '/api/v1/merchants/balance');
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Get balance history
|
|
16
|
+
*/
|
|
17
|
+
async getHistory(params) {
|
|
18
|
+
const queryParams = new URLSearchParams();
|
|
19
|
+
if (params?.limit)
|
|
20
|
+
queryParams.append('limit', params.limit.toString());
|
|
21
|
+
if (params?.offset)
|
|
22
|
+
queryParams.append('offset', params.offset.toString());
|
|
23
|
+
if (params?.crypto_type)
|
|
24
|
+
queryParams.append('crypto_type', params.crypto_type);
|
|
25
|
+
const url = `/api/v1/merchants/balance/history${queryParams.toString() ? `?${queryParams.toString()}` : ''}`;
|
|
26
|
+
return this.client.request('GET', url);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
exports.Balances = Balances;
|
|
30
|
+
class AuditLogs {
|
|
31
|
+
constructor(client) {
|
|
32
|
+
this.client = client;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Get audit logs
|
|
36
|
+
*/
|
|
37
|
+
async list(params) {
|
|
38
|
+
const queryParams = new URLSearchParams();
|
|
39
|
+
if (params?.limit)
|
|
40
|
+
queryParams.append('limit', params.limit.toString());
|
|
41
|
+
if (params?.offset)
|
|
42
|
+
queryParams.append('offset', params.offset.toString());
|
|
43
|
+
if (params?.action)
|
|
44
|
+
queryParams.append('action', params.action);
|
|
45
|
+
if (params?.start_date)
|
|
46
|
+
queryParams.append('start_date', params.start_date);
|
|
47
|
+
if (params?.end_date)
|
|
48
|
+
queryParams.append('end_date', params.end_date);
|
|
49
|
+
const url = `/api/v1/merchants/audit-logs${queryParams.toString() ? `?${queryParams.toString()}` : ''}`;
|
|
50
|
+
return this.client.request('GET', url);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
exports.AuditLogs = AuditLogs;
|
|
54
|
+
//# sourceMappingURL=balances.js.map
|