throw new Exception(msg);
}
List<MultitenancyPackage> multitenancyPackages = mtBillingInfo.getMultitenancyPackages();
Subscription subscription = getCurrentSubscription(userRegistry);
Item currentPackage;
if (subscription == null) {
// so the active until is gone, hence i'm marking it as inactive
currentPackage = null;
} else {
currentPackage = subscription.getItem();
}
List<PackageInfoBean> packageInfoBeans = new ArrayList<PackageInfoBean>();
for (MultitenancyPackage multitenancyPackage: multitenancyPackages) {
PackageInfoBean packageInfoBean = new PackageInfoBean();
packageInfoBean.setName(multitenancyPackage.getName());
if (multitenancyPackage.getName().toLowerCase().contains("free") &&
currentPackage == null) {
packageInfoBean.setCurrentPackage(true);
}
else if (currentPackage != null &&
multitenancyPackage.getName().equals(currentPackage.getName())) {
packageInfoBean.setCurrentPackage(true);
}
packageInfoBean.setSubscriptionPerUserFee(multitenancyPackage.getChargePerUser().serializeToString());
packageInfoBean.setBandwidthLimit(multitenancyPackage.getBandwidthLimit());
packageInfoBean.setOveruseCharge(multitenancyPackage.getBandwidthOveruseCharge().serializeToString());