@plyaz/types 1.25.1 → 1.25.2

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.
@@ -0,0 +1,56 @@
1
+ import type { CurrencyCode } from '../../../../locale/types';
2
+ import type { PAYMENT_METHOD, PAYMENT_PROVIDER_TYPE } from '../../../provider';
3
+ import type { Money } from '../../../transaction';
4
+ export declare enum FEE_CONTEXT {
5
+ Payment = "payment",
6
+ Subscription = "subscription",
7
+ Withdrawal = "withdrawal",
8
+ Refund = "refund",
9
+ Dispute = "dispute"
10
+ }
11
+ export interface CalculateFeeParams {
12
+ amount: Money;
13
+ paymentMethod: PAYMENT_METHOD;
14
+ provider: PAYMENT_PROVIDER_TYPE;
15
+ context: FEE_CONTEXT;
16
+ accountCurrency: string;
17
+ expedite?: boolean;
18
+ highRisk?: boolean;
19
+ }
20
+ export declare enum FEE_TYPE {
21
+ Platform = "platform",
22
+ CrossBorder = "crossBorder",
23
+ Conversion = "currencyConversion",
24
+ Network = "network",
25
+ Gas = "gas",
26
+ Expedite = "expedite",
27
+ Risk = "risk",
28
+ Compliance = "compliance",
29
+ Chargeback = "chargeback",
30
+ Refund = "refund"
31
+ }
32
+ export interface FeeMetadata {
33
+ processingRate?: number;
34
+ platformRate?: number;
35
+ crossBorderRate?: number;
36
+ conversionRate?: number;
37
+ calculatedAt: Date;
38
+ ruleVersion?: string;
39
+ }
40
+ /**
41
+ * Unified Fee Rule
42
+ */
43
+ export interface FeeRule<TMetadata extends object = {}> {
44
+ type: FEE_TYPE;
45
+ context: FEE_CONTEXT[];
46
+ enabled: boolean;
47
+ percentage?: number;
48
+ fixed?: number;
49
+ minimumFee?: number;
50
+ amount?: number;
51
+ currency?: CurrencyCode;
52
+ riskScoreThreshold?: number;
53
+ estimated?: number;
54
+ maxLimit?: number;
55
+ metadata?: TMetadata;
56
+ }
@@ -1,5 +1,7 @@
1
1
  import type { CurrencyCode } from '../../../locale/types';
2
- import type { PAYMENT_METHOD, PAYMENT_PROVIDER_TYPE } from '../../provider';
2
+ import type { PAYMENT_METHOD, PAYMENT_PROVIDER_TYPE, USER_TYPE } from '../../provider';
3
+ import type { Money } from '../../transaction';
4
+ import type { FEE_CONTEXT } from './fee/types';
3
5
  /**
4
6
  * Base configuration interface that all payment providers must implement.
5
7
  * This ensures consistent configuration structure across all providers.
@@ -258,23 +260,69 @@ export interface ProviderFeeConfiguration {
258
260
  additionalFees: {
259
261
  /** Cross-border transaction fees */
260
262
  crossBorder?: {
263
+ context: FEE_CONTEXT[];
261
264
  percentage: number;
262
265
  fixed?: number;
266
+ enabled: boolean;
263
267
  };
264
268
  /** Currency conversion fees */
265
269
  currencyConversion?: {
270
+ context: FEE_CONTEXT[];
266
271
  percentage: number;
267
272
  minimumFee?: number;
273
+ enabled: boolean;
268
274
  };
269
275
  /** Chargeback fees */
270
276
  chargeback?: {
277
+ context: FEE_CONTEXT[];
271
278
  amount: number;
272
279
  currency: CurrencyCode;
280
+ enabled: boolean;
273
281
  };
274
282
  /** Refund processing fees */
275
283
  refund?: {
284
+ context: FEE_CONTEXT[];
276
285
  percentage: number;
277
286
  fixed?: number;
287
+ enabled: boolean;
288
+ };
289
+ platform?: {
290
+ context: FEE_CONTEXT[];
291
+ percentage?: number;
292
+ fixed?: number;
293
+ minimumFee?: number;
294
+ enabled: boolean;
295
+ };
296
+ expedite?: {
297
+ context: FEE_CONTEXT[];
298
+ fixed: number;
299
+ enabled: boolean;
300
+ };
301
+ risk?: {
302
+ context: FEE_CONTEXT[];
303
+ percentage?: number;
304
+ riskScoreThreshold?: number;
305
+ enabled: boolean;
306
+ };
307
+ compliance?: {
308
+ context: FEE_CONTEXT[];
309
+ fixed?: number;
310
+ perCheck?: number;
311
+ currency: CurrencyCode;
312
+ enabled: boolean;
313
+ };
314
+ network?: {
315
+ context: FEE_CONTEXT[];
316
+ amount?: number;
317
+ currency: CurrencyCode;
318
+ enabled: boolean;
319
+ };
320
+ gas?: {
321
+ context: FEE_CONTEXT[];
322
+ estimated?: number;
323
+ maxLimit?: number;
324
+ currency: CurrencyCode;
325
+ enabled: boolean;
278
326
  };
279
327
  };
280
328
  /** Fee calculation configuration */
@@ -433,3 +481,41 @@ export interface ProviderPerformanceConfiguration {
433
481
  evictionStrategy: 'lru' | 'lfu' | 'ttl';
434
482
  };
435
483
  }
484
+ export interface WithdrawalEligibilityRequest {
485
+ amount: Money;
486
+ paymentMethod: PAYMENT_METHOD;
487
+ userType?: USER_TYPE;
488
+ accountCurrency: CurrencyCode;
489
+ expedite: true;
490
+ highRisk: true;
491
+ metadata?: {
492
+ geoInfo?: {
493
+ country: string;
494
+ region?: string;
495
+ city?: string;
496
+ timezone?: string;
497
+ };
498
+ };
499
+ }
500
+ export interface WithdrawalFeeStructure {
501
+ percentage?: number;
502
+ fixed?: number;
503
+ }
504
+ export interface WithdrawalFeeDetail {
505
+ provider: PAYMENT_PROVIDER_TYPE;
506
+ fees: WithdrawalFeeStructure;
507
+ estimatedFee: number;
508
+ }
509
+ export interface RoutingContext {
510
+ amount: Money;
511
+ paymentMethod: PAYMENT_METHOD;
512
+ userType?: USER_TYPE;
513
+ provider?: PAYMENT_PROVIDER_TYPE;
514
+ metadata?: {
515
+ geoInfo?: {
516
+ region?: string;
517
+ country?: string;
518
+ city?: string;
519
+ };
520
+ };
521
+ }
@@ -3,9 +3,10 @@ import type { ProviderHealthStatus } from '../../../features';
3
3
  import type { BaseProviderConfig, CreatePricingParams, CreatePricingResult, CreateProductParams, CreateProductResult, UpdateProductStatusParams, UpdateProductStatusResult, FetchProductParams, FetchProductResult, UpdatePricingParams, UpdatePricingResult, UpdateProductParams, UpdateProductResult } from '../../gateways';
4
4
  import type { PaymentResult, ProcessPaymentRequest } from '../../request';
5
5
  import type { FeeBreakdown, Money } from '../../transaction';
6
- import type { AdapterConfiguration, CreateCustomerParams, CreateSubscriptionParams, CustomerResult, FeeCalculationOptions, FeeStructure, PaymentStatusResult, PayoutParams, PayoutResult, RefundParams, RefundResult, SavedPaymentMethod, SavedPaymentMethodResult, SavePaymentMethodParams, SubscriptionResult, TransactionDetails, TransactionHistory, TransactionHistoryParams, WebhookPayload, WebhookResult, WithdrawalParams, WithdrawalResult } from '../core';
6
+ import type { AdapterConfiguration, CreateCustomerParams, CreateSubscriptionParams, CustomerResult, FeeStructure, PaymentStatusResult, PayoutParams, PayoutResult, RefundParams, RefundResult, SavedPaymentMethod, SavedPaymentMethodResult, SavePaymentMethodParams, SubscriptionResult, TransactionDetails, TransactionHistory, TransactionHistoryParams, WebhookPayload, WebhookResult, WithdrawalParams, WithdrawalResult } from '../core';
7
7
  import type { ProviderCapabilities, ProviderConfiguration } from '../payment-provider';
8
8
  import type { PAYMENT_METHOD, PAYMENT_PROVIDER_TYPE } from '../provider-capability';
9
+ import type { CalculateFeeParams } from '../../gateways/provider/fee/types';
9
10
  /**
10
11
  * Core interface that all payment providers must implement.
11
12
  * This interface ensures consistent behavior across all providers
@@ -151,7 +152,7 @@ export interface PaymentAdapter {
151
152
  * @param options - Additional calculation options
152
153
  * @returns Detailed fee breakdown
153
154
  */
154
- calculateFees(amount: Money, method: PAYMENT_METHOD, options?: FeeCalculationOptions): Promise<FeeBreakdown>;
155
+ calculateFees(feeParams: CalculateFeeParams): Promise<FeeBreakdown>;
155
156
  /**
156
157
  * Get fee structure for a payment method
157
158
  */
@@ -2,9 +2,10 @@ import type { ProviderHealthStatus } from '../../../features';
2
2
  import type { BaseProviderConfig } from '../../gateways';
3
3
  import type { PaymentResult, ProcessPaymentRequest } from '../../request';
4
4
  import type { FeeBreakdown, Money } from '../../transaction';
5
- import type { CreateCustomerParams, CustomerResult, FeeCalculationOptions, PaymentStatusResult, RefundParams, RefundResult, SavedPaymentMethodResult, SavePaymentMethodParams, TransactionHistory, TransactionHistoryParams, WebhookPayload, WebhookResult } from '../core';
5
+ import type { CreateCustomerParams, CustomerResult, PaymentStatusResult, RefundParams, RefundResult, SavedPaymentMethodResult, SavePaymentMethodParams, TransactionHistory, TransactionHistoryParams, WebhookPayload, WebhookResult } from '../core';
6
6
  import type { PAYMENT_METHOD, PAYMENT_PROVIDER_TYPE } from '../provider-capability';
7
7
  import type { CurrencyCode } from '../../../locale/types';
8
+ import type { CalculateFeeParams } from '../../gateways/provider/fee/types';
8
9
  /**
9
10
  * Core interface that all payment providers must implement.
10
11
  * This interface ensures consistent behavior across all providers
@@ -127,7 +128,7 @@ export interface PaymentProvider {
127
128
  * @param options - Additional calculation options
128
129
  * @returns Detailed fee breakdown
129
130
  */
130
- calculateFees(amount: Money, method: PAYMENT_METHOD, options?: FeeCalculationOptions): Promise<FeeBreakdown>;
131
+ calculateFees(feeParams: CalculateFeeParams): Promise<FeeBreakdown>;
131
132
  /**
132
133
  * Check provider health and availability.
133
134
  * This method should:
@@ -70,6 +70,10 @@ export interface FeeBreakdown {
70
70
  riskFee?: Money;
71
71
  /** Regulatory compliance fee (where applicable) */
72
72
  complianceFee?: Money;
73
+ /** Fee charged when a payment is disputed */
74
+ chargebackFee?: Money;
75
+ /** Fee retained or applied when a refund is processed */
76
+ refundFee?: Money;
73
77
  /** Total of all fees combined */
74
78
  total: Money;
75
79
  /**
@@ -1375,6 +1375,43 @@ export interface StorageTemplateFrontmatter {
1375
1375
  };
1376
1376
  /** Custom CSS */
1377
1377
  css?: string;
1378
+ /**
1379
+ * Styling options for CSS variables in layouts
1380
+ * Used in layout templates via Handlebars conditionals:
1381
+ * `{{#if styling.primaryColor}}{{styling.primaryColor}}{{else}}#2563eb{{/if}}`
1382
+ */
1383
+ styling?: {
1384
+ /** Primary brand color - headers, links, buttons */
1385
+ primaryColor?: string;
1386
+ /** Secondary/supporting color - subtle backgrounds */
1387
+ secondaryColor?: string;
1388
+ /** Accent/highlight color - CTAs, emphasis */
1389
+ accentColor?: string;
1390
+ /** Page background color */
1391
+ backgroundColor?: string;
1392
+ /** Main body text color */
1393
+ textColor?: string;
1394
+ /** Subtle text color - captions, footers */
1395
+ mutedColor?: string;
1396
+ /** Border/divider color */
1397
+ borderColor?: string;
1398
+ /** Success state color - paid, approved */
1399
+ successColor?: string;
1400
+ /** Warning state color - pending, overdue */
1401
+ warningColor?: string;
1402
+ /** Error state color - failed, declined */
1403
+ errorColor?: string;
1404
+ /** Primary font family */
1405
+ fontFamily?: string;
1406
+ /** Heading font family */
1407
+ fontFamilyHeading?: string;
1408
+ /** Base font size (e.g., '11pt') */
1409
+ fontSize?: string;
1410
+ /** Line height (e.g., '1.5') */
1411
+ lineHeight?: string;
1412
+ /** Base spacing unit (e.g., '4mm') */
1413
+ spacingUnit?: string;
1414
+ };
1378
1415
  /** Additional custom fields */
1379
1416
  [key: string]: unknown;
1380
1417
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plyaz/types",
3
- "version": "1.25.1",
3
+ "version": "1.25.2",
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.",