@plyaz/types 1.13.14 → 1.13.15
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/api/index.cjs +538 -5286
- package/dist/api/index.cjs.map +1 -1
- package/dist/errors/index.cjs +577 -5327
- package/dist/errors/index.cjs.map +1 -1
- package/dist/index.cjs +775 -1336
- package/dist/index.cjs.map +1 -1
- package/dist/payments/base-error/types.d.ts +2 -2
- package/dist/payments/gateways/provider/types.d.ts +13 -13
- package/dist/payments/gateways/routings/types.d.ts +30 -11
- package/dist/payments/provider/adapter/types.d.ts +2 -2
- package/dist/payments/provider/core/types.d.ts +6 -6
- package/dist/payments/provider/payment-provider/types.d.ts +2 -2
- package/dist/payments/transaction/types.d.ts +3 -3
- package/package.json +2 -2
|
@@ -2,9 +2,9 @@ import type { PAYMENTMETHOD, PAYMENTPROVIDERTYPE, ProviderCapabilities, Provider
|
|
|
2
2
|
import type { Money } from '../transaction';
|
|
3
3
|
import type { BaseErrorContext } from '../../api';
|
|
4
4
|
import type { EventProcessingMetadata, PaymentEventPayload, PAYMENTEVENTTYPE } from '../events';
|
|
5
|
-
import type { CURRENCY_CODES } from '@plyaz/config';
|
|
6
5
|
import type { PAYMENT_ERROR_CATEGORY } from './enum';
|
|
7
6
|
import type { ERROR_SEVERITY } from '../../errors';
|
|
7
|
+
import type { CurrencyCode } from '@plyaz/config';
|
|
8
8
|
/**
|
|
9
9
|
* Base adapter options used for constructing provider adapters.
|
|
10
10
|
*/
|
|
@@ -12,7 +12,7 @@ export interface BasePaymentAdapterOptions {
|
|
|
12
12
|
name: PAYMENTPROVIDERTYPE;
|
|
13
13
|
apiVersion: string;
|
|
14
14
|
methods: PAYMENTMETHOD[];
|
|
15
|
-
currencies:
|
|
15
|
+
currencies: CurrencyCode[];
|
|
16
16
|
capabilities: ProviderCapabilities;
|
|
17
17
|
providerConfiguration: ProviderConfiguration;
|
|
18
18
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { CurrencyCode } from '@plyaz/config';
|
|
2
2
|
import type { PAYMENTMETHOD, PAYMENTPROVIDERTYPE } from '../../provider';
|
|
3
3
|
/**
|
|
4
4
|
* Base configuration interface that all payment providers must implement.
|
|
@@ -238,13 +238,13 @@ export interface ProviderFeeConfiguration {
|
|
|
238
238
|
/** Fixed fee per transaction (in cents) */
|
|
239
239
|
fixed: number;
|
|
240
240
|
/** Currency for fixed fees */
|
|
241
|
-
currency:
|
|
241
|
+
currency: CurrencyCode;
|
|
242
242
|
};
|
|
243
243
|
/** Payment method specific fees */
|
|
244
244
|
methodFees: Record<PAYMENTMETHOD, {
|
|
245
245
|
percentage: number;
|
|
246
246
|
fixed: number;
|
|
247
|
-
currency:
|
|
247
|
+
currency: CurrencyCode;
|
|
248
248
|
}>;
|
|
249
249
|
/** Volume-based fee tiers */
|
|
250
250
|
volumeTiers: VolumeTier[];
|
|
@@ -252,7 +252,7 @@ export interface ProviderFeeConfiguration {
|
|
|
252
252
|
regionalFees: Record<string, {
|
|
253
253
|
percentage: number;
|
|
254
254
|
fixed: number;
|
|
255
|
-
currency:
|
|
255
|
+
currency: CurrencyCode;
|
|
256
256
|
}>;
|
|
257
257
|
/** Additional fee types */
|
|
258
258
|
additionalFees: {
|
|
@@ -269,7 +269,7 @@ export interface ProviderFeeConfiguration {
|
|
|
269
269
|
/** Chargeback fees */
|
|
270
270
|
chargeback?: {
|
|
271
271
|
amount: number;
|
|
272
|
-
currency:
|
|
272
|
+
currency: CurrencyCode;
|
|
273
273
|
};
|
|
274
274
|
/** Refund processing fees */
|
|
275
275
|
refund?: {
|
|
@@ -284,12 +284,12 @@ export interface ProviderFeeConfiguration {
|
|
|
284
284
|
/** Minimum fee amount */
|
|
285
285
|
minimumFee?: {
|
|
286
286
|
amount: number;
|
|
287
|
-
currency:
|
|
287
|
+
currency: CurrencyCode;
|
|
288
288
|
};
|
|
289
289
|
/** Maximum fee amount */
|
|
290
290
|
maximumFee?: {
|
|
291
291
|
amount: number;
|
|
292
|
-
currency:
|
|
292
|
+
currency: CurrencyCode;
|
|
293
293
|
};
|
|
294
294
|
};
|
|
295
295
|
}
|
|
@@ -302,13 +302,13 @@ export interface VolumeTier {
|
|
|
302
302
|
/** Minimum monthly volume to qualify */
|
|
303
303
|
minimumVolume: {
|
|
304
304
|
amount: number;
|
|
305
|
-
currency:
|
|
305
|
+
currency: CurrencyCode;
|
|
306
306
|
};
|
|
307
307
|
/** Fee rates for this tier */
|
|
308
308
|
feeRates: {
|
|
309
309
|
percentage: number;
|
|
310
310
|
fixed: number;
|
|
311
|
-
currency:
|
|
311
|
+
currency: CurrencyCode;
|
|
312
312
|
};
|
|
313
313
|
/** Tier benefits */
|
|
314
314
|
benefits?: string[];
|
|
@@ -324,12 +324,12 @@ export interface ProviderLimitsConfiguration<TProviderSpecific extends object =
|
|
|
324
324
|
/** Minimum transaction amount */
|
|
325
325
|
minimum: Record<PAYMENTMETHOD, {
|
|
326
326
|
amount: number;
|
|
327
|
-
currency:
|
|
327
|
+
currency: CurrencyCode;
|
|
328
328
|
}>;
|
|
329
329
|
/** Maximum transaction amount */
|
|
330
330
|
maximum: Record<PAYMENTMETHOD, {
|
|
331
331
|
amount: number;
|
|
332
|
-
currency:
|
|
332
|
+
currency: CurrencyCode;
|
|
333
333
|
}>;
|
|
334
334
|
};
|
|
335
335
|
/** Velocity limits */
|
|
@@ -341,7 +341,7 @@ export interface ProviderLimitsConfiguration<TProviderSpecific extends object =
|
|
|
341
341
|
/** Maximum total amount */
|
|
342
342
|
maxAmount: {
|
|
343
343
|
amount: number;
|
|
344
|
-
currency:
|
|
344
|
+
currency: CurrencyCode;
|
|
345
345
|
};
|
|
346
346
|
};
|
|
347
347
|
/** Monthly transaction limits */
|
|
@@ -349,7 +349,7 @@ export interface ProviderLimitsConfiguration<TProviderSpecific extends object =
|
|
|
349
349
|
maxTransactions: number;
|
|
350
350
|
maxAmount: {
|
|
351
351
|
amount: number;
|
|
352
|
-
currency:
|
|
352
|
+
currency: CurrencyCode;
|
|
353
353
|
};
|
|
354
354
|
};
|
|
355
355
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { CurrencyCode } from '@plyaz/config';
|
|
2
2
|
import type { PAYMENTMETHOD, PAYMENTPROVIDERTYPE, TRANSACTIONTYPE, USERTYPE } from '../../provider';
|
|
3
3
|
import type { VolumeTier } from '../provider/types';
|
|
4
4
|
import type { COSTOPTIMIZATIONSTRATEGY, FAILOVERSTRATEGY, LOADBALANCINGSTRATEGY, PERFORMANCEMETRICTYPE, REGULATORYFRAMEWORK, ROUTINGSTRATEGY } from './enums';
|
|
@@ -35,7 +35,7 @@ export interface ProviderSelectionRules {
|
|
|
35
35
|
/** Amount-based provider selection */
|
|
36
36
|
amountBasedSelection: AmountBasedRule[];
|
|
37
37
|
/** Currency-specific provider preferences */
|
|
38
|
-
currencySpecificProviders: Record<
|
|
38
|
+
currencySpecificProviders: Record<CurrencyCode, ProviderPreference[]>;
|
|
39
39
|
/** Region-specific provider preferences */
|
|
40
40
|
regionSpecificProviders: Record<string, ProviderPreference[]>;
|
|
41
41
|
/** User type specific preferences */
|
|
@@ -60,12 +60,12 @@ export interface ProviderPreference {
|
|
|
60
60
|
/** Maximum transaction amount for this provider */
|
|
61
61
|
maxAmount?: {
|
|
62
62
|
amount: number;
|
|
63
|
-
currency:
|
|
63
|
+
currency: CurrencyCode;
|
|
64
64
|
};
|
|
65
65
|
/** Minimum transaction amount for this provider */
|
|
66
66
|
minAmount?: {
|
|
67
67
|
amount: number;
|
|
68
|
-
currency:
|
|
68
|
+
currency: CurrencyCode;
|
|
69
69
|
};
|
|
70
70
|
/** Health check requirements */
|
|
71
71
|
healthRequirements: {
|
|
@@ -100,11 +100,11 @@ export interface AmountBasedRule {
|
|
|
100
100
|
amountRange: {
|
|
101
101
|
min: {
|
|
102
102
|
amount: number;
|
|
103
|
-
currency:
|
|
103
|
+
currency: CurrencyCode;
|
|
104
104
|
};
|
|
105
105
|
max: {
|
|
106
106
|
amount: number;
|
|
107
|
-
currency:
|
|
107
|
+
currency: CurrencyCode;
|
|
108
108
|
};
|
|
109
109
|
};
|
|
110
110
|
/** Preferred providers for this amount range */
|
|
@@ -307,7 +307,7 @@ export interface GeographicRoutingConfig {
|
|
|
307
307
|
enabled: boolean;
|
|
308
308
|
/** Zone definitions */
|
|
309
309
|
zones: Record<string, {
|
|
310
|
-
currencies:
|
|
310
|
+
currencies: CurrencyCode[];
|
|
311
311
|
preferredProviders: PAYMENTPROVIDERTYPE[];
|
|
312
312
|
}>;
|
|
313
313
|
};
|
|
@@ -330,11 +330,11 @@ export interface RegionRoutingConfig {
|
|
|
330
330
|
transactionLimits: {
|
|
331
331
|
daily: {
|
|
332
332
|
amount: number;
|
|
333
|
-
currency:
|
|
333
|
+
currency: CurrencyCode;
|
|
334
334
|
};
|
|
335
335
|
monthly: {
|
|
336
336
|
amount: number;
|
|
337
|
-
currency:
|
|
337
|
+
currency: CurrencyCode;
|
|
338
338
|
};
|
|
339
339
|
};
|
|
340
340
|
/** Required licenses */
|
|
@@ -368,11 +368,11 @@ export interface ComplianceRule {
|
|
|
368
368
|
amountThresholds?: {
|
|
369
369
|
min?: {
|
|
370
370
|
amount: number;
|
|
371
|
-
currency:
|
|
371
|
+
currency: CurrencyCode;
|
|
372
372
|
};
|
|
373
373
|
max?: {
|
|
374
374
|
amount: number;
|
|
375
|
-
currency:
|
|
375
|
+
currency: CurrencyCode;
|
|
376
376
|
};
|
|
377
377
|
};
|
|
378
378
|
/** User types affected */
|
|
@@ -510,3 +510,22 @@ export interface ABTestExperiment {
|
|
|
510
510
|
/** Experiment active status */
|
|
511
511
|
active: boolean;
|
|
512
512
|
}
|
|
513
|
+
/**
|
|
514
|
+
* Enumerates all routing rule identifiers used within RouterStrategy.
|
|
515
|
+
*
|
|
516
|
+
* Purpose:
|
|
517
|
+
* - Avoid hardcoded strings for rule names
|
|
518
|
+
* - Provide consistent naming for debugging and error contexts
|
|
519
|
+
* - Improve developer experience via auto-completion
|
|
520
|
+
*/
|
|
521
|
+
export declare enum ROUTER_RULE_NAME {
|
|
522
|
+
AmountBasedSelection = "amountBasedSelection",
|
|
523
|
+
CurrencySpecificProviders = "currencySpecificProviders",
|
|
524
|
+
RegionSelection = "regionSelection",
|
|
525
|
+
RegionCompliance = "regionCompliance",
|
|
526
|
+
UserTypeSelection = "userTypeSelection",
|
|
527
|
+
TimeBasedSelection = "timeBasedSelection",
|
|
528
|
+
CustomRuleEvaluation = "customRuleEvaluation",
|
|
529
|
+
ABTesting = "abTesting",
|
|
530
|
+
DefaultSelection = "defaultSelection"
|
|
531
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { CurrencyCode } from '@plyaz/config';
|
|
2
2
|
import type { ProviderHealthStatus } from '../../../features';
|
|
3
3
|
import type { BaseProviderConfig } from '../../gateways';
|
|
4
4
|
import type { PaymentResult, ProcessPaymentRequest } from '../../request';
|
|
@@ -25,7 +25,7 @@ export interface PaymentAdapter {
|
|
|
25
25
|
/** Payment methods supported by this provider */
|
|
26
26
|
readonly supportedMethods: PAYMENTMETHOD[];
|
|
27
27
|
/** Currencies supported by this provider */
|
|
28
|
-
readonly supportedCurrencies:
|
|
28
|
+
readonly supportedCurrencies: CurrencyCode[];
|
|
29
29
|
/** Detailed capabilities of this provider */
|
|
30
30
|
readonly capabilities: ProviderCapabilities;
|
|
31
31
|
/** Provider configuration and metadata */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { CurrencyCode } from '@plyaz/config';
|
|
2
2
|
import type { FeeBreakdown, Money } from '../../transaction';
|
|
3
3
|
import type { PAYMENTMETHOD, PAYMENTPROVIDERTYPE, PAYMENTSTATUS } from '../provider-capability';
|
|
4
4
|
/**
|
|
@@ -256,7 +256,7 @@ export interface NormalizedPaymentRequest<TMetadata extends object = object> {
|
|
|
256
256
|
/** Payment method */
|
|
257
257
|
method: PAYMENTMETHOD;
|
|
258
258
|
/** CurrencyCode */
|
|
259
|
-
CurrencyCode:
|
|
259
|
+
CurrencyCode: CurrencyCode;
|
|
260
260
|
/** User initiating the transaction */
|
|
261
261
|
userId: string;
|
|
262
262
|
/** Product or service being purchased */
|
|
@@ -288,7 +288,7 @@ export interface TransactionDetails<TMetadata extends object = object> {
|
|
|
288
288
|
/** Payment method used */
|
|
289
289
|
method: PAYMENTMETHOD;
|
|
290
290
|
/** CurrencyCode of the transaction */
|
|
291
|
-
CurrencyCode:
|
|
291
|
+
CurrencyCode: CurrencyCode;
|
|
292
292
|
/** Timestamp when transaction was created */
|
|
293
293
|
createdAt: Date;
|
|
294
294
|
/** Timestamp of the latest status update */
|
|
@@ -329,7 +329,7 @@ export interface AdapterConfiguration<TMetadata extends object = object> {
|
|
|
329
329
|
};
|
|
330
330
|
/** Supported payment methods and currencies */
|
|
331
331
|
supportedMethods: PAYMENTMETHOD[];
|
|
332
|
-
supportedCurrencies:
|
|
332
|
+
supportedCurrencies: CurrencyCode[];
|
|
333
333
|
/** Additional configuration or metadata */
|
|
334
334
|
metadata?: TMetadata;
|
|
335
335
|
}
|
|
@@ -383,7 +383,7 @@ export interface PayoutParams<TMetadata extends object = object> {
|
|
|
383
383
|
/** Amount to pay out */
|
|
384
384
|
amount: Money;
|
|
385
385
|
/** CurrencyCode of payout */
|
|
386
|
-
CurrencyCode:
|
|
386
|
+
CurrencyCode: CurrencyCode;
|
|
387
387
|
/** Optional bank account / wallet ID at provider */
|
|
388
388
|
destinationId?: string;
|
|
389
389
|
/** Optional description */
|
|
@@ -415,7 +415,7 @@ export interface ReceiptData<TMetadata extends object = object> {
|
|
|
415
415
|
receiptId: string;
|
|
416
416
|
issuedAt: Date;
|
|
417
417
|
amount: Money;
|
|
418
|
-
CurrencyCode:
|
|
418
|
+
CurrencyCode: CurrencyCode;
|
|
419
419
|
lineItems?: Array<{
|
|
420
420
|
name: string;
|
|
421
421
|
quantity: number;
|
|
@@ -4,7 +4,7 @@ import type { PaymentResult, ProcessPaymentRequest } from '../../request';
|
|
|
4
4
|
import type { FeeBreakdown, Money } from '../../transaction';
|
|
5
5
|
import type { CreateCustomerParams, CustomerResult, FeeCalculationOptions, PaymentStatusResult, RefundParams, RefundResult, SavedPaymentMethodResult, SavePaymentMethodParams, TransactionHistory, TransactionHistoryParams, WebhookPayload, WebhookResult } from '../core';
|
|
6
6
|
import type { PAYMENTMETHOD, PAYMENTPROVIDERTYPE } from '../provider-capability';
|
|
7
|
-
import type {
|
|
7
|
+
import type { CurrencyCode } from '@plyaz/config';
|
|
8
8
|
/**
|
|
9
9
|
* Core interface that all payment providers must implement.
|
|
10
10
|
* This interface ensures consistent behavior across all providers
|
|
@@ -22,7 +22,7 @@ export interface PaymentProvider {
|
|
|
22
22
|
/** Payment methods supported by this provider */
|
|
23
23
|
readonly supportedMethods: PAYMENTMETHOD[];
|
|
24
24
|
/** Currencies supported by this provider */
|
|
25
|
-
readonly supportedCurrencies:
|
|
25
|
+
readonly supportedCurrencies: CurrencyCode[];
|
|
26
26
|
/** Detailed capabilities of this provider */
|
|
27
27
|
readonly capabilities: ProviderCapabilities;
|
|
28
28
|
/** Provider configuration and metadata */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { CurrencyCode } from '@plyaz/config';
|
|
2
2
|
/**
|
|
3
3
|
* Core money interface for handling monetary values throughout the system.
|
|
4
4
|
* All monetary amounts are stored in the smallest currency unit to avoid
|
|
@@ -20,7 +20,7 @@ export interface Money {
|
|
|
20
20
|
* Currency code following ISO 4217 standard for fiat currencies
|
|
21
21
|
* and custom codes for cryptocurrencies (BTC, ETH, etc.)
|
|
22
22
|
*/
|
|
23
|
-
currency:
|
|
23
|
+
currency: CurrencyCode;
|
|
24
24
|
/**
|
|
25
25
|
* Human-readable formatted amount for display purposes
|
|
26
26
|
* Example: "$50.00", "€45.50", "0.001 BTC"
|
|
@@ -35,7 +35,7 @@ export interface Money {
|
|
|
35
35
|
* Original currency if this amount was converted
|
|
36
36
|
* Helps with audit trails and reconciliation
|
|
37
37
|
*/
|
|
38
|
-
originalCurrency?:
|
|
38
|
+
originalCurrency?: CurrencyCode;
|
|
39
39
|
/**
|
|
40
40
|
* Timestamp when exchange rate was calculated
|
|
41
41
|
* Important for cryptocurrency and volatile currency exchanges
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plyaz/types",
|
|
3
|
-
"version": "1.13.
|
|
3
|
+
"version": "1.13.15",
|
|
4
4
|
"author": "Redeemer Pace",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"description": "Provides shared TypeScript types and schema utilities for validation and parsing in the @playz ecosystem.",
|
|
@@ -192,6 +192,7 @@
|
|
|
192
192
|
"keywords": [],
|
|
193
193
|
"packageManager": "pnpm@10.11.0",
|
|
194
194
|
"dependencies": {
|
|
195
|
+
"@plyaz/config": "^1.7.3",
|
|
195
196
|
"pino": "^10.0.0",
|
|
196
197
|
"type-fest": "^4.41.0",
|
|
197
198
|
"zustand": "^5.0.0"
|
|
@@ -204,7 +205,6 @@
|
|
|
204
205
|
"@eslint/markdown": "^6.5.0",
|
|
205
206
|
"@nestjs/common": "^11.1.7",
|
|
206
207
|
"@next/eslint-plugin-next": "^15.0.3",
|
|
207
|
-
"@plyaz/config": "^1.6.5",
|
|
208
208
|
"@plyaz/devtools": "^1.9.4",
|
|
209
209
|
"@tanstack/react-query": "5.85.6",
|
|
210
210
|
"@testing-library/react": "^16.3.0",
|