mirror of
https://github.com/appwrite/console.git
synced 2026-06-06 19:27:48 +00:00
Validate invoice after retrying payment live
This commit is contained in:
@@ -19,7 +19,9 @@
|
||||
import RetryPaymentModal from './retryPaymentModal.svelte';
|
||||
import { selectedInvoice, showRetryModal } from './store';
|
||||
import { Button } from '$lib/elements/forms';
|
||||
import { goto } from '$app/navigation';
|
||||
import { goto, invalidate } from '$app/navigation';
|
||||
import { Dependencies } from '$lib/constants';
|
||||
import { base } from '$app/paths';
|
||||
|
||||
export let data;
|
||||
|
||||
@@ -50,10 +52,20 @@
|
||||
await confirmPayment(
|
||||
$organization.$id,
|
||||
invoice.clientSecret,
|
||||
$organization.paymentMethodId
|
||||
$organization.paymentMethodId,
|
||||
`${base}/organization-${$organization.$id}/billing?type=validate-invoice&invoice=${invoice.$id}`
|
||||
);
|
||||
}
|
||||
|
||||
if (
|
||||
$page.url.searchParams.has('type') &&
|
||||
$page.url.searchParams.get('type') === 'validate-invoice'
|
||||
) {
|
||||
const invoiceId = $page.url.searchParams.get('invoice');
|
||||
await sdk.forConsole.billing.validateInvoice($organization.$id, invoiceId);
|
||||
invalidate(Dependencies.INVOICES);
|
||||
}
|
||||
|
||||
if (
|
||||
$page.url.searchParams.has('invoice') &&
|
||||
$page.url.searchParams.get('type') === 'retry'
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
import { onMount } from 'svelte';
|
||||
import { getApiEndpoint, sdk } from '$lib/stores/sdk';
|
||||
import { formatCurrency } from '$lib/helpers/numbers';
|
||||
import { base } from '$app/paths';
|
||||
|
||||
export let show = false;
|
||||
export let invoice: Invoice;
|
||||
@@ -79,8 +80,12 @@
|
||||
await confirmPayment(
|
||||
$organization.$id,
|
||||
clientSecret,
|
||||
paymentMethodId ? paymentMethodId : $organization.paymentMethodId
|
||||
paymentMethodId ? paymentMethodId : $organization.paymentMethodId,
|
||||
`${base}/organization-${$organization.$id}/billing?type=validate-invoice&invoice=${invoice.$id}`
|
||||
);
|
||||
|
||||
await sdk.forConsole.billing.validateInvoice($organization.$id, invoice.$id);
|
||||
|
||||
invalidate(Dependencies.ORGANIZATION);
|
||||
invalidate(Dependencies.INVOICES);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user