nodela-sdk 1.0.1

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/dist/client.js ADDED
@@ -0,0 +1,74 @@
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.config = config;
12
+ this.axiosInstance = this.createAxiosInstance();
13
+ this.setupInterceptors();
14
+ }
15
+ createAxiosInstance() {
16
+ return axios_1.default.create({
17
+ baseURL: this.config.get('baseURL'),
18
+ timeout: this.config.get('timeout'),
19
+ headers: {
20
+ 'Content-Type': 'application/json',
21
+ Authorization: `Bearer ${this.config.get('apiKey')}`,
22
+ 'User-Agent': `nodela-sdk/${process.version}`,
23
+ },
24
+ });
25
+ }
26
+ setupInterceptors() {
27
+ this.axiosInstance.interceptors.request.use((config) => {
28
+ return config;
29
+ }, (error) => Promise.reject(error));
30
+ this.axiosInstance.interceptors.response.use((response) => response, async (error) => {
31
+ return this.handleError(error);
32
+ });
33
+ }
34
+ async handleError(error) {
35
+ if (!error.response) {
36
+ throw new errors_1.APIError('Network error occurred', 0, { originalError: error.message });
37
+ }
38
+ const { status, data } = error.response;
39
+ switch (status) {
40
+ case 401: {
41
+ const errorData = data;
42
+ throw new errors_1.AuthenticationError((typeof errorData?.message === 'string' ? errorData.message : undefined) ||
43
+ 'Invalid API key or unauthorized access');
44
+ }
45
+ case 429: {
46
+ const retryAfter = error.response.headers['retry-after'];
47
+ throw new errors_1.RateLimitError('Rate limit exceeded', retryAfter ? parseInt(retryAfter) : undefined);
48
+ }
49
+ default:
50
+ throw errors_1.APIError.fromResponse(status, data);
51
+ }
52
+ }
53
+ async request(config) {
54
+ const response = await this.axiosInstance.request(config);
55
+ return response.data;
56
+ }
57
+ async get(url, config) {
58
+ return this.request({ ...config, method: 'GET', url });
59
+ }
60
+ async post(url, data, config) {
61
+ return this.request({ ...config, method: 'POST', url, data });
62
+ }
63
+ async put(url, data, config) {
64
+ return this.request({ ...config, method: 'PUT', url, data });
65
+ }
66
+ async patch(url, data, config) {
67
+ return this.request({ ...config, method: 'PATCH', url, data });
68
+ }
69
+ async delete(url, config) {
70
+ return this.request({ ...config, method: 'DELETE', url });
71
+ }
72
+ }
73
+ exports.HTTPClient = HTTPClient;
74
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA4F;AAE5F,qCAAyE;AAEzE,MAAa,UAAU;IAIrB,YAAY,MAAc;QACxB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,mBAAmB,EAAE,CAAC;QAChD,IAAI,CAAC,iBAAiB,EAAE,CAAC;IAC3B,CAAC;IAEO,mBAAmB;QACzB,OAAO,eAAK,CAAC,MAAM,CAAC;YAClB,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,SAAS,CAAC;YACnC,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,SAAS,CAAC;YACnC,OAAO,EAAE;gBACP,cAAc,EAAE,kBAAkB;gBAClC,aAAa,EAAE,UAAU,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE;gBACpD,YAAY,EAAE,cAAc,OAAO,CAAC,OAAO,EAAE;aAC9C;SACF,CAAC,CAAC;IACL,CAAC;IAEO,iBAAiB;QACvB,IAAI,CAAC,aAAa,CAAC,YAAY,CAAC,OAAO,CAAC,GAAG,CACzC,CAAC,MAAM,EAAE,EAAE;YACT,OAAO,MAAM,CAAC;QAChB,CAAC,EACD,CAAC,KAAK,EAAE,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+ }
8
+ export interface SDKConfigOptions {
9
+ timeout?: number;
10
+ maxRetries?: number;
11
+ environment?: 'production' | 'sandbox';
12
+ }
13
+ export declare class Config {
14
+ private config;
15
+ constructor(apiKey: string, options?: SDKConfigOptions);
16
+ private validateApiKey;
17
+ private isNodelaApiKey;
18
+ private validateOptions;
19
+ get<K extends keyof Required<SDKConfig>>(key: K): Required<SDKConfig>[K];
20
+ getAll(): Required<SDKConfig>;
21
+ }
22
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,YAAY,GAAG,SAAS,CAAC;CACxC;AAED,MAAM,WAAW,gBAAgB;IAC/B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,YAAY,GAAG,SAAS,CAAC;CACxC;AAED,qBAAa,MAAM;IACjB,OAAO,CAAC,MAAM,CAAsB;gBAExB,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,gBAAgB;IAgBtD,OAAO,CAAC,cAAc;IAWtB,OAAO,CAAC,cAAc;IAItB,OAAO,CAAC,eAAe;IAuBvB,GAAG,CAAC,CAAC,SAAS,MAAM,QAAQ,CAAC,SAAS,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;IAIxE,MAAM,IAAI,QAAQ,CAAC,SAAS,CAAC;CAG9B"}
package/dist/config.js ADDED
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Config = void 0;
4
+ class Config {
5
+ constructor(apiKey, options) {
6
+ this.validateApiKey(apiKey);
7
+ if (options) {
8
+ this.validateOptions(options);
9
+ }
10
+ this.config = {
11
+ apiKey,
12
+ baseURL: 'https://api.nodela.com',
13
+ timeout: options?.timeout ?? 5000,
14
+ maxRetries: options?.maxRetries ?? 3,
15
+ environment: options?.environment ?? 'production',
16
+ };
17
+ }
18
+ validateApiKey(apiKey) {
19
+ if (!apiKey ||
20
+ typeof apiKey !== 'string' ||
21
+ apiKey.trim() === '' ||
22
+ !this.isNodelaApiKey(apiKey)) {
23
+ throw new Error('Invalid API key provided. Please provide a valid API key.');
24
+ }
25
+ }
26
+ isNodelaApiKey(apiKey) {
27
+ return apiKey.startsWith('nk_test_') || apiKey.startsWith('nk_live_');
28
+ }
29
+ validateOptions(options) {
30
+ if (options.timeout !== undefined &&
31
+ (typeof options.timeout !== 'number' || options.timeout <= 0)) {
32
+ throw new Error('Invalid timeout value. Timeout must be a positive number.');
33
+ }
34
+ if (options.maxRetries !== undefined &&
35
+ (typeof options.maxRetries !== 'number' || options.maxRetries < 0)) {
36
+ throw new Error('Invalid maxRetries value. maxRetries must be a non-negative number.');
37
+ }
38
+ if (options.environment !== undefined &&
39
+ !['production', 'sandbox'].includes(options.environment)) {
40
+ throw new Error('Invalid environment value. Environment must be either "production" or "sandbox".');
41
+ }
42
+ }
43
+ get(key) {
44
+ return this.config[key];
45
+ }
46
+ getAll() {
47
+ return { ...this.config };
48
+ }
49
+ }
50
+ exports.Config = Config;
51
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":";;;AAcA,MAAa,MAAM;IAGjB,YAAY,MAAc,EAAE,OAA0B;QACpD,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;QAE5B,IAAI,OAAO,EAAE,CAAC;YACZ,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;QAChC,CAAC;QAED,IAA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,CAAC;QACJ,CAAC;IACH,CAAC;IAED,GAAG,CAAsC,GAAM;QAC7C,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IAC1B,CAAC;IAED,MAAM;QACJ,OAAO,EAAE,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;IAC5B,CAAC;CACF;AAhED,wBAgEC"}
@@ -0,0 +1,16 @@
1
+ import { SDKError } from './base';
2
+ export declare class APIError extends SDKError {
3
+ constructor(message: string, statusCode?: number, details?: unknown);
4
+ static fromResponse(status: number, data: unknown): APIError;
5
+ }
6
+ export declare class ValidationError extends SDKError {
7
+ constructor(message: string, details?: unknown);
8
+ }
9
+ export declare class AuthenticationError extends SDKError {
10
+ constructor(message?: string);
11
+ }
12
+ export declare class RateLimitError extends SDKError {
13
+ readonly retryAfter?: number;
14
+ constructor(message: string, retryAfter?: number);
15
+ }
16
+ //# sourceMappingURL=api-error.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api-error.d.ts","sourceRoot":"","sources":["../../src/errors/api-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAElC,qBAAa,QAAS,SAAQ,QAAQ;gBACxB,OAAO,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO;IAInE,MAAM,CAAC,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,QAAQ;CAY7D;AAED,qBAAa,eAAgB,SAAQ,QAAQ;gBAC/B,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO;CAG/C;AAED,qBAAa,mBAAoB,SAAQ,QAAQ;gBACnC,OAAO,GAAE,MAAgC;CAGtD;AAED,qBAAa,cAAe,SAAQ,QAAQ;IAC1C,SAAgB,UAAU,CAAC,EAAE,MAAM,CAAC;gBAExB,OAAO,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM;CAIjD"}
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RateLimitError = exports.AuthenticationError = exports.ValidationError = exports.APIError = void 0;
4
+ const base_1 = require("./base");
5
+ class APIError extends base_1.SDKError {
6
+ constructor(message, statusCode, details) {
7
+ super(message, 'API_ERROR', statusCode, details);
8
+ }
9
+ static fromResponse(status, data) {
10
+ const body = data;
11
+ const errorField = body?.error;
12
+ const message = (typeof body?.message === 'string' ? body.message : undefined) ||
13
+ (typeof errorField === 'string' ? errorField : undefined) ||
14
+ (typeof errorField === 'object' && typeof errorField?.message === 'string'
15
+ ? errorField.message
16
+ : undefined) ||
17
+ `API request failed with status code ${status}`;
18
+ return new APIError(message, status, data);
19
+ }
20
+ }
21
+ exports.APIError = APIError;
22
+ class ValidationError extends base_1.SDKError {
23
+ constructor(message, details) {
24
+ super(message, 'VALIDATION_ERROR', undefined, details);
25
+ }
26
+ }
27
+ exports.ValidationError = ValidationError;
28
+ class AuthenticationError extends base_1.SDKError {
29
+ constructor(message = 'Authentication failed') {
30
+ super(message, 'AUTHENTICATION_ERROR', 401);
31
+ }
32
+ }
33
+ exports.AuthenticationError = AuthenticationError;
34
+ class RateLimitError extends base_1.SDKError {
35
+ constructor(message, retryAfter) {
36
+ super(message, 'RATE_LIMIT_ERROR', 429);
37
+ this.retryAfter = retryAfter;
38
+ }
39
+ }
40
+ exports.RateLimitError = RateLimitError;
41
+ //# sourceMappingURL=api-error.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api-error.js","sourceRoot":"","sources":["../../src/errors/api-error.ts"],"names":[],"mappings":";;;AAAA,iCAAkC;AAElC,MAAa,QAAS,SAAQ,eAAQ;IACpC,YAAY,OAAe,EAAE,UAAmB,EAAE,OAAiB;QACjE,KAAK,CAAC,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC;IACnD,CAAC;IAED,MAAM,CAAC,YAAY,CAAC,MAAc,EAAE,I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+ constructor(message: string, code: string, statusCode?: number, details?: unknown);
6
+ }
7
+ //# sourceMappingURL=base.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../src/errors/base.ts"],"names":[],"mappings":"AAAA,qBAAa,QAAS,SAAQ,KAAK;IACjC,SAAgB,IAAI,EAAE,MAAM,CAAC;IAC7B,SAAgB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpC,SAAgB,OAAO,CAAC,EAAE,OAAO,CAAC;gBAEtB,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO;CASlF"}
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SDKError = void 0;
4
+ class SDKError extends Error {
5
+ constructor(message, code, statusCode, details) {
6
+ super(message);
7
+ this.name = this.constructor.name;
8
+ this.code = code;
9
+ this.statusCode = statusCode;
10
+ this.details = details;
11
+ Error.captureStackTrace(this, this.constructor);
12
+ }
13
+ }
14
+ exports.SDKError = SDKError;
15
+ //# sourceMappingURL=base.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base.js","sourceRoot":"","sources":["../../src/errors/base.ts"],"names":[],"mappings":";;;AAAA,MAAa,QAAS,SAAQ,KAAK;IAKjC,YAAY,OAAe,EAAE,IAAY,EAAE,UAAmB,EAAE,OAAiB;QAC/E,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;QAClC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QAEvB,KAAK,CAAC,iBAAiB,CAAC,IAAI,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;IAClD,CAAC;CACF;AAdD,4BAcC"}
@@ -0,0 +1,3 @@
1
+ export * from './base';
2
+ export * from './api-error';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/errors/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC"}
@@ -0,0 +1,19 @@
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
+ __exportStar(require("./base"), exports);
18
+ __exportStar(require("./api-error"), exports);
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/errors/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yCAAuB;AACvB,8CAA4B"}
@@ -0,0 +1,14 @@
1
+ import { Config, SDKConfigOptions } from './config';
2
+ import { Transactions } from './resources/Transactions';
3
+ import { Invoices } from './resources/Invoices';
4
+ export * from './errors';
5
+ export declare class Nodela {
6
+ private config;
7
+ private client;
8
+ readonly transactions: Transactions;
9
+ readonly invoices: Invoices;
10
+ constructor(apiKey: string, options?: SDKConfigOptions);
11
+ getConfig(): ReturnType<Config['getAll']>;
12
+ }
13
+ export default Nodela;
14
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAEpD,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAEhD,cAAc,UAAU,CAAC;AAEzB,qBAAa,MAAM;IACjB,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,MAAM,CAAa;IAE3B,SAAgB,YAAY,EAAE,YAAY,CAAC;IAC3C,SAAgB,QAAQ,EAAE,QAAQ,CAAC;gBAEvB,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,gBAAgB;IAQtD,SAAS,IAAI,UAAU,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;CAG1C;AAED,eAAe,MAAM,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,36 @@
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.Nodela = void 0;
18
+ const config_1 = require("./config");
19
+ const client_1 = require("./client");
20
+ const Transactions_1 = require("./resources/Transactions");
21
+ const Invoices_1 = require("./resources/Invoices");
22
+ __exportStar(require("./errors"), exports);
23
+ class Nodela {
24
+ constructor(apiKey, options) {
25
+ this.config = new config_1.Config(apiKey, options);
26
+ this.client = new client_1.HTTPClient(this.config);
27
+ this.transactions = new Transactions_1.Transactions(this.client);
28
+ this.invoices = new Invoices_1.Invoices(this.client);
29
+ }
30
+ getConfig() {
31
+ return this.config.getAll();
32
+ }
33
+ }
34
+ exports.Nodela = Nodela;
35
+ exports.default = Nodela;
36
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,qCAAoD;AACpD,qCAAsC;AACtC,2DAAwD;AACxD,mDAAgD;AAEhD,2CAAyB;AAEzB,MAAa,MAAM;IAOjB,YAAY,MAAc,EAAE,OAA0B;QACpD,IAAI,CAAC,MAAM,GAAG,IAAI,eAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAC1C,IAAI,CAAC,MAAM,GAAG,IAAI,mBAAU,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAE1C,IAAI,CAAC,YAAY,GAAG,IAAI,2BAAY,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAClD,IAAI,CAAC,QAAQ,GAAG,IAAI,mBAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC5C,CAAC;IAED,SAAS;QACP,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;IAC9B,CAAC;CACF;AAlBD,wBAkBC;AAED,kBAAe,MAAM,CAAC"}
@@ -0,0 +1,86 @@
1
+ import { BaseResource } from './base';
2
+ import { HTTPClient } from '../client';
3
+ export declare const SUPPORTED_CURRENCIES: readonly ["USD", "CAD", "MXN", "BRL", "ARS", "CLP", "COP", "PEN", "JMD", "TTD", "EUR", "GBP", "CHF", "SEK", "NOK", "DKK", "PLN", "CZK", "HUF", "RON", "BGN", "HRK", "ISK", "TRY", "RUB", "UAH", "NGN", "ZAR", "KES", "GHS", "EGP", "MAD", "TZS", "UGX", "XOF", "XAF", "ETB", "JPY", "CNY", "INR", "KRW", "IDR", "MYR", "THB", "PHP", "VND", "SGD", "HKD", "TWD", "BDT", "PKR", "LKR", "AED", "SAR", "QAR", "KWD", "BHD", "OMR", "ILS", "JOD", "AUD", "NZD", "FJD"];
4
+ export type SupportedCurrency = (typeof SUPPORTED_CURRENCIES)[number];
5
+ export interface CreateInvoiceParams {
6
+ amount: number;
7
+ currency: SupportedCurrency;
8
+ success_url?: string;
9
+ cancel_url?: string;
10
+ webhook_url?: string;
11
+ reference?: string;
12
+ customer?: {
13
+ name?: string;
14
+ email: string;
15
+ };
16
+ title?: string;
17
+ description?: string;
18
+ }
19
+ export interface CreateInvoiceResponse {
20
+ success: boolean;
21
+ error?: {
22
+ code: string;
23
+ message: string;
24
+ };
25
+ data?: {
26
+ id: string;
27
+ invoice_id: string;
28
+ original_amount: string;
29
+ original_currency: string;
30
+ amount: string;
31
+ currency: string;
32
+ exchange_rate?: string;
33
+ webhook_url?: string;
34
+ customer?: {
35
+ email: string;
36
+ name?: string;
37
+ };
38
+ checkout_url: string;
39
+ status?: string;
40
+ created_at: string;
41
+ };
42
+ }
43
+ export interface VerifyInvoiceResponse {
44
+ success: boolean;
45
+ data?: {
46
+ id: string;
47
+ invoice_id: string;
48
+ reference?: string;
49
+ original_amount: string;
50
+ original_currency: string;
51
+ amount: number;
52
+ currency: string;
53
+ exchange_rate?: number;
54
+ title?: string;
55
+ description?: string;
56
+ status: string;
57
+ paid: true;
58
+ customer?: {
59
+ email: string;
60
+ name?: string;
61
+ };
62
+ created_at: string;
63
+ payment?: {
64
+ id: string;
65
+ network: string;
66
+ token: string;
67
+ address: string;
68
+ amount: number;
69
+ status: string;
70
+ tx_hash: string[];
71
+ transaction_type: string;
72
+ payer_email: string;
73
+ created_at: string;
74
+ };
75
+ };
76
+ error?: {
77
+ code: string;
78
+ message: string;
79
+ };
80
+ }
81
+ export declare class Invoices extends BaseResource {
82
+ constructor(client: HTTPClient);
83
+ create(params: CreateInvoiceParams): Promise<CreateInvoiceResponse>;
84
+ verify(invoiceId: string): Promise<VerifyInvoiceResponse>;
85
+ }
86
+ //# sourceMappingURL=Invoices.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Invoices.d.ts","sourceRoot":"","sources":["../../src/resources/Invoices.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAEvC,eAAO,MAAM,oBAAoB,ocAsEvB,CAAC;AAEX,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,oBAAoB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEtE,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE;QACT,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,KAAK,EAAE,MAAM,CAAC;KACf,CAAC;IACF,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE;QACN,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;IACF,IAAI,CAAC,EAAE;QACL,EAAE,EAAE,MAAM,CAAC;QACX,UAAU,EAAE,MAAM,CAAC;QACnB,eAAe,EAAE,MAAM,CAAC;QACxB,iBAAiB,EAAE,MAAM,CAAC;QAC1B,MAAM,EAAE,MAAM,CAAC;QACf,QAAQ,EAAE,MAAM,CAAC;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AK,CAAC,EAAE;QACN,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;CACH;AAED,qBAAa,QAAS,SAAQ,YAAY;gBAC5B,MAAM,EAAE,UAAU;IAIxB,MAAM,CAAC,MAAM,EAAE,mBAAmB,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAUnE,MAAM,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,qBAAqB,CAAC;CAGhE"}
@@ -0,0 +1,86 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Invoices = exports.SUPPORTED_CURRENCIES = void 0;
4
+ const base_1 = require("./base");
5
+ exports.SUPPORTED_CURRENCIES = [
6
+ 'USD',
7
+ 'CAD',
8
+ 'MXN',
9
+ 'BRL',
10
+ 'ARS',
11
+ 'CLP',
12
+ 'COP',
13
+ 'PEN',
14
+ 'JMD',
15
+ 'TTD',
16
+ 'EUR',
17
+ 'GBP',
18
+ 'CHF',
19
+ 'SEK',
20
+ 'NOK',
21
+ 'DKK',
22
+ 'PLN',
23
+ 'CZK',
24
+ 'HUF',
25
+ 'RON',
26
+ 'BGN',
27
+ 'HRK',
28
+ 'ISK',
29
+ 'TRY',
30
+ 'RUB',
31
+ 'UAH',
32
+ 'NGN',
33
+ 'ZAR',
34
+ 'KES',
35
+ 'GHS',
36
+ 'EGP',
37
+ 'MAD',
38
+ 'TZS',
39
+ 'UGX',
40
+ 'XOF',
41
+ 'XAF',
42
+ 'ETB',
43
+ 'JPY',
44
+ 'CNY',
45
+ 'INR',
46
+ 'KRW',
47
+ 'IDR',
48
+ 'MYR',
49
+ 'THB',
50
+ 'PHP',
51
+ 'VND',
52
+ 'SGD',
53
+ 'HKD',
54
+ 'TWD',
55
+ 'BDT',
56
+ 'PKR',
57
+ 'LKR',
58
+ 'AED',
59
+ 'SAR',
60
+ 'QAR',
61
+ 'KWD',
62
+ 'BHD',
63
+ 'OMR',
64
+ 'ILS',
65
+ 'JOD',
66
+ 'AUD',
67
+ 'NZD',
68
+ 'FJD',
69
+ ];
70
+ class Invoices extends base_1.BaseResource {
71
+ constructor(client) {
72
+ super(client, '/v1/invoices');
73
+ }
74
+ async create(params) {
75
+ const upper = params.currency.toUpperCase();
76
+ if (!exports.SUPPORTED_CURRENCIES.includes(upper)) {
77
+ throw new Error(`Unsupported currency: "${params.currency}". Supported currencies: ${exports.SUPPORTED_CURRENCIES.join(', ')}`);
78
+ }
79
+ return this.client.post(this.basePath, { ...params, currency: upper });
80
+ }
81
+ async verify(invoiceId) {
82
+ return this.client.get(this.buildPath(invoiceId, 'verify'));
83
+ }
84
+ }
85
+ exports.Invoices = Invoices;
86
+ //# sourceMappingURL=Invoices.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Invoices.js","sourceRoot":"","sources":["../../src/resources/Invoices.ts"],"names":[],"mappings":";;;AAAA,iCAAsC;AAGzB,QAAA,oBAAoB,GAAG;IAElC,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IAEL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IAEL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IAEL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IAEL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IAEL,KAAK;IACL,KAAK;IACL,KAAK;CACG,CAAC;AAmFX,MAAa,QAAS,SAAQ,mBAAY;IACxC,YAAY,MAAkB;QAC5B,KAAK,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;IAChC,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,MAA2B;QACtC,MAAM,KAAK,GAAG,MAAM,CAAC,QAAQ,CAAC,WAAW,EAAuB,CAAC;QACjE,IAAI,CAAC,4BAAoB,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;YAC1C,MAAM,IAAI,KAAK,CACb,0BAA0B,MAAM,CAAC,QAAQ,4BAA4B,4BAAoB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CACvG,CAAC;QACJ,CAAC;QACD,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,EAAE,GAAG,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,CAAC;IACzE,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,SAAiB;QAC5B,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC,CAAC;IAC9D,CAAC;CACF;AAlBD,4BAkBC"}
@@ -0,0 +1,58 @@
1
+ import { BaseResource } from './base';
2
+ import { HTTPClient } from '../client';
3
+ export interface ListTransactionsParams {
4
+ page?: number;
5
+ limit?: number;
6
+ }
7
+ export interface TransactionCustomer {
8
+ email: string;
9
+ name: string;
10
+ }
11
+ export interface TransactionPayment {
12
+ id: string;
13
+ network: string;
14
+ token: string;
15
+ address: string;
16
+ amount: number;
17
+ status: string;
18
+ tx_hash: string[];
19
+ transaction_type: string;
20
+ payer_email: string;
21
+ created_at: string;
22
+ }
23
+ export interface Transaction {
24
+ id: string;
25
+ invoice_id: string;
26
+ reference: string;
27
+ original_amount: number;
28
+ original_currency: string;
29
+ amount: number;
30
+ currency: string;
31
+ exchange_rate: number;
32
+ title: string;
33
+ description: string;
34
+ status: string;
35
+ paid: boolean;
36
+ customer: TransactionCustomer;
37
+ created_at: string;
38
+ payment: TransactionPayment;
39
+ }
40
+ export interface Pagination {
41
+ page: number;
42
+ limit: number;
43
+ total: number;
44
+ total_pages: number;
45
+ has_more: boolean;
46
+ }
47
+ export interface ListTransactionsResponse {
48
+ success: boolean;
49
+ data: {
50
+ transactions: Transaction[];
51
+ pagination: Pagination;
52
+ };
53
+ }
54
+ export declare class Transactions extends BaseResource {
55
+ constructor(client: HTTPClient);
56
+ list(params?: ListTransactionsParams): Promise<ListTransactionsResponse>;
57
+ }
58
+ //# sourceMappingURL=Transactions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Transactions.d.ts","sourceRoot":"","sources":["../../src/resources/Transactions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAEvC,MAAM,WAAW,sBAAsB;IACrC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,kBAAkB;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,gBAAgB,EAAE,MAAM,CAAC;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,EAAE,MAAM,CAAC;IACxB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,OAAO,CAAC;IACd,QAAQ,EAAE,mBAAmB,CAAC;IAC9B,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,kBAAkB,CAAC;CAC7B;AAED,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,wBAAwB;IACvC,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE;QACJ,YAAY,EAAE,WAAW,EAAE,CAAC;QAC5B,UAAU,EAAE,UAAU,CAAC;KACxB,CAAC;CACH;AAED,qBAAa,YAAa,SAAQ,YAAY;gBAChC,MAAM,EAAE,UAAU;IAIxB,IAAI,CAAC,MAAM,CAAC,EAAE,sBAAsB,GAAG,OAAO,CAAC,wBAAwB,CAAC;CAG/E"}
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Transactions = void 0;
4
+ const base_1 = require("./base");
5
+ class Transactions extends base_1.BaseResource {
6
+ constructor(client) {
7
+ super(client, '/v1/transactions');
8
+ }
9
+ async list(params) {
10
+ return this.client.get(this.basePath + this.buildQueryString(params));
11
+ }
12
+ }
13
+ exports.Transactions = Transactions;
14
+ //# sourceMappingURL=Transactions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Transactions.js","sourceRoot":"","sources":["../../src/resources/Transactions.ts"],"names":[],"mappings":";;;AAAA,iCAAsC;AA4DtC,MAAa,YAAa,SAAQ,mBAAY;IAC5C,YAAY,MAAkB;QAC5B,KAAK,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC;IACpC,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,MAA+B;QACxC,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC,CAAC;IACxE,CAAC;CACF;AARD,oCAQC"}
@@ -0,0 +1,9 @@
1
+ import { HTTPClient } from '../client';
2
+ export declare abstract class BaseResource {
3
+ protected client: HTTPClient;
4
+ protected basePath: string;
5
+ constructor(client: HTTPClient, basePath: string);
6
+ protected buildPath(...segments: (string | number)[]): string;
7
+ protected buildQueryString(params?: Record<string, unknown> | object): string;
8
+ }
9
+ //# sourceMappingURL=base.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../src/resources/base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAEvC,8BAAsB,YAAY;IAChC,SAAS,CAAC,MAAM,EAAE,UAAU,CAAC;IAC7B,SAAS,CAAC,QAAQ,EAAE,MAAM,CAAC;gBAEf,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM;IAKhD,SAAS,CAAC,SAAS,CAAC,GAAG,QAAQ,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,GAAG,MAAM;IAI7D,SAAS,CAAC,gBAAgB,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,GAAG,MAAM;CAU9E"}