diff --git a/src/services/objectStorage.service.ts b/src/services/objectStorage.service.ts index f1517cde..07461515 100644 --- a/src/services/objectStorage.service.ts +++ b/src/services/objectStorage.service.ts @@ -47,18 +47,6 @@ export class ObjectStorageService { await this.axios.put(`${this.config.OBJECT_STORAGE_URL}/users/${payload.customerId}/deactivate`, {}, params); } - async deleteAccount(payload: { customerId: string }): Promise { - const jwt = signToken('5m', this.config.OBJECT_STORAGE_GATEWAY_SECRET); - const params: AxiosRequestConfig = { - headers: { - 'Content-Type': 'application/json', - Authorization: `Bearer ${jwt}`, - }, - }; - - await this.axios.delete(`${this.config.OBJECT_STORAGE_URL}/users/${payload.customerId}`, params); - } - private async createUser(email: string, customerId: string): Promise { const jwt = signToken('5m', this.config.OBJECT_STORAGE_GATEWAY_SECRET); const params: AxiosRequestConfig = { diff --git a/src/webhooks/handleSubscriptionCanceled.ts b/src/webhooks/handleSubscriptionCanceled.ts index 56a27986..e2e16215 100644 --- a/src/webhooks/handleSubscriptionCanceled.ts +++ b/src/webhooks/handleSubscriptionCanceled.ts @@ -38,7 +38,7 @@ async function handleObjectStorageSubscriptionCancelled( logger.info(`Deleting object storage customer ${customer.id} with sub ${subscription.id}`); - await objectStorageService.deleteAccount({ + await objectStorageService.suspendAccount({ customerId: customer.id, }); diff --git a/src/webhooks/handleSubscriptionUpdated.ts b/src/webhooks/handleSubscriptionUpdated.ts index 2e02787d..e042ed25 100644 --- a/src/webhooks/handleSubscriptionUpdated.ts +++ b/src/webhooks/handleSubscriptionUpdated.ts @@ -22,7 +22,7 @@ async function handleObjectStorageScheduledForCancelation( ): Promise { logger.info(`Deleting object storage customer ${customer.id} with sub ${subscription.id}`); - await objectStorageService.deleteAccount({ + await objectStorageService.suspendAccount({ customerId: customer.id, });