import BaseService from '..'; import { PAYMENT_ROUTES } from './payment.routes'; import type { IOneTimeCheckoutPayload, ICheckoutResponse, IPaymentStatusResponse, ISignupCheckoutPayload, ISignupCheckoutResponse, } from './payment.interface'; export const createOneTimeCheckout = async ( payload: IOneTimeCheckoutPayload ): Promise => { return await BaseService.post(PAYMENT_ROUTES.ONE_TIME_CHECKOUT, payload); }; export const getPaymentStatus = async ( sessionId: string ): Promise => { const resp = await BaseService.get( `${PAYMENT_ROUTES.STATUS}?session_id=${sessionId}` ); const data = (resp as any)?.data || resp; return { status: data?.status || data }; }; // ── Signup Mirror → Launch Discount (pilot) ───────────────────── /** * Creates the Launch Discount checkout session. The LAUNCH50 coupon and the * 7-day trial are attached server-side by dashboard-api; the plugin only * ever sees the resulting hosted checkout URL. The Bearer token is attached * automatically by the shared axios config, so no token argument is needed. */ export const createSignupCheckout = async ( payload: ISignupCheckoutPayload ): Promise => { return await BaseService.post(PAYMENT_ROUTES.SIGNUP_CHECKOUT, payload); }; /** Forfeits the Launch Discount from the one-shot signup screen. */ export const skipLaunchDiscount = async (): Promise => { await BaseService.post(PAYMENT_ROUTES.SKIP_LAUNCH_DISCOUNT, {}); }; /** Stamps the Signup Mirror as completed. Best-effort, non-blocking. */ export const completeSignupMirror = async (): Promise => { await BaseService.post(PAYMENT_ROUTES.COMPLETE_MIRROR, {}); };