@plyaz/types 1.12.1 → 1.12.3

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.
@@ -48,7 +48,7 @@ export interface AuthServiceProvider {
48
48
  * @param email The user's primary email address from the external provider.
49
49
  * @returns A Promise resolving to an object containing the internal UserContext and the provider-specific RLS JWT.
50
50
  */
51
- syncUserFromExternalToken(externalId: string, email: string): Promise<{
51
+ syncUserFromExternalToken(clerkJwt: string, externalId: string, email: string): Promise<{
52
52
  user: UserContext;
53
53
  supabaseRlsToken: string;
54
54
  }>;
@@ -314,6 +314,7 @@ export interface PaymentEventEmitterConfig {
314
314
  /** Queue processing interval in milliseconds */
315
315
  processingInterval: number;
316
316
  };
317
+ debug?: boolean;
317
318
  /** Error handling configuration */
318
319
  errorHandling: {
319
320
  /** Strategy for handling emission errors */
@@ -4,7 +4,7 @@ import type { PAYMENTMETHOD, PAYMENTPROVIDERTYPE } from '../../provider';
4
4
  * Base configuration interface that all payment providers must implement.
5
5
  * This ensures consistent configuration structure across all providers.
6
6
  */
7
- export interface BaseProviderConfig<TProviderSpecific extends object> {
7
+ export interface BaseProviderConfig {
8
8
  /** Provider identification */
9
9
  provider: PAYMENTPROVIDERTYPE;
10
10
  /** Display name for this provider */
@@ -28,7 +28,7 @@ export interface BaseProviderConfig<TProviderSpecific extends object> {
28
28
  /** Regional availability and restrictions */
29
29
  /** Monitoring and alerting configuration */
30
30
  /** Provider-specific custom settings */
31
- customSettings: TProviderSpecific;
31
+ customSettings: {};
32
32
  }
33
33
  /**
34
34
  * Provider environment configuration.
@@ -1,8 +1,9 @@
1
1
  import type { ProviderHealthStatus } from '../../../features';
2
2
  import type { CURRENCY } from '../../currency';
3
- import type { PaymentResult } from '../../request';
3
+ import type { BaseProviderConfig } from '../../gateways';
4
+ import type { PaymentResult, ProcessPaymentRequest } from '../../request';
4
5
  import type { FeeBreakdown, Money } from '../../transaction';
5
- import type { AdapterConfiguration, CreateCustomerParams, CreatePaymentParams, CreateSubscriptionParams, CustomerResult, FeeCalculationOptions, FeeStructure, PaymentProviderConfig, PaymentStatusResult, PayoutParams, PayoutResult, RefundParams, RefundResult, SavedPaymentMethod, SavedPaymentMethodResult, SavePaymentMethodParams, SubscriptionResult, TransactionDetails, TransactionHistory, TransactionHistoryParams, WebhookPayload, WebhookResult } from '../core';
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';
6
7
  import type { ProviderCapabilities, ProviderConfiguration } from '../payment-provider';
7
8
  import type { PAYMENTMETHOD, PAYMENTPROVIDERTYPE } from '../provider-capability';
8
9
  /**
@@ -41,7 +42,7 @@ export interface PaymentAdapter {
41
42
  * @throws ProviderConfigurationError if configuration is invalid
42
43
  * @throws ProviderConnectionError if unable to connect to provider
43
44
  */
44
- initialize(config: PaymentProviderConfig): Promise<void>;
45
+ initialize(config: BaseProviderConfig): Promise<void>;
45
46
  /**
46
47
  * Shutdown the provider and clean up resources.
47
48
  * This method should:
@@ -67,7 +68,7 @@ export interface PaymentAdapter {
67
68
  * @throws PaymentValidationError for invalid parameters
68
69
  * @throws PaymentProcessingError for provider errors
69
70
  */
70
- createPayment(params: CreatePaymentParams): Promise<PaymentResult>;
71
+ createPayment(params: ProcessPaymentRequest): Promise<PaymentResult>;
71
72
  /**
72
73
  * Capture a previously authorized payment (if supported)
73
74
  * Used in two-step payment flows
@@ -1,87 +1,6 @@
1
1
  import type { CURRENCY } from '../../currency';
2
2
  import type { FeeBreakdown, Money } from '../../transaction';
3
3
  import type { PAYMENTMETHOD, PAYMENTPROVIDERTYPE, PAYMENTSTATUS } from '../provider-capability';
4
- /**
5
- * High-level configuration for initializing a payment provider.
6
- *
7
- * This configuration is passed to the provider adapter during initialization.
8
- * It must contain everything required to:
9
- * - Authenticate with the provider
10
- * - Configure operational behavior
11
- * - Enable webhook verification
12
- * - Support different environments (sandbox, production, etc.)
13
- */
14
- export interface PaymentProviderConfig<TExtra extends object = object, TCustomHeaders extends Record<string, string> = Record<string, string>> {
15
- /** Provider type identifier (e.g., stripe, paypal) */
16
- provider: PAYMENTPROVIDERTYPE;
17
- /** Primary authentication */
18
- apiKey?: string;
19
- secretKey?: string;
20
- /** For Stripe client-side integrations */
21
- publishableKey?: string;
22
- /** Optional merchant/account identifiers */
23
- merchantId?: string;
24
- accountId?: string;
25
- /** Optional API version pinning */
26
- apiVersion?: string;
27
- /** Environment */
28
- environment: 'sandbox' | 'staging' | 'production';
29
- apiBaseUrl?: string;
30
- /** Currency and region support */
31
- supportedCurrencies?: CURRENCY[];
32
- supportedRegions?: string[];
33
- /** Webhook configuration */
34
- webhook?: {
35
- url: string;
36
- secret?: string;
37
- /** Support multiple webhook endpoints if needed */
38
- secrets?: Record<string, string>;
39
- events?: string[];
40
- tolerance?: number;
41
- };
42
- /** Request config */
43
- requestTimeout?: number;
44
- retryPolicy?: {
45
- maxRetries: number;
46
- backoffMs: number;
47
- };
48
- /** Debug and advanced options */
49
- debug?: boolean;
50
- customHeaders?: TCustomHeaders;
51
- extra?: TExtra;
52
- /** Optional secondary credentials (e.g., key rotation) */
53
- secondaryCredentials?: {
54
- apiKey?: string;
55
- secretKey?: string;
56
- };
57
- }
58
- /**
59
- * Core parameters for initiating a payment transaction with any provider.
60
- * This type is **provider-agnostic** and later normalized/translated
61
- * inside the provider adapter.
62
- */
63
- export interface CreatePaymentParams<TMetadata extends object = object> {
64
- /** Amount to be charged, always in smallest currency unit */
65
- amount: Money;
66
- /** Payment method selected for this transaction */
67
- method: PAYMENTMETHOD;
68
- /** Currency of the transaction */
69
- currency: CURRENCY;
70
- /** Unique identifier for the user initiating the transaction */
71
- userId: string;
72
- /** Product or service being paid for */
73
- productId: string;
74
- /** Description for statement or receipt */
75
- description?: string;
76
- /** URL to redirect user after successful payment */
77
- returnUrl?: string;
78
- /** URL to redirect user after failed/cancelled payment */
79
- cancelUrl?: string;
80
- /** Optional idempotency key to prevent duplicate charges */
81
- idempotencyKey?: string;
82
- /** Additional metadata (campaign, subscription, geo info, etc.) */
83
- metadata?: TMetadata;
84
- }
85
4
  /**
86
5
  * Parameters required to initiate a refund.
87
6
  * Refunds can be full or partial.
@@ -1,8 +1,9 @@
1
1
  import type { ProviderHealthStatus } from '../../../features';
2
2
  import type { CURRENCY } from '../../currency';
3
+ import type { BaseProviderConfig } from '../../gateways';
3
4
  import type { PaymentResult, ProcessPaymentRequest } from '../../request';
4
5
  import type { FeeBreakdown, Money } from '../../transaction';
5
- import type { CreateCustomerParams, CustomerResult, FeeCalculationOptions, PaymentProviderConfig, PaymentStatusResult, RefundParams, RefundResult, SavedPaymentMethodResult, SavePaymentMethodParams, TransactionHistory, TransactionHistoryParams, WebhookPayload, WebhookResult } from '../core';
6
+ import type { CreateCustomerParams, CustomerResult, FeeCalculationOptions, PaymentStatusResult, RefundParams, RefundResult, SavedPaymentMethodResult, SavePaymentMethodParams, TransactionHistory, TransactionHistoryParams, WebhookPayload, WebhookResult } from '../core';
6
7
  import type { PAYMENTMETHOD, PAYMENTPROVIDERTYPE } from '../provider-capability';
7
8
  /**
8
9
  * Core interface that all payment providers must implement.
@@ -38,7 +39,7 @@ export interface PaymentProvider {
38
39
  * @throws ProviderConfigurationError if configuration is invalid
39
40
  * @throws ProviderConnectionError if unable to connect to provider
40
41
  */
41
- initialize(config: PaymentProviderConfig): Promise<void>;
42
+ initialize(config: BaseProviderConfig): Promise<void>;
42
43
  /**
43
44
  * Shutdown the provider and clean up resources.
44
45
  * This method should:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plyaz/types",
3
- "version": "1.12.1",
3
+ "version": "1.12.3",
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.",