mirror of
https://github.com/appwrite/console.git
synced 2026-06-06 19:27:48 +00:00
Add payment mandate setup and check for missing mandate
This commit is contained in:
@@ -18,6 +18,7 @@ export type PaymentMethodData = {
|
||||
clientSecret: string;
|
||||
failed: boolean;
|
||||
name: string;
|
||||
mandateId?: string;
|
||||
};
|
||||
|
||||
export type PaymentList = {
|
||||
@@ -849,6 +850,26 @@ export class Billing {
|
||||
);
|
||||
}
|
||||
|
||||
async setupPaymentMandate(
|
||||
organizationId: string,
|
||||
paymentMethodId: string
|
||||
): Promise<PaymentMethodData> {
|
||||
const path = `/account/payment-methods/${paymentMethodId}/setup`;
|
||||
const params = {
|
||||
organizationId,
|
||||
paymentMethodId
|
||||
};
|
||||
const uri = new URL(this.client.config.endpoint + path);
|
||||
return await this.client.call(
|
||||
'post',
|
||||
uri,
|
||||
{
|
||||
'content-type': 'application/json'
|
||||
},
|
||||
params
|
||||
);
|
||||
}
|
||||
|
||||
async listAddresses(queries: Query[] = []): Promise<AddressesList> {
|
||||
const path = `/account/billing-addresses`;
|
||||
const params = {
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
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
|
||||
@@ -248,6 +249,13 @@
|
||||
}
|
||||
});
|
||||
|
||||
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);
|
||||
|
||||
Reference in New Issue
Block a user