function home()
 {
     $pagamento = $this->verificar_pagamento();
     $this->set('pagamento', $pagamento);
     $vendaController = new VendaController();
     $this->set('vendas', $vendaController->recoverDataToDashboardOneWeek($this->instancia));
     $this->layout = 'wadmin';
 }
 public function payment()
 {
     $andress = $this->request->data('endereco');
     $client = $this->request->data('cliente');
     $products = $this->loadProductsAndValuesCart();
     (double) ($valor_frete = number_format($this->Session->read('Frete.valor'), 2, '.', ','));
     $objVenda = new VendaController();
     $productsSale = $this->prepareProductsSale($products['products_cart']);
     $usuario_id = $this->Session->read('Usuario.id');
     $retorno_venda = $objVenda->salvar_venda($productsSale, array('forma_pagamento' => 'pagseguro'), array('valor' => $valor_frete + $products['total']), $usuario_id);
     $this->paymentPagSeguro($products['products_cart'], $andress, $client, $products['total'], $valor_frete, $retorno_venda['id']);
 }