Package org.broadleafcommerce.core.order.domain

Examples of org.broadleafcommerce.core.order.domain.TaxDetail


                // Set taxes on the fulfillment group items
                for (FulfillmentGroupItem fgItem : fulfillmentGroup.getFulfillmentGroupItems()) {
                    if (isItemTaxable(fgItem)) {
                        BigDecimal factor = determineItemTaxRate(fulfillmentGroup.getAddress());
                        if (factor != null && factor.compareTo(BigDecimal.ZERO) != 0) {
                            TaxDetail tax;
                            checkDetail: {
                                for (TaxDetail detail : fgItem.getTaxes()) {
                                    if (detail.getType().equals(TaxType.COMBINED)) {
                                        tax = detail;
                                        break checkDetail;
                                    }
                                }
                                tax = entityConfig.createEntityInstance(TaxDetail.class.getName(), TaxDetail.class);
                                tax.setType(TaxType.COMBINED);
                                fgItem.getTaxes().add(tax);
                            }
                            tax.setRate(factor);
                            tax.setAmount(fgItem.getTotalItemTaxableAmount().multiply(factor));
                        }
                    }
                }
   
                for (FulfillmentGroupFee fgFee : fulfillmentGroup.getFulfillmentGroupFees()) {
                    if (isFeeTaxable(fgFee)) {
                        BigDecimal factor = determineItemTaxRate(fulfillmentGroup.getAddress());
                        if (factor != null && factor.compareTo(BigDecimal.ZERO) != 0) {
                            TaxDetail tax;
                            checkDetail: {
                                for (TaxDetail detail : fgFee.getTaxes()) {
                                    if (detail.getType().equals(TaxType.COMBINED)) {
                                        tax = detail;
                                        break checkDetail;
                                    }
                                }
                                tax = entityConfig.createEntityInstance(TaxDetail.class.getName(), TaxDetail.class);
                                tax.setType(TaxType.COMBINED);
                                fgFee.getTaxes().add(tax);
                            }
                            tax.setRate(factor);
                            tax.setAmount(fgFee.getAmount().multiply(factor));
                        }
                    }
                }
   
                BigDecimal factor = determineTaxRateForFulfillmentGroup(fulfillmentGroup);
                if (factor != null && factor.compareTo(BigDecimal.ZERO) != 0) {
                    TaxDetail tax;
                    checkDetail: {
                        for (TaxDetail detail : fulfillmentGroup.getTaxes()) {
                            if (detail.getType().equals(TaxType.COMBINED)) {
                                tax = detail;
                                break checkDetail;
                            }
                        }
                        tax = entityConfig.createEntityInstance(TaxDetail.class.getName(), TaxDetail.class);
                        tax.setType(TaxType.COMBINED);
                        fulfillmentGroup.getTaxes().add(tax);
                    }
                    tax.setRate(factor);
                    tax.setAmount(fulfillmentGroup.getFulfillmentPrice().multiply(factor));
                }
            }
        }

        return order;
View Full Code Here

TOP

Related Classes of org.broadleafcommerce.core.order.domain.TaxDetail

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.