- Create Economist SubmissionTracking package correctly: * mainArticle = full blog post content * coverLetter = 216-word SIR— letter * Links to blog post via blogPostId - Archive 'Letter to The Economist' from blog posts (it's the cover letter) - Fix date display on article cards (use published_at) - Target publication already displaying via blue badge Database changes: - Make blogPostId optional in SubmissionTracking model - Economist package ID: 68fa85ae49d4900e7f2ecd83 - Le Monde package ID: 68fa2abd2e6acd5691932150 Next: Enhanced modal with tabs, validation, export 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
54 lines
1.8 KiB
JavaScript
54 lines
1.8 KiB
JavaScript
/**
|
|
* Koha Success Page - Donation Verification
|
|
*/
|
|
|
|
// Get session ID from URL
|
|
const urlParams = new URLSearchParams(window.location.search);
|
|
const sessionId = urlParams.get('session_id');
|
|
|
|
// Verify donation
|
|
async function verifyDonation() {
|
|
if (!sessionId) {
|
|
// No session ID - just show success message
|
|
document.getElementById('loading-content').classList.add('hidden');
|
|
document.getElementById('success-content').classList.remove('hidden');
|
|
return;
|
|
}
|
|
|
|
try {
|
|
const response = await fetch(`/api/koha/verify/${sessionId}`);
|
|
const data = await response.json();
|
|
|
|
if (data.success && data.data.isSuccessful) {
|
|
// Show success content
|
|
document.getElementById('loading-content').classList.add('hidden');
|
|
document.getElementById('success-content').classList.remove('hidden');
|
|
|
|
// Update details
|
|
document.getElementById('amount').textContent = `$${data.data.amount.toFixed(2)} ${data.data.currency.toUpperCase()}`;
|
|
|
|
const frequencyText = data.data.frequency === 'monthly' ? 'Monthly Donation' : 'One-Time Donation';
|
|
document.getElementById('frequency').textContent = frequencyText;
|
|
|
|
// Show monthly section if applicable
|
|
if (data.data.frequency === 'monthly') {
|
|
document.getElementById('monthly-section').classList.remove('hidden');
|
|
}
|
|
|
|
} else {
|
|
throw new Error('Donation not successful');
|
|
}
|
|
|
|
} catch (error) {
|
|
console.error('Verification error:', error);
|
|
document.getElementById('loading-content').classList.add('hidden');
|
|
document.getElementById('error-content').classList.remove('hidden');
|
|
}
|
|
}
|
|
|
|
// Verify on page load
|
|
if (sessionId) {
|
|
document.getElementById('success-content').classList.add('hidden');
|
|
document.getElementById('loading-content').classList.remove('hidden');
|
|
verifyDonation();
|
|
}
|