- 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>
159 lines
7 KiB
JavaScript
159 lines
7 KiB
JavaScript
#!/usr/bin/env node
|
||
|
||
/**
|
||
* Check and display Stripe bank account holder name
|
||
*
|
||
* This script helps diagnose the bank account holder name issue by:
|
||
* 1. Listing all external accounts (bank accounts) on the Stripe account
|
||
* 2. Showing the current account holder name
|
||
* 3. Providing the exact account details for verification
|
||
*
|
||
* Usage:
|
||
* node scripts/check-stripe-bank-account.js
|
||
*
|
||
* Environment:
|
||
* STRIPE_SECRET_KEY - Your Stripe secret key (test or live)
|
||
*/
|
||
|
||
require('dotenv').config();
|
||
const stripe = require('stripe')(process.env.STRIPE_SECRET_KEY);
|
||
|
||
async function checkBankAccount() {
|
||
console.log('\n🔍 Checking Stripe Bank Account Configuration\n');
|
||
console.log('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n');
|
||
|
||
try {
|
||
// Get account details
|
||
const account = await stripe.account.retrieve();
|
||
|
||
console.log('📋 Account Information:');
|
||
console.log(` Type: ${account.type}`);
|
||
console.log(` Country: ${account.country}`);
|
||
console.log(` Email: ${account.email || 'Not set'}`);
|
||
|
||
if (account.type === 'standard') {
|
||
console.log(` Business Name: ${account.business_profile?.name || 'Not set'}`);
|
||
} else if (account.type === 'express' || account.type === 'custom') {
|
||
console.log(` Account Holder Name: ${account.individual?.first_name || ''} ${account.individual?.last_name || ''}`);
|
||
console.log(` Company Name: ${account.company?.name || 'Not set'}`);
|
||
}
|
||
|
||
console.log('\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n');
|
||
|
||
// List external accounts (bank accounts)
|
||
console.log('🏦 External Accounts (Bank Accounts):\n');
|
||
|
||
// For standard accounts, bank accounts are accessed via the account object's external_accounts
|
||
let externalAccounts;
|
||
|
||
try {
|
||
if (account.type === 'standard') {
|
||
// Standard accounts: query external accounts directly
|
||
externalAccounts = await stripe.account.listExternalAccounts({
|
||
object: 'bank_account',
|
||
limit: 10
|
||
});
|
||
} else {
|
||
// Express/Custom accounts: use the Connect API
|
||
externalAccounts = await stripe.accounts.listExternalAccounts(
|
||
account.id,
|
||
{ object: 'bank_account', limit: 10 }
|
||
);
|
||
}
|
||
} catch (err) {
|
||
console.log(' ⚠️ Could not retrieve bank accounts via API');
|
||
console.log(` Error: ${err.message}\n`);
|
||
console.log(' 📍 This is normal - bank account details require dashboard access');
|
||
console.log(' 📍 Please check manually in Stripe Dashboard:');
|
||
console.log(' https://dashboard.stripe.com/settings/payouts\n');
|
||
console.log(' 📋 What to look for:');
|
||
console.log(' 1. Find "Bank accounts and debit cards" section');
|
||
console.log(' 2. Click on account ending in 6-85');
|
||
console.log(' 3. Look for "Account holder name" field');
|
||
console.log(' 4. Should say: "John Geoffrey Stroh"\n');
|
||
return;
|
||
}
|
||
|
||
if (!externalAccounts || externalAccounts.data.length === 0) {
|
||
console.log(' ⚠️ No bank accounts found on this Stripe account');
|
||
console.log(' 📍 You may need to add a bank account in the dashboard:');
|
||
console.log(' https://dashboard.stripe.com/settings/payouts\n');
|
||
return;
|
||
}
|
||
|
||
externalAccounts.data.forEach((bankAccount, index) => {
|
||
console.log(`\n Bank Account #${index + 1}:`);
|
||
console.log(` ├─ Account Holder Name: ${bankAccount.account_holder_name || 'NOT SET ❌'}`);
|
||
console.log(` ├─ Account Holder Type: ${bankAccount.account_holder_type || 'Not specified'}`);
|
||
console.log(` ├─ Bank Name: ${bankAccount.bank_name || 'Unknown'}`);
|
||
console.log(` ├─ Country: ${bankAccount.country}`);
|
||
console.log(` ├─ Currency: ${bankAccount.currency.toUpperCase()}`);
|
||
console.log(` ├─ Last 4 Digits: ****${bankAccount.last4}`);
|
||
console.log(` ├─ Routing Number: ${bankAccount.routing_number || 'N/A'}`);
|
||
console.log(` ├─ Status: ${bankAccount.status}`);
|
||
console.log(` ├─ Default for currency: ${bankAccount.default_for_currency ? 'Yes ✅' : 'No'}`);
|
||
console.log(` └─ Bank Account ID: ${bankAccount.id}`);
|
||
|
||
// Check if name matches required format
|
||
const requiredName = 'John Geoffrey Stroh';
|
||
if (bankAccount.account_holder_name === requiredName) {
|
||
console.log(`\n ✅ Account holder name matches TSB requirement!`);
|
||
} else if (bankAccount.account_holder_name) {
|
||
console.log(`\n ⚠️ Account holder name does NOT match TSB requirement`);
|
||
console.log(` Current: "${bankAccount.account_holder_name}"`);
|
||
console.log(` Required: "${requiredName}"`);
|
||
} else {
|
||
console.log(`\n ❌ Account holder name is NOT SET`);
|
||
console.log(` Required: "${requiredName}"`);
|
||
}
|
||
});
|
||
|
||
console.log('\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n');
|
||
|
||
// Check if this is the correct TSB account
|
||
const tsbAccount = externalAccounts.data.find(acc =>
|
||
acc.last4 === '6-85' || acc.last4 === '0685' || acc.routing_number?.includes('3959')
|
||
);
|
||
|
||
if (tsbAccount) {
|
||
console.log('✅ Found your TSB account (ending in 6-85)\n');
|
||
} else {
|
||
console.log('⚠️ Could not identify TSB account ending in 6-85');
|
||
console.log(' Please verify the account details above match your bank.\n');
|
||
}
|
||
|
||
console.log('📍 Next Steps:\n');
|
||
|
||
const hasCorrectName = externalAccounts.data.some(acc =>
|
||
acc.account_holder_name === 'John Geoffrey Stroh'
|
||
);
|
||
|
||
if (hasCorrectName) {
|
||
console.log(' ✅ Bank account holder name is correct!');
|
||
console.log(' ✅ You should be all set for payouts.\n');
|
||
} else {
|
||
console.log(' ⚠️ Bank account holder name needs to be updated\n');
|
||
console.log(' Option 1: Update via Stripe Dashboard');
|
||
console.log(' https://dashboard.stripe.com/settings/payouts\n');
|
||
console.log(' Option 2: Remove and re-add bank account with correct name');
|
||
console.log(' (This script cannot update the name automatically)\n');
|
||
console.log(' Option 3: Contact Stripe Support');
|
||
console.log(' https://dashboard.stripe.com/support\n');
|
||
console.log(' Option 4: Try the update script');
|
||
console.log(' node scripts/update-stripe-bank-name.js\n');
|
||
}
|
||
|
||
} catch (error) {
|
||
console.error('❌ Error checking Stripe account:', error.message);
|
||
|
||
if (error.type === 'StripeAuthenticationError') {
|
||
console.error('\n⚠️ Authentication failed. Please check:');
|
||
console.error(' 1. STRIPE_SECRET_KEY is set in .env');
|
||
console.error(' 2. The key starts with sk_test_ or sk_live_');
|
||
console.error(' 3. The key is valid and not expired\n');
|
||
}
|
||
}
|
||
}
|
||
|
||
// Run the check
|
||
checkBankAccount().catch(console.error);
|