billing - prevent STRIPE customers deletion
MODIFY
src/integration/billing/stripe/StripeBillingIntegration.ts
src/integration/billing/stripe/StripeBillingIntegration.ts
@@ -1396,13 +1396,16 @@ export default class StripeBillingIntegration extends BillingIntegration {
}
public async deleteUser(user: User): Promise<void> {
+ if (FeatureToggles.isFeatureActive(Feature.BILLING_PREVENT_CUSTOMER_DELETION)) {
+ // To be on the SAFE side - we preserve the customer on the STRIPE side
+ return Promise.resolve();
+ }
// Check Stripe
await this.checkConnection();
// const customer = await this.getCustomerByEmail(user.email);
const customerID = user.billingData?.customerID;
const customer = await this.getStripeCustomer(customerID);
if (customer && customer.id) {
- // TODO - ro be clarified - is this allowed when the user has some invoices
await this.stripe.customers.del(
customer.id
);

MODIFY
src/utils/FeatureToggles.ts
src/utils/FeatureToggles.ts
@@ -7,6 +7,7 @@ export enum Feature {
BILLING_ITEM_WITH_PARKING_TIME,
BILLING_ITEM_WITH_START_DATE,
BILLING_CHECK_THRESHOLD_ON_STOP,
+ BILLING_PREVENT_CUSTOMER_DELETION,
}
export default class FeatureToggles {
@@ -18,6 +19,7 @@ export default class FeatureToggles {
// Feature.BILLING_ITEM_WITH_PARKING_TIME,
Feature.BILLING_ITEM_WITH_START_DATE,
Feature.BILLING_CHECK_THRESHOLD_ON_STOP,
+ Feature.BILLING_PREVENT_CUSTOMER_DELETION,
];
// Check whether the feature is active or not!

billing - prevent STRIPE customers deletion