class CheckoutServiceFacadeImpl implements CheckoutServiceFacade {

    @Override
    public PriceModel getOrderDeliveryTotalSub(final CustomerOrder customerOrder, final CustomerOrderDelivery delivery, final ShoppingCart cart) {

        final Total grandTotal = getOrderDeliveryTotal(customerOrder, delivery);

        final boolean hasTax = MoneyUtils.isPositive(grandTotal.getSubTotalTax());

        final boolean showTax = hasTax && cart.getShoppingContext().isTaxInfoEnabled();
        final boolean showTaxNet = showTax && cart.getShoppingContext().isTaxInfoUseNet();
        final boolean showTaxAmount = showTax && cart.getShoppingContext().isTaxInfoShowAmount();

        if (showTax) {

            final String firstTaxCode = delivery.getTaxCode();

            final BigDecimal netAmount = grandTotal.getSubTotalAmount().subtract(grandTotal.getSubTotalTax());
            final BigDecimal taxPercent = grandTotal.getSubTotalTax().divide(netAmount, Constants.TAX_SCALE, BigDecimal.ROUND_FLOOR);
            final BigDecimal taxRate = taxPercent.multiply(MoneyUtils.HUNDRED).setScale(Constants.MONEY_SCALE, BigDecimal.ROUND_HALF_UP);

            final boolean priceTaxExclusive = MoneyUtils.isFirstBiggerThanSecond(grandTotal.getSubTotalAmount(), grandTotal.getSubTotal());

            // no discounts on sub total
            return new PriceModelImpl(
                    DELIVERY_TOTAL_REF,
                    customerOrder.getCurrency(),
                    BigDecimal.ONE,
                    false,
                    false,
                    showTaxNet ? grandTotal.getSubTotalAmount().subtract(grandTotal.getSubTotalTax()) : grandTotal.getSubTotalAmount(),
                    null,
                    showTax, showTaxNet, showTaxAmount,
                    firstTaxCode,
                    taxRate,
                    priceTaxExclusive,
                    grandTotal.getSubTotalTax()
            );

        }

        // no discounts on sub total
        return new PriceModelImpl(
                DELIVERY_TOTAL_REF,
                customerOrder.getCurrency(),
                BigDecimal.ONE,
                false,
                false,
                grandTotal.getSubTotal(),
                null
        );

    }

    public  CheckoutServiceFacadeImpl(final CustomerOrderService customerOrderService,
                                     final AmountCalculationStrategy amountCalculationStrategy,
                                     final DeliveryTimeEstimationVisitor deliveryTimeEstimationVisitor,
                                     final CustomerOrderPaymentService customerOrderPaymentService,
                                     final CarrierSlaService carrierSlaService,
                                     final PaymentProcessorFactory paymentProcessorFactory,
                                     final PaymentModulesManager paymentModulesManager,
                                     final ReportGenerator reportGenerator);

}