fix: Stripe IDs and admin overrides
All checks were successful
Deploy to Staging / Build Images (push) Successful in 3m38s
Deploy to Staging / Deploy to Staging (push) Successful in 53s
Deploy to Staging / Verify Staging (push) Successful in 9s
Deploy to Staging / Notify Staging Ready (push) Successful in 8s
Deploy to Staging / Notify Staging Failure (push) Has been skipped

This commit is contained in:
Eric Gullickson
2026-02-15 21:26:38 -06:00
parent c1e8807bda
commit ddae397cb3
4 changed files with 61 additions and 16 deletions

View File

@@ -134,7 +134,8 @@ export class SubscriptionsController {
userId,
tier,
billingCycle,
paymentMethodId || ''
paymentMethodId || '',
email
);
reply.status(200).send(updatedSubscription);
@@ -207,6 +208,7 @@ export class SubscriptionsController {
): Promise<void> {
try {
const userId = (request as any).user.sub;
const email = (request as any).user.email;
const { paymentMethodId } = request.body;
// Validate input
@@ -218,19 +220,8 @@ export class SubscriptionsController {
return;
}
// Get subscription
const subscription = await this.service.getSubscription(userId);
if (!subscription) {
reply.status(404).send({
error: 'Subscription not found',
message: 'No subscription exists for this user',
});
return;
}
// Update payment method via Stripe
const stripeClient = new StripeClient();
await stripeClient.updatePaymentMethod(subscription.stripeCustomerId, paymentMethodId);
// Update payment method via service (handles admin_override_ customer IDs)
await this.service.updatePaymentMethod(userId, paymentMethodId, email);
reply.status(200).send({
message: 'Payment method updated successfully',