mirror of
https://github.com/appwrite/console.git
synced 2026-11-18 20:47:21 +00:00
feat: update methods
This commit is contained in:
1 parent
74a091edad
commit
42570c01d0
2 files changed
+27
-4
No files matched your search
+25
-2
@@ -530,14 +530,37 @@ export class Billing {
|
||||
params
|
||||
);
|
||||
}
|
||||
async updatePaymentMethod(
|
||||
|
||||
async setPaymentMethod(
|
||||
paymentMethodId: string,
|
||||
providerMethodId: string | PaymentMethod
|
||||
): Promise<PaymentMethodData> {
|
||||
const path = `/account/payment-methods/${paymentMethodId}/provider`;
|
||||
const params = {
|
||||
paymentMethodId,
|
||||
providerMethodId
|
||||
};
|
||||
const uri = new URL(this.client.config.endpoint + path);
|
||||
return await this.client.call(
|
||||
'patch',
|
||||
uri,
|
||||
{
|
||||
'content-type': 'application/json'
|
||||
},
|
||||
params
|
||||
);
|
||||
}
|
||||
|
||||
async updatePaymentMethod(
|
||||
paymentMethodId: string,
|
||||
expiryMonth: string,
|
||||
expiryYear: string
|
||||
): Promise<PaymentMethodData> {
|
||||
const path = `/account/payment-methods/${paymentMethodId}`;
|
||||
const params = {
|
||||
paymentMethodId,
|
||||
providerMethodId
|
||||
expiryMonth,
|
||||
expiryYear
|
||||
};
|
||||
const uri = new URL(this.client.config.endpoint + path);
|
||||
return await this.client.call(
|
||||
|
||||
@@ -81,7 +81,7 @@ export async function submitStripeCard(name?: string) {
|
||||
});
|
||||
|
||||
if (setupIntent && setupIntent.status === 'succeeded') {
|
||||
const method = await sdk.forConsole.billing.updatePaymentMethod(
|
||||
const method = await sdk.forConsole.billing.setPaymentMethod(
|
||||
paymentMethod.$id,
|
||||
setupIntent.payment_method
|
||||
);
|
||||
@@ -118,7 +118,7 @@ export async function updateStripeCard(selectedPaymentMethod?: string) {
|
||||
});
|
||||
|
||||
if (setupIntent && setupIntent.status === 'succeeded') {
|
||||
const method = await sdk.forConsole.billing.updatePaymentMethod(
|
||||
const method = await sdk.forConsole.billing.setPaymentMethod(
|
||||
paymentMethod.$id,
|
||||
setupIntent.payment_method
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user