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

Function createBindCardTask

static/js/payment.js:2444–2542  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2442
2443// 生成并创建绑卡任务
2444async function createBindCardTask() {
2445 let payload;
2446 try {
2447 payload = getCheckoutPayload();
2448 } catch (err) {
2449 toast.warning(err.message || "参数不完整");
2450 return;
2451 }
2452
2453 const bindMode = getBindMode();
2454 const isVendorEfun = bindMode === "vendor_efun";
2455 const efunConfig = isVendorEfun ? collectEfunConfig() : {};
2456 const vendorConfigForRun = isVendorEfun
2457 ? {
2458 redeem_code: "",
2459 checkout_url: String(payload?.custom_checkout_url || "").trim(),
2460 api_url: String(efunConfig.api_url || "").trim(),
2461 api_key: String(efunConfig.api_key || "").trim(),
2462 }
2463 : null;
2464 if (isVendorEfun) {
2465 const resolved = resolveEfunCodeFromInputOrPool();
2466 const resolvedCode = String(resolved?.code || "").trim();
2467 if (!resolvedCode) {
2468 renderEfunPoolHint();
2469 toast.warning("卡商EFun模式需要兑换码:可先在卡池添加供应商=EFun的可用码,或手动填写");
2470 return;
2471 }
2472 efunConfig.code = resolvedCode;
2473 vendorConfigForRun.redeem_code = resolvedCode;
2474 setInputValue("efun-code-input", resolvedCode);
2475 storage.set(EFUN_CODE_STORAGE_KEY, resolvedCode);
2476 if (!EFUN_CODE_REGEX.test(String(efunConfig.code || ""))) {
2477 toast.warning("CDK 格式无效");
2478 return;
2479 }
2480 renderEfunPoolHint();
2481 setEfunResult("已准备就绪:将执行接口流程(强制生成 Checkout -> EFun 开卡 -> bindcard 提交 -> 同步订阅)");
2482 } else {
2483 let bindData = collectBillingFormData();
2484 const missing = [];
2485 if (!bindData.card_number) missing.push("卡号");
2486 if (!bindData.exp_month || !bindData.exp_year) missing.push("有效期");
2487 if (!bindData.cvc) missing.push("CVC");
2488 if (!bindData.billing_name) missing.push("姓名");
2489 if (!bindData.address_line1) missing.push("地址");
2490 if (!bindData.postal_code) missing.push("邮编");
2491 if (missing.length && bindMode === "semi_auto") {
2492 toast.warning(`绑卡资料未完整:${missing.join("、")}(本次仅创建半自动任务,不会阻断)`, 5000);
2493 }
2494 if (missing.length && bindMode === "local_auto") {
2495 toast.warning(`全自动绑卡需要完整资料:${missing.join("、")}`, 5000);
2496 return;
2497 }
2498 }
2499
2500 payload.auto_open = isVendorEfun ? false : Boolean(document.getElementById("bind-auto-open")?.checked);
2501 payload.bind_mode = bindMode;

Callers

nothing calls this directly

Calls 15

getCheckoutPayloadFunction · 0.85
getBindModeFunction · 0.85
collectEfunConfigFunction · 0.85
renderEfunPoolHintFunction · 0.85
setInputValueFunction · 0.85
setEfunResultFunction · 0.85
collectBillingFormDataFunction · 0.85
setButtonLoadingFunction · 0.85
showGeneratedLinkFunction · 0.85
showVendorProgressPanelFunction · 0.85

Tested by

no test coverage detected