diff --git a/src/lib/components/billing/alerts/paymentMandate.svelte b/src/lib/components/billing/alerts/paymentMandate.svelte
new file mode 100644
index 000000000..d8819b492
--- /dev/null
+++ b/src/lib/components/billing/alerts/paymentMandate.svelte
@@ -0,0 +1,29 @@
+
+
+{#if $actionRequiredInvoices && $actionRequiredInvoices?.invoices?.length && !$page.url.pathname.includes('/console/account')}
+
+ Please authorize your upcoming payment for {$organization.name}. Your bank requires this
+ security measure to proceed with payment.
+
+
+
+
+
+{/if}
diff --git a/src/lib/stores/billing.ts b/src/lib/stores/billing.ts
index 22b873828..3a20511ac 100644
--- a/src/lib/stores/billing.ts
+++ b/src/lib/stores/billing.ts
@@ -261,7 +261,15 @@ export function checkForMarkedForDeletion(org: Organization) {
id: 'markedForDeletion',
component: MarkedForDeletion,
show: true,
- importance: 5
+ importance: 10
});
}
}
+
+export async function checkForMandate(org: Organization) {
+ const paymentId = org.paymentMethodId ?? org.backupPaymentMethodId;
+ const paymentMethod = await sdk.forConsole.billing.getPaymentMethod(paymentId);
+ if (paymentMethod.mandateId === null && paymentMethod.country === 'in') {
+ const method = sdk.forConsole.billing.setupPaymentMandate(org.$id, paymentId);
+ }
+}
diff --git a/src/routes/console/+layout.svelte b/src/routes/console/+layout.svelte
index 8cd889e91..77e091d61 100644
--- a/src/routes/console/+layout.svelte
+++ b/src/routes/console/+layout.svelte
@@ -19,7 +19,8 @@
checkPaymentAuthorizationRequired,
calculateTrialDay,
paymentExpired,
- checkForMarkedForDeletion
+ checkForMarkedForDeletion,
+ checkForMandate
} from '$lib/stores/billing';
import { goto } from '$app/navigation';
import { CommandCenter, registerCommands, registerSearchers } from '$lib/commandCenter';
@@ -40,7 +41,6 @@
import UsageRates from './wizard/cloudOrganization/usageRates.svelte';
import { activeHeaderAlert, consoleVariables } from './store';
import { headerAlert } from '$lib/stores/headerAlert';
- import { sdk } from '$lib/stores/sdk';
function kebabToSentenceCase(str: string) {
return str
@@ -249,13 +249,6 @@
}
});
- async function checkForMandate() {
- const paymentMethods = await sdk.forConsole.billing.listPaymentMethods();
- const missingMandate = paymentMethods.paymentMethods.filter(
- (method) => method.mandateId === null && method.country === 'in'
- );
- }
-
function checkForFeedback(interval: number) {
const minutes = interval / 60000;
feedback.increaseElapsed(minutes);
@@ -277,6 +270,7 @@
await checkForUsageLimit(org);
checkForMarkedForDeletion(org);
await checkPaymentAuthorizationRequired(org);
+ await checkForMandate(org);
}
});