Skip to content

Commit 47b5657

Browse files
authored
Merge pull request #363 from internxt/fix/suspend-instead-of-delete-os-account-on-sub-cancellation
[_]: fix/suspend-os-account-instead-of-deleting-it-on-sub-cancelled
2 parents d4899c8 + f6605ae commit 47b5657

3 files changed

Lines changed: 2 additions & 14 deletions

File tree

src/services/objectStorage.service.ts

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -47,18 +47,6 @@ export class ObjectStorageService {
4747
await this.axios.put(`${this.config.OBJECT_STORAGE_URL}/users/${payload.customerId}/deactivate`, {}, params);
4848
}
4949

50-
async deleteAccount(payload: { customerId: string }): Promise<void> {
51-
const jwt = signToken('5m', this.config.OBJECT_STORAGE_GATEWAY_SECRET);
52-
const params: AxiosRequestConfig = {
53-
headers: {
54-
'Content-Type': 'application/json',
55-
Authorization: `Bearer ${jwt}`,
56-
},
57-
};
58-
59-
await this.axios.delete(`${this.config.OBJECT_STORAGE_URL}/users/${payload.customerId}`, params);
60-
}
61-
6250
private async createUser(email: string, customerId: string): Promise<void> {
6351
const jwt = signToken('5m', this.config.OBJECT_STORAGE_GATEWAY_SECRET);
6452
const params: AxiosRequestConfig = {

src/webhooks/handleSubscriptionCanceled.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ async function handleObjectStorageSubscriptionCancelled(
3838

3939
logger.info(`Deleting object storage customer ${customer.id} with sub ${subscription.id}`);
4040

41-
await objectStorageService.deleteAccount({
41+
await objectStorageService.suspendAccount({
4242
customerId: customer.id,
4343
});
4444

src/webhooks/handleSubscriptionUpdated.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ async function handleObjectStorageScheduledForCancelation(
2222
): Promise<void> {
2323
logger.info(`Deleting object storage customer ${customer.id} with sub ${subscription.id}`);
2424

25-
await objectStorageService.deleteAccount({
25+
await objectStorageService.suspendAccount({
2626
customerId: customer.id,
2727
});
2828

0 commit comments

Comments
 (0)