fix(zalo): fix pairing channel detection and webhook payload format

Amp-Thread-ID: https://ampcode.com/threads/T-019bc4e0-fcb1-77be-b0b5-0d498f0c7197
Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
Long
2026-01-16 10:43:14 +07:00
parent 5b827528f8
commit c0c9742e44
7 changed files with 46 additions and 23 deletions

View File

@@ -8,11 +8,10 @@ const pairingIdLabels: Record<string, string> = {
telegram: "telegramUserId",
discord: "discordUserId",
};
const requirePairingAdapter = vi.fn((channel: string) => ({
const getPairingAdapter = vi.fn((channel: string) => ({
idLabel: pairingIdLabels[channel] ?? "userId",
}));
const listPairingChannels = vi.fn(() => ["telegram", "discord"]);
const resolvePairingChannel = vi.fn((raw: string) => raw);
vi.mock("../pairing/pairing-store.js", () => ({
listChannelPairingRequests,
@@ -21,9 +20,8 @@ vi.mock("../pairing/pairing-store.js", () => ({
vi.mock("../channels/plugins/pairing.js", () => ({
listPairingChannels,
resolvePairingChannel,
notifyPairingApproved,
requirePairingAdapter,
getPairingAdapter,
}));
vi.mock("../config/config.js", () => ({