fix(premiumGeoDB): inspect payment outcome on enable, mirror BAA flow

This commit is contained in:
Damodar Lohani committed 2026-07-16 07:47:38 +05:45
1 parent 6581c8ae8a
commit 74e69fc42b
1 file changed
+40 -2
@@ -39,12 +39,50 @@
region: page.params.region,
project: page.params.project
});
await confirmPayment({
const outcome = await confirmPayment({
clientSecret: paymentAuth.clientSecret,
paymentMethodId: $organization.paymentMethodId,
orgId: $organization.$id,
route: `${settingsUrl}?type=confirm-addon&addonId=${paymentAuth.addonId}`
route: `${settingsUrl}?type=confirm-addon&addonId=${paymentAuth.addonId}`,
redirectIfRequired: true
});
if (!outcome || outcome.status === 'error') {
if (outcome?.status === 'error') {
error = outcome.message;
}
return;
}
// 3DS challenge required — Stripe redirects; the settings onMount
// handler finalizes on return via ?type=confirm-addon.
if (outcome.status === 'requires_action') {
return;
}
await sdk.forConsoleIn(page.params.region).projects.confirmAddonPayment({
projectId: page.params.project,
addonId: paymentAuth.addonId
});
await Promise.all([
invalidate(Dependencies.ADDONS),
invalidate(Dependencies.PROJECT)
]);
if (outcome.status === 'processing') {
addNotification({
message:
"Premium Geo DB addon payment is processing — we'll activate it shortly.",
type: 'info'
});
} else {
addNotification({
message: 'Premium Geo DB addon has been enabled',
type: 'success'
});
}
show = false;
return;
}