Rev 686 | Rev 689 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 686 | Rev 688 | ||
|---|---|---|---|
| Line 584... | Line 584... | ||
| 584 | }
|
584 | }
|
| 585 | 585 | ||
| 586 | public void prepararPagamentoComCupom() { |
586 | public void prepararPagamentoComCupom() { |
| 587 | prepararPagamento(); |
587 | prepararPagamento(); |
| 588 | setCupomSelecionado(new Cupom()); |
588 | setCupomSelecionado(new Cupom()); |
| - | 589 | }
|
|
| - | 590 | ||
| - | 591 | public void prepararPagamentoComCashback() { |
|
| - | 592 | limparPagamento(); |
|
| - | 593 | Double subtotalPago = getParametrosVenda().valorTotalLancamentos() - getParametrosVenda().valorTotalPago(); |
|
| - | 594 | Double subtotal = getParametrosVenda().getCliente().getValorCashbackDisponivel(); |
|
| - | 595 | if (subtotal > 0) { |
|
| - | 596 | if (subtotal > subtotalPago) { |
|
| - | 597 | setValorPagamento(subtotalPago); |
|
| - | 598 | } else { |
|
| - | 599 | setValorPagamento(subtotal); |
|
| - | 600 | }
|
|
| - | 601 | }
|
|
| 589 | }
|
602 | }
|
| 590 | 603 | ||
| 591 | public void adicionarPagamentoEmDinheiro() { |
604 | public void adicionarPagamentoEmDinheiro() { |
| 592 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
605 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
| 593 | public void execute() { |
606 | public void execute() { |
| Line 665... | Line 678... | ||
| 665 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
678 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
| 666 | public void execute() { |
679 | public void execute() { |
| 667 | FormaPagamento formaPagamento = formaPagamentoService.consultarPorId(new FormaPagamento(ConstantesSEC.FormasDePagamento.FORMAPAGAMENTO_CASHBACK_28)); |
680 | FormaPagamento formaPagamento = formaPagamentoService.consultarPorId(new FormaPagamento(ConstantesSEC.FormasDePagamento.FORMAPAGAMENTO_CASHBACK_28)); |
| 668 | VendaFormaPagamento vendaFormaPagamento = new VendaFormaPagamento(getEntidade(), formaPagamento); |
681 | VendaFormaPagamento vendaFormaPagamento = new VendaFormaPagamento(getEntidade(), formaPagamento); |
| 669 | vendaFormaPagamento.setValorPagamento(getValorPagamento()); |
682 | vendaFormaPagamento.setValorPagamento(getValorPagamento()); |
| 670 | retirarCashbackCliente(getEntidade().getCliente(), getValorPagamento()); |
- | |
| - | 683 | retirarCashbackCliente(getValorPagamento()); |
|
| 671 | adicionarPagamento(vendaFormaPagamento); |
684 | adicionarPagamento(vendaFormaPagamento); |
| 672 | }
|
685 | }
|
| 673 | 686 | ||
| 674 | private void retirarCashbackCliente(Cliente cliente, Double valor) { |
- | |
| 675 | // cashbackService.utilizarCashback(cliente, valor);
|
- | |
| - | 687 | private void retirarCashbackCliente(Double valor) { |
|
| - | 688 | getParametrosVenda().getCliente().setValorCashbackDisponivel(getParametrosVenda().getCliente().getValorCashbackDisponivel() - valor); |
|
| 676 | }
|
689 | }
|
| 677 | }); |
690 | }); |
| 678 | }
|
691 | }
|
| 679 | 692 | ||
| 680 | public void adicionarPagamento(final VendaFormaPagamento vendaFormaPagamento) { |
693 | public void adicionarPagamento(final VendaFormaPagamento vendaFormaPagamento) { |