culqi-node
Version:
Typescript wrapper for Culqi web services developed for Node.js with 0 runtime dependencies
68 lines (67 loc) • 1.95 kB
TypeScript
import { HttpRequestOptions } from './request';
export type PlanInterval = 'Dias' | 'Semanas' | 'Meses' | 'Años';
export type Plan = {
object: string;
id: string;
name: string;
amount: number;
currency_code: string;
interval_count: number;
interval: PlanInterval;
limit: number;
trial_days: number;
total_subscriptions: number;
metadata: Record<string, string>;
};
export type CreatePlanRequest = {
name: string;
amount: number;
currency_code: string;
interval: PlanInterval;
interval_count: number;
limit: number;
};
export type GetPlanRequest = {
id: string;
};
export type GetPlansRequest = {
amount?: string;
min_amount?: string;
max_amount?: string;
creation_date_from?: string;
creation_date_to?: string;
limit?: string;
before?: string;
after?: string;
};
export type GetPlansResponse = {
data: Plan[];
paging: {
previous: string;
next: string;
cursors: {
before: string;
after: string;
};
remaining_items: number;
};
};
export type UpdatePlanRequest = {
id: string;
metadata?: Record<string, string>;
};
export type DeletePlanRequest = {
id: string;
};
export type DeletePlanResponse = {
id: string;
deleted: boolean;
merchant_message: string;
};
export declare const plans: {
createPlan: (req: CreatePlanRequest, extraHttpOptions?: Partial<HttpRequestOptions>) => Promise<Plan>;
getPlan: (req: GetPlanRequest, extraHttpOptions?: Partial<HttpRequestOptions>) => Promise<Plan>;
getPlans: (req?: GetPlansRequest, extraHttpOptions?: Partial<HttpRequestOptions>) => Promise<GetPlansResponse>;
updatePlan: (req: UpdatePlanRequest, extraHttpOptions?: Partial<HttpRequestOptions>) => Promise<Plan>;
deletePlan: (req: DeletePlanRequest, extraHttpOptions?: Partial<HttpRequestOptions>) => Promise<DeletePlanResponse>;
};