billing - inconsitency - better error handling
MODIFY
src/integration/billing/stripe/StripeBillingIntegration.ts
src/integration/billing/stripe/StripeBillingIntegration.ts
@@ -827,8 +827,18 @@ export default class StripeBillingIntegration extends BillingIntegration<StripeB
}
if (customerID) {
+ try {
const customer: Stripe.Customer = await this.stripe.customers.retrieve(customerID) as Stripe.Customer;
return customer;
+ } catch (error) {
+ throw new BackendError({
+ source: Constants.CENTRAL_SERVER,
+ module: MODULE_NAME, method: 'getStripeCustomer',
+ action: ServerAction.BILLING,
+ message: `Stripe Inconsistency: ${error.message as string}`,
+ detailedMessages: { error: error.message, stack: error.stack }
+ });
+ }
}
// No Customer in STRIPE DB so far!

MODIFY
test/api/BillingTest.ts
test/api/BillingTest.ts
@@ -261,7 +261,7 @@ describe('Billing Service', function() {
fakeUser
);
testData.createdUsers.push(fakeUser);
- fakeUser.billingData = { customerID: 'cus_test' }; // TODO - Updating billing data is not possible anymore - filterUserRequest prevents this to happen!!!
+ fakeUser.billingData = { customerID: 'cus_utbilling_fake_user' }; // TODO - Updating billing data is not possible anymore - filterUserRequest prevents this to happen!!!
await testData.userService.updateEntity(
testData.userService.userApi,
fakeUser

billing - inconsitency - better error handling