BixPay card integration, phase 1 (Marty approved the copy 2026-10-29; docs/BIXPAY-INTEGRATION.md): gated by site config bixpayLive (off by default). Profile > BixPay card field (partner link validated: bix.ibportal.io/auth/register, e= token, a=1; the appId=3 card-customer link is refused with a message), bixpay.js resolver own > sponsor chain (10 levels) > company link (bixCompanyLink, seeded with Marty's partner link), every surface says whose link it is. Wallet tab card, one-week Overview announcement (24 h snooze), one sentence in TierPaid payout emails and the games' wallet nudges, Promo tools > BixPay tab (3 posts, email swipe, 4 text-only banners on the Spaces CDN, tracked link + per-member clicks), public guide /bixpay with masked app screenshots, chatbot canned answers + facts gated to 'coming soon' while off (KNOWLEDGE_DATE 2026-10-29). Clicks per surface via /go/bixpay in the admin Traffic tab; admin Overview counts members with a link; member card shows it; signed /api/partner/bixpay and the lssync profile row carry it for LinkSpin/CTB. accounts.bix_partner_link column (db.js alterSafe). Tests: qa/bixpay.test.cjs (17) + walk.mjs BixPay block; my.js/promo.js/admin.js ?v=20261029bx.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
martbost
2026-10-29 07:56:49 -05:00
parent 6e1ab102f1
commit ed6febe0b8
29 changed files with 971 additions and 27 deletions
+8 -5
View File
@@ -74,7 +74,7 @@ function fetchRows(g) {
});
}
// copy (Marty, 2026-10-27): the ask is the LINK step only (one free signature), never "switch on payouts": a linked wallet is paid
function copy(games, stage, link) {
function copy(games, stage, link, bixLine) {
const total = games.reduce((n, g) => n + g.unpaid, 0);
const parts = games.map(g => g.unpaid.toFixed(2) + ' POL in ' + g.name);
const list = parts.length > 1 ? parts.slice(0, -1).join(', ') + ' and ' + parts[parts.length - 1] : parts[0];
@@ -82,8 +82,11 @@ function copy(games, stage, link) {
const p1 = "You've earned " + list + ". Link your wallet (one free signature) and it's sent automatically, including everything you've earned so far.";
const p2 = 'It is not a transaction and it cannot move funds. Every game pays that same wallet from then on.';
const p3 = stage >= 2 ? 'This is the last reminder about this balance. It stays yours; it just waits for a wallet.' : 'Not sure which wallet to use? SafePal is the one we recommend; MetaMask and Phantom work too. The Wallet tab has a short guide.';
const text = [p1, '', p2, '', 'Link your wallet: ' + link, '', p3].join('\n');
const html = '<p>' + esc(p1).replace(esc(list), '<b>' + esc(list) + '</b>') + '</p><p>' + esc(p2) + '</p><p><a href="' + esc(link) + '"><b>Link your wallet</b></a></p><p>' + esc(p3) + '</p>';
// BixPay (2026-10-29): one sentence after the wallet ask, the member's resolved partner link behind a counted /go link; '' while bixpayLive is off
const bx = String(bixLine || '').trim();
const text = [p1, '', p2, '', 'Link your wallet: ' + link, '', p3].concat(bx ? ['', bx] : []).join('\n');
const bxHtml = bx ? '<p>' + esc(bx).replace(/(https:\/\/\S+)/, '<a href="$1">$1</a>') + '</p>' : '';
const html = '<p>' + esc(p1).replace(esc(list), '<b>' + esc(list) + '</b>') + '</p><p>' + esc(p2) + '</p><p><a href="' + esc(link) + '"><b>Link your wallet</b></a></p><p>' + esc(p3) + '</p>' + bxHtml;
return { subject, text, html, total };
}
async function tick() {
@@ -132,7 +135,7 @@ async function tick() {
const stage = p.sent.length; if (stage >= STAGES.length) continue;
if (now - p.first < STAGES[stage]) continue;
const link = (R.site || 'https://instantadpay.com') + '/my#wallet';
const c = copy(gs, stage, link);
const c = copy(gs, stage, link, R.bixLine ? R.bixLine(a) : '');
let ok = false;
try { await R.message(email, c.subject, c.html); ok = true; } catch (e) {}
if (R.mailer && R.mailer.hasKey && R.mailer.hasKey() && R.optedIn) { try { if (await R.optedIn(email)) { await R.mailer.send(email, c.subject, c.text, c.html); ok = true; } } catch (e) {} }
@@ -154,4 +157,4 @@ function adminView() {
return { stats: Object.assign({ pushed: 0 }, S.stats), lastRun: S.lastRun, lastRows: S.lastRows, games: games().map(g => ({ key: g.key, name: g.name, url: g.url, nudge: g.nudge !== false })),
pushed: (S.pushLog || []).slice(0, 100), pushRefused: Object.values(S.pushes || {}).filter(x => x.status !== 'ok').sort((a, b) => b.at - a.at).slice(0, 100), waiting: people.filter(p => !p.done), done: people.filter(p => p.done).slice(0, 100) };
}
module.exports = { init, tick, waitingFor, adminView, games, STAGES };
module.exports = { init, tick, waitingFor, adminView, games, STAGES, copy };