fix: use source 'card' and require funnelId for Flow Service deposit
Flow Service expects source to be wallet|card|bank, not 'transak'. funnelId falls back to FUNNEL_ID env var when not in partnerOrderId. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
0ef5aad3ad
commit
7ffabe9b0a
|
|
@ -183,9 +183,11 @@ routes.post("/api/transak/webhook", async (c) => {
|
|||
return c.json({ error: "Invalid webhook data" }, 400);
|
||||
}
|
||||
|
||||
// partnerOrderId format: "flowId" or "flowId:funnelId"
|
||||
// partnerOrderId format: "flowId:funnelId" or "flowId" (uses env default)
|
||||
const [flowId, funnelId] = partnerOrderId.split(":");
|
||||
if (!flowId) return c.json({ error: "Missing flowId in partnerOrderId" }, 400);
|
||||
const resolvedFunnelId = funnelId || process.env.FUNNEL_ID || "";
|
||||
if (!resolvedFunnelId) return c.json({ error: "Missing funnelId" }, 400);
|
||||
|
||||
// Convert crypto amount to USDC units (6 decimals)
|
||||
const amountUnits = Math.round(parseFloat(cryptoAmount) * 1e6).toString();
|
||||
|
|
@ -196,8 +198,8 @@ routes.post("/api/transak/webhook", async (c) => {
|
|||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({
|
||||
amount: amountUnits,
|
||||
source: "transak",
|
||||
...(funnelId ? { funnelId } : {}),
|
||||
source: "card",
|
||||
funnelId: resolvedFunnelId,
|
||||
}),
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue