Examples of OutstandingBalanceInfoBean


Examples of org.wso2.carbon.billing.core.beans.OutstandingBalanceInfoBean

            customers.add(preferredCustomer);
        }else{
            customers = getAllCustomers();
        }
        for(Customer customer : customers){
            OutstandingBalanceInfoBean balanceBean = new OutstandingBalanceInfoBean();
            balanceBean.setCustomerName(customer.getName());
            Invoice invoice = getLastInvoice(customer);
            if(invoice!=null){
                balanceBean.setCarriedForward(invoice.getCarriedForward().toString());
                balanceBean.setLastInvoiceDate(invoice.getDate());
                List<Subscription> subscriptions = getInvoiceSubscriptions(invoice.getId());
                if(subscriptions!=null && subscriptions.size()>0){
                    balanceBean.setSubscription(subscriptions.get(0).getSubscriptionPlan());
                }
            }else{ //if we dont have an invoice we have to look for the active subscription to get the subscription plan
                Subscription subscription = getActiveSubscriptionOfCustomer(customer.getId());
                if(subscription!=null){
                    balanceBean.setSubscription(subscription.getSubscriptionPlan());
                }else{
                    balanceBean.setSubscription("Not Available");
                }
            }

            Payment payment = getLastPayment(customer);
            if(payment!=null){
                balanceBean.setLastPaidAmount(payment.getAmount().toString());
                balanceBean.setLastPaymentDate(payment.getDate());
            }
            outstandingBalances.add(balanceBean);
        }
        return outstandingBalances;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.