public static void addSubscriptionInfo(SubscriptionInfoBean subscriptionInfoBean,
UserRegistry userRegistry) throws Exception {
BillingEngine billingEngine = billingManager.getBillingEngine(StratosConstants.MULTITENANCY_SCHEDULED_TASK_ID);
Customer customer = getCurrentCustomer(userRegistry);
// if customer doesn't exist, we are making a one
if (customer == null) {
int currentTenantId = userRegistry.getTenantId();
TenantManager tenantManger = getRealmService().getTenantManager();
Tenant currentTenant = (Tenant) tenantManger.getTenant(currentTenantId);
if (currentTenant == null || currentTenant.getDomain() == null) {
String msg = "Error in getting the customer information.";
throw new Exception(msg);
}
customer = new Customer();
customer.setName(currentTenant.getDomain());
customer.setEmail(currentTenant.getEmail());
customer.setStartedDate(new Date());
billingEngine.addCustomer(customer);
}
String itemName = subscriptionInfoBean.getPackageName();