diff --git a/server/api/internal/reconcile-payments.post.js b/server/api/internal/reconcile-payments.post.js index 762ba40..9c0686f 100644 --- a/server/api/internal/reconcile-payments.post.js +++ b/server/api/internal/reconcile-payments.post.js @@ -9,6 +9,7 @@ import Member from '../../models/member.js' import Payment from '../../models/payment.js' import { listHelcimCustomerTransactions } from '../../utils/helcim.js' +import { connectDB } from '../../utils/mongoose.js' import { upsertPaymentFromHelcim } from '../../utils/payments.js' // Same filter upsertPaymentFromHelcim applies — keep dry-run summary in sync. @@ -51,6 +52,8 @@ export default defineEventHandler(async (event) => { const apply = getQuery(event).apply !== 'false' + await connectDB() + const members = await Member.find( { helcimCustomerId: { $exists: true, $ne: null } }, { _id: 1, email: 1, name: 1, helcimCustomerId: 1, helcimSubscriptionId: 1, billingCadence: 1 }