From 0bff8bcd56a131122da4b8c0effcd60d467b985a Mon Sep 17 00:00:00 2001 From: Addison Beck Date: Tue, 8 Sep 2020 09:17:04 -0400 Subject: [PATCH] changed the way we load planResponse objects in organizationResponse objects (#167) --- src/models/response/organizationResponse.ts | 3 +- src/models/response/planResponse.ts | 78 ++++++++++----------- 2 files changed, 41 insertions(+), 40 deletions(-) diff --git a/src/models/response/organizationResponse.ts b/src/models/response/organizationResponse.ts index c54aee077c..466a2b3334 100644 --- a/src/models/response/organizationResponse.ts +++ b/src/models/response/organizationResponse.ts @@ -38,7 +38,8 @@ export class OrganizationResponse extends BaseResponse { this.businessCountry = this.getResponseProperty('BusinessCountry'); this.businessTaxNumber = this.getResponseProperty('BusinessTaxNumber'); this.billingEmail = this.getResponseProperty('BillingEmail'); - this.plan = this.getResponseProperty('Plan'); + const plan = this.getResponseProperty('Plan'); + this.plan = plan == null ? null : new PlanResponse(plan); this.planType = this.getResponseProperty('PlanType'); this.seats = this.getResponseProperty('Seats'); this.maxCollections = this.getResponseProperty('MaxCollections'); diff --git a/src/models/response/planResponse.ts b/src/models/response/planResponse.ts index 96b385da07..2cdd18acf0 100644 --- a/src/models/response/planResponse.ts +++ b/src/models/response/planResponse.ts @@ -50,44 +50,44 @@ export class PlanResponse extends BaseResponse { constructor(response: any) { super(response); - this.type = this.getResponseProperty('type'); - this.product = this.getResponseProperty('product'); - this.name = this.getResponseProperty('name'); - this.isAnnual = this.getResponseProperty('isAnnual'); - this.nameLocalizationKey = this.getResponseProperty('nameLocalizationKey'); - this.descriptionLocalizationKey = this.getResponseProperty('descriptionLocalizationKey'); - this.canBeUsedByBusiness = this.getResponseProperty('canBeUsedByBusiness'); - this.baseSeats = this.getResponseProperty('baseSeats'); - this.baseStorageGb = this.getResponseProperty('baseStorageGb'); - this.maxCollections = this.getResponseProperty('maxCollections'); - this.maxUsers = this.getResponseProperty('maxUsers'); - this.hasAdditionalSeatsOption = this.getResponseProperty('hasAdditionalSeatsOption'); - this.maxAdditionalSeats = this.getResponseProperty('maxAdditionalSeats'); - this.hasAdditionalStorageOption = this.getResponseProperty('hasAdditionalStorageOption'); - this.maxAdditionalStorage = this.getResponseProperty('maxAdditionalStorage'); - this.hasPremiumAccessOption = this.getResponseProperty('hasPremiumAccessOption'); - this.trialPeriodDays = this.getResponseProperty('trialPeriodDays'); - this.hasSelfHost = this.getResponseProperty('hasSelfHost'); - this.hasPolicies = this.getResponseProperty('hasPolicies'); - this.hasGroups = this.getResponseProperty('hasGroups'); - this.hasDirectory = this.getResponseProperty('hasDirectory'); - this.hasEvents = this.getResponseProperty('hasEvents'); - this.hasTotp = this.getResponseProperty('hasTotp'); - this.has2fa = this.getResponseProperty('has2fa'); - this.hasApi = this.getResponseProperty('hasApi'); - this.hasSso = this.getResponseProperty('hasSso'); - this.usersGetPremium = this.getResponseProperty('usersGetPremium'); - this.upgradeSortOrder = this.getResponseProperty('upgradeSortOrder'); - this.displaySortOrder = this.getResponseProperty('sortOrder'); - this.legacyYear = this.getResponseProperty('legacyYear'); - this.disabled = this.getResponseProperty('disabled'); - this.stripePlanId = this.getResponseProperty('stripePlanId'); - this.stripeSeatPlanId = this.getResponseProperty('stripeSeatPlanId'); - this.stripeStoragePlanId = this.getResponseProperty('stripeStoragePlanId'); - this.stripePremiumAccessPlanId = this.getResponseProperty('stripePremiumAccessPlanId'); - this.basePrice = this.getResponseProperty('basePrice'); - this.seatPrice = this.getResponseProperty('seatPrice'); - this.additionalStoragePricePerGb = this.getResponseProperty('additionalStoragePricePerGb'); - this.premiumAccessOptionPrice = this.getResponseProperty('premiumAccessOptionPrice'); + this.type = this.getResponseProperty('Type'); + this.product = this.getResponseProperty('Product'); + this.name = this.getResponseProperty('Name'); + this.isAnnual = this.getResponseProperty('IsAnnual'); + this.nameLocalizationKey = this.getResponseProperty('NameLocalizationKey'); + this.descriptionLocalizationKey = this.getResponseProperty('DescriptionLocalizationKey'); + this.canBeUsedByBusiness = this.getResponseProperty('CanBeUsedByBusiness'); + this.baseSeats = this.getResponseProperty('BaseSeats'); + this.baseStorageGb = this.getResponseProperty('BaseStorageGb'); + this.maxCollections = this.getResponseProperty('MaxCollections'); + this.maxUsers = this.getResponseProperty('MaxUsers'); + this.hasAdditionalSeatsOption = this.getResponseProperty('HasAdditionalSeatsOption'); + this.maxAdditionalSeats = this.getResponseProperty('MaxAdditionalSeats'); + this.hasAdditionalStorageOption = this.getResponseProperty('HasAdditionalStorageOption'); + this.maxAdditionalStorage = this.getResponseProperty('MaxAdditionalStorage'); + this.hasPremiumAccessOption = this.getResponseProperty('HasPremiumAccessOption'); + this.trialPeriodDays = this.getResponseProperty('TrialPeriodDays'); + this.hasSelfHost = this.getResponseProperty('HasSelfHost'); + this.hasPolicies = this.getResponseProperty('HasPolicies'); + this.hasGroups = this.getResponseProperty('HasGroups'); + this.hasDirectory = this.getResponseProperty('HasDirectory'); + this.hasEvents = this.getResponseProperty('HasEvents'); + this.hasTotp = this.getResponseProperty('HasTotp'); + this.has2fa = this.getResponseProperty('Has2fa'); + this.hasApi = this.getResponseProperty('HasApi'); + this.hasSso = this.getResponseProperty('HasSso'); + this.usersGetPremium = this.getResponseProperty('UsersGetPremium'); + this.upgradeSortOrder = this.getResponseProperty('UpgradeSortOrder'); + this.displaySortOrder = this.getResponseProperty('SortOrder'); + this.legacyYear = this.getResponseProperty('LegacyYear'); + this.disabled = this.getResponseProperty('Disabled'); + this.stripePlanId = this.getResponseProperty('StripePlanId'); + this.stripeSeatPlanId = this.getResponseProperty('StripeSeatPlanId'); + this.stripeStoragePlanId = this.getResponseProperty('StripeStoragePlanId'); + this.stripePremiumAccessPlanId = this.getResponseProperty('StripePremiumAccessPlanId'); + this.basePrice = this.getResponseProperty('BasePrice'); + this.seatPrice = this.getResponseProperty('SeatPrice'); + this.additionalStoragePricePerGb = this.getResponseProperty('AdditionalStoragePricePerGb'); + this.premiumAccessOptionPrice = this.getResponseProperty('PremiumAccessOptionPrice'); } }