kiotviet-client-sdk - v0.3.4
    Preparing search index...

    Class WebhookHandler

    Index

    Constructors

    Methods

    • Create a new webhook

      Parameters

      • webhookData: WebhookCreateParams

        The webhook configuration data

      Returns Promise<Webhook>

    • Delete a webhook

      Parameters

      • webhookId: number

        The ID of the webhook to delete

      Returns Promise<void>

    • Disable a webhook

      Parameters

      • webhookId: number

        The ID of the webhook to disable

      Returns Promise<Webhook>

    • Enable a webhook

      Parameters

      • webhookId: number

        The ID of the webhook to enable

      Returns Promise<Webhook>

    • Get a webhook by its ID

      Parameters

      • webhookId: number

        The ID of the webhook to retrieve

      Returns Promise<Webhook>

    • List webhooks with optional filtering

      Parameters

      • params: WebhookListParams = {}

        Filter parameters

      Returns Promise<WebhookListResponse>

    • Parse and verify customer update webhook payload

      Parameters

      • payload: string

        The raw webhook payload string

      • signature: string

        The signature from X-Hub-Signature header

      • secret: string

        The webhook secret

      Returns TypedWebhookPayload<CustomerUpdated>

    • Parse and verify invoice update webhook payload

      Parameters

      • payload: string

        The raw webhook payload string

      • signature: string

        The signature from X-Hub-Signature header

      • secret: string

        The webhook secret

      Returns TypedWebhookPayload<InvoiceUpdated>

    • Parse and verify order update webhook payload

      Parameters

      • payload: string

        The raw webhook payload string

      • signature: string

        The signature from X-Hub-Signature header

      • secret: string

        The webhook secret

      Returns TypedWebhookPayload<OrderUpdated>

    • Parse and verify product update webhook payload

      Parameters

      • payload: string

        The raw webhook payload string

      • signature: string

        The signature from X-Hub-Signature header

      • secret: string

        The webhook secret

      Returns TypedWebhookPayload<ProductUpdated>

    • Parse and verify stock update webhook payload

      Parameters

      • payload: string

        The raw webhook payload string

      • signature: string

        The signature from X-Hub-Signature header

      • secret: string

        The webhook secret

      Returns TypedWebhookPayload<StockUpdated>

    • Parse and verify a webhook payload with automatic type casting based on the event type

      Type Parameters

      • E extends WebhookEvent

      Parameters

      • payload: string

        The raw webhook payload string

      • signature: string

        The signature from X-Hub-Signature header

      • secret: string

        The webhook secret

      • expectedEvent: E

      Returns TypedWebhookPayload<E>

    • Parse and verify webhook payload

      Type Parameters

      • T = any

      Parameters

      • payload: string

        The raw webhook payload string

      • signature: string

        The signature from X-Hub-Signature header

      • secret: string

        The webhook secret

      Returns WebhookPayload<T>

    • Update an existing webhook

      Parameters

      • webhookId: number

        The ID of the webhook to update

      • webhookData: Partial<WebhookUpdateParams>

        The webhook data to update

      Returns Promise<Webhook>

    • Kiểm tra xem webhook payload có hợp lệ không và có đúng cấu trúc cho customer.update không

      Parameters

      • payload: any

        Webhook payload dạng object (đã parse từ JSON)

      Returns payload is CustomerUpdateWebhookPayload

    • Kiểm tra cấu trúc của payload xóa (RemoveId)

      Parameters

      • payload: any

        Webhook payload dạng object (đã parse từ JSON)

      Returns boolean

    • Kiểm tra cấu trúc chung của webhook payload (trường hợp update)

      Parameters

      • payload: any

        Webhook payload dạng object (đã parse từ JSON)

      Returns boolean

    • Kiểm tra xem webhook payload có hợp lệ không và có đúng cấu trúc cho order.update không

      Parameters

      • payload: any

        Webhook payload dạng object (đã parse từ JSON)

      Returns payload is OrderUpdateWebhookPayload

    • Kiểm tra xem webhook payload có hợp lệ không và có đúng cấu trúc cho product.update không

      Parameters

      • payload: any

        Webhook payload dạng object (đã parse từ JSON)

      Returns payload is ProductUpdateWebhookPayload

    • Verify webhook signature

      Parameters

      • payload: string

        The raw webhook payload

      • signature: string

        The signature from X-KiotViet-Signature header

      • secret: string

        The webhook secret

      Returns boolean