modem-pay
Version:
A TypeScript SDK for integrating with the Modem Pay payment gateway, enabling seamless payment processing and financial services in your applications.
220 lines (219 loc) • 5.19 kB
TypeScript
/**
* Parameters for creating a coupon.
*/
export type CouponParams = {
/**
* Amount to be discounted from the total.
*/
amount_off?: number;
/**
* Currency in which the discount is applied.
*/
currency?: string;
/**
* Duration of the coupon's validity.
*/
duration: "forever" | "once" | "repeating";
/**
* Number of months the coupon is valid for if the duration is "repeating".
*/
duration_in_months?: number;
/**
* Metadata associated with the coupon.
*/
metadata?: object;
/**
* Name of the coupon.
*/
name: string;
/**
* Percentage discount to be applied.
*/
percent_off?: number;
/**
* Maximum number of times the coupon can be redeemed.
*/
max_redemptions?: number;
/**
* The ID of the product associated with the coupon.
*/
product_id?: string;
/**
* The ID of the storefront where the coupon can be redeemed.
*/
store_id?: string;
/**
* Date by which the coupon must be redeemed.
*/
redeem_by?: Date;
/**
* Restrictions associated with the promotion code.
*/
restrictions?: {
/**
* Indicates if the coupon is restricted to first-time transactions.
*/
first_time_transaction: boolean;
/**
* Minimum amount required to use the coupon.
*/
minimum_amount: number | null;
/**
* Currency of the minimum amount required to use the coupon.
*/
minimum_amount_currency: string | null;
};
};
/**
* Parameters for creating a coupon.
*/
export type UpdateParams = {
duration_in_months?: number;
/**
* Metadata associated with the coupon.
*/
metadata?: object;
/**
* Name of the coupon.
*/
name?: string;
/**
* Percentage discount to be applied.
*/
percent_off?: number;
/**
* Maximum number of times the coupon can be redeemed.
*/
max_redemptions?: number;
/**
* Date by which the coupon must be redeemed.
*/
redeem_by?: Date;
/**
* Restrictions associated with the promotion code.
*/
restrictions?: {
/**
* Indicates if the coupon is restricted to first-time transactions.
*/
first_time_transaction: boolean;
/**
* Minimum amount required to use the coupon.
*/
minimum_amount: number | null;
/**
* Currency of the minimum amount required to use the coupon.
*/
minimum_amount_currency: string | null;
};
};
/**
* Representation of a coupon.
*/
export type Coupon = CouponParams & {
/**
* Unique identifier for the coupon.
*/
id: string;
/**
* Number of times the coupon has been redeemed.
*/
times_redeemed: number;
/**
* Indicates if the coupon is currently valid.
*/
valid: boolean;
};
/**
* Options for listing coupons.
*/
export type CouponListOption = {
/**
* Maximum number of coupons to retrieve in a single request.
*/
limit?: number;
/**
* Search term for filtering coupons.
*/
search?: string;
};
/**
* Parameters for creating or updating a promotion code.
*/
export type PromotionCodeParams = {
/**
* The code for the promotion.
*/
code?: string;
/**
* The ID of the associated coupon.
*/
coupon_id: string;
/**
* Metadata associated with the promotion code.
*/
metadata?: object;
/**
* Indicates if the promotion code is active.
*/
active?: boolean;
/**
* The ID of the customer associated with the promotion code.
*/
customer_id?: string;
/**
* Maximum number of times the promotion code can be redeemed.
*/
max_redemptions?: number;
/**
* Expiration date of the promotion code.
*/
expires_at?: Date;
/**
* Restrictions associated with the promotion code.
*/
restrictions?: {
/**
* Indicates if the promotion code is restricted to first-time transactions.
*/
first_time_transaction: boolean;
/**
* Minimum amount required to use the promotion code.
*/
minimum_amount: number | null;
/**
* Currency of the minimum amount required to use the promotion code.
*/
minimum_amount_currency: string | null;
};
};
/**
* Representation of a promotion code.
*/
export type PromotionCode = PromotionCodeParams & {
/**
* Unique identifier for the promotion code.
*/
id: string;
/**
* The ID of the account associated with the promotion code.
*/
account_id: string;
/**
* The ID of the business associated with the promotion code.
*/
business_id: string;
};
/**
* Options for listing promotion codes.
*/
export type PromotionCodeListOption = {
/**
* Maximum number of promotion codes to retrieve in a single request.
*/
limit?: number;
/**
* Search term for filtering promotion codes.
*/
search?: string;
};