@fiddupay/fiddupay-node 2.3.7 → 2.3.9
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 +29 -7
- package/dist/resources/analytics.d.ts +9 -3
- package/dist/resources/analytics.d.ts.map +1 -1
- package/dist/resources/analytics.js +10 -4
- package/dist/resources/analytics.js.map +1 -1
- package/dist/resources/balances.js +3 -3
- package/dist/resources/balances.js.map +1 -1
- package/dist/resources/merchants.d.ts +10 -53
- package/dist/resources/merchants.d.ts.map +1 -1
- package/dist/resources/merchants.js +19 -46
- package/dist/resources/merchants.js.map +1 -1
- package/dist/resources/payments.d.ts +10 -10
- package/dist/resources/payments.d.ts.map +1 -1
- package/dist/resources/payments.js +18 -18
- package/dist/resources/payments.js.map +1 -1
- package/dist/resources/refunds.d.ts +5 -5
- package/dist/resources/refunds.d.ts.map +1 -1
- package/dist/resources/refunds.js +9 -9
- package/dist/resources/refunds.js.map +1 -1
- package/dist/resources/sandbox.js +2 -2
- package/dist/resources/sandbox.js.map +1 -1
- package/dist/resources/security.d.ts +9 -8
- package/dist/resources/security.d.ts.map +1 -1
- package/dist/resources/security.js +16 -16
- package/dist/resources/security.js.map +1 -1
- package/dist/resources/wallets.d.ts +9 -8
- package/dist/resources/wallets.d.ts.map +1 -1
- package/dist/resources/wallets.js +16 -16
- package/dist/resources/wallets.js.map +1 -1
- package/dist/resources/withdrawals.d.ts +1 -1
- package/dist/resources/withdrawals.js +6 -6
- package/dist/resources/withdrawals.js.map +1 -1
- package/dist/types/index.d.ts +41 -19
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +15 -12
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
# FidduPay Node.js SDK
|
|
1
|
+
# FidduPay Node.js SDK v2.3.9
|
|
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)
|
|
@@ -60,6 +60,13 @@ const payment = await client.payments.create({
|
|
|
60
60
|
});
|
|
61
61
|
|
|
62
62
|
console.log('Payment created:', payment.id);
|
|
63
|
+
|
|
64
|
+
// NEW: Sandbox Simulation (in sandbox environment)
|
|
65
|
+
await client.sandbox.simulatePayment(payment.id, {
|
|
66
|
+
status: 'completed',
|
|
67
|
+
transaction_hash: '0xabc...',
|
|
68
|
+
from_address: '0xsender...'
|
|
69
|
+
});
|
|
63
70
|
```
|
|
64
71
|
|
|
65
72
|
## Features
|
|
@@ -134,12 +141,21 @@ app.post('/webhooks/fiddupay', express.raw({type: 'application/json'}), (req, re
|
|
|
134
141
|
);
|
|
135
142
|
|
|
136
143
|
switch (event.type) {
|
|
137
|
-
case 'payment.
|
|
138
|
-
console.log('Payment
|
|
144
|
+
case 'payment.detected':
|
|
145
|
+
console.log('Payment detected (0-conf):', event.data);
|
|
146
|
+
break;
|
|
147
|
+
case 'payment.partially_paid':
|
|
148
|
+
console.log('Partial payment received:', event.data);
|
|
149
|
+
break;
|
|
150
|
+
case 'payment.confirmed':
|
|
151
|
+
console.log('Payment confirmed:', event.data);
|
|
139
152
|
break;
|
|
140
153
|
case 'payment.failed':
|
|
141
154
|
console.log('Payment failed:', event.data);
|
|
142
155
|
break;
|
|
156
|
+
case 'wallet.low_balance':
|
|
157
|
+
console.log('Low gas wallet balance:', event.data);
|
|
158
|
+
break;
|
|
143
159
|
}
|
|
144
160
|
|
|
145
161
|
res.status(200).send('OK');
|
|
@@ -162,11 +178,11 @@ console.log('Daily Volume Remaining:', profile.daily_volume_remaining);
|
|
|
162
178
|
const balance = await client.merchants.getBalance();
|
|
163
179
|
|
|
164
180
|
// Configure wallet
|
|
165
|
-
await client.merchants.
|
|
166
|
-
|
|
167
|
-
network: 'ethereum',
|
|
181
|
+
await client.merchants.setWallet({
|
|
182
|
+
crypto_type: 'ETH',
|
|
168
183
|
address: '0x742d35Cc6634C0532925a3b8D4C9db96590c6C87'
|
|
169
184
|
});
|
|
185
|
+
|
|
170
186
|
```
|
|
171
187
|
|
|
172
188
|
## Refund Operations
|
|
@@ -244,6 +260,12 @@ try {
|
|
|
244
260
|
|
|
245
261
|
**Total: 10 cryptocurrency options across 5 blockchains**
|
|
246
262
|
|
|
263
|
+
## Postman Documentation
|
|
264
|
+
|
|
265
|
+
The SDK includes a dedicated Postman collection for merchant integration:
|
|
266
|
+
`postman/FidduPay-Merchant-API.postman_collection.json`
|
|
267
|
+
|
|
268
|
+
|
|
247
269
|
## API Reference
|
|
248
270
|
|
|
249
271
|
For complete API documentation, visit: [https://docs.fiddupay.com](https://docs.fiddupay.com)
|
|
@@ -1,18 +1,24 @@
|
|
|
1
1
|
import { HttpClient } from '../client';
|
|
2
|
-
import { Analytics } from '../types';
|
|
2
|
+
import { Analytics, RequestOptions } from '../types';
|
|
3
3
|
export declare class AnalyticsResource {
|
|
4
4
|
private client;
|
|
5
5
|
constructor(client: HttpClient);
|
|
6
|
+
/**
|
|
7
|
+
* Get analytics data
|
|
8
|
+
*/
|
|
6
9
|
retrieve(params?: {
|
|
7
10
|
start_date?: string;
|
|
8
11
|
end_date?: string;
|
|
9
12
|
granularity?: 'day' | 'week' | 'month';
|
|
10
|
-
}): Promise<Analytics>;
|
|
13
|
+
}, options?: RequestOptions): Promise<Analytics>;
|
|
14
|
+
/**
|
|
15
|
+
* Export analytics data
|
|
16
|
+
*/
|
|
11
17
|
export(params: {
|
|
12
18
|
format: 'csv' | 'json' | 'xlsx';
|
|
13
19
|
start_date: string;
|
|
14
20
|
end_date: string;
|
|
15
|
-
}): Promise<{
|
|
21
|
+
}, options?: RequestOptions): Promise<{
|
|
16
22
|
export_id: string;
|
|
17
23
|
status: string;
|
|
18
24
|
format: string;
|
|
@@ -1 +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,
|
|
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,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,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,EAAE,KAAK,GAAG,MAAM,GAAG,MAAM,CAAC;QAChC,UAAU,EAAE,MAAM,CAAC;QACnB,QAAQ,EAAE,MAAM,CAAC;KAClB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC;QACpC,SAAS,EAAE,MAAM,CAAC;QAClB,MAAM,EAAE,MAAM,CAAC;QACf,MAAM,EAAE,MAAM,CAAC;QACf,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;QAC5B,UAAU,EAAE,MAAM,CAAC;QACnB,UAAU,EAAE,MAAM,CAAC;KACpB,CAAC;CAGH"}
|
|
@@ -5,7 +5,10 @@ class AnalyticsResource {
|
|
|
5
5
|
constructor(client) {
|
|
6
6
|
this.client = client;
|
|
7
7
|
}
|
|
8
|
-
|
|
8
|
+
/**
|
|
9
|
+
* Get analytics data
|
|
10
|
+
*/
|
|
11
|
+
async retrieve(params, options) {
|
|
9
12
|
const queryParams = new URLSearchParams();
|
|
10
13
|
if (params?.start_date)
|
|
11
14
|
queryParams.append('start_date', params.start_date);
|
|
@@ -14,11 +17,14 @@ class AnalyticsResource {
|
|
|
14
17
|
if (params?.granularity)
|
|
15
18
|
queryParams.append('granularity', params.granularity);
|
|
16
19
|
const query = queryParams.toString();
|
|
17
|
-
const path = query ? `/api/v1/
|
|
20
|
+
const path = query ? `/api/v1/merchants/analytics?${query}` : '/api/v1/merchants/analytics';
|
|
18
21
|
return this.client.request('GET', path);
|
|
19
22
|
}
|
|
20
|
-
|
|
21
|
-
|
|
23
|
+
/**
|
|
24
|
+
* Export analytics data
|
|
25
|
+
*/
|
|
26
|
+
async export(params, options) {
|
|
27
|
+
return this.client.request('POST', '/api/v1/merchants/analytics/export', params);
|
|
22
28
|
}
|
|
23
29
|
}
|
|
24
30
|
exports.AnalyticsResource = AnalyticsResource;
|
|
@@ -1 +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;
|
|
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,UAAU;YAAE,WAAW,CAAC,MAAM,CAAC,YAAY,EAAE,MAAM,CAAC,UAAU,CAAC,CAAC;QAC5E,IAAI,MAAM,EAAE,QAAQ;YAAE,WAAW,CAAC,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC;QACtE,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;QAQzB,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,EAAE,oCAAoC,EAAE,MAAM,CAAC,CAAC;IACnF,CAAC;CACF;AAxCD,8CAwCC"}
|
|
@@ -9,7 +9,7 @@ class Balances {
|
|
|
9
9
|
* Get current balance
|
|
10
10
|
*/
|
|
11
11
|
async get() {
|
|
12
|
-
return this.client.request('GET', '/api/v1/
|
|
12
|
+
return this.client.request('GET', '/api/v1/merchants/balance');
|
|
13
13
|
}
|
|
14
14
|
/**
|
|
15
15
|
* Get balance history
|
|
@@ -22,7 +22,7 @@ class Balances {
|
|
|
22
22
|
queryParams.append('offset', params.offset.toString());
|
|
23
23
|
if (params?.crypto_type)
|
|
24
24
|
queryParams.append('crypto_type', params.crypto_type);
|
|
25
|
-
const url = `/api/v1/
|
|
25
|
+
const url = `/api/v1/merchants/balance/history${queryParams.toString() ? `?${queryParams.toString()}` : ''}`;
|
|
26
26
|
return this.client.request('GET', url);
|
|
27
27
|
}
|
|
28
28
|
}
|
|
@@ -46,7 +46,7 @@ class AuditLogs {
|
|
|
46
46
|
queryParams.append('start_date', params.start_date);
|
|
47
47
|
if (params?.end_date)
|
|
48
48
|
queryParams.append('end_date', params.end_date);
|
|
49
|
-
const url = `/api/v1/
|
|
49
|
+
const url = `/api/v1/merchants/audit-logs${queryParams.toString() ? `?${queryParams.toString()}` : ''}`;
|
|
50
50
|
return this.client.request('GET', url);
|
|
51
51
|
}
|
|
52
52
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"balances.js","sourceRoot":"","sources":["../../src/resources/balances.ts"],"names":[],"mappings":";;;AAUA,MAAa,QAAQ;IACnB,YAAoB,MAAkB;QAAlB,WAAM,GAAN,MAAM,CAAY;
|
|
1
|
+
{"version":3,"file":"balances.js","sourceRoot":"","sources":["../../src/resources/balances.ts"],"names":[],"mappings":";;;AAUA,MAAa,QAAQ;IACnB,YAAoB,MAAkB;QAAlB,WAAM,GAAN,MAAM,CAAY;IAAI,CAAC;IAE3C;;OAEG;IACH,KAAK,CAAC,GAAG;QACP,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAU,KAAK,EAAE,2BAA2B,CAAC,CAAC;IAC1E,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,UAAU,CAAC,MAAiC;QAChD,MAAM,WAAW,GAAG,IAAI,eAAe,EAAE,CAAC;QAE1C,IAAI,MAAM,EAAE,KAAK;YAAE,WAAW,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC;QACxE,IAAI,MAAM,EAAE,MAAM;YAAE,WAAW,CAAC,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC;QAC3E,IAAI,MAAM,EAAE,WAAW;YAAE,WAAW,CAAC,MAAM,CAAC,aAAa,EAAE,MAAM,CAAC,WAAW,CAAC,CAAC;QAE/E,MAAM,GAAG,GAAG,oCAAoC,WAAW,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,IAAI,WAAW,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;QAC7G,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAoC,KAAK,EAAE,GAAG,CAAC,CAAC;IAC5E,CAAC;CACF;AAvBD,4BAuBC;AAED,MAAa,SAAS;IACpB,YAAoB,MAAkB;QAAlB,WAAM,GAAN,MAAM,CAAY;IAAI,CAAC;IAE3C;;OAEG;IACH,KAAK,CAAC,IAAI,CAAC,MAA4B;QACrC,MAAM,WAAW,GAAG,IAAI,eAAe,EAAE,CAAC;QAE1C,IAAI,MAAM,EAAE,KAAK;YAAE,WAAW,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC;QACxE,IAAI,MAAM,EAAE,MAAM;YAAE,WAAW,CAAC,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC;QAC3E,IAAI,MAAM,EAAE,MAAM;YAAE,WAAW,CAAC,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;QAChE,IAAI,MAAM,EAAE,UAAU;YAAE,WAAW,CAAC,MAAM,CAAC,YAAY,EAAE,MAAM,CAAC,UAAU,CAAC,CAAC;QAC5E,IAAI,MAAM,EAAE,QAAQ;YAAE,WAAW,CAAC,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC;QAEtE,MAAM,GAAG,GAAG,+BAA+B,WAAW,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,IAAI,WAAW,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;QACxG,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAA8B,KAAK,EAAE,GAAG,CAAC,CAAC;IACtE,CAAC;CACF;AAlBD,8BAkBC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { HttpClient } from '../client';
|
|
2
|
-
import {
|
|
2
|
+
import { MerchantProfile, RequestOptions } from '../types';
|
|
3
3
|
export declare class Merchants {
|
|
4
4
|
private client;
|
|
5
5
|
constructor(client: HttpClient);
|
|
@@ -17,22 +17,19 @@ export declare class Merchants {
|
|
|
17
17
|
/**
|
|
18
18
|
* Get current merchant profile
|
|
19
19
|
*/
|
|
20
|
-
retrieve(): Promise<
|
|
20
|
+
retrieve(options?: RequestOptions): Promise<MerchantProfile>;
|
|
21
21
|
/**
|
|
22
22
|
* Set wallet address for a cryptocurrency
|
|
23
23
|
*/
|
|
24
24
|
setWallet(data: {
|
|
25
25
|
crypto_type: string;
|
|
26
26
|
address: string;
|
|
27
|
-
}): Promise<{
|
|
27
|
+
}, options?: RequestOptions): Promise<{
|
|
28
28
|
message: string;
|
|
29
29
|
}>;
|
|
30
|
-
/**
|
|
31
|
-
* Switch environment (sandbox/production)
|
|
32
|
-
*/
|
|
33
30
|
switchEnvironment(data: {
|
|
34
31
|
environment: 'sandbox' | 'production';
|
|
35
|
-
}): Promise<{
|
|
32
|
+
}, options?: RequestOptions): Promise<{
|
|
36
33
|
message: string;
|
|
37
34
|
environment: string;
|
|
38
35
|
}>;
|
|
@@ -41,7 +38,7 @@ export declare class Merchants {
|
|
|
41
38
|
*/
|
|
42
39
|
generateApiKey(data?: {
|
|
43
40
|
environment?: 'sandbox' | 'production';
|
|
44
|
-
}): Promise<{
|
|
41
|
+
}, options?: RequestOptions): Promise<{
|
|
45
42
|
api_key: string;
|
|
46
43
|
environment: string;
|
|
47
44
|
}>;
|
|
@@ -50,7 +47,7 @@ export declare class Merchants {
|
|
|
50
47
|
*/
|
|
51
48
|
rotateApiKey(data?: {
|
|
52
49
|
environment?: 'sandbox' | 'production';
|
|
53
|
-
}): Promise<{
|
|
50
|
+
}, options?: RequestOptions): Promise<{
|
|
54
51
|
api_key: string;
|
|
55
52
|
}>;
|
|
56
53
|
/**
|
|
@@ -58,7 +55,7 @@ export declare class Merchants {
|
|
|
58
55
|
*/
|
|
59
56
|
setWebhook(data: {
|
|
60
57
|
webhook_url: string;
|
|
61
|
-
}): Promise<{
|
|
58
|
+
}, options?: RequestOptions): Promise<{
|
|
62
59
|
message: string;
|
|
63
60
|
}>;
|
|
64
61
|
/**
|
|
@@ -66,19 +63,19 @@ export declare class Merchants {
|
|
|
66
63
|
*/
|
|
67
64
|
setIpWhitelist(data: {
|
|
68
65
|
ip_addresses: string[];
|
|
69
|
-
}): Promise<{
|
|
66
|
+
}, options?: RequestOptions): Promise<{
|
|
70
67
|
message: string;
|
|
71
68
|
}>;
|
|
72
69
|
/**
|
|
73
70
|
* Get IP whitelist
|
|
74
71
|
*/
|
|
75
|
-
getIpWhitelist(): Promise<{
|
|
72
|
+
getIpWhitelist(options?: RequestOptions): Promise<{
|
|
76
73
|
ip_addresses: string[];
|
|
77
74
|
}>;
|
|
78
75
|
/**
|
|
79
76
|
* Get merchant balance
|
|
80
77
|
*/
|
|
81
|
-
getBalance(): Promise<{
|
|
78
|
+
getBalance(options?: RequestOptions): Promise<{
|
|
82
79
|
balances: Array<{
|
|
83
80
|
crypto_type: string;
|
|
84
81
|
balance: string;
|
|
@@ -89,45 +86,5 @@ export declare class Merchants {
|
|
|
89
86
|
total_balance_usd: string;
|
|
90
87
|
total_pending_usd: string;
|
|
91
88
|
}>;
|
|
92
|
-
/**
|
|
93
|
-
* Set wallet addresses for automatic forwarding
|
|
94
|
-
*/
|
|
95
|
-
setWallets(wallets: Record<string, string>): Promise<{
|
|
96
|
-
message: string;
|
|
97
|
-
wallets: Record<string, string>;
|
|
98
|
-
}>;
|
|
99
|
-
/**
|
|
100
|
-
* Get balance history
|
|
101
|
-
*/
|
|
102
|
-
getBalanceHistory(): Promise<{
|
|
103
|
-
history: Array<{
|
|
104
|
-
date: string;
|
|
105
|
-
balance_usd: string;
|
|
106
|
-
change_usd: string;
|
|
107
|
-
change_percentage: number;
|
|
108
|
-
}>;
|
|
109
|
-
}>;
|
|
110
|
-
/**
|
|
111
|
-
* Login merchant
|
|
112
|
-
*/
|
|
113
|
-
login(data: {
|
|
114
|
-
email: string;
|
|
115
|
-
password: string;
|
|
116
|
-
}): Promise<{
|
|
117
|
-
user: any;
|
|
118
|
-
api_key: string;
|
|
119
|
-
}>;
|
|
120
|
-
/**
|
|
121
|
-
* Get audit logs
|
|
122
|
-
*/
|
|
123
|
-
getAuditLogs(): Promise<{
|
|
124
|
-
logs: Array<{
|
|
125
|
-
id: string;
|
|
126
|
-
action: string;
|
|
127
|
-
timestamp: string;
|
|
128
|
-
ip_address: string;
|
|
129
|
-
user_agent: string;
|
|
130
|
-
}>;
|
|
131
|
-
}>;
|
|
132
89
|
}
|
|
133
90
|
//# sourceMappingURL=merchants.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"merchants.d.ts","sourceRoot":"","sources":["../../src/resources/merchants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"merchants.d.ts","sourceRoot":"","sources":["../../src/resources/merchants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EAAY,eAAe,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAErE,qBAAa,SAAS;IACR,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,UAAU;IAEtC;;OAEG;IACG,QAAQ,CAAC,IAAI,EAAE;QACnB,KAAK,EAAE,MAAM,CAAC;QACd,aAAa,EAAE,MAAM,CAAC;QACtB,QAAQ,EAAE,MAAM,CAAC;KAClB,GAAG,OAAO,CAAC;QAAE,IAAI,EAAE,GAAG,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IAI3C;;OAEG;IACG,QAAQ,CAAC,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,eAAe,CAAC;IAIlE;;OAEG;IACG,SAAS,CAAC,IAAI,EAAE;QACpB,WAAW,EAAE,MAAM,CAAC;QACpB,OAAO,EAAE,MAAM,CAAA;KAChB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IAIpD,iBAAiB,CAAC,IAAI,EAAE;QAC5B,WAAW,EAAE,SAAS,GAAG,YAAY,CAAA;KACtC,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC;IAK/E;;OAEG;IACG,cAAc,CAAC,IAAI,CAAC,EAAE;QAC1B,WAAW,CAAC,EAAE,SAAS,GAAG,YAAY,CAAA;KACvC,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC;IAK/E;;OAEG;IACG,YAAY,CAAC,IAAI,CAAC,EAAE;QACxB,WAAW,CAAC,EAAE,SAAS,GAAG,YAAY,CAAA;KACvC,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IAK1D;;OAEG;IACG,UAAU,CAAC,IAAI,EAAE;QACrB,WAAW,EAAE,MAAM,CAAA;KACpB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IAK1D;;OAEG;IACG,cAAc,CAAC,IAAI,EAAE;QACzB,YAAY,EAAE,MAAM,EAAE,CAAA;KACvB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IAI1D;;OAEG;IACG,cAAc,CAAC,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC;QAAE,YAAY,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC;IAInF;;OAEG;IACG,UAAU,CAAC,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC;QAClD,QAAQ,EAAE,KAAK,CAAC;YACd,WAAW,EAAE,MAAM,CAAC;YACpB,OAAO,EAAE,MAAM,CAAC;YAChB,WAAW,EAAE,MAAM,CAAC;YACpB,OAAO,EAAE,MAAM,CAAC;YAChB,WAAW,EAAE,MAAM,CAAC;SACrB,CAAC,CAAC;QACH,iBAAiB,EAAE,MAAM,CAAC;QAC1B,iBAAiB,EAAE,MAAM,CAAC;KAC3B,CAAC;CAKH"}
|
|
@@ -9,89 +9,62 @@ class Merchants {
|
|
|
9
9
|
* Register new merchant
|
|
10
10
|
*/
|
|
11
11
|
async register(data) {
|
|
12
|
-
return this.client.request('POST', '/api/v1/
|
|
12
|
+
return this.client.request('POST', '/api/v1/merchants/register', data);
|
|
13
13
|
}
|
|
14
14
|
/**
|
|
15
15
|
* Get current merchant profile
|
|
16
16
|
*/
|
|
17
|
-
async retrieve() {
|
|
18
|
-
return this.client.request('GET', '/api/v1/
|
|
17
|
+
async retrieve(options) {
|
|
18
|
+
return this.client.request('GET', '/api/v1/merchants/profile');
|
|
19
19
|
}
|
|
20
20
|
/**
|
|
21
21
|
* Set wallet address for a cryptocurrency
|
|
22
22
|
*/
|
|
23
|
-
async setWallet(data) {
|
|
24
|
-
return this.client.request('PUT', '/api/v1/
|
|
23
|
+
async setWallet(data, options) {
|
|
24
|
+
return this.client.request('PUT', '/api/v1/merchants/wallets', data);
|
|
25
25
|
}
|
|
26
|
-
|
|
27
|
-
* Switch environment (sandbox/production)
|
|
28
|
-
*/
|
|
29
|
-
async switchEnvironment(data) {
|
|
26
|
+
async switchEnvironment(data, options) {
|
|
30
27
|
const requestData = { to_live: data.environment === 'production' };
|
|
31
|
-
return this.client.request('POST', '/api/v1/
|
|
28
|
+
return this.client.request('POST', '/api/v1/merchants/environment/switch', requestData);
|
|
32
29
|
}
|
|
33
30
|
/**
|
|
34
31
|
* Generate new API key
|
|
35
32
|
*/
|
|
36
|
-
async generateApiKey(data) {
|
|
33
|
+
async generateApiKey(data, options) {
|
|
37
34
|
const requestData = data ? { is_live: data.environment === 'production' } : { is_live: false };
|
|
38
|
-
return this.client.request('POST', '/api/v1/
|
|
35
|
+
return this.client.request('POST', '/api/v1/merchants/api-keys/generate', requestData);
|
|
39
36
|
}
|
|
40
37
|
/**
|
|
41
38
|
* Rotate existing API key
|
|
42
39
|
*/
|
|
43
|
-
async rotateApiKey(data) {
|
|
40
|
+
async rotateApiKey(data, options) {
|
|
44
41
|
const requestData = data ? { is_live: data.environment === 'production' } : { is_live: false };
|
|
45
|
-
return this.client.request('POST', '/api/v1/
|
|
42
|
+
return this.client.request('POST', '/api/v1/merchants/api-keys/rotate', requestData);
|
|
46
43
|
}
|
|
47
44
|
/**
|
|
48
45
|
* Set webhook URL
|
|
49
46
|
*/
|
|
50
|
-
async setWebhook(data) {
|
|
47
|
+
async setWebhook(data, options) {
|
|
51
48
|
const requestData = { url: data.webhook_url };
|
|
52
|
-
return this.client.request('PUT', '/api/v1/
|
|
49
|
+
return this.client.request('PUT', '/api/v1/merchants/webhook', requestData);
|
|
53
50
|
}
|
|
54
51
|
/**
|
|
55
52
|
* Set IP whitelist
|
|
56
53
|
*/
|
|
57
|
-
async setIpWhitelist(data) {
|
|
58
|
-
return this.client.request('PUT', '/api/v1/
|
|
54
|
+
async setIpWhitelist(data, options) {
|
|
55
|
+
return this.client.request('PUT', '/api/v1/merchants/ip-whitelist', data);
|
|
59
56
|
}
|
|
60
57
|
/**
|
|
61
58
|
* Get IP whitelist
|
|
62
59
|
*/
|
|
63
|
-
async getIpWhitelist() {
|
|
64
|
-
return this.client.request('GET', '/api/v1/
|
|
60
|
+
async getIpWhitelist(options) {
|
|
61
|
+
return this.client.request('GET', '/api/v1/merchants/ip-whitelist');
|
|
65
62
|
}
|
|
66
63
|
/**
|
|
67
64
|
* Get merchant balance
|
|
68
65
|
*/
|
|
69
|
-
async getBalance() {
|
|
70
|
-
return this.client.request('GET', '/api/v1/
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* Set wallet addresses for automatic forwarding
|
|
74
|
-
*/
|
|
75
|
-
async setWallets(wallets) {
|
|
76
|
-
return this.client.request('PUT', '/api/v1/merchant/wallets', { wallets });
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* Get balance history
|
|
80
|
-
*/
|
|
81
|
-
async getBalanceHistory() {
|
|
82
|
-
return this.client.request('GET', '/api/v1/merchant/balance/history');
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* Login merchant
|
|
86
|
-
*/
|
|
87
|
-
async login(data) {
|
|
88
|
-
return this.client.request('POST', '/api/v1/merchant/login', data);
|
|
89
|
-
}
|
|
90
|
-
/**
|
|
91
|
-
* Get audit logs
|
|
92
|
-
*/
|
|
93
|
-
async getAuditLogs() {
|
|
94
|
-
return this.client.request('GET', '/api/v1/audit-logs');
|
|
66
|
+
async getBalance(options) {
|
|
67
|
+
return this.client.request('GET', '/api/v1/merchants/balance');
|
|
95
68
|
}
|
|
96
69
|
}
|
|
97
70
|
exports.Merchants = Merchants;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"merchants.js","sourceRoot":"","sources":["../../src/resources/merchants.ts"],"names":[],"mappings":";;;AAGA,MAAa,SAAS;IACpB,YAAoB,MAAkB;QAAlB,WAAM,GAAN,MAAM,CAAY;
|
|
1
|
+
{"version":3,"file":"merchants.js","sourceRoot":"","sources":["../../src/resources/merchants.ts"],"names":[],"mappings":";;;AAGA,MAAa,SAAS;IACpB,YAAoB,MAAkB;QAAlB,WAAM,GAAN,MAAM,CAAY;IAAI,CAAC;IAE3C;;OAEG;IACH,KAAK,CAAC,QAAQ,CAAC,IAId;QACC,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,EAAE,4BAA4B,EAAE,IAAI,CAAC,CAAC;IACzE,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,QAAQ,CAAC,OAAwB;QACrC,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAkB,KAAK,EAAE,2BAA2B,CAAC,CAAC;IAClF,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,SAAS,CAAC,IAGf,EAAE,OAAwB;QACzB,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,2BAA2B,EAAE,IAAI,CAAC,CAAC;IACvE,CAAC;IAED,KAAK,CAAC,iBAAiB,CAAC,IAEvB,EAAE,OAAwB;QACzB,MAAM,WAAW,GAAG,EAAE,OAAO,EAAE,IAAI,CAAC,WAAW,KAAK,YAAY,EAAE,CAAC;QACnE,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,EAAE,sCAAsC,EAAE,WAAW,CAAC,CAAC;IAC1F,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,cAAc,CAAC,IAEpB,EAAE,OAAwB;QACzB,MAAM,WAAW,GAAG,IAAI,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,WAAW,KAAK,YAAY,EAAE,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;QAC/F,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,EAAE,qCAAqC,EAAE,WAAW,CAAC,CAAC;IACzF,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,YAAY,CAAC,IAElB,EAAE,OAAwB;QACzB,MAAM,WAAW,GAAG,IAAI,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,WAAW,KAAK,YAAY,EAAE,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;QAC/F,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,EAAE,mCAAmC,EAAE,WAAW,CAAC,CAAC;IACvF,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,UAAU,CAAC,IAEhB,EAAE,OAAwB;QACzB,MAAM,WAAW,GAAG,EAAE,GAAG,EAAE,IAAI,CAAC,WAAW,EAAE,CAAC;QAC9C,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,2BAA2B,EAAE,WAAW,CAAC,CAAC;IAC9E,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,cAAc,CAAC,IAEpB,EAAE,OAAwB;QACzB,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,gCAAgC,EAAE,IAAI,CAAC,CAAC;IAC5E,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,cAAc,CAAC,OAAwB;QAC3C,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,gCAAgC,CAAC,CAAC;IACtE,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,UAAU,CAAC,OAAwB;QAWvC,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,2BAA2B,CAAC,CAAC;IACjE,CAAC;CAGF;AAtGD,8BAsGC"}
|
|
@@ -1,46 +1,46 @@
|
|
|
1
1
|
import { HttpClient } from '../client';
|
|
2
|
-
import { CreatePaymentRequest, CreateAddressOnlyPaymentRequest, Payment, AddressOnlyPayment, ListPaymentsRequest, ListPaymentsResponse, UpdateFeeSettingRequest, FeeSettingResponse, UpdateFeeSettingResponse } from '../types';
|
|
2
|
+
import { CreatePaymentRequest, CreateAddressOnlyPaymentRequest, Payment, AddressOnlyPayment, ListPaymentsRequest, ListPaymentsResponse, UpdateFeeSettingRequest, FeeSettingResponse, UpdateFeeSettingResponse, RequestOptions } from '../types';
|
|
3
3
|
export declare class Payments {
|
|
4
4
|
private client;
|
|
5
5
|
constructor(client: HttpClient);
|
|
6
6
|
/**
|
|
7
7
|
* Create a new payment
|
|
8
8
|
*/
|
|
9
|
-
create(data: CreatePaymentRequest): Promise<Payment>;
|
|
9
|
+
create(data: CreatePaymentRequest, options?: RequestOptions): Promise<Payment>;
|
|
10
10
|
/**
|
|
11
11
|
* Retrieve a payment by ID
|
|
12
12
|
*/
|
|
13
|
-
retrieve(paymentId: string): Promise<Payment>;
|
|
13
|
+
retrieve(paymentId: string, options?: RequestOptions): Promise<Payment>;
|
|
14
14
|
/**
|
|
15
15
|
* Verify a payment with transaction hash
|
|
16
16
|
*/
|
|
17
17
|
verify(paymentId: string, data: {
|
|
18
18
|
transaction_hash: string;
|
|
19
|
-
}): Promise<any>;
|
|
19
|
+
}, options?: RequestOptions): Promise<any>;
|
|
20
20
|
/**
|
|
21
21
|
* List payments with optional filters
|
|
22
22
|
*/
|
|
23
|
-
list(params?: ListPaymentsRequest): Promise<ListPaymentsResponse>;
|
|
23
|
+
list(params?: ListPaymentsRequest, options?: RequestOptions): Promise<ListPaymentsResponse>;
|
|
24
24
|
/**
|
|
25
25
|
* Cancel a pending payment
|
|
26
26
|
*/
|
|
27
|
-
cancel(paymentId: string): Promise<Payment>;
|
|
27
|
+
cancel(paymentId: string, options?: RequestOptions): Promise<Payment>;
|
|
28
28
|
/**
|
|
29
29
|
* Create an address-only payment
|
|
30
30
|
*/
|
|
31
|
-
createAddressOnly(data: CreateAddressOnlyPaymentRequest): Promise<AddressOnlyPayment>;
|
|
31
|
+
createAddressOnly(data: CreateAddressOnlyPaymentRequest, options?: RequestOptions): Promise<AddressOnlyPayment>;
|
|
32
32
|
/**
|
|
33
33
|
* Retrieve an address-only payment by ID
|
|
34
34
|
*/
|
|
35
|
-
retrieveAddressOnly(paymentId: string): Promise<AddressOnlyPayment>;
|
|
35
|
+
retrieveAddressOnly(paymentId: string, options?: RequestOptions): Promise<AddressOnlyPayment>;
|
|
36
36
|
/**
|
|
37
37
|
* Update fee setting (customer pays fee vs merchant pays fee)
|
|
38
38
|
*/
|
|
39
|
-
updateFeeSetting(data: UpdateFeeSettingRequest): Promise<UpdateFeeSettingResponse>;
|
|
39
|
+
updateFeeSetting(data: UpdateFeeSettingRequest, options?: RequestOptions): Promise<UpdateFeeSettingResponse>;
|
|
40
40
|
/**
|
|
41
41
|
* Get current fee setting
|
|
42
42
|
*/
|
|
43
|
-
getFeeSetting(): Promise<FeeSettingResponse>;
|
|
43
|
+
getFeeSetting(options?: RequestOptions): Promise<FeeSettingResponse>;
|
|
44
44
|
private validateCreatePayment;
|
|
45
45
|
private validateCreateAddressOnlyPayment;
|
|
46
46
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"payments.d.ts","sourceRoot":"","sources":["../../src/resources/payments.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EACL,oBAAoB,EACpB,+BAA+B,EAC/B,OAAO,EACP,kBAAkB,EAClB,mBAAmB,EACnB,oBAAoB,EACpB,uBAAuB,EACvB,kBAAkB,EAClB,wBAAwB,
|
|
1
|
+
{"version":3,"file":"payments.d.ts","sourceRoot":"","sources":["../../src/resources/payments.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EACL,oBAAoB,EACpB,+BAA+B,EAC/B,OAAO,EACP,kBAAkB,EAClB,mBAAmB,EACnB,oBAAoB,EACpB,uBAAuB,EACvB,kBAAkB,EAClB,wBAAwB,EACxB,cAAc,EACf,MAAM,UAAU,CAAC;AAGlB,qBAAa,QAAQ;IACP,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,UAAU;IAEtC;;OAEG;IACG,MAAM,CAAC,IAAI,EAAE,oBAAoB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,OAAO,CAAC;IAKpF;;OAEG;IACG,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,OAAO,CAAC;IAO7E;;OAEG;IACG,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE;QACpC,gBAAgB,EAAE,MAAM,CAAA;KACzB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,GAAG,CAAC;IAO1C;;OAEG;IACG,IAAI,CAAC,MAAM,CAAC,EAAE,mBAAmB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAcjG;;OAEG;IACG,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,OAAO,CAAC;IAO3E;;OAEG;IACG,iBAAiB,CAAC,IAAI,EAAE,+BAA+B,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAKrH;;OAEG;IACG,mBAAmB,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAOnG;;OAEG;IACG,gBAAgB,CAAC,IAAI,EAAE,uBAAuB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,wBAAwB,CAAC;IAOlH;;OAEG;IACG,aAAa,CAAC,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAI1E,OAAO,CAAC,qBAAqB;IAoD7B,OAAO,CAAC,gCAAgC;CAwDzC"}
|
|
@@ -9,32 +9,32 @@ class Payments {
|
|
|
9
9
|
/**
|
|
10
10
|
* Create a new payment
|
|
11
11
|
*/
|
|
12
|
-
async create(data) {
|
|
12
|
+
async create(data, options) {
|
|
13
13
|
this.validateCreatePayment(data);
|
|
14
|
-
return this.client.request('POST', '/api/v1/
|
|
14
|
+
return this.client.request('POST', '/api/v1/merchants/payments', data);
|
|
15
15
|
}
|
|
16
16
|
/**
|
|
17
17
|
* Retrieve a payment by ID
|
|
18
18
|
*/
|
|
19
|
-
async retrieve(paymentId) {
|
|
19
|
+
async retrieve(paymentId, options) {
|
|
20
20
|
if (!paymentId) {
|
|
21
21
|
throw new errors_1.FidduPayValidationError('Payment ID is required', 'payment_id');
|
|
22
22
|
}
|
|
23
|
-
return this.client.get(`/api/v1/
|
|
23
|
+
return this.client.get(`/api/v1/merchants/payments/${paymentId}`, options);
|
|
24
24
|
}
|
|
25
25
|
/**
|
|
26
26
|
* Verify a payment with transaction hash
|
|
27
27
|
*/
|
|
28
|
-
async verify(paymentId, data) {
|
|
28
|
+
async verify(paymentId, data, options) {
|
|
29
29
|
if (!paymentId) {
|
|
30
30
|
throw new errors_1.FidduPayValidationError('Payment ID is required', 'payment_id');
|
|
31
31
|
}
|
|
32
|
-
return this.client.request('POST', `/api/v1/
|
|
32
|
+
return this.client.request('POST', `/api/v1/merchants/payments/${paymentId}/verify`, data);
|
|
33
33
|
}
|
|
34
34
|
/**
|
|
35
35
|
* List payments with optional filters
|
|
36
36
|
*/
|
|
37
|
-
async list(params) {
|
|
37
|
+
async list(params, options) {
|
|
38
38
|
const queryParams = new URLSearchParams();
|
|
39
39
|
if (params?.limit)
|
|
40
40
|
queryParams.append('limit', params.limit.toString());
|
|
@@ -45,48 +45,48 @@ class Payments {
|
|
|
45
45
|
if (params?.crypto_type)
|
|
46
46
|
queryParams.append('crypto_type', params.crypto_type);
|
|
47
47
|
const query = queryParams.toString();
|
|
48
|
-
const path = query ? `/api/v1/
|
|
48
|
+
const path = query ? `/api/v1/merchants/payments?${query}` : '/api/v1/merchants/payments';
|
|
49
49
|
return this.client.request('GET', path);
|
|
50
50
|
}
|
|
51
51
|
/**
|
|
52
52
|
* Cancel a pending payment
|
|
53
53
|
*/
|
|
54
|
-
async cancel(paymentId) {
|
|
54
|
+
async cancel(paymentId, options) {
|
|
55
55
|
if (!paymentId) {
|
|
56
56
|
throw new errors_1.FidduPayValidationError('Payment ID is required', 'payment_id');
|
|
57
57
|
}
|
|
58
|
-
return this.client.post(`/payments/${paymentId}/cancel`, {});
|
|
58
|
+
return this.client.post(`/api/v1/merchants/payments/${paymentId}/cancel`, {}, options);
|
|
59
59
|
}
|
|
60
60
|
/**
|
|
61
61
|
* Create an address-only payment
|
|
62
62
|
*/
|
|
63
|
-
async createAddressOnly(data) {
|
|
63
|
+
async createAddressOnly(data, options) {
|
|
64
64
|
this.validateCreateAddressOnlyPayment(data);
|
|
65
|
-
return this.client.post('/address-only-payments', data);
|
|
65
|
+
return this.client.post('/api/v1/merchants/address-only-payments', data, options);
|
|
66
66
|
}
|
|
67
67
|
/**
|
|
68
68
|
* Retrieve an address-only payment by ID
|
|
69
69
|
*/
|
|
70
|
-
async retrieveAddressOnly(paymentId) {
|
|
70
|
+
async retrieveAddressOnly(paymentId, options) {
|
|
71
71
|
if (!paymentId) {
|
|
72
72
|
throw new errors_1.FidduPayValidationError('Payment ID is required', 'payment_id');
|
|
73
73
|
}
|
|
74
|
-
return this.client.get(`/address-only-payments/${paymentId}
|
|
74
|
+
return this.client.get(`/api/v1/merchants/address-only-payments/${paymentId}`, options);
|
|
75
75
|
}
|
|
76
76
|
/**
|
|
77
77
|
* Update fee setting (customer pays fee vs merchant pays fee)
|
|
78
78
|
*/
|
|
79
|
-
async updateFeeSetting(data) {
|
|
79
|
+
async updateFeeSetting(data, options) {
|
|
80
80
|
if (typeof data.customer_pays_fee !== 'boolean') {
|
|
81
81
|
throw new errors_1.FidduPayValidationError('customer_pays_fee must be a boolean', 'customer_pays_fee');
|
|
82
82
|
}
|
|
83
|
-
return this.client.post('/fee-setting', data);
|
|
83
|
+
return this.client.post('/api/v1/merchants/fee-setting', data, options);
|
|
84
84
|
}
|
|
85
85
|
/**
|
|
86
86
|
* Get current fee setting
|
|
87
87
|
*/
|
|
88
|
-
async getFeeSetting() {
|
|
89
|
-
return this.client.get('/fee-setting');
|
|
88
|
+
async getFeeSetting(options) {
|
|
89
|
+
return this.client.get('/api/v1/merchants/fee-setting', options);
|
|
90
90
|
}
|
|
91
91
|
validateCreatePayment(data) {
|
|
92
92
|
// Validate that either amount or amount_usd is provided, but not both
|