@plyaz/types 1.14.5 → 1.14.6

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.
@@ -5,7 +5,7 @@ import type { PaymentResult, ProcessPaymentRequest } from '../../request';
5
5
  import type { FeeBreakdown, Money } from '../../transaction';
6
6
  import type { AdapterConfiguration, CreateCustomerParams, CreateSubscriptionParams, CustomerResult, FeeCalculationOptions, FeeStructure, PaymentStatusResult, PayoutParams, PayoutResult, RefundParams, RefundResult, SavedPaymentMethod, SavedPaymentMethodResult, SavePaymentMethodParams, SubscriptionResult, TransactionDetails, TransactionHistory, TransactionHistoryParams, WebhookPayload, WebhookResult } from '../core';
7
7
  import type { ProviderCapabilities, ProviderConfiguration } from '../payment-provider';
8
- import type { PAYMENTMETHOD, PAYMENTPROVIDERTYPE } from '../provider-capability';
8
+ import type { PAYMENT_METHOD, PAYMENT_PROVIDER_TYPE } from '../provider-capability';
9
9
  /**
10
10
  * Core interface that all payment providers must implement.
11
11
  * This interface ensures consistent behavior across all providers
@@ -19,11 +19,11 @@ import type { PAYMENTMETHOD, PAYMENTPROVIDERTYPE } from '../provider-capability'
19
19
  */
20
20
  export interface PaymentAdapter {
21
21
  /** Unique identifier for this payment provider */
22
- readonly name: PAYMENTPROVIDERTYPE;
22
+ readonly name: PAYMENT_PROVIDER_TYPE;
23
23
  /** Provider API version in use */
24
24
  readonly apiVersion: string;
25
25
  /** Payment methods supported by this provider */
26
- readonly supportedMethods: PAYMENTMETHOD[];
26
+ readonly supportedMethods: PAYMENT_METHOD[];
27
27
  /** Currencies supported by this provider */
28
28
  readonly supportedCurrencies: CurrencyCode[];
29
29
  /** Detailed capabilities of this provider */
@@ -151,11 +151,11 @@ export interface PaymentAdapter {
151
151
  * @param options - Additional calculation options
152
152
  * @returns Detailed fee breakdown
153
153
  */
154
- calculateFees(amount: Money, method: PAYMENTMETHOD, options?: FeeCalculationOptions): Promise<FeeBreakdown>;
154
+ calculateFees(amount: Money, method: PAYMENT_METHOD, options?: FeeCalculationOptions): Promise<FeeBreakdown>;
155
155
  /**
156
156
  * Get fee structure for a payment method
157
157
  */
158
- getFeeStructure(method: PAYMENTMETHOD): Promise<FeeStructure>;
158
+ getFeeStructure(method: PAYMENT_METHOD): Promise<FeeStructure>;
159
159
  /**
160
160
  * Check provider health and availability.
161
161
  * This method should:
@@ -1,6 +1,6 @@
1
1
  import type { CurrencyCode } from '../../../locale/types';
2
2
  import type { FeeBreakdown, Money } from '../../transaction';
3
- import type { PAYMENTMETHOD, PAYMENTPROVIDERTYPE, PAYMENTSTATUS } from '../provider-capability';
3
+ import type { PAYMENT_METHOD, PAYMENT_PROVIDER_TYPE, PAYMENT_STATUS } from '../provider-capability';
4
4
  /**
5
5
  * Parameters required to initiate a refund.
6
6
  * Refunds can be full or partial.
@@ -29,7 +29,7 @@ export interface RefundResult<TMetadata extends object = object> {
29
29
  /** Provider-specific refund ID (if available) */
30
30
  providerRefundId?: string;
31
31
  /** Status of the refund transaction */
32
- status: PAYMENTSTATUS;
32
+ status: PAYMENT_STATUS;
33
33
  /** Refunded amount */
34
34
  amount: Money;
35
35
  /** Any applicable refund fees (if provider charges fees on refunds) */
@@ -46,7 +46,7 @@ export interface RefundResult<TMetadata extends object = object> {
46
46
  */
47
47
  export interface PaymentStatusResult<TMetadata extends object = object> {
48
48
  /** Current normalized payment status */
49
- status: PAYMENTSTATUS;
49
+ status: PAYMENT_STATUS;
50
50
  /** Internal Plyaz transaction ID */
51
51
  transactionId: string;
52
52
  /** Provider transaction ID */
@@ -73,7 +73,7 @@ export interface WebhookPayload {
73
73
  /** Signature extracted from headers */
74
74
  signature?: string;
75
75
  /** Provider type (e.g., stripe, paypal, etc.) */
76
- provider: PAYMENTPROVIDERTYPE;
76
+ provider: PAYMENT_PROVIDER_TYPE;
77
77
  }
78
78
  /**
79
79
  * Normalized webhook result returned after processing provider webhook.
@@ -86,7 +86,7 @@ export interface WebhookResult<TMetadata extends object = object> {
86
86
  /** Transaction ID this event relates to */
87
87
  transactionId?: string;
88
88
  /** Updated payment status if applicable */
89
- updatedStatus?: PAYMENTSTATUS;
89
+ updatedStatus?: PAYMENT_STATUS;
90
90
  /** Optional message for logging or auditing */
91
91
  message?: string;
92
92
  /** Raw provider webhook payload */
@@ -156,7 +156,7 @@ export interface SavePaymentMethodParams<TMetadata extends object = object> {
156
156
  /** Provider customer ID */
157
157
  providerCustomerId: string;
158
158
  /** Type of payment method (card, bank account, wallet, etc.) */
159
- method: PAYMENTMETHOD;
159
+ method: PAYMENT_METHOD;
160
160
  /** Token or ID returned from provider after authorization */
161
161
  paymentToken: string;
162
162
  /** Whether this should be the default method for the user */
@@ -193,7 +193,7 @@ export interface TransactionHistoryParams {
193
193
  to: Date;
194
194
  };
195
195
  /** Filter by payment status */
196
- status?: PAYMENTSTATUS;
196
+ status?: PAYMENT_STATUS;
197
197
  /** Maximum number of records to return */
198
198
  limit?: number;
199
199
  /** Pagination cursor or token */
@@ -208,10 +208,10 @@ export interface TransactionHistory<TMetadata extends object = object> {
208
208
  transactionId: string;
209
209
  providerTransactionId?: string;
210
210
  amount: Money;
211
- status: PAYMENTSTATUS;
211
+ status: PAYMENT_STATUS;
212
212
  createdAt: Date;
213
213
  updatedAt?: Date;
214
- method: PAYMENTMETHOD;
214
+ method: PAYMENT_METHOD;
215
215
  metadata?: TMetadata;
216
216
  }>;
217
217
  /** Pagination cursor for next page */
@@ -223,10 +223,10 @@ export interface PaymentAdapterConfig<TExtra extends object = object> {
223
223
  /** Default region used if no specific mapping is found */
224
224
  defaultRegion?: string;
225
225
  /** Region → Provider mapping */
226
- regionProviderMapping?: Record<string, PAYMENTPROVIDERTYPE>;
226
+ regionProviderMapping?: Record<string, PAYMENT_PROVIDER_TYPE>;
227
227
  /** Provider credentials and environment configuration */
228
228
  providers: {
229
- [key in PAYMENTPROVIDERTYPE]?: {
229
+ [key in PAYMENT_PROVIDER_TYPE]?: {
230
230
  apiKey?: string;
231
231
  secretKey?: string;
232
232
  merchantId?: string;
@@ -241,7 +241,7 @@ export interface PaymentAdapterConfig<TExtra extends object = object> {
241
241
  fallbackRules?: {
242
242
  enabled: boolean;
243
243
  strategy: 'round_robin' | 'priority' | 'failover';
244
- priorityList?: PAYMENTPROVIDERTYPE[];
244
+ priorityList?: PAYMENT_PROVIDER_TYPE[];
245
245
  };
246
246
  /** Global settings (timeouts, logging, etc.) */
247
247
  globalSettings?: {
@@ -254,7 +254,7 @@ export interface NormalizedPaymentRequest<TMetadata extends object = object> {
254
254
  /** Amount to charge */
255
255
  amount: Money;
256
256
  /** Payment method */
257
- method: PAYMENTMETHOD;
257
+ method: PAYMENT_METHOD;
258
258
  /** CurrencyCode */
259
259
  CurrencyCode: CurrencyCode;
260
260
  /** User initiating the transaction */
@@ -278,7 +278,7 @@ export interface TransactionDetails<TMetadata extends object = object> {
278
278
  /** Provider transaction ID */
279
279
  providerTransactionId?: string;
280
280
  /** Current payment status */
281
- status: PAYMENTSTATUS;
281
+ status: PAYMENT_STATUS;
282
282
  /** Total amount of the transaction */
283
283
  amount: Money;
284
284
  /** Refunded amount (if applicable) */
@@ -286,7 +286,7 @@ export interface TransactionDetails<TMetadata extends object = object> {
286
286
  /** Fees applied to this transaction */
287
287
  fees?: FeeBreakdown;
288
288
  /** Payment method used */
289
- method: PAYMENTMETHOD;
289
+ method: PAYMENT_METHOD;
290
290
  /** CurrencyCode of the transaction */
291
291
  CurrencyCode: CurrencyCode;
292
292
  /** Timestamp when transaction was created */
@@ -328,7 +328,7 @@ export interface AdapterConfiguration<TMetadata extends object = object> {
328
328
  subscribedEvents?: string[];
329
329
  };
330
330
  /** Supported payment methods and currencies */
331
- supportedMethods: PAYMENTMETHOD[];
331
+ supportedMethods: PAYMENT_METHOD[];
332
332
  supportedCurrencies: CurrencyCode[];
333
333
  /** Additional configuration or metadata */
334
334
  metadata?: TMetadata;
@@ -339,7 +339,7 @@ export interface SavedPaymentMethod<TMetadata extends object = object> {
339
339
  /** Provider-specific payment method ID */
340
340
  providerPaymentMethodId: string;
341
341
  /** Type of payment method (card, wallet, etc.) */
342
- method: PAYMENTMETHOD;
342
+ method: PAYMENT_METHOD;
343
343
  /** Display-friendly label (e.g. “Visa •••• 4242”) */
344
344
  label?: string;
345
345
  /** Whether this is the default payment method */
@@ -408,7 +408,7 @@ export interface PayoutResult<TMetadata extends object = object> {
408
408
  export interface SavedPaymentMethodInfo {
409
409
  id: string;
410
410
  label: string;
411
- method: PAYMENTMETHOD;
411
+ method: PAYMENT_METHOD;
412
412
  isDefault: boolean;
413
413
  }
414
414
  export interface ReceiptData<TMetadata extends object = object> {
@@ -3,7 +3,7 @@ import type { BaseProviderConfig } from '../../gateways';
3
3
  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
- import type { PAYMENTMETHOD, PAYMENTPROVIDERTYPE } from '../provider-capability';
6
+ import type { PAYMENT_METHOD, PAYMENT_PROVIDER_TYPE } from '../provider-capability';
7
7
  import type { CurrencyCode } from '../../../locale/types';
8
8
  /**
9
9
  * Core interface that all payment providers must implement.
@@ -18,9 +18,9 @@ import type { CurrencyCode } from '../../../locale/types';
18
18
  */
19
19
  export interface PaymentProvider {
20
20
  /** Unique identifier for this payment provider */
21
- readonly name: PAYMENTPROVIDERTYPE;
21
+ readonly name: PAYMENT_PROVIDER_TYPE;
22
22
  /** Payment methods supported by this provider */
23
- readonly supportedMethods: PAYMENTMETHOD[];
23
+ readonly supportedMethods: PAYMENT_METHOD[];
24
24
  /** Currencies supported by this provider */
25
25
  readonly supportedCurrencies: CurrencyCode[];
26
26
  /** Detailed capabilities of this provider */
@@ -127,7 +127,7 @@ export interface PaymentProvider {
127
127
  * @param options - Additional calculation options
128
128
  * @returns Detailed fee breakdown
129
129
  */
130
- calculateFees(amount: Money, method: PAYMENTMETHOD, options?: FeeCalculationOptions): Promise<FeeBreakdown>;
130
+ calculateFees(amount: Money, method: PAYMENT_METHOD, options?: FeeCalculationOptions): Promise<FeeBreakdown>;
131
131
  /**
132
132
  * Check provider health and availability.
133
133
  * This method should:
@@ -208,15 +208,15 @@ export interface ProviderCapabilities {
208
208
  /** Provides dispute evidence submission */
209
209
  supportsDisputeEvidence: boolean;
210
210
  /** Minimum transaction amount per payment method */
211
- minimumAmounts: Record<PAYMENTMETHOD, Money>;
211
+ minimumAmounts: Record<PAYMENT_METHOD, Money>;
212
212
  /** Maximum transaction amount per payment method */
213
- maximumAmounts: Record<PAYMENTMETHOD, Money>;
213
+ maximumAmounts: Record<PAYMENT_METHOD, Money>;
214
214
  /** Supported countries/regions */
215
215
  supportedRegions: string[];
216
216
  /** Processing time estimates per payment method */
217
- processingTimes: Record<PAYMENTMETHOD, ProcessingTimeEstimate>;
217
+ processingTimes: Record<PAYMENT_METHOD, ProcessingTimeEstimate>;
218
218
  /** Settlement time estimates per payment method */
219
- settlementTimes: Record<PAYMENTMETHOD, SettlementTimeEstimate>;
219
+ settlementTimes: Record<PAYMENT_METHOD, SettlementTimeEstimate>;
220
220
  }
221
221
  /**
222
222
  * Provider configuration interface for initialization.
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Enumeration of all supported payment providers in the Plyaz ecosystem.
3
3
  */
4
- export declare enum PAYMENTPROVIDERTYPE {
4
+ export declare enum PAYMENT_PROVIDER_TYPE {
5
5
  Stripe = "stripe",
6
6
  Paypal = "paypal",
7
7
  CheckoutCom = "checkout_com",
@@ -21,7 +21,7 @@ export declare enum PAYMENTPROVIDERTYPE {
21
21
  /**
22
22
  * Enumeration of payment methods supported across all providers.
23
23
  */
24
- export declare enum PAYMENTMETHOD {
24
+ export declare enum PAYMENT_METHOD {
25
25
  CreditCard = "credit_card",
26
26
  DebitCard = "debit_card",
27
27
  BankTransfer = "bank_transfer",
@@ -47,7 +47,7 @@ export declare enum PAYMENTMETHOD {
47
47
  /**
48
48
  * Comprehensive payment status enumeration.
49
49
  */
50
- export declare enum PAYMENTSTATUS {
50
+ export declare enum PAYMENT_STATUS {
51
51
  Initiated = "initiated",
52
52
  Pending = "pending",
53
53
  Processing = "processing",
@@ -72,7 +72,7 @@ export declare enum PAYMENTSTATUS {
72
72
  /**
73
73
  * Transaction type enumeration.
74
74
  */
75
- export declare enum TRANSACTIONTYPE {
75
+ export declare enum TRANSACTION_TYPE {
76
76
  Payment = "payment",
77
77
  Refund = "refund",
78
78
  PartialRefund = "partial_refund",
@@ -90,7 +90,7 @@ export declare enum TRANSACTIONTYPE {
90
90
  /**
91
91
  * User type enumeration.
92
92
  */
93
- export declare enum USERTYPE {
93
+ export declare enum USER_TYPE {
94
94
  Fan = "fan",
95
95
  Athlete = "athlete",
96
96
  Club = "club",
@@ -102,7 +102,7 @@ export declare enum USERTYPE {
102
102
  /**
103
103
  * Product type enumeration.
104
104
  */
105
- export declare enum PRODUCTTYPE {
105
+ export declare enum PRODUCT_TYPE {
106
106
  Campaign = "campaign",
107
107
  Subscription = "subscription",
108
108
  Nft = "nft",
@@ -1,4 +1,4 @@
1
- import type { PAYMENTMETHOD, PAYMENTPROVIDERTYPE, PAYMENTSTATUS, PRODUCTTYPE, USERTYPE } from '../provider';
1
+ import type { PAYMENT_METHOD, PAYMENT_PROVIDER_TYPE, PAYMENT_STATUS, PRODUCT_TYPE, USER_TYPE } from '../provider';
2
2
  import type { ReceiptData, SavedPaymentMethodInfo } from '../provider/core';
3
3
  import type { FeeBreakdown, Money } from '../transaction';
4
4
  import type { REQUIREDACTIONTYPE } from './enums';
@@ -16,20 +16,20 @@ export interface ProcessPaymentRequest<TCustomMetadata extends Record<string, st
16
16
  /** Payment amount and currency information */
17
17
  amount: Money;
18
18
  /** Selected payment method from supported options */
19
- paymentMethod: PAYMENTMETHOD;
19
+ paymentMethod: PAYMENT_METHOD;
20
20
  /**
21
21
  * Optional provider override for advanced use cases
22
22
  * If not specified, optimal provider will be auto-selected
23
23
  */
24
- provider?: PAYMENTPROVIDERTYPE;
24
+ provider?: PAYMENT_PROVIDER_TYPE;
25
25
  /** User making the payment - must be authenticated */
26
26
  userId: string;
27
27
  /** Type of user making the payment for limit enforcement */
28
- userType: USERTYPE;
28
+ userType: USER_TYPE;
29
29
  /** Product or service being purchased */
30
30
  productId: string;
31
31
  /** Type of product for business rule application */
32
- productType: PRODUCTTYPE;
32
+ productType: PRODUCT_TYPE;
33
33
  /**
34
34
  * Human-readable description for receipts and statements
35
35
  * Should be descriptive but concise (max 255 characters)
@@ -136,7 +136,7 @@ export interface PaymentResult<TProviderResponse extends object = {}> {
136
136
  /** Provider's transaction identifier for reference */
137
137
  providerTransactionId?: string;
138
138
  /** Current payment status */
139
- status: PAYMENTSTATUS;
139
+ status: PAYMENT_STATUS;
140
140
  /**
141
141
  * URL for redirect-based payment flows (Stripe Checkout, PayPal, etc.)
142
142
  * Client should redirect user to this URL to complete payment
@@ -1,5 +1,5 @@
1
1
  import type { ValidationResult } from '../../common';
2
- import type { PAYMENTPROVIDERTYPE, PAYMENTSTATUS } from '../provider';
2
+ import type { PAYMENT_PROVIDER_TYPE, PAYMENT_STATUS } from '../provider';
3
3
  import type { PaymentAdapter } from '../provider/adapter';
4
4
  import type { PaymentResult, ProcessPaymentRequest } from '../request';
5
5
  import type { Money } from '../transaction';
@@ -13,7 +13,7 @@ export interface PaymentServiceInterface {
13
13
  /** Process a new payment transaction with full business logic validation */
14
14
  processPayment(request: ProcessPaymentRequest): Promise<PaymentResult>;
15
15
  /** Get current status of any payment transaction */
16
- getPaymentStatus(transactionId: string): Promise<PAYMENTSTATUS>;
16
+ getPaymentStatus(transactionId: string): Promise<PAYMENT_STATUS>;
17
17
  /** Process refunds with authorization and business rule validation */
18
18
  /** Validate payment limits before processing */
19
19
  validatePaymentLimits(userId: string, amount: Money): Promise<boolean>;
@@ -25,11 +25,11 @@ export interface PaymentServiceInterface {
25
25
  */
26
26
  export interface PaymentAdapterFactory {
27
27
  /** Create adapter instance for specific provider */
28
- createAdapter(provider: PAYMENTPROVIDERTYPE): Promise<PaymentAdapter>;
28
+ createAdapter(provider: PAYMENT_PROVIDER_TYPE): Promise<PaymentAdapter>;
29
29
  /** Get list of currently available and healthy providers */
30
- getAvailableProviders(): PAYMENTPROVIDERTYPE[];
30
+ getAvailableProviders(): PAYMENT_PROVIDER_TYPE[];
31
31
  /** Validate provider configuration before creating adapter */
32
- validateProviderConfig(provider: PAYMENTPROVIDERTYPE): boolean;
32
+ validateProviderConfig(provider: PAYMENT_PROVIDER_TYPE): boolean;
33
33
  /** Get adapter with automatic provider selection based on routing rules */
34
34
  getOptimalAdapter(request: ProcessPaymentRequest): Promise<PaymentAdapter>;
35
35
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plyaz/types",
3
- "version": "1.14.5",
3
+ "version": "1.14.6",
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.",