openvibers/openvibe.live Commits
PowerChat donate links: send viewers back; explain isTest skips in the log
Changes
@@@ -119,11 +119,15 @@ function buildSubscribeLink(order, streamerUserId, { autoRenew = 0 } = {}) {// the viewer's free choice — donations are never pinned.function buildDonateLink(streamerUserId, donorUserId, { goalId = null } = {}) {const purpose = goalId ? `goal:${goalId}` : 'donation';++ // returnTo: donors get auto-redirected back to our confirmation page after the++ // checkout too — without app_redirect_uri PowerChat only offers a plain++ // "Return to app" link and viewers just sat on the tip page.++ const opts = { purpose, returnTo: true };const direct = _checkoutConn(streamerUserId);-- if (direct) return { url: tipLinkFor(direct.powerchat_username, '', { purpose }), mode: 'direct' };++ if (direct) return { url: tipLinkFor(direct.powerchat_username, '', opts), mode: 'direct' };const site = getSiteAccount();if (!site) return null;-- return { url: tipLinkFor(site.username, `pcdon:${streamerUserId}:${donorUserId || 0}`, { purpose }), mode: 'site' };++ return { url: tipLinkFor(site.username, `pcdon:${streamerUserId}:${donorUserId || 0}`, opts), mode: 'site' };}// ── Webhook fulfillment ──────────────────────────────────────@@@ -206,7 +206,14 @@ function processEvent(envelope) {// data.isTest = no money moved (dashboard test fires, free test method, no payout// provider). Never credit those — unless the owner explicitly enabled test// fulfillment for dev/sandbox, where every delivery is isTest.-- if (data.isTest && !_testFulfillmentAllowed()) { console.log(`[PowerChat] test webhook ${envelope.type} verified OK (not credited)`); return; }++ if (data.isTest && !_testFulfillmentAllowed()) {++ // Make the skip self-explanatory when it's an attributed checkout — this is the++ // #1 "my tip went through but nothing credited" question: the PowerChat side++ // confirmed a TEST checkout (no payout provider / free test method).++ const ref = data.appExternalRef ? ` (checkout ref ${data.appExternalRef} — no money moved; enable powerchat_allow_test_fulfillment in admin to credit test checkouts in dev)` : '';++ console.log(`[PowerChat] test webhook ${envelope.type} verified OK (not credited)${ref}`);++ return;++ }if (data.isTest) console.warn(`[PowerChat] processing TEST ${envelope.type} (powerchat_allow_test_fulfillment is ON — no money moved)`);// App-sourced events are OUR OWN pushes (tips/subs/follows/redemptions we forwarded// via the platform scopes) echoing back through the webhook — they already happened
@@ -119,11 +119,15 @@ function buildSubscribeLink(order, streamerUserId, { autoRenew = 0 } = {}) {
@@ -119,11 +119,15 @@ function buildSubscribeLink(order, streamerUserId, { autoRenew = 0 } = {}) {
// the viewer's free choice — donations are never pinned.
// the viewer's free choice — donations are never pinned.
function buildDonateLink(streamerUserId, donorUserId, { goalId = null } = {}) {
function buildDonateLink(streamerUserId, donorUserId, { goalId = null } = {}) {
const purpose = goalId ? `goal:${goalId}` : 'donation';
const purpose = goalId ? `goal:${goalId}` : 'donation';
+ // returnTo: donors get auto-redirected back to our confirmation page after the
+ // checkout too — without app_redirect_uri PowerChat only offers a plain
+ // "Return to app" link and viewers just sat on the tip page.
+ const opts = { purpose, returnTo: true };
const direct = _checkoutConn(streamerUserId);
const direct = _checkoutConn(streamerUserId);
- if (direct) return { url: tipLinkFor(direct.powerchat_username, '', { purpose }), mode: 'direct' };
+ if (direct) return { url: tipLinkFor(direct.powerchat_username, '', opts), mode: 'direct' };
const site = getSiteAccount();
const site = getSiteAccount();
if (!site) return null;
if (!site) return null;
- return { url: tipLinkFor(site.username, `pcdon:${streamerUserId}:${donorUserId || 0}`, { purpose }), mode: 'site' };
+ return { url: tipLinkFor(site.username, `pcdon:${streamerUserId}:${donorUserId || 0}`, opts), mode: 'site' };
}
}
// ── Webhook fulfillment ──────────────────────────────────────
// ── Webhook fulfillment ──────────────────────────────────────
@@ -206,7 +206,14 @@ function processEvent(envelope) {
@@ -206,7 +206,14 @@ function processEvent(envelope) {
// data.isTest = no money moved (dashboard test fires, free test method, no payout
// data.isTest = no money moved (dashboard test fires, free test method, no payout
// provider). Never credit those — unless the owner explicitly enabled test
// provider). Never credit those — unless the owner explicitly enabled test
// fulfillment for dev/sandbox, where every delivery is isTest.
// fulfillment for dev/sandbox, where every delivery is isTest.
- if (data.isTest && !_testFulfillmentAllowed()) { console.log(`[PowerChat] test webhook ${envelope.type} verified OK (not credited)`); return; }
+ if (data.isTest && !_testFulfillmentAllowed()) {
+ // Make the skip self-explanatory when it's an attributed checkout — this is the
+ // #1 "my tip went through but nothing credited" question: the PowerChat side
+ // confirmed a TEST checkout (no payout provider / free test method).
+ const ref = data.appExternalRef ? ` (checkout ref ${data.appExternalRef} — no money moved; enable powerchat_allow_test_fulfillment in admin to credit test checkouts in dev)` : '';
+ console.log(`[PowerChat] test webhook ${envelope.type} verified OK (not credited)${ref}`);
+ return;
+ }
if (data.isTest) console.warn(`[PowerChat] processing TEST ${envelope.type} (powerchat_allow_test_fulfillment is ON — no money moved)`);
if (data.isTest) console.warn(`[PowerChat] processing TEST ${envelope.type} (powerchat_allow_test_fulfillment is ON — no money moved)`);
// App-sourced events are OUR OWN pushes (tips/subs/follows/redemptions we forwarded
// App-sourced events are OUR OWN pushes (tips/subs/follows/redemptions we forwarded
// via the platform scopes) echoing back through the webhook — they already happened
// via the platform scopes) echoing back through the webhook — they already happened