feat: update methods

This commit is contained in:
Arman committed 2023-08-02 16:53:15 +02:00
1 parent 74a091edad
commit 42570c01d0
2 files changed
+27 -4

No files matched your search

+25 -2
View File
@@ -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(
+2 -2
View File
@@ -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
);