@plyaz/types 1.21.0 → 1.21.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.
|
@@ -104,16 +104,32 @@ export interface FetchProductResult<T extends object = object> {
|
|
|
104
104
|
metadata?: T;
|
|
105
105
|
}
|
|
106
106
|
/**
|
|
107
|
-
* Parameters to
|
|
107
|
+
* Parameters to activatedeactivate or archive a product in the provider
|
|
108
108
|
*/
|
|
109
|
-
export interface
|
|
110
|
-
/**
|
|
111
|
-
provider: PAYMENT_PROVIDER_TYPE;
|
|
112
|
-
/** Provider-specific product ID to deactivate */
|
|
109
|
+
export interface UpdateProductStatusParams {
|
|
110
|
+
/** Provider-specific product ID */
|
|
113
111
|
providerProductId: string;
|
|
114
|
-
/**
|
|
112
|
+
/** Whether the product should be active */
|
|
113
|
+
active: boolean;
|
|
114
|
+
/** Optional reason for status change */
|
|
115
115
|
reason?: string;
|
|
116
116
|
}
|
|
117
|
+
/**
|
|
118
|
+
* Parameters for updating the status of a product.
|
|
119
|
+
*
|
|
120
|
+
* This can be used to activate or deactivate a product and optionally
|
|
121
|
+
* provide metadata describing the reason or context for the status change.
|
|
122
|
+
*
|
|
123
|
+
* @template T - Optional metadata object type
|
|
124
|
+
*/
|
|
125
|
+
export interface UpdateProductStatusResult<T extends object = object> {
|
|
126
|
+
/** The provider-specific product ID (e.g., Stripe product ID) */
|
|
127
|
+
providerProductId: string;
|
|
128
|
+
/** Desired product status (Active or Inactive) */
|
|
129
|
+
status: PROVIDER_PRODUCT_STATUS;
|
|
130
|
+
/** Optional metadata to provide additional context for the status update */
|
|
131
|
+
metadata: T;
|
|
132
|
+
}
|
|
117
133
|
/**
|
|
118
134
|
* Parameters to create pricing for a product in the provider
|
|
119
135
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { CurrencyCode } from '../../../locale/types';
|
|
2
2
|
import type { ProviderHealthStatus } from '../../../features';
|
|
3
|
-
import type { BaseProviderConfig, CreatePricingParams, CreatePricingResult, CreateProductParams, CreateProductResult,
|
|
3
|
+
import type { BaseProviderConfig, CreatePricingParams, CreatePricingResult, CreateProductParams, CreateProductResult, UpdateProductStatusParams, 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
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';
|
|
@@ -221,7 +221,7 @@ export interface PaymentAdapter {
|
|
|
221
221
|
/** Fetch provider product details */
|
|
222
222
|
fetchProduct?(params: FetchProductParams): Promise<FetchProductResult>;
|
|
223
223
|
/** Deactivate or archive provider product */
|
|
224
|
-
|
|
224
|
+
updateProductStatus?(params: UpdateProductStatusParams): Promise<boolean>;
|
|
225
225
|
createPricing?(params: CreatePricingParams): Promise<CreatePricingResult>;
|
|
226
226
|
updatePricing?(params: UpdatePricingParams): Promise<UpdatePricingResult>;
|
|
227
227
|
}
|
|
@@ -16,6 +16,15 @@ export interface RefundParams<TMetadata extends object = object> {
|
|
|
16
16
|
amount?: Money;
|
|
17
17
|
/** Reason for refund (optional, useful for reporting) */
|
|
18
18
|
reason?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Idempotency key to prevent duplicate refunds
|
|
21
|
+
*/
|
|
22
|
+
idempotencyKey?: string;
|
|
23
|
+
/**
|
|
24
|
+
* Whether this is a partial refund
|
|
25
|
+
* Derived but can be explicit for validation
|
|
26
|
+
*/
|
|
27
|
+
isPartial?: boolean;
|
|
19
28
|
/** Initiator of refund (system, user, admin) */
|
|
20
29
|
initiatedBy?: 'system' | 'user' | 'admin';
|
|
21
30
|
/** Additional metadata for audit */
|
|
@@ -37,6 +46,10 @@ export interface RefundResult<TMetadata extends object = object> {
|
|
|
37
46
|
fees?: FeeBreakdown;
|
|
38
47
|
/** Message or reason in case of failure */
|
|
39
48
|
failureReason?: string;
|
|
49
|
+
/**
|
|
50
|
+
* Whether this was partial refund
|
|
51
|
+
*/
|
|
52
|
+
isPartial?: boolean;
|
|
40
53
|
/** Timestamp when refund was processed */
|
|
41
54
|
processedAt?: Date;
|
|
42
55
|
/** Raw provider response for debugging */
|
|
@@ -393,6 +406,7 @@ export interface CreateSubscriptionParams<TMetadata extends object = object> {
|
|
|
393
406
|
export interface SubscriptionResult<TMetadata extends object = object> {
|
|
394
407
|
/** Checkout session URL for user to complete subscription */
|
|
395
408
|
checkoutUrl: string;
|
|
409
|
+
subscriptionId?: string;
|
|
396
410
|
/** Optional: provider subscription ID (available after webhook confirmation) */
|
|
397
411
|
providerSubscriptionId?: string;
|
|
398
412
|
/** Status: active, trialing, paused, canceled, expired */
|
package/package.json
CHANGED