@fiddupay/fiddupay-node 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/README.md +248 -0
  2. package/dist/client.d.ts +18 -0
  3. package/dist/client.d.ts.map +1 -0
  4. package/dist/client.js +140 -0
  5. package/dist/client.js.map +1 -0
  6. package/dist/errors/index.d.ts +28 -0
  7. package/dist/errors/index.d.ts.map +1 -0
  8. package/dist/errors/index.js +59 -0
  9. package/dist/errors/index.js.map +1 -0
  10. package/dist/index.d.ts +21 -0
  11. package/dist/index.d.ts.map +1 -0
  12. package/dist/index.js +62 -0
  13. package/dist/index.js.map +1 -0
  14. package/dist/resources/analytics.d.ts +30 -0
  15. package/dist/resources/analytics.d.ts.map +1 -0
  16. package/dist/resources/analytics.js +31 -0
  17. package/dist/resources/analytics.js.map +1 -0
  18. package/dist/resources/merchants.d.ts +47 -0
  19. package/dist/resources/merchants.d.ts.map +1 -0
  20. package/dist/resources/merchants.js +40 -0
  21. package/dist/resources/merchants.js.map +1 -0
  22. package/dist/resources/payments.d.ts +24 -0
  23. package/dist/resources/payments.d.ts.map +1 -0
  24. package/dist/resources/payments.js +83 -0
  25. package/dist/resources/payments.js.map +1 -0
  26. package/dist/resources/refunds.d.ts +27 -0
  27. package/dist/resources/refunds.d.ts.map +1 -0
  28. package/dist/resources/refunds.js +54 -0
  29. package/dist/resources/refunds.js.map +1 -0
  30. package/dist/resources/webhooks.d.ts +17 -0
  31. package/dist/resources/webhooks.d.ts.map +1 -0
  32. package/dist/resources/webhooks.js +130 -0
  33. package/dist/resources/webhooks.js.map +1 -0
  34. package/dist/types/index.d.ts +110 -0
  35. package/dist/types/index.d.ts.map +1 -0
  36. package/dist/types/index.js +4 -0
  37. package/dist/types/index.js.map +1 -0
  38. package/package.json +65 -0
package/README.md ADDED
@@ -0,0 +1,248 @@
1
+ # FidduPay Node.js SDK
2
+
3
+ Official Node.js SDK for the FidduPay cryptocurrency payment gateway platform.
4
+
5
+ [![npm version](https://badge.fury.io/js/fiddupay-node.svg)](https://www.npmjs.com/package/fiddupay-node)
6
+ [![Build Status](https://github.com/fiddupay/fiddupay-node/workflows/CI%2FCD%20Pipeline/badge.svg)](https://github.com/fiddupay/fiddupay-node/actions)
7
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
8
+
9
+ ## 🚀 Quick Start
10
+
11
+ ### Installation
12
+
13
+ ```bash
14
+ npm install fiddupay-node
15
+ ```
16
+
17
+ ### Basic Usage
18
+
19
+ ```typescript
20
+ import { FidduPay } from 'fiddupay-node';
21
+
22
+ const fiddupay = new FidduPay({
23
+ apiKey: 'your-api-key',
24
+ environment: 'sandbox' // or 'production'
25
+ });
26
+
27
+ // Create a payment
28
+ const payment = await fiddupay.payments.create({
29
+ amount: 100.50,
30
+ currency: 'USDT',
31
+ network: 'ethereum',
32
+ description: 'Order #12345'
33
+ });
34
+
35
+ console.log('Payment created:', payment.id);
36
+ ```
37
+
38
+ ## 📚 Features
39
+
40
+ - **💳 Payment Processing**: Create, retrieve, list, and cancel payments
41
+ - **🔔 Webhook Verification**: Secure HMAC-SHA256 signature validation
42
+ - **🏪 Merchant Management**: Profile, balance, and wallet configuration
43
+ - **💰 Refund Operations**: Create and track refunds
44
+ - **📊 Analytics**: Data retrieval and export
45
+ - **🔒 Security**: Input validation, rate limiting, retry logic
46
+ - **📝 TypeScript**: Full type definitions included
47
+
48
+ ## 🔧 Configuration
49
+
50
+ ```typescript
51
+ const fiddupay = new FidduPay({
52
+ apiKey: 'your-api-key',
53
+ environment: 'sandbox', // 'sandbox' or 'production'
54
+ timeout: 30000, // Request timeout in milliseconds
55
+ retries: 3, // Number of retry attempts
56
+ baseURL: 'https://api.fiddupay.com' // Custom API base URL
57
+ });
58
+ ```
59
+
60
+ ## 💳 Payment Operations
61
+
62
+ ### Create Payment
63
+
64
+ ```typescript
65
+ const payment = await fiddupay.payments.create({
66
+ amount: 100.50,
67
+ currency: 'USDT',
68
+ network: 'ethereum',
69
+ description: 'Order #12345',
70
+ metadata: {
71
+ orderId: '12345',
72
+ customerId: 'cust_123'
73
+ }
74
+ });
75
+ ```
76
+
77
+ ### Retrieve Payment
78
+
79
+ ```typescript
80
+ const payment = await fiddupay.payments.retrieve('pay_123');
81
+ ```
82
+
83
+ ### List Payments
84
+
85
+ ```typescript
86
+ const payments = await fiddupay.payments.list({
87
+ limit: 10,
88
+ status: 'completed'
89
+ });
90
+ ```
91
+
92
+ ## 🔔 Webhook Handling
93
+
94
+ ```typescript
95
+ import express from 'express';
96
+
97
+ const app = express();
98
+
99
+ app.post('/webhooks/fiddupay', express.raw({type: 'application/json'}), (req, res) => {
100
+ const signature = req.headers['fiddupay-signature'] as string;
101
+
102
+ try {
103
+ const event = fiddupay.webhooks.constructEvent(
104
+ req.body,
105
+ signature,
106
+ 'your-webhook-secret'
107
+ );
108
+
109
+ switch (event.type) {
110
+ case 'payment.completed':
111
+ console.log('Payment completed:', event.data);
112
+ break;
113
+ case 'payment.failed':
114
+ console.log('Payment failed:', event.data);
115
+ break;
116
+ }
117
+
118
+ res.status(200).send('OK');
119
+ } catch (error) {
120
+ console.error('Webhook error:', error);
121
+ res.status(400).send('Invalid signature');
122
+ }
123
+ });
124
+ ```
125
+
126
+ ## 🏪 Merchant Operations
127
+
128
+ ```typescript
129
+ // Get merchant profile
130
+ const profile = await fiddupay.merchants.getProfile();
131
+
132
+ // Get account balance
133
+ const balance = await fiddupay.merchants.getBalance();
134
+
135
+ // Configure wallet
136
+ await fiddupay.merchants.configureWallet({
137
+ currency: 'USDT',
138
+ network: 'ethereum',
139
+ address: '0x742d35Cc6634C0532925a3b8D4C9db96590c6C87'
140
+ });
141
+ ```
142
+
143
+ ## 💰 Refund Operations
144
+
145
+ ```typescript
146
+ // Create refund
147
+ const refund = await fiddupay.refunds.create({
148
+ paymentId: 'pay_123',
149
+ amount: 50.25,
150
+ reason: 'customer_request'
151
+ });
152
+
153
+ // List refunds
154
+ const refunds = await fiddupay.refunds.list({
155
+ paymentId: 'pay_123'
156
+ });
157
+ ```
158
+
159
+ ## 📊 Analytics
160
+
161
+ ```typescript
162
+ // Get analytics data
163
+ const analytics = await fiddupay.analytics.getData({
164
+ startDate: '2026-01-01',
165
+ endDate: '2026-01-31',
166
+ metrics: ['revenue', 'transaction_count']
167
+ });
168
+
169
+ // Export data
170
+ const exportData = await fiddupay.analytics.exportData({
171
+ format: 'csv',
172
+ startDate: '2026-01-01',
173
+ endDate: '2026-01-31'
174
+ });
175
+ ```
176
+
177
+ ## 🚨 Error Handling
178
+
179
+ ```typescript
180
+ import {
181
+ FidduPayError,
182
+ APIError,
183
+ AuthenticationError,
184
+ ValidationError,
185
+ RateLimitError
186
+ } from 'fiddupay-node';
187
+
188
+ try {
189
+ const payment = await fiddupay.payments.create({
190
+ amount: 100,
191
+ currency: 'USDT'
192
+ });
193
+ } catch (error) {
194
+ if (error instanceof AuthenticationError) {
195
+ console.error('Invalid API key');
196
+ } else if (error instanceof ValidationError) {
197
+ console.error('Invalid parameters:', error.details);
198
+ } else if (error instanceof RateLimitError) {
199
+ console.error('Rate limit exceeded, retry after:', error.retryAfter);
200
+ } else if (error instanceof APIError) {
201
+ console.error('API error:', error.message);
202
+ }
203
+ }
204
+ ```
205
+
206
+ ## 🔒 Security
207
+
208
+ - **API Key Security**: Never expose API keys in client-side code
209
+ - **Webhook Verification**: Always verify webhook signatures
210
+ - **HTTPS Only**: All API calls use HTTPS encryption
211
+ - **Input Validation**: All inputs are validated and sanitized
212
+
213
+ ## 🌍 Supported Cryptocurrencies
214
+
215
+ **5 Major Blockchain Networks:**
216
+ - **Solana** - SOL + USDT (SPL)
217
+ - **Ethereum** - ETH + USDT (ERC-20)
218
+ - **Binance Smart Chain** - BNB + USDT (BEP-20)
219
+ - **Polygon** - MATIC + USDT
220
+ - **Arbitrum** - ARB + USDT
221
+
222
+ **Total: 10 cryptocurrency options across 5 blockchains**
223
+
224
+ ## 📖 API Reference
225
+
226
+ For complete API documentation, visit: [https://docs.fiddupay.com](https://docs.fiddupay.com)
227
+
228
+ ## 🤝 Contributing
229
+
230
+ 1. Fork the repository
231
+ 2. Create a feature branch: `git checkout -b feature/new-feature`
232
+ 3. Commit changes: `git commit -am 'Add new feature'`
233
+ 4. Push to branch: `git push origin feature/new-feature`
234
+ 5. Submit a pull request
235
+
236
+ ## 📄 License
237
+
238
+ MIT License - see [LICENSE](LICENSE) file for details.
239
+
240
+ ## 🆘 Support
241
+
242
+ - **Documentation**: [https://docs.fiddupay.com](https://docs.fiddupay.com)
243
+ - **Issues**: [GitHub Issues](https://github.com/fiddupay/fiddupay-node/issues)
244
+ - **Email**: support@fiddupay.com
245
+
246
+ ---
247
+
248
+ **Made with ❤️ by the FidduPay Team**
@@ -0,0 +1,18 @@
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', 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
+ }
18
+ //# 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,MAAM,SAAS,CAAC;AAQzD,qBAAa,UAAU;IACrB,OAAO,CAAC,MAAM,CAAgB;IAC9B,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,UAAU,CAAS;gBAEf,MAAM,EAAE,cAAc;IAsBlC,OAAO,CAAC,UAAU;IAMlB,OAAO,CAAC,iBAAiB;IA0BzB,OAAO,CAAC,cAAc;IAiBtB,OAAO,CAAC,iBAAiB;YAIX,KAAK;IAIb,OAAO,CAAC,CAAC,EACb,MAAM,EAAE,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,QAAQ,EACzC,IAAI,EAAE,MAAM,EACZ,IAAI,CAAC,EAAE,GAAG,EACV,OAAO,GAAE,cAAmB,GAC3B,OAAO,CAAC,CAAC,CAAC;IA6DP,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,CAAC,CAAC;IAI1D,IAAI,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,CAAC,CAAC;IAIvE,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,CAAC,CAAC;IAItE,MAAM,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,CAAC,CAAC;CAGpE"}
package/dist/client.js ADDED
@@ -0,0 +1,140 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (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
+ 'Authorization': `Bearer ${this.apiKey}`
21
+ },
22
+ // Security configurations
23
+ maxRedirects: 0, // Prevent redirect attacks
24
+ validateStatus: (status) => status >= 200 && status < 300,
25
+ });
26
+ this.setupInterceptors();
27
+ }
28
+ getBaseURL(environment) {
29
+ return environment === 'production'
30
+ ? 'https://api.fiddupay.com/v1'
31
+ : 'https://api-sandbox.fiddupay.com/v1';
32
+ }
33
+ setupInterceptors() {
34
+ // Request interceptor
35
+ this.client.interceptors.request.use((config) => {
36
+ // Add request ID for tracking
37
+ config.headers['X-Request-ID'] = this.generateRequestId();
38
+ return config;
39
+ }, (error) => Promise.reject(error));
40
+ // Response interceptor
41
+ this.client.interceptors.response.use((response) => response, (error) => {
42
+ if (error.response) {
43
+ return Promise.reject(this.handleAPIError(error.response));
44
+ }
45
+ else if (error.request) {
46
+ return Promise.reject(new errors_1.FidduPayConnectionError('Network request failed'));
47
+ }
48
+ else {
49
+ return Promise.reject(new errors_1.FidduPayConnectionError(error.message));
50
+ }
51
+ });
52
+ }
53
+ handleAPIError(response) {
54
+ const { status, data } = response;
55
+ const message = data?.error?.message || data?.message || 'API request failed';
56
+ const code = data?.error?.code || data?.code;
57
+ const requestId = response.headers['x-request-id'];
58
+ switch (status) {
59
+ case 401:
60
+ return new errors_1.FidduPayAuthenticationError(message);
61
+ case 429:
62
+ const retryAfter = parseInt(response.headers['retry-after']) || undefined;
63
+ return new errors_1.FidduPayRateLimitError(message, retryAfter);
64
+ default:
65
+ return new errors_1.FidduPayAPIError(message, status, code, requestId);
66
+ }
67
+ }
68
+ generateRequestId() {
69
+ return `req_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
70
+ }
71
+ async sleep(ms) {
72
+ return new Promise(resolve => setTimeout(resolve, ms));
73
+ }
74
+ async request(method, path, data, options = {}) {
75
+ const config = {
76
+ method,
77
+ url: path,
78
+ timeout: options.timeout,
79
+ };
80
+ if (data) {
81
+ config.data = data;
82
+ }
83
+ if (options.idempotencyKey) {
84
+ config.headers = {
85
+ ...config.headers,
86
+ 'Idempotency-Key': options.idempotencyKey
87
+ };
88
+ }
89
+ const maxRetries = options.retries !== undefined ? options.retries : this.maxRetries;
90
+ let lastError;
91
+ for (let attempt = 0; attempt <= maxRetries; attempt++) {
92
+ try {
93
+ const response = await this.client.request(config);
94
+ return response.data;
95
+ }
96
+ catch (error) {
97
+ lastError = error;
98
+ // Don't retry on authentication errors or client errors (4xx except 429)
99
+ if (error instanceof errors_1.FidduPayAuthenticationError) {
100
+ throw error;
101
+ }
102
+ if (error instanceof errors_1.FidduPayAPIError && error.statusCode) {
103
+ if (error.statusCode >= 400 && error.statusCode < 500 && error.statusCode !== 429) {
104
+ throw error;
105
+ }
106
+ }
107
+ // Don't retry on the last attempt
108
+ if (attempt === maxRetries) {
109
+ break;
110
+ }
111
+ // Calculate backoff delay
112
+ const baseDelay = Math.pow(2, attempt) * 1000; // Exponential backoff
113
+ const jitter = Math.random() * 1000; // Add jitter
114
+ const delay = baseDelay + jitter;
115
+ // For rate limit errors, respect the Retry-After header
116
+ if (error instanceof errors_1.FidduPayRateLimitError && error.retryAfter) {
117
+ await this.sleep(error.retryAfter * 1000);
118
+ }
119
+ else {
120
+ await this.sleep(delay);
121
+ }
122
+ }
123
+ }
124
+ throw lastError;
125
+ }
126
+ async get(path, options) {
127
+ return this.request('GET', path, undefined, options);
128
+ }
129
+ async post(path, data, options) {
130
+ return this.request('POST', path, data, options);
131
+ }
132
+ async put(path, data, options) {
133
+ return this.request('PUT', path, data, options);
134
+ }
135
+ async delete(path, options) {
136
+ return this.request('DELETE', path, undefined, options);
137
+ }
138
+ }
139
+ exports.HttpClient = HttpClient;
140
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":";;;;;;AAAA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AC1D,CAAC;IAED,KAAK,CAAC,IAAI,CAAI,IAAY,EAAE,IAAU,EAAE,OAAwB;QAC9D,OAAO,IAAI,CAAC,OAAO,CAAI,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;IACtD,CAAC;IAED,KAAK,CAAC,GAAG,CAAI,IAAY,EAAE,IAAU,EAAE,OAAwB;QAC7D,OAAO,IAAI,CAAC,OAAO,CAAI,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;IACrD,CAAC;IAED,KAAK,CAAC,MAAM,CAAI,IAAY,EAAE,OAAwB;QACpD,OAAO,IAAI,CAAC,OAAO,CAAI,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;IAC7D,CAAC;CACF;AArKD,gCAqKC"}
@@ -0,0 +1,28 @@
1
+ export declare class FidduPayError extends Error {
2
+ readonly type: string;
3
+ readonly code?: string;
4
+ readonly 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":["../../src/errors/index.ts"],"names":[],"mappings":";AAAA,wCAAwC;;;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AAS,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,21 @@
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 { Webhooks } from './resources/webhooks';
7
+ export declare class FidduPay {
8
+ private client;
9
+ readonly payments: Payments;
10
+ readonly merchants: Merchants;
11
+ readonly refunds: Refunds;
12
+ readonly analytics: AnalyticsResource;
13
+ readonly webhooks: typeof Webhooks;
14
+ constructor(config: FidduPayConfig);
15
+ private validateConfig;
16
+ }
17
+ export * from './types';
18
+ export * from './errors';
19
+ export { Webhooks } from './resources/webhooks';
20
+ export default FidduPay;
21
+ //# 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,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAEhD,qBAAa,QAAQ;IACnB,OAAO,CAAC,MAAM,CAAa;IAE3B,SAAgB,QAAQ,EAAE,QAAQ,CAAC;IACnC,SAAgB,SAAS,EAAE,SAAS,CAAC;IACrC,SAAgB,OAAO,EAAE,OAAO,CAAC;IACjC,SAAgB,SAAS,EAAE,iBAAiB,CAAC;IAC7C,SAAgB,QAAQ,kBAAY;gBAExB,MAAM,EAAE,cAAc;IAYlC,OAAO,CAAC,cAAc;CAqBvB;AAGD,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAGhD,eAAe,QAAQ,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+ var __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.Webhooks = exports.FidduPay = 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 webhooks_1 = require("./resources/webhooks");
25
+ class FidduPay {
26
+ constructor(config) {
27
+ this.webhooks = webhooks_1.Webhooks;
28
+ this.validateConfig(config);
29
+ this.client = new client_1.HttpClient(config);
30
+ // Initialize resource classes
31
+ this.payments = new payments_1.Payments(this.client);
32
+ this.merchants = new merchants_1.Merchants(this.client);
33
+ this.refunds = new refunds_1.Refunds(this.client);
34
+ this.analytics = new analytics_1.AnalyticsResource(this.client);
35
+ }
36
+ validateConfig(config) {
37
+ if (!config.apiKey) {
38
+ throw new errors_1.FidduPayValidationError('API key is required');
39
+ }
40
+ if (!config.apiKey.startsWith('sk_')) {
41
+ throw new errors_1.FidduPayValidationError('Invalid API key format. API key must start with "sk_"');
42
+ }
43
+ if (config.environment && !['sandbox', 'production'].includes(config.environment)) {
44
+ throw new errors_1.FidduPayValidationError('Environment must be either "sandbox" or "production"');
45
+ }
46
+ if (config.timeout && (config.timeout < 1000 || config.timeout > 60000)) {
47
+ throw new errors_1.FidduPayValidationError('Timeout must be between 1000ms and 60000ms');
48
+ }
49
+ if (config.maxRetries && (config.maxRetries < 0 || config.maxRetries > 10)) {
50
+ throw new errors_1.FidduPayValidationError('Max retries must be between 0 and 10');
51
+ }
52
+ }
53
+ }
54
+ exports.FidduPay = FidduPay;
55
+ // Export everything
56
+ __exportStar(require("./types"), exports);
57
+ __exportStar(require("./errors"), exports);
58
+ var webhooks_2 = require("./resources/webhooks");
59
+ Object.defineProperty(exports, "Webhooks", { enumerable: true, get: function () { return webhooks_2.Webhooks; } });
60
+ // Default export
61
+ exports.default = FidduPay;
62
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,qCAA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,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;AA1CD,4BA0CC;AAED,oBAAoB;AACpB,0CAAwB;AACxB,2CAAyB;AACzB,iDAAgD;AAAvC,oGAAA,QAAQ,OAAA;AAEjB,iBAAiB;AACjB,kBAAe,QAAQ,CAAC"}
@@ -0,0 +1,30 @@
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
+ start_date?: string;
11
+ end_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
+ start_date: string;
20
+ end_date: string;
21
+ }, options?: RequestOptions): Promise<{
22
+ export_id: string;
23
+ status: string;
24
+ format: string;
25
+ download_url: string | null;
26
+ expires_at: string;
27
+ created_at: string;
28
+ }>;
29
+ }
30
+ //# 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,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"}