MCPcopy Create free account
hub / github.com/Tron521/codex-console-temp / generateLink

Function generateLink

static/js/payment.js:2323–2352  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2321
2322// 生成支付链接
2323async function generateLink() {
2324 if (isGeneratingCheckoutLink) {
2325 return;
2326 }
2327
2328 let payload;
2329 try {
2330 payload = getCheckoutPayload();
2331 } catch (err) {
2332 toast.warning(err.message || "参数不完整");
2333 return;
2334 }
2335
2336 isGeneratingCheckoutLink = true;
2337 setButtonLoading("generate-link-btn", "生成中...", true);
2338 try {
2339 const data = await api.post("/payment/generate-link", payload);
2340 if (!data?.success || !data?.link) {
2341 throw new Error(data?.detail || "生成链接失败");
2342 }
2343 showGeneratedLink(data);
2344 toast.success("支付链接生成成功");
2345 } catch (e) {
2346 toast.error(`生成链接失败: ${formatErrorMessage(e)}`);
2347 } finally {
2348 isGeneratingCheckoutLink = false;
2349 setButtonLoading("generate-link-btn", "生成中...", false);
2350 resetGenerateLinkButtonState();
2351 }
2352}
2353
2354async function submitThirdPartyAutoBind(task, bindData) {
2355 const thirdParty = collectThirdPartyConfig();

Callers

nothing calls this directly

Calls 9

getCheckoutPayloadFunction · 0.85
setButtonLoadingFunction · 0.85
showGeneratedLinkFunction · 0.85
formatErrorMessageFunction · 0.85
warningMethod · 0.80
successMethod · 0.80
errorMethod · 0.80
postMethod · 0.45

Tested by

no test coverage detected