|
| 1 | +/** |
| 2 | + * Subscription Dunning Rules |
| 3 | + * Description: Subscription Dunning Rules. |
| 4 | + * DOCS: TODO: add docs when ready |
| 5 | + */ |
| 6 | +import { |
| 7 | + Identifiable, |
| 8 | + CrudQueryableResource |
| 9 | +} from './core' |
| 10 | + |
| 11 | +/** |
| 12 | + * Core Subscription Dunning Rules Base Interface |
| 13 | + * For custom flows, extend this interface |
| 14 | + * DOCS: TODO: add docs when ready |
| 15 | + */ |
| 16 | +export interface SubscriptionDunningRulesBase { |
| 17 | + type: 'subscription_dunning_rule' |
| 18 | + attributes: { |
| 19 | + payment_retry_type: 'fixed' | 'backoff' | 'tiered' |
| 20 | + payment_retry_interval?: number |
| 21 | + payment_retry_unit?: 'day' | 'week' |
| 22 | + payment_retry_multiplier?: number |
| 23 | + payment_retries_limit: number |
| 24 | + action: 'none' | 'pause' | 'close' |
| 25 | + default?: boolean |
| 26 | + } |
| 27 | +} |
| 28 | + |
| 29 | +export interface SubscriptionDunningRules extends Identifiable, SubscriptionDunningRulesBase { |
| 30 | + meta: { |
| 31 | + owner: 'store' | 'organization' |
| 32 | + timestamps: { |
| 33 | + updated_at: string |
| 34 | + created_at: string |
| 35 | + } |
| 36 | + } |
| 37 | +} |
| 38 | + |
| 39 | +export type SubscriptionDunningRulesCreate = SubscriptionDunningRulesBase |
| 40 | +export type SubscriptionDunningRulesUpdate = Identifiable & Omit<SubscriptionDunningRulesBase, 'attributes'> & {attributes: Partial<SubscriptionDunningRules['attributes']>} |
| 41 | + |
| 42 | +/** |
| 43 | + * Subscription Dunning Rules Endpoints |
| 44 | + * DOCS: TODO: add docs when ready |
| 45 | + */ |
| 46 | +export interface SubscriptionDunningRulesEndpoint |
| 47 | + extends CrudQueryableResource< |
| 48 | + SubscriptionDunningRules, |
| 49 | + SubscriptionDunningRulesCreate, |
| 50 | + SubscriptionDunningRulesUpdate, |
| 51 | + never, |
| 52 | + never, |
| 53 | + never |
| 54 | + > { |
| 55 | + endpoint: 'dunning-rules' |
| 56 | +} |
0 commit comments