Package org.wso2.carbon.billing.core.dataobjects

Examples of org.wso2.carbon.billing.core.dataobjects.Item


        return subscriptions;
    }

    private Item getItem(int itemId) throws BillingException {
        DataAccessObject dataAccessObject = BillingManager.getInstance().getDataAccessObject();
        Item item = null;
        boolean succeeded = false;
        try {
            dataAccessObject.beginTransaction();
            item = dataAccessObject.getItem(itemId);
            succeeded = true;
View Full Code Here


                        correctCustomer = getCustomer(customerId);
                        customersCash.put(customerId, correctCustomer);
                    }
                    subscription.setCustomer(correctCustomer);

                    Item dummyItem = subscription.getItem();
                    Item correctItem = getItem(dummyItem.getId());
                    subscription.setItem(correctItem);
                }
                //succeeded = true; //i think it is wrong to place this boolean here. If there are no subscriptions
                                    //this makes the transaction to rollback and hence failing to show the invoice
            }
View Full Code Here

            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());
View Full Code Here

                getItemsWithName(itemName);
        if (items == null || items.size() == 0) {
            String msg = "Invalid item name: " + itemName + ".";
            throw new Exception(msg);
        }
        Item item = items.get(0);

        // adding the subscription
        Subscription subscription = new Subscription();
        subscription.setItem(item);
        subscription.setCustomer(customer);
View Full Code Here

        if (subscription.getActiveUntil().getTime() <= System.currentTimeMillis()) {
            return null;
        }
        int itemId = subscription.getItem().getId();
        // fill with a correct item
        Item item =  billingEngine.getItem(itemId);
        subscription.setItem(item);
        return subscription;
    }
View Full Code Here

        if (subscription.getActiveUntil().getTime() <= System.currentTimeMillis()) {
            return null;
        }
        int itemId = subscription.getItem().getId();
        // fill with a correct item
        Item item;
        try {
            item = billingEngine.getItem(itemId);
        } catch (BillingException e) {
            String msg = "Error in getting the item for item id: " + itemId + ".";
            log.error(msg, e);
View Full Code Here

            log.error(msg);
            throw new RegistryException(msg);
        }
        List<MultitenancyPackage> multitenancyPackages = mtBillingInfo.getMultitenancyPackages();
        Subscription subscription = getCurrentSubscription(tenantId);
        Item currentPackage;
        if (subscription == null) {
            currentPackage = null;
        } else {
            currentPackage = subscription.getItem();
        }
        MultitenancyPackage currentMultitenancyPackage = null;
        for (MultitenancyPackage multitenancyPackage : multitenancyPackages) {
            if (multitenancyPackage.getName().toLowerCase().contains("free") &&
                currentPackage == null) {
                currentMultitenancyPackage = multitenancyPackage;
                break;
            } else if (currentPackage != null &&
                       multitenancyPackage.getName().equals(currentPackage.getName())) {
                currentMultitenancyPackage = multitenancyPackage;
                break;
            }
        }
        return currentMultitenancyPackage;
View Full Code Here

        customer.setId(tenantBean.getTenantId());
        Subscription subscription=new Subscription();
        subscription.setCustomer(customer);
        subscription.setActive(false);
        subscription.setActiveSince(Calendar.getInstance().getTime());
        Item item=new Item();
        subscription.setItem(item);
        String planName=tenantBean.getUsagePlan();
        subscription.setSubscriptionPlan(planName);
        int subscriptionId = 0;
        try {
View Full Code Here

        if (subscription.getActiveUntil().getTime() <= System.currentTimeMillis()) {
            return null;
        }
        int itemId = subscription.getItem().getId();
        // fill with a correct item
        Item item;
        try {
            item = billingEngine.getItem(itemId);
        } catch (BillingException e) {
            String msg = "Error in getting the item for item id: " + itemId + ".";
            log.error(msg, e);
View Full Code Here

            log.error(msg);
            throw new RegistryException(msg);
        }
        List<MultitenancyPackage> multitenancyPackages = mtBillingInfo.getMultitenancyPackages();
        Subscription subscription = getCurrentSubscription(tenantId);
        Item currentPackage;
        if (subscription == null) {
            currentPackage = null;
        } else {
            currentPackage = subscription.getItem();
        }
        MultitenancyPackage currentMultitenancyPackage = null;
        for (MultitenancyPackage multitenancyPackage : multitenancyPackages) {
            if (multitenancyPackage.getName().toLowerCase().contains("free") &&
                    currentPackage == null) {
                currentMultitenancyPackage = multitenancyPackage;
                break;
            } else if (currentPackage != null &&
                    multitenancyPackage.getName().equals(currentPackage.getName())) {
                currentMultitenancyPackage = multitenancyPackage;
                break;
            }
        }
        return currentMultitenancyPackage;
View Full Code Here

TOP

Related Classes of org.wso2.carbon.billing.core.dataobjects.Item

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.