openvibe-sdk/coupons

Generated at from openvibe-contracts v0.221.0 and openvibe-sdk v0.65.0.

From types/coupons.d.ts (server only). Declarations are shown verbatim.

type ReportOutcome

export type ReportOutcome = 'worked' | 'failed';

type ReportReason

export type ReportReason = 'invalid' | 'expired' | 'min_spend_not_met' | 'not_eligible' | 'other';

interface CouponSubmission

export interface CouponSubmission {
    code: string; title: string; merchant_id?: string; host?: string; url?: string; description?: string | null; expires?: string | null;
    expiry_basis?: 'submitter' | 'evidence'; evidence_url?: string; restrictions?: Record<string, unknown>; hint?: string | null; [k: string]: unknown;
}

interface CouponsClient

export interface CouponsClient {
    merchants: {
        resolve(host: string, opts?: Opts): Promise<CouponsJson>;
        get(id: string, opts?: Opts): Promise<CouponsJson>;
        coupons(id: string, opts?: Opts): Promise<CouponsJson>;
    };
    get(id: string, opts?: Opts): Promise<CouponsJson>;
    submit(fields: CouponSubmission, opts?: Opts): Promise<CouponsJson>;
    report(id: string, req: { outcome: ReportOutcome; reason?: ReportReason | null }, opts?: Opts): Promise<CouponsJson>;
}

export export function createCouponsClient(client: { json(opts: Rec

export function createCouponsClient(client: { json(opts: Record<string, unknown>): Promise<any> }, options?: { baseUrl?: string }): CouponsClient;