* Método responsável por gerar boleto de pagamento.
* @param order O pedido ao qual será gerado o pedido.
*/
public void generateBoleto(Order order) {
logger.info("Gerando boleto do pedido...");
JBoletoBean boletoBean = new JBoletoBean();
SimpleDateFormat df = new SimpleDateFormat("dd/MM/yyyy");
boletoBean.setDataProcessamento(df.format(new Date()));
Vector<String> descricoes = new Vector<String>();
double valorBoleto = 0.0d;
for (ItemsOrder itemsOrder : order.getItemsOrders()) {
descricoes.add(itemsOrder.getProduct().getName());
valorBoleto += itemsOrder.getPrice();
}
descricoes.add("Produtos:");
descricoes.add("Código do pedido: " + order.getId());
descricoes.add("Boleto referente a compras no site BuyFast");
boletoBean.setDescricoes(descricoes);
boletoBean.setLocalPagamento("ATE O VENCIMENTO, PREFERENCIALMENTE " + order.getBank().getBank().toUpperCase());
boletoBean.setLocalPagamento2("APOS O VENCIMENTO, SOMENTE NO " + order.getBank().getBank().toUpperCase());
boletoBean.setInstrucao1("APOS O VENCIMENTO COBRAR MULTA DE 2%");
boletoBean.setInstrucao2("APOS O VENCIMENTO, COBRAR MULTA DE R$ 0.50 AO DIA");
boletoBean.setInstrucao3("APOS O VENCIMENTO NÃO APLICAR DESCONTO");
boletoBean.setInstrucao4("APOS O VENCIMENTO COBRAR R$ 1.50 DE TAXA DE OPERAÇÃO");
boletoBean.setInstrucao5("ANTES DO VENCIMENTO APLICAR DESCONTO DE 5%");
boletoBean.setNomeSacado(order.getCustomer().getName());
boletoBean.setEnderecoSacado(order.getCustomer().getAddress().getStreet());
boletoBean.setBairroSacado(order.getCustomer().getAddress().getDistrict());
boletoBean.setCidadeSacado(order.getCustomer().getAddress().getCity());
boletoBean.setUfSacado(order.getCustomer().getAddress().getState());
boletoBean.setCepSacado(order.getCustomer().getAddress().getCep());
boletoBean.setCpfSacado(order.getCustomer().getCpf());
Calendar calendar = Calendar.getInstance();
calendar.setTime(new Date());
calendar.add(Calendar.DATE, 7);
boletoBean.setDataVencimento(df.format(calendar.getTime()));
boletoBean.setValorBoleto(Double.valueOf(valorBoleto).toString());
boletoBean.setDataDocumento(df.format(new Date()));
generate(boletoBean, order.getBank());
}