Billing - user.billingData - liveMode property added
MODIFY
src/integration/billing/stripe/StripeBillingIntegration.ts
src/integration/billing/stripe/StripeBillingIntegration.ts
@@ -1107,6 +1107,7 @@ export default class StripeBillingIntegration extends BillingIntegration<StripeB
// Let's populate the initial Billing Data of our new customer
const billingData: BillingUserData = {
customerID: customer.id,
+ liveMode: customer.livemode, // true when using a productive STRIPE account
lastChangedOn: new Date(),
hasSynchroError: false,
invoicesLastSynchronizedOn: null

MODIFY
src/storage/mongodb/UserStorage.ts
src/storage/mongodb/UserStorage.ts
@@ -489,6 +489,7 @@ export default class UserStorage {
const updatedUserMDB: any = {
billingData: {
customerID: billingData.customerID,
+ liveMode: Utils.convertToBoolean(billingData.liveMode),
hasSynchroError: billingData.hasSynchroError,
invoicesLastSynchronizedOn: Utils.convertToDate(billingData.invoicesLastSynchronizedOn),
lastChangedOn: Utils.convertToDate(billingData.lastChangedOn),

MODIFY
src/types/Billing.ts
src/types/Billing.ts
@@ -38,8 +38,9 @@ export interface BillingDataTransactionStop {
}
export interface BillingUserData {
- customerID?: string;
- lastChangedOn?: Date;
+ customerID: string;
+ liveMode: boolean;
+ lastChangedOn: Date;
hasSynchroError?: boolean;
invoicesLastSynchronizedOn?: Date;
}

MODIFY
test/api/BillingTest.ts
test/api/BillingTest.ts
@@ -312,7 +312,11 @@ describe('Billing Service', function() {
fakeUser
);
testData.createdUsers.push(fakeUser);
- fakeUser.billingData = { customerID: 'cus_utbilling_fake_user' }; // TODO - not supported anymore
+ fakeUser.billingData = {
+ customerID: 'cus_utbilling_fake_user',
+ liveMode: false,
+ lastChangedOn: new Date(),
+ }; // TODO - not supported anymore
await testData.userService.updateEntity(
testData.userService.userApi,
fakeUser

Billing - user.billingData - liveMode property added