public static function requestUpdateVendaStatus() { try { /*$json = ' {"newOrderStatus":{"name":"Pagamento aceito","template":"payment","send_email":"1","module_name":"","invoice":"1","color":"#32CD32","unremovable":"1","logable":"1","delivery":"0","hidden":"0","shipped":"0","paid":"1","pdf_invoice":"1","pdf_delivery":"0","deleted":"0","id":2,"id_shop_list":null,"force_id":false},"id_order":9,"cookie":{},"cart":{"id":11,"id_shop_group":"1","id_shop":"1","id_address_delivery":"5","id_address_invoice":"5","id_currency":"1","id_customer":"2","id_guest":"2","id_lang":"2","recyclable":"0","gift":"0","gift_message":"","mobile_theme":"0","date_add":"2016-10-05 06:34:07","secure_key":"a24bacb3d454dcd53813e624d60bc9f1","id_carrier":"3","date_upd":"2016-10-05 06:35:06","checkedTos":false,"pictures":null,"textFields":null,"delivery_option":"a:1:{i:5;s:2:\"3,\";}","allow_seperated_package":"0","id_shop_list":null,"force_id":false},"altern":3} '; $_POST = json_decode($json,true); $_POST['id_empreendimento'] = 6 ;*/ $dados = $_POST; $VendaDao = new VendaDao(); $PagamentoClienteDao = new PagamentoClienteDao(); $ReferenciaIntegracaoDao = new ReferenciaIntegracaoDao(); if (strtolower($dados['newOrderStatus']['id']) != '2') { return; } $id_order = $dados['id_order']; $refVenda = $ReferenciaIntegracaoDao->get(array('sistema_integrado' => 'PrestaShop', 'tabela' => 'tbl_vendas', 'id_item_referencia' => $id_order, 'tipo' => 'venda', 'id_empreendimento' => $dados['id_empreendimento'], 'flg_excluido' => 0)); $refPag = $ReferenciaIntegracaoDao->get(array('sistema_integrado' => 'PrestaShop', 'tabela' => 'tbl_pagamentos_venda', 'id_item_referencia' => $id_order, 'tipo' => 'pagamento', 'id_empreendimento' => $dados['id_empreendimento'], 'flg_excluido' => 0)); $VendaDao->changeStatusVenda($refVenda['id_item'], 6); $PagamentoClienteDao->updateStatus($refPag['id_item'], 1, date('Y-m-d H:i:s')); } catch (Exception $e) { $log = new KLogger("logs/logErrorPrestaShop.txt", KLogger::DEBUG); $log->LogError($e->getMessage() . '- file:' . $e->getFile() . ' - line:' . $e->getLine()); $log->LogDebug(json_encode($_POST)); $log->LogJunp(); Flight::halt(500, $e->getMessage()); } }