Represents an object for handling messages and templates.

interface MessageHandlerObject {
    GetShippingRecipient: ((orderId: number) => Recipient);
    GetTemplateBody: ((templateName: string, data: any) => string);
    IsActive: ((templateName: string) => boolean);
    SendMessage: ((message: MessageContextObject) => boolean);
    SendMessageByTemplate: ((templateName: string, toEmail: string, data: any) => boolean);
}

Properties

GetShippingRecipient: ((orderId: number) => Recipient)

Retrieves the shipping recipient details for a specific order.

Type declaration

    • (orderId): Recipient
    • Parameters

      • orderId: number

        The ID of the order to retrieve the shipping recipient for.

      Returns Recipient

      The shipping recipient object containing recipient details.

GetTemplateBody: ((templateName: string, data: any) => string)

Retrieves the body of a message template with populated data.

Type declaration

    • (templateName, data): string
    • Parameters

      • templateName: string

        The name of the template to retrieve.

      • data: any

        Additional data to populate the template.

      Returns string

      The populated body of the message template as a string.

IsActive: ((templateName: string) => boolean)

Checks if a message template is active and available for use.

Type declaration

    • (templateName): boolean
    • Parameters

      • templateName: string

        The name of the template to check.

      Returns boolean

      true if the template is active and available, false otherwise.

SendMessage: ((message: MessageContextObject) => boolean)

Sends a message using the provided message context object.

Type declaration

    • (message): boolean
    • Parameters

      Returns boolean

      true if the message was sent successfully, false otherwise.

SendMessageByTemplate: ((templateName: string, toEmail: string, data: any) => boolean)

Sends a message using a predefined template.

Type declaration

    • (templateName, toEmail, data): boolean
    • Parameters

      • templateName: string

        The name of the template to use.

      • toEmail: string

        The recipient's email address.

      • data: any

        Additional data to populate the template.

      Returns boolean

      true if the message was sent successfully, false otherwise.