/** * Esse método recupera o objeto {@link Transaction} e já geraComissao os valores do carrinho. * * @return A instância de {@link Transaction} */ public Transaction getTransaction() { Double discountAmount = 0.0; Double weight = 0.0; Double shippingAmount = 0.0; for (final Iterator<Product> productIterator = getProductIterator(); productIterator.hasNext(); ) { final Product product = productIterator.next(); discountAmount += product.getDiscount(); weight += product.getWeight(); shippingAmount += product.getShipping(); } transaction.setDiscountAmount(discountAmount); transaction.setWeight(weight); transaction.setShippingAmount(shippingAmount); return transaction; }