feat(internal-admin): refund + generalize subscription extend #30
Reference in New Issue
Block a user
Delete Branch "dev"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Phase E. Stripe refund endpoint + extendTrial generalized to active subscriptions.
Refund (Stripe API) - StripeService.refundPayment({ paymentId, amount?, reason, founderId }) is a new public method that wraps stripe.refunds.create: * Requires the payment to have a stripePaymentIntentId (post-Iyzico). * Refuses payments not in completed/partially_refunded status. * Partial refund: amount must be in 1..payment.amount (kuruş). * Sends panel_* metadata to Stripe for the founder/reason audit trail. * Flips payments.status to refunded / partially_refunded. * Appends a dated reason line to payments.admin_note. * Captures a `payment_refunded` PostHog event (via:'super_panel'). * Does NOT cancel the subscription — that's a separate decision. - New endpoint POST /internal/admin/payments/:id/refund behind the InternalTokenGuard, body { amount?, reason, founderId }. - Wired through PaymentsAdminController in InternalAdminModule; StripeModule imported. Extend (goodwill / bonus time) - BillingService.extendTrial now accepts both trial AND active subscriptions (was trial-only). Same end-date semantics (base = max(now, current endDate)). Response now also returns subscriptionStatus so the panel can surface the right copy. - Endpoint URL kept as /trial/extend for backward compatibility; the panel decides the user-facing label ("Trial uzat" vs "Bonus süre ekle / Goodwill") based on current status. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>