fix(invite): persist billingCadence at invite-accept time

Annual-choosing invitees who abandoned between accept and payment were left at billingCadence:'monthly' (the model default) while contributionAmount held an annual-unit value, rendering $180/mo in admin views. Persist the chosen cadence at Member.create time.

accept-invite.vue now sends cadence in the accept POST body; inviteAcceptSchema accepts cadence (defaults 'monthly'); accept.post.js sets billingCadence on create, forced to 'monthly' for $0 members since a free member has no billing relationship.
This commit is contained in:
Jennie Robinson Faber 2026-05-24 15:21:34 +01:00
parent 10a28ac5ef
commit c3b1c59779
4 changed files with 62 additions and 0 deletions

View file

@ -59,6 +59,7 @@ export default defineEventHandler(async (event) => {
location: body.location || undefined,
circle: body.circle,
contributionAmount: body.contributionAmount,
billingCadence: body.contributionAmount === 0 ? 'monthly' : body.cadence,
bio: body.motivation || undefined,
status: body.contributionAmount === 0 ? 'active' : 'pending_payment',
helcimCustomerId: helcimCustomer?.id,

View file

@ -363,6 +363,7 @@ export const inviteAcceptSchema = z.object({
circle: z.enum(['community', 'founder', 'practitioner']),
motivation: z.string().max(5000).optional(),
contributionAmount: z.number().int().min(0),
cadence: z.enum(['monthly', 'annual']).default('monthly'),
agreedToGuidelines: z.literal(true),
token: z.string().min(1)
})