public void Comprar(Carrinho carrinho, DetalhesPagamento detalhesPagamento, bool deveNotificarCliente)
    {
        if(detalhesPagamento.FormaPagamento == FormasPagamento.CARTAOCREDITO)
            _processador.Processar(detalhesDoPagamento, carrinho);

        _reservador.ReservarEstoque(carrinho);

        if(deveNotificarCliente)
            _notificador.NotificarCliente(carrinho);
    }
    public void Comprar(Carrinho carrinho, DetalhesPagamento detalhesPagamento, bool deveNotificarCliente)
    {
        if(detalhesPagamento.FormaPagamento == FormasPagamento.CARTAOCREDITO)
            CobrarCartao(detalhesDoPagamento, carrinho);

        ReservarEstoque(carrinho);

        if(deveNotificarCliente)
            NotificarCliente(carrinho);
    }
    private void CobrarCartao(DetalhesPagamento detalhesDoPagamento, Carrinho carrinho)
    {
        var gatewayPagamento = new GatewayPagamento();

        gatewayPagamento.credencial   = "bla";
        gatewayPagamento.MumeroCartao = detalhesDoPagamento.MumeroCartao;
        gatewayPagamento.MesExpiracao = detalhesDoPagamento.MesExpiracao;
        gatewayPagamento.AnoExpiracao = detalhesDoPagamento.AnoExpiracao;
        gatewayPagamento.NomeNoCartao = detalhesDoPagamento.NomeNoCartao;
        gatewayPagamento.Valor        = carrinho.ValorTotal;
        gatewayPagamento.Cobrar();
    }
    private void CobrarCartao(DetalhesPagamento detalhesDoPagamento, Carrinho carrinho)
    {
        var gatewayPagamento = new GatewayPagamento();

        gatewayPagamento.credencial   = "bla";
        gatewayPagamento.MumeroCartao = detalhesDoPagamento.MumeroCartao;
        gatewayPagamento.MesExpiracao = detalhesDoPagamento.MesExpiracao;
        gatewayPagamento.AnoExpiracao = detalhesDoPagamento.AnoExpiracao;
        gatewayPagamento.NomeNoCartao = detalhesDoPagamento.NomeNoCartao;
        gatewayPagamento.Valor        = carrinho.ValorTotal;
        gatewayPagamento.Cobrar();
    }
Example #5
0
    public void Comprar(Carrinho carrinho, DetalhesPagamento detalhesPagamento, bool deveNotificarCliente)
    {
        if (detalhesPagamento.FormaPagamento == FormasPagamento.CARTAOCREDITO)
        {
            _processador.Processar(detalhesDoPagamento, carrinho);
        }

        _reservador.ReservarEstoque(carrinho);

        if (deveNotificarCliente)
        {
            _notificador.NotificarCliente(carrinho);
        }
    }
    public void Comprar(Carrinho carrinho, DetalhesPagamento detalhesPagamento, bool deveNotificarCliente)
    {
        if (detalhesPagamento.FormaPagamento == FormasPagamento.CARTAOCREDITO)
        {
            CobrarCartao(detalhesDoPagamento, carrinho);
        }

        ReservarEstoque(carrinho);

        if (deveNotificarCliente)
        {
            NotificarCliente(carrinho);
        }
    }