@plyaz/types 1.11.3 → 1.12.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.
- package/dist/errors/types.d.ts +3 -0
- package/dist/index.cjs +345 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +328 -1
- package/dist/index.js.map +1 -1
- package/dist/payments/currency/index.d.ts +37 -0
- package/dist/payments/events/emitter/index.d.ts +1 -0
- package/dist/payments/events/emitter/types.d.ts +333 -0
- package/dist/payments/events/enums.d.ts +110 -0
- package/dist/payments/events/index.d.ts +4 -0
- package/dist/payments/events/types.d.ts +151 -0
- package/dist/payments/events/unified-event/enums.d.ts +14 -0
- package/dist/payments/events/unified-event/index.d.ts +2 -0
- package/dist/payments/events/unified-event/types.d.ts +346 -0
- package/dist/payments/gateways/index.d.ts +2 -0
- package/dist/payments/gateways/provider/index.d.ts +1 -0
- package/dist/payments/gateways/provider/types.d.ts +435 -0
- package/dist/payments/gateways/routings/enums.d.ts +87 -0
- package/dist/payments/gateways/routings/index.d.ts +2 -0
- package/dist/payments/gateways/routings/types.d.ts +512 -0
- package/dist/payments/index.cjs +351 -0
- package/dist/payments/index.cjs.map +1 -0
- package/dist/payments/index.d.ts +7 -0
- package/dist/payments/index.js +332 -0
- package/dist/payments/index.js.map +1 -0
- package/dist/payments/provider/adapter/index.d.ts +1 -0
- package/dist/payments/provider/adapter/types.d.ts +208 -0
- package/dist/payments/provider/core/index.d.ts +1 -0
- package/dist/payments/provider/core/types.d.ts +508 -0
- package/dist/payments/provider/index.d.ts +4 -0
- package/dist/payments/provider/payment-provider/index.d.ts +1 -0
- package/dist/payments/provider/payment-provider/types.d.ts +269 -0
- package/dist/payments/provider/provider-capability/enums.d.ts +116 -0
- package/dist/payments/provider/provider-capability/index.d.ts +1 -0
- package/dist/payments/request/enums.d.ts +19 -0
- package/dist/payments/request/index.d.ts +2 -0
- package/dist/payments/request/types.d.ts +221 -0
- package/dist/payments/service/index.d.ts +1 -0
- package/dist/payments/service/types.d.ts +48 -0
- package/dist/payments/transaction/index.d.ts +1 -0
- package/dist/payments/transaction/types.d.ts +120 -0
- package/package.json +6 -1
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import type { CURRENCY } from '../currency';
|
|
2
|
+
/**
|
|
3
|
+
* Core money interface for handling monetary values throughout the system.
|
|
4
|
+
* All monetary amounts are stored in the smallest currency unit to avoid
|
|
5
|
+
* floating-point precision issues.
|
|
6
|
+
*
|
|
7
|
+
* Design Principles:
|
|
8
|
+
* - Always store amounts in smallest currency unit (cents, satoshis, wei)
|
|
9
|
+
* - Include currency information with every amount
|
|
10
|
+
* - Support display formatting for user interfaces
|
|
11
|
+
* - Track exchange rates for converted amounts
|
|
12
|
+
*/
|
|
13
|
+
export interface Money {
|
|
14
|
+
/**
|
|
15
|
+
* Amount in smallest currency unit (e.g., cents for USD, satoshis for BTC)
|
|
16
|
+
* Using integer values prevents floating-point precision issues
|
|
17
|
+
*/
|
|
18
|
+
amount: number;
|
|
19
|
+
/**
|
|
20
|
+
* Currency code following ISO 4217 standard for fiat currencies
|
|
21
|
+
* and custom codes for cryptocurrencies (BTC, ETH, etc.)
|
|
22
|
+
*/
|
|
23
|
+
currency: CURRENCY;
|
|
24
|
+
/**
|
|
25
|
+
* Human-readable formatted amount for display purposes
|
|
26
|
+
* Example: "$50.00", "€45.50", "0.001 BTC"
|
|
27
|
+
*/
|
|
28
|
+
displayAmount?: string;
|
|
29
|
+
/**
|
|
30
|
+
* Exchange rate used if this amount was converted from another currency
|
|
31
|
+
* Useful for tracking conversions and fees
|
|
32
|
+
*/
|
|
33
|
+
exchangeRate?: number;
|
|
34
|
+
/**
|
|
35
|
+
* Original currency if this amount was converted
|
|
36
|
+
* Helps with audit trails and reconciliation
|
|
37
|
+
*/
|
|
38
|
+
originalCurrency?: CURRENCY;
|
|
39
|
+
/**
|
|
40
|
+
* Timestamp when exchange rate was calculated
|
|
41
|
+
* Important for cryptocurrency and volatile currency exchanges
|
|
42
|
+
*/
|
|
43
|
+
exchangeRateTimestamp?: Date;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Comprehensive fee breakdown interface providing transparency
|
|
47
|
+
* into all costs associated with a payment transaction.
|
|
48
|
+
*
|
|
49
|
+
* Business Requirements:
|
|
50
|
+
* - Full transparency of all fees charged
|
|
51
|
+
* - Support for various fee types across providers
|
|
52
|
+
* - Regulatory compliance for fee disclosure
|
|
53
|
+
*/
|
|
54
|
+
export interface FeeBreakdown {
|
|
55
|
+
/** Payment processor fee (Stripe, PayPal, etc.) */
|
|
56
|
+
processingFee: Money;
|
|
57
|
+
/** Platform fee taken by Plyaz */
|
|
58
|
+
platformFee: Money;
|
|
59
|
+
/** Additional fee for international/cross-border transactions */
|
|
60
|
+
crossBorderFee?: Money;
|
|
61
|
+
/** Fee for currency conversion if applicable */
|
|
62
|
+
currencyConversionFee?: Money;
|
|
63
|
+
/** Network fee for blockchain transactions */
|
|
64
|
+
networkFee?: Money;
|
|
65
|
+
/** Gas fee for smart contract interactions */
|
|
66
|
+
gasFee?: Money;
|
|
67
|
+
/** Fee for instant/expedited processing */
|
|
68
|
+
expediteFee?: Money;
|
|
69
|
+
/** Risk assessment fee for high-risk transactions */
|
|
70
|
+
riskFee?: Money;
|
|
71
|
+
/** Regulatory compliance fee (where applicable) */
|
|
72
|
+
complianceFee?: Money;
|
|
73
|
+
/** Total of all fees combined */
|
|
74
|
+
total: Money;
|
|
75
|
+
/**
|
|
76
|
+
* Fee calculation metadata for audit and debugging
|
|
77
|
+
* Includes rate information and calculation details
|
|
78
|
+
*/
|
|
79
|
+
calculationMetadata?: {
|
|
80
|
+
processingRate?: number;
|
|
81
|
+
platformRate?: number;
|
|
82
|
+
crossBorderRate?: number;
|
|
83
|
+
conversionRate?: number;
|
|
84
|
+
calculatedAt: Date;
|
|
85
|
+
ruleVersion?: string;
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Payment limits interface defining constraints on transaction amounts
|
|
90
|
+
* and frequencies to support compliance and risk management.
|
|
91
|
+
*/
|
|
92
|
+
export interface PaymentLimits {
|
|
93
|
+
/** Minimum transaction amount per payment method */
|
|
94
|
+
minimumAmount: Money;
|
|
95
|
+
/** Maximum transaction amount per payment method */
|
|
96
|
+
maximumAmount: Money;
|
|
97
|
+
/** Maximum daily transaction volume per user */
|
|
98
|
+
dailyLimit?: Money;
|
|
99
|
+
/** Maximum weekly transaction volume per user */
|
|
100
|
+
weeklyLimit?: Money;
|
|
101
|
+
/** Maximum monthly transaction volume per user */
|
|
102
|
+
monthlyLimit?: Money;
|
|
103
|
+
/** Maximum annual transaction volume per user */
|
|
104
|
+
annualLimit?: Money;
|
|
105
|
+
/** Maximum number of transactions per day */
|
|
106
|
+
dailyTransactionLimit?: number;
|
|
107
|
+
/** Maximum number of transactions per hour */
|
|
108
|
+
hourlyTransactionLimit?: number;
|
|
109
|
+
/** Cooling-off period between large transactions (minutes) */
|
|
110
|
+
coolingOffPeriod?: number;
|
|
111
|
+
/** Velocity check configuration */
|
|
112
|
+
velocityLimits?: {
|
|
113
|
+
/** Maximum amount in specified time window */
|
|
114
|
+
maxAmount: Money;
|
|
115
|
+
/** Time window in minutes */
|
|
116
|
+
timeWindowMinutes: number;
|
|
117
|
+
/** Number of transactions allowed in window */
|
|
118
|
+
maxTransactions: number;
|
|
119
|
+
};
|
|
120
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plyaz/types",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.12.0",
|
|
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.",
|
|
@@ -165,6 +165,11 @@
|
|
|
165
165
|
"import": "./dist/web3/index.js",
|
|
166
166
|
"require": "./dist/web3/index.cjs"
|
|
167
167
|
},
|
|
168
|
+
"./payments": {
|
|
169
|
+
"types": "./dist/payments/index.d.ts",
|
|
170
|
+
"import": "./dist/payments/index.js",
|
|
171
|
+
"require": "./dist/payments/index.cjs"
|
|
172
|
+
},
|
|
168
173
|
"./package.json": "./package.json"
|
|
169
174
|
},
|
|
170
175
|
"files": [
|