Interface representing a budget object within the MegaScript context.

interface Budget {
    Amount: number;
    Clear: (() => boolean);
    CreatedOnUtc: object;
    CustomerId: number;
    ExpiresOnUtc: object;
    GetRemainingAmount: (() => number);
    Id: number;
    IsBudgetValid: (() => boolean);
    PurchasedWithOrderProductVariantId: number;
    Type: number;
    UsageHistory: BudgetUsageHistory[];
    UseBudget: ((amountInstance: number, orderObj: object, details: string) => boolean);
}

Properties

Amount: number

The amount allocated to the budget.

Clear: (() => boolean)

Clears the remaining amount of the budget.

Type declaration

    • (): boolean
    • Returns boolean

      true if the operation is successful, otherwise false.

CreatedOnUtc: object

The date and time when the budget was created, in UTC.

CustomerId: number

The identifier of the customer associated with the budget.

ExpiresOnUtc: object

The expiration date and time of the budget, in UTC.

GetRemainingAmount: (() => number)

Gets the remaining amount of the budget.

Type declaration

    • (): number
    • Returns number

      The remaining amount as a NumberInstance.

Id: number

The identifier of the budget.

IsBudgetValid: (() => boolean)

Checks if the budget is still valid.

Type declaration

    • (): boolean
    • Returns boolean

      true if the budget is valid, otherwise false.

PurchasedWithOrderProductVariantId: number

The ID of the Order Product Variant that the budget was purchased with, if applicable.

Type: number

The type of the budget.

UsageHistory: BudgetUsageHistory[]

The usage history of the budget, represented as an array of MsBudgetUsageHistory objects.

UseBudget: ((amountInstance: number, orderObj: object, details: string) => boolean)

Uses the specified amount from the budget for an order.

Type declaration

    • (amountInstance, orderObj, details): boolean
    • Parameters

      • amountInstance: number

        The amount to use from the budget.

      • orderObj: object

        The order object associated with the usage.

      • details: string

        Additional details about the usage.

      Returns boolean

      true if the operation is successful, otherwise false.