fix: handle Caddy-proxied payment webhooks and method selection

This commit is contained in:
3252a8
2026-05-18 22:45:42 +03:00
parent 49cf5ebad8
commit e3643ee9a0
7 changed files with 56 additions and 7 deletions
+9 -2
View File
@@ -421,8 +421,15 @@
) {
billingStore.update((s) => ({ ...s, selectedPlan: selectedTariffPlans[0] || null }));
}
$: if (!$billingStore.selectedMethod && methods.length) {
billingStore.update((s) => ({ ...s, selectedMethod: methods[0].id }));
$: if (methods.length) {
const selectedMethodAvailable = methods.some(
(method) => method.id === $billingStore.selectedMethod
);
if (!$billingStore.selectedMethod || !selectedMethodAvailable) {
billingStore.update((s) => ({ ...s, selectedMethod: methods[0].id }));
}
} else if ($billingStore.selectedMethod) {
billingStore.update((s) => ({ ...s, selectedMethod: "" }));
}
$: {
const emailKey = normalizedEmail(user?.email);