import { InvoicingSubscriptionPayload } from '../../../entity/invoicing/invoicingSubscription/invoicingSubscriptionPayload'; import { ZeniAPIResponse } from '../../../responsePayload'; import { AddressUpdatableInfo } from '../../addressView/addressViewState'; import { InvoicingSubscriptionFormLocalData } from './editInvoicingSubscriptionDetailViewState'; export type SaveInvoicingSubscriptionResponse = ZeniAPIResponse; /** * Build the create/update subscription request body from the form draft. The * shipping address is sent as an object (captured via the shared Address * screen); the backend persists it — same pattern as the customer save flow. * * `remaining_billing_cycles` is omitted when the user left the field empty, so * the backend applies the plan's own `billing_cycles` (or renews forever when * the plan sets no limit) rather than being pinned to a value the form invented. * * `billing_period` / `billing_period_unit` are deliberately absent. Billing * cadence is a property of the selected price point, not of the subscription, * and the backend derives it from that price point when the fields are omitted. * Sending them made every price point whose cadence the form could not express * — a daily plan, for instance — fail with a 422. */ export declare const localDataToSaveInvoicingSubscriptionPayload: (localData: InvoicingSubscriptionFormLocalData, shippingAddress?: AddressUpdatableInfo) => Record; export type RunInvoicingSubscriptionActionResponse = ZeniAPIResponse; /** Snake_case request bodies for subscription action endpoints. */ export type ApplyCouponBody = { coupon_code: string; }; export type RemoveCouponBody = { coupon_code: string; }; export type SubscriptionChargeItemBody = { item_price_code: string; description?: string; quantity?: number; unit_price?: number; }; export type AddChargesBody = { charges: SubscriptionChargeItemBody[]; }; export type PauseSubscriptionBody = { pause_reason?: string; resume_date?: string; }; /** * What the cancel dialog collects. Form values, not the request body: the screen * turns these into {@link CancelSubscriptionBody}. */ export type InvoicingCancelSubscriptionValues = { cancelReasonCode: string; cancelReason?: string; }; export type CancelSubscriptionBody = { cancel_reason?: string; cancel_reason_code?: string; end_of_term?: boolean; }; export type ChangeTermEndBody = { term_ends_at: string; invoice_immediately?: boolean; prorate?: boolean; }; export type ChangePlanBody = { item_price_code: string; billing_period?: number; billing_period_unit?: 'month' | 'year' | 'week' | 'day'; change_option?: 'immediately' | 'end_of_term'; invoice_immediately?: boolean; prorate?: boolean; }; export type ScheduleChargeBody = { amount: number; charge_date: string; description: string; payment_method?: string; }; export type InvoicingSubscriptionActionBody = ApplyCouponBody | RemoveCouponBody | AddChargesBody | PauseSubscriptionBody | CancelSubscriptionBody | ChangePlanBody | ChangeTermEndBody | ScheduleChargeBody | Record; export type InvoicingSubscriptionDetailResponse = ZeniAPIResponse;