Subversion Repositories SmartDukaan

Rev

Rev 20961 | Blame | Compare with Previous | Last modification | View Log | RSS feed

package com.providers.logistics;

import in.shop2020.model.v1.order.Order;

import java.util.List;

public class ShipmentInfo {
        private double totalWeightInKg=0;
        private double totalAmount=0;
        private double netPayable=0;
        private double shippingCharges=0;

        private double totalShippingAmount=0;
        private  int totalPcs = 0;
        private Order order;
        private boolean cashOnDelivery=false;

        public ShipmentInfo(List<Order> orders) {
                for(Order o : orders) {
                        this.totalAmount += o.getTotal_amount();
                        this.totalWeightInKg += o.getTotal_weight();
                        this.netPayable += o.getNet_payable_amount();
                        this.shippingCharges += o.getShippingCost();
                        this.totalPcs += o.getLineitems().get(0).getQuantity();
                }
                this.order = orders.get(0);
                determineCod();

        }

        private void determineCod(){
                if (order.isCod() && netPayable > 0){
                        cashOnDelivery = true;
                }
        }

        public double getTotalWeightInKg() {
                return totalWeightInKg;
        }

        public double getTotalAmount() {
                return totalAmount;
        }

        public double getTotalShippingAmount() {
                return totalShippingAmount;
        }

        public int getTotalPcs() {
                return totalPcs;
        }

        public Order getOrder() {
                return order;
        }

        public double getNetPayable() {
                return netPayable;
        }

        public void setNetPayable(double netPayable) {
                this.netPayable = netPayable;
        }

        public boolean isCashOnDelivery() {
                return cashOnDelivery;
        }

}