source: Klonkt/src/views/pages/paid-result.ejs@ dede82e

main
Last change on this file since dede82e was ec288dc, checked in by Robin <roboburr@…>, 7 weeks ago

Debug: show why a patron is rejected on the "Nog geen supporter" page

We are debugging boiert.eu blind (it's a self-hosted instance we can't see
the logs of), so surface the non-identifying diagnosis on the result page
itself. verifyPatron now always returns { status, cents, diag } after it
reaches Patreon, where diag is a breadcrumb: the configured campaign_id, the
memberships Patreon returned (campaign:status:cents each), and what got
picked. The paid-result page prints it small under the buttons so the tester
can read it and report back. No identity (name/email) is included or stored.

Once the cause is known this can be removed again.

Changed files:
src/services/PaidPatreonService.js

  • verifyPatron returns {status,cents,diag}; null only on hard misconfig

src/routes/paid.js

  • pass diag as debug to the notpatron/tier result page

src/views/pages/paid-result.ejs

  • small "diagnose:" line when debug is present

-robo
Co-Authored-By: Claude Opus 4.8 <noreply@…>

  • Property mode set to 100644
File size: 2.8 KB
Line 
1<%
2 var _slug = (typeof postSlug !== 'undefined' && postSlug) ? postSlug : '';
3 var _base = (typeof siteUrlBase !== 'undefined' && siteUrlBase) ? siteUrlBase : '';
4 var _patron = (typeof patronUrl !== 'undefined' && patronUrl) ? patronUrl : '';
5%>
6<section class="pr">
7 <div class="pr-card">
8 <div class="pr-ic">🔒</div>
9 <% if (reason === 'notpatron') { %>
10 <h1 class="pr-h1">Nog geen supporter</h1>
11 <p class="pr-sub">Je bent (nog) geen actieve supporter van deze site op Patreon. Word supporter en probeer het daarna opnieuw vanaf de post.</p>
12 <% } else if (reason === 'tier') { %>
13 <h1 class="pr-h1">Een niveau hoger nodig</h1>
14 <p class="pr-sub">
15 Deze post vraagt vanaf &euro;<%= ((typeof neededCents !== 'undefined' ? neededCents : 0)/100).toFixed(2) %>.
16 Jouw steun is nu &euro;<%= ((typeof haveCents !== 'undefined' ? haveCents : 0)/100).toFixed(2) %>. Verhoog je steun en probeer opnieuw.
17 </p>
18 <% } else if (reason === 'expired') { %>
19 <h1 class="pr-h1">Aanvraag verlopen</h1>
20 <p class="pr-sub">Deze ontgrendel-link is verlopen of al gebruikt. Ga terug naar de post en probeer het opnieuw.</p>
21 <% } else { %>
22 <h1 class="pr-h1">Ontgrendelen afgebroken</h1>
23 <p class="pr-sub">Er is niets gekoppeld. Je kunt het opnieuw proberen vanaf de post.</p>
24 <% } %>
25
26 <div class="pr-actions">
27 <% if ((reason === 'notpatron' || reason === 'tier') && _patron) { %>
28 <a class="pr-btn" href="<%= _patron %>" target="_blank" rel="noopener">Word supporter op Patreon</a>
29 <% } %>
30 <% if (_slug) { %>
31 <a class="pr-btn pr-btn-ghost" href="<%= _base %>/<%= _slug %>">Terug naar de post</a>
32 <% } else { %>
33 <a class="pr-btn pr-btn-ghost" href="<%= _base %>/">Terug naar de site</a>
34 <% } %>
35 </div>
36
37 <% if (typeof debug !== 'undefined' && debug) { %>
38 <p class="pr-diag">diagnose: <code><%= debug %></code></p>
39 <% } %>
40 </div>
41</section>
42
43<style>
44 .pr { max-width: 460px; margin: 0 auto; padding: 56px 18px; text-align: center; }
45 .pr-card { border: 1px solid color-mix(in srgb, var(--ink,#000) 16%, transparent); border-radius: 18px; padding: 34px 26px; }
46 .pr-ic { font-size: 38px; margin-bottom: 6px; }
47 .pr-h1 { font-size: 23px; margin: 0 0 8px; }
48 .pr-sub { opacity: .85; line-height: 1.6; margin: 0 0 20px; }
49 .pr-actions { display: flex; flex-direction: column; gap: 10px; align-items: stretch; }
50 .pr-btn { display: inline-block; padding: 11px 20px; border-radius: 10px; background: var(--accent,#6b8f71); color: #fff; text-decoration: none; font-weight: 600; }
51 .pr-btn-ghost { background: transparent; color: var(--ink,#222); border: 1px solid color-mix(in srgb, var(--ink,#000) 22%, transparent); }
52 .pr-diag { margin: 18px 0 0; font-size: 12px; opacity: .6; word-break: break-all; }
53 .pr-diag code { font-family: ui-monospace, monospace; }
54</style>
Note: See TracBrowser for help on using the repository browser.