From a1540bfd2a35acc4128068f04ed9eb872476444e Mon Sep 17 00:00:00 2001 From: Andre Kutianski Date: Wed, 10 Apr 2024 18:36:59 -0300 Subject: [PATCH 01/25] refact: atualiza chamadas de registro e melhora o tratamento de erros #55 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit O commit inclui atualizações nas chamadas de registro para fornecer informações mais precisas sobre o comportamento do aplicativo. Também melhora o tratamento de erros em vários locais para tornar o aplicativo mais robusto e mais fácil de depurar quando algo dá errado. As alterações de registro garantem que cenários de falha importantes sejam registrados corretamente para solução de problemas futuros. --- .../addons/NFEioServiceInvoices/callback.php | 16 ++++-- .../lib/Admin/Controller.php | 4 +- .../lib/Hooks/AfterCronJob.php | 6 +-- .../lib/Hooks/DailyCronJob.php | 2 +- .../lib/Hooks/InvoiceCreation.php | 4 +- .../lib/Hooks/InvoicePaid.php | 4 +- .../lib/Legacy/Functions.php | 53 ++++++++++--------- .../NFEioServiceInvoices/lib/Legacy/Hooks.php | 8 +-- .../Models/ClientConfiguration/Repository.php | 2 +- .../NFEioServiceInvoices/lib/NFEio/Nfe.php | 22 ++++---- 10 files changed, 66 insertions(+), 55 deletions(-) diff --git a/modules/addons/NFEioServiceInvoices/callback.php b/modules/addons/NFEioServiceInvoices/callback.php index cb1cc11..4abe4a1 100644 --- a/modules/addons/NFEioServiceInvoices/callback.php +++ b/modules/addons/NFEioServiceInvoices/callback.php @@ -14,11 +14,17 @@ if ($_SERVER['REQUEST_METHOD'] != 'POST') { // https://developer.mozilla.org/pt-BR/docs/Web/HTTP/Status/405 http_response_code(405); + echo "Method Not Allowed"; exit(); } +// armazena o cabecalho da requisição +$headers = getallheaders(); + $post = json_decode(file_get_contents('php://input'), true); +logModuleCall('nfeio_serviceinvoices', 'callback', 'Webhook Raw Payload', ['headers' => $headers, 'body' => $post]); + if ($post) { $functions = new Functions(); //require_once __DIR__ . '/functions.php'; @@ -37,12 +43,12 @@ //verificar o ambiente if ($environment == 'on' && $nf_environment == 'Production') { - logModuleCall('NFEioServiceInvoices', 'callback_error_development', 'Ambiente Development ativo mas recebendo notas de Production', $post, $params); + logModuleCall('nfeio_serviceinvoices', 'callback_error_development', 'Ambiente Development ativo mas recebendo notas de Production', $post, $params); // https://developer.mozilla.org/pt-BR/docs/Web/HTTP/Status/403 http_response_code(200); exit(); } elseif ($environment == '' && $nf_environment == 'Development') { - logModuleCall('NFEioServiceInvoices', 'callback_error_production', 'Ambiente Production ativo mas recebendo notas de Development', $post, $params); + logModuleCall('nfeio_serviceinvoices', 'callback_error_production', 'Ambiente Production ativo mas recebendo notas de Development', $post, $params); // https://developer.mozilla.org/pt-BR/docs/Web/HTTP/Status/403 http_response_code(200); exit(); @@ -51,7 +57,7 @@ //verificar se a nfe existe na tabela if ($totalNfLocal == 0) { - logModuleCall('NFEioServiceInvoices', 'callback_error', 'Nota Fiscal não existe no banco local', $post); + logModuleCall('nfeio_serviceinvoices', 'callback_error', 'Nota Fiscal não existe no banco local', $post); // https://developer.mozilla.org/pt-BR/docs/Web/HTTP/Status/404 http_response_code(404); exit(); @@ -97,9 +103,9 @@ try { $save_nfe = Capsule::table('mod_nfeio_si_serviceinvoices')->where('nfe_id', '=', $post['id'])->update($new_nfe); - logModuleCall('NFEioServiceInvoices', 'callback_success', $post, $save_nfe); + logModuleCall('nfeio_serviceinvoices', 'callback_success', $post, $save_nfe); } catch (\Exception $e) { - logModuleCall('NFEioServiceInvoices', 'callback_error', "Erro ao atualizar a nota no banco de dados \n\n Nota: \n {$new_nfe} Callback: \n {$post}", $e->getMessage()); + logModuleCall('nfeio_serviceinvoices', 'callback_error', "Erro ao atualizar a nota no banco de dados \n\n Nota: \n {$new_nfe} Callback: \n {$post}", $e->getMessage()); } // garante retorno de cabeçalho na resposta diff --git a/modules/addons/NFEioServiceInvoices/lib/Admin/Controller.php b/modules/addons/NFEioServiceInvoices/lib/Admin/Controller.php index a0dcd9d..c878c4c 100644 --- a/modules/addons/NFEioServiceInvoices/lib/Admin/Controller.php +++ b/modules/addons/NFEioServiceInvoices/lib/Admin/Controller.php @@ -338,11 +338,11 @@ public function legacyFunctions($vars) if ($delete_nfe->message) { $response = $nfe->updateLocalNfeStatus($_REQUEST['gnfe_cancel'], 'Cancelled'); - logModuleCall('nfeioserviceinvoices', 'cancel_nf', $_REQUEST['gnfe_cancel'], "NF API Response: \n {$delete_nfe->message} \n NF LOCAL Response: \n {$response}"); + logModuleCall('nfeio_serviceinvoices', 'cancel_nf', $_REQUEST['gnfe_cancel'], "NF API Response: \n {$delete_nfe->message} \n NF LOCAL Response: \n {$response}"); $msg->warning("Nota fiscal cancelada, mas com aviso: {$delete_nfe->message}", $redirectUrl); } else { - logModuleCall('nfeioserviceinvoices', 'cancel_nf', $_REQUEST['gnfe_cancel'], $delete_nfe); + logModuleCall('nfeio_serviceinvoices', 'cancel_nf', $_REQUEST['gnfe_cancel'], $delete_nfe); $msg->success("Nota fiscal cancelada com sucesso", $redirectUrl); } diff --git a/modules/addons/NFEioServiceInvoices/lib/Hooks/AfterCronJob.php b/modules/addons/NFEioServiceInvoices/lib/Hooks/AfterCronJob.php index 36871cf..2115c19 100644 --- a/modules/addons/NFEioServiceInvoices/lib/Hooks/AfterCronJob.php +++ b/modules/addons/NFEioServiceInvoices/lib/Hooks/AfterCronJob.php @@ -47,8 +47,8 @@ public function run() $hasNfWaiting = Capsule::table($serviceInvoicesTable)->whereBetween('created_at', [$initialDate, $dataAtual])->where('status', '=', 'Waiting')->count(); logModuleCall( - 'NFEioServiceInvoices', - 'Hook - AfterCronJob', + 'nfeio_serviceinvoices', + 'hook_aftercronjob', "{$hasNfWaiting} notas a serem geradas", array( [ @@ -74,7 +74,7 @@ public function run() */ } - logModuleCall('NFEioServiceInvoices', 'Hook - AfterCronJob', "{$hasNfWaiting} notas a serem geradas", $queryNf); + logModuleCall('nfeio_serviceinvoices', 'hook_aftercronjob', "{$hasNfWaiting} notas a serem geradas", $queryNf); } } } diff --git a/modules/addons/NFEioServiceInvoices/lib/Hooks/DailyCronJob.php b/modules/addons/NFEioServiceInvoices/lib/Hooks/DailyCronJob.php index cb117cc..dc97857 100644 --- a/modules/addons/NFEioServiceInvoices/lib/Hooks/DailyCronJob.php +++ b/modules/addons/NFEioServiceInvoices/lib/Hooks/DailyCronJob.php @@ -81,7 +81,7 @@ public function run() if (count($invoicesIdToGenerateNF) > 0) { foreach ($invoicesIdToGenerateNF as $invoice) { $queue = $this->nf->queue($invoice); - logModuleCall('NFEioServiceInvoices', 'Hook - DailyCronJob', $invoice, $queue); + logModuleCall('nfeio_serviceinvoices', 'Hook - DailyCronJob', $invoice, $queue); } } } diff --git a/modules/addons/NFEioServiceInvoices/lib/Hooks/InvoiceCreation.php b/modules/addons/NFEioServiceInvoices/lib/Hooks/InvoiceCreation.php index fdb70bc..3a24c79 100644 --- a/modules/addons/NFEioServiceInvoices/lib/Hooks/InvoiceCreation.php +++ b/modules/addons/NFEioServiceInvoices/lib/Hooks/InvoiceCreation.php @@ -54,11 +54,11 @@ public function run() if ($clientIssueCondition == 'seguir configuração do módulo nfe.io' and $moduleIssueCondition == $generateTaxBillWhen and $generateTaxBill) { $queue = $nfe->queue($this->invoiceId); - logModuleCall('NFEioServiceInvoices', __CLASS__ . __FUNCTION__, $data, $queue); + logModuleCall('nfeio_serviceinvoices', 'nf_invoice_creation', $data, $queue); } if ($clientIssueCondition == $generateTaxBillWhen and $generateTaxBill) { $queue = $nfe->queue($this->invoiceId); - logModuleCall('NFEioServiceInvoices', __CLASS__ . __FUNCTION__, $data, $queue); + logModuleCall('nfeio_serviceinvoices', 'nf_invoice_creation', $data, $queue); } } } diff --git a/modules/addons/NFEioServiceInvoices/lib/Hooks/InvoicePaid.php b/modules/addons/NFEioServiceInvoices/lib/Hooks/InvoicePaid.php index 674db8d..ec8fa53 100644 --- a/modules/addons/NFEioServiceInvoices/lib/Hooks/InvoicePaid.php +++ b/modules/addons/NFEioServiceInvoices/lib/Hooks/InvoicePaid.php @@ -46,11 +46,11 @@ public function run() if ($clientIssueCondition == 'seguir configuração do módulo nfe.io' and $moduleIssueCondition == $generateTaxBillWhen and $generateTaxBill) { $queue = $nfe->queue($this->invoiceId); - logModuleCall('NFEioServiceInvoices', __CLASS__ . __FUNCTION__, $data, $queue); + logModuleCall('nfeio_serviceinvoices', 'nf_invoice_paid', $data, $queue); } if ($clientIssueCondition == $generateTaxBillWhen and $generateTaxBill) { $queue = $nfe->queue($this->invoiceId); - logModuleCall('NFEioServiceInvoices', __CLASS__ . __FUNCTION__, $data, $queue); + logModuleCall('nfeio_serviceinvoices', 'nf_invoice_paid', $data, $queue); } } } diff --git a/modules/addons/NFEioServiceInvoices/lib/Legacy/Functions.php b/modules/addons/NFEioServiceInvoices/lib/Legacy/Functions.php index d14bfd7..ae4c30c 100644 --- a/modules/addons/NFEioServiceInvoices/lib/Legacy/Functions.php +++ b/modules/addons/NFEioServiceInvoices/lib/Legacy/Functions.php @@ -55,9 +55,6 @@ function gnfe_customer($user_id, $client) $cnpj_customfield_value = preg_replace('/[^0-9]/', '', $customfieldvalue->value); } } - logModuleCall('NFEioServiceInvoices', 'gnfe_customer-cpf', $cpf_customfield_value, '', '', ''); - logModuleCall('NFEioServiceInvoices', 'gnfe_customer-cnpj', $cnpj_customfield_value, '', '', ''); - logModuleCall('NFEioServiceInvoices', 'gnfe_customer-municipal', $insc_customfield_value, '', '', ''); // Cliente possui CPF e CNPJ // CPF com 1 nº a menos, adiciona 0 antes do documento @@ -112,11 +109,14 @@ function gnfe_customer($user_id, $client) } if (!$cpf and !$cnpj) { $error = 'CPF e/ou CNPJ ausente.'; + logModuleCall('nfeio_serviceinvoices', 'nf_customer_error', $custumer, $error); } if (!$error) { return $custumer; } if ($error) { + logModuleCall('nfeio_serviceinvoices', 'nf_customer_error', $custumer, $error); + return $custumer['error'] = $error; } } @@ -176,7 +176,7 @@ function gnfe_ibge($zip) $city = json_decode(json_encode(json_decode($response))); if ($city->message || $err) { - logModuleCall('NFEioServiceInvoices', 'gnfe_ibge', $zip, $response, 'ERROR', ''); + logModuleCall('nfeio_serviceinvoices', 'ibge_error', $zip, $response); return 'ERROR'; } else { return $city->city->code; @@ -261,8 +261,6 @@ function gnfe_issue_nfe($postfields) if (!$gnfe_webhook_id) { $create_webhook = $this->gnfe_create_webhook($webhook_url); - logModuleCall('NFEioServiceInvoices', 'gnfe_issue_nfe - gnfe_create_webhook', $create_webhook, $webhook_url); - if ($create_webhook == null) { return (object) ['message' => 'Erro ao criar novo webhook']; } @@ -281,17 +279,16 @@ function gnfe_issue_nfe($postfields) curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($postfields)); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); $response = curl_exec($curl); - $err = curl_error($curl); + $error = curl_error($curl); $info = curl_getinfo($curl); curl_close($curl); - $error = $err ? $err : $response; - logModuleCall('NFEioServiceInvoices', 'gnfe_issue_nfe - curl_init', $error, $info, '', ''); - logModuleCall('NFEioServiceInvoices', 'gnfe_issue_nfe - CURLOPT_POSTFIELDS', json_encode($postfields), '', '', ''); - if ($err) { - return (object) ['message' => $err, 'info' => $info]; + if ($error) { + logModuleCall('nfeio_serviceinvoices', 'nf_issue_curl_error', $postfields, ['error' => $error, 'response' => $response, 'info' => $info], '', ''); + return (object) ['message' => $error, 'info' => $info]; } else { + logModuleCall('nfeio_serviceinvoices', 'nf_issue_curl_success', $postfields, $response, json_decode($response, true), ''); return json_decode(json_encode(json_decode($response))); } } @@ -353,7 +350,7 @@ function gnfe_test_connection() $response = curl_exec($curl); $info = curl_getinfo($curl); $err = curl_error($curl); - logModuleCall('NFEioServiceInvoices', 'gnfe_issue_nfe - curl_init', $err, $info, '', ''); + logModuleCall('nfeio_serviceinvoices', 'test_connection', $info, $response, json_decode($response, true)); curl_close($curl); return $info; @@ -370,6 +367,8 @@ function gnfe_delete_nfe($nf) $response = curl_exec($curl); curl_close($curl); + logModuleCall('nfeio_serviceinvoices', 'delete_nfe', $nf, $response, json_decode($response, true), ''); + return json_decode($response); } @@ -385,6 +384,8 @@ function gnfe_email_nfe($nf) $response = curl_exec($curl); curl_close($curl); + logModuleCall('nfeio_serviceinvoices', 'email_nfe', $nf, $response, json_decode($response, true), ''); + return json_decode($response); } } @@ -458,6 +459,8 @@ function gnfe_update_nfe($nfe, $user_id, $invoice_id, $pdf, $created_at, $update } $save_nfe = Capsule::table($_tableName)->where($camp, '=', $id)->update($data); + logModuleCall('nfeio_serviceinvoices', 'update_nfe', $data, $save_nfe, '', ''); + return 'success'; } catch (\Exception $e) { return $e->getMessage(); @@ -499,14 +502,14 @@ function gnfe_check_webhook($id) if ($info['http_code'] == 200) { return json_decode($response, true); } elseif ($info['http_code'] == 400 || $info['http_code'] == 404) { - logModuleCall('NFEioServiceInvoices', 'gnfe_check_webhook', $id, "ERRO " . $info['http_code']); + logModuleCall('nfeio_serviceinvoices', 'webhook_check_error', $id, "ERRO " . $info['http_code']); return "ERRO " . $info['http_code']; } else { - logModuleCall('NFEioServiceInvoices', 'gnfe_check_webhook', $id, $info['http_code']); + logModuleCall('nfeio_serviceinvoices', 'webhook_check_error', $id, $info['http_code']); } } } catch (Exception $ex) { - logModuleCall('NFEioServiceInvoices', 'gnfe_check_webhook', $id, $ex->getMessage()); + logModuleCall('nfeio_serviceinvoices', 'webhook_check_error', $id, $ex->getMessage()); } return null; @@ -528,13 +531,14 @@ function gnfe_create_webhook($url) if (!curl_errno($curl)) { if ($info['http_code'] == 201) { + logModuleCall('nfeio_serviceinvoices', 'webhook_create', $url, $response); return json_decode($response, true); } else { - logModuleCall('NFEioServiceInvoices', 'gnfe_create_webhook', $url, $info['http_code']); + logModuleCall('nfeio_serviceinvoices', 'webhook_create_error', $url, $info['http_code']); } } } catch (Exception $ex) { - logModuleCall('NFEioServiceInvoices', 'gnfe_create_webhook', $url, $ex->getMessage()); + logModuleCall('nfeio_serviceinvoices', 'webhook_create_error', $url, $ex->getMessage()); } return null; @@ -555,13 +559,14 @@ function gnfe_delete_webhook($id) if (!curl_errno($curl)) { if ($info['http_code'] == 200) { + logModuleCall('nfeio_serviceinvoices', 'webhook_delete_success', $id, $response); return json_decode($response, true); } else { - logModuleCall('NFEioServiceInvoices', 'gnfe_delete_webhook', $id, $info['http_code']); + logModuleCall('nfeio_serviceinvoices', 'webhook_delete_error', $id, $info['http_code']); } } } catch (Exception $ex) { - logModuleCall('NFEioServiceInvoices', 'gnfe_delete_webhook', $id, $ex->getMessage()); + logModuleCall('nfeio_serviceinvoices', 'webhook_delete_error', $id, $ex->getMessage()); } return null; @@ -824,7 +829,7 @@ function emitNFE($invoices, $nfeio) // CPF/CNPJ/NAME $customer = $this->gnfe_customer($invoices->userid, $client); - logModuleCall('NFEioServiceInvoices', 'gnfe_customer', $customer, '', '', ''); + logModuleCall('nfeio_serviceinvoices', 'nf_customer', '', $customer); if ($customer['doc_type'] == 2) { if ($client->companyname != '') { @@ -862,9 +867,9 @@ function emitNFE($invoices, $nfeio) $desc .= ' | ' . substr(implode("\n", $line_items), 0, 600) . ' ' . $params['descCustom']; } - logModuleCall('NFEioServiceInvoices', 'description-descCustom', $params['descCustom'], '', '', ''); - logModuleCall('NFEioServiceInvoices', 'description-InvoiceDetails', $params['InvoiceDetails'], '', '', ''); - logModuleCall('NFEioServiceInvoices', 'description', $params, '', '', ''); + logModuleCall('nfeio_serviceinvoices', 'description-descCustom', $params['descCustom'], '', '', ''); + logModuleCall('nfeio_serviceinvoices', 'description-InvoiceDetails', $params['InvoiceDetails'], '', '', ''); + logModuleCall('nfeio_serviceinvoices', 'description', $params, '', '', ''); //define address if (strpos($client['address1'], ',')) { diff --git a/modules/addons/NFEioServiceInvoices/lib/Legacy/Hooks.php b/modules/addons/NFEioServiceInvoices/lib/Legacy/Hooks.php index cf58e0f..b063055 100644 --- a/modules/addons/NFEioServiceInvoices/lib/Legacy/Hooks.php +++ b/modules/addons/NFEioServiceInvoices/lib/Legacy/Hooks.php @@ -36,10 +36,10 @@ function invoicecancelled($vars) $clientId = $invoice->userid; $delete_nfe = $this->functions->gnfe_delete_nfe($nfe_for_invoice['nfe_id']); if (!$delete_nfe->message) { - logModuleCall('gofas_nfeio', 'invoicecancelled', $nfe_for_invoice['nfe_id'], $delete_nfe, 'OK', ''); + logModuleCall('nfeio_serviceinvoices', 'nf_canceled', $nfe_for_invoice['nfe_id'], $delete_nfe); $gnfe_update_nfe = $this->functions->gnfe_update_nfe((object) ['id' => $nfe_for_invoice['nfe_id'], 'status' => 'Cancelled', 'servicesAmount' => $nfe_for_invoice['services_amount'], 'environment' => $nfe_for_invoice['environment'], 'flow_status' => $nfe_for_invoice['flow_status']], $clientId, $vars['invoiceid'], 'n/a', $nfe_for_invoice['created_at'], date('Y-m-d H:i:s')); } else { - logModuleCall('gofas_nfeio', 'invoicecancelled', $nfe_for_invoice['nfe_id'], $delete_nfe, 'ERROR', ''); + logModuleCall('nfeio_serviceinvoices', 'nf_canceled_error', $nfe_for_invoice['nfe_id'], $delete_nfe); } } } @@ -50,9 +50,9 @@ function productdelete($vars) $productCodeTable = $this->productCodeRepo->tableName(); try { $delete = Capsule::table($productCodeTable)->where('product_id', '=', $vars['pid'])->delete(); - logModuleCall('gofas_nfeio', 'productdelete', 'product_id=' . $vars['pid'], $delete, 'OK', ''); + logModuleCall('nfeio_serviceinvoices', 'nf_product_delete', 'product_id=' . $vars['pid'], $delete, 'OK', ''); } catch (Exception $e) { - logModuleCall('gofas_nfeio', 'productdelete', 'product_id=' . $vars['pid'], $e->getMessage(), 'ERROR', ''); + logModuleCall('nfeio_serviceinvoices', 'nf_product_delete_error', $vars['pid'], $e->getMessage()); } } diff --git a/modules/addons/NFEioServiceInvoices/lib/Models/ClientConfiguration/Repository.php b/modules/addons/NFEioServiceInvoices/lib/Models/ClientConfiguration/Repository.php index 0415afa..ed36b9e 100644 --- a/modules/addons/NFEioServiceInvoices/lib/Models/ClientConfiguration/Repository.php +++ b/modules/addons/NFEioServiceInvoices/lib/Models/ClientConfiguration/Repository.php @@ -81,7 +81,7 @@ public function getClientIssueCondition($clientId) $issueCondition = strtolower($value); } - logModuleCall('NFEioServiceInvoices', "getClientIssueCondition", $clientId, "{$issueCondition}" . ' - ' . $value); + logModuleCall('nfeio_serviceinvoices', "client_issue_condition", "Customer ID: {$clientId}", "{$issueCondition}" . ' - ' . $value); return $issueCondition; } diff --git a/modules/addons/NFEioServiceInvoices/lib/NFEio/Nfe.php b/modules/addons/NFEioServiceInvoices/lib/NFEio/Nfe.php index df1b52d..b689477 100644 --- a/modules/addons/NFEioServiceInvoices/lib/NFEio/Nfe.php +++ b/modules/addons/NFEioServiceInvoices/lib/NFEio/Nfe.php @@ -302,12 +302,12 @@ public function queue($invoiceId, $reissue = false) // se já houver uma nota no banco local com o mesmo external_id pula a emissão de nota if (is_array($hasExternalId)) { - logModuleCall('NFEioServiceInvoices', __CLASS__ . __FUNCTION__, "Um external_id idêntico foi encontrado para {$nf['nfe_external_id']}, NF não adicionada para transmissão", $hasExternalId); + logModuleCall('nfeio_serviceinvoices', 'nf_queue', "Um external_id idêntico foi encontrado para {$nf['nfe_external_id']}, NF não adicionada para transmissão", $hasExternalId); continue; } $result = Capsule::table($this->serviceInvoicesTable)->insert($nf); - logModuleCall('NFEioServiceInvoices', __CLASS__ . __FUNCTION__, $nf, $result); + logModuleCall('nfeio_serviceinvoices', 'nf_queue', $nf, $result); } } @@ -329,7 +329,7 @@ public function emit($data) $clientData = \WHMCS\User\Client::find($clientId); $customer = $this->legacyFunctions->gnfe_customer($clientId, $clientData); - logModuleCall('NFEioServiceInvoices', 'get_client_details', $clientData, $customer); + logModuleCall('nfeio_serviceinvoices', 'nf_emit_for_customer', $data, $customer); $emailNfeConfig = (bool) $this->storage->get('gnfe_email_nfe_config'); $client_email = $emailNfeConfig ? $clientData->email : ''; @@ -404,9 +404,9 @@ public function emit($data) if (!$nfeResponse->message) { $gnfe_update_nfe = $this->legacyFunctions->gnfe_update_nfe($nfeResponse, $clientId, $invoiceId, 'n/a', date('Y-m-d H:i:s'), date('Y-m-d H:i:s'), $nfDbId); - logModuleCall('NFEioServiceInvoices', 'transmit_nf_success', $postData, $nfeResponse); + logModuleCall('nfeio_serviceinvoices', 'nf_emit', $postData, $nfeResponse); } else { - logModuleCall('NFEioServiceInvoices', 'transmit_nf_error', $postData, $nfeResponse); + logModuleCall('nfeio_serviceinvoices', 'nf_emit_error', $postData, $nfeResponse); } } @@ -478,10 +478,10 @@ public function reissueNfbyId($nfId) try { $result = Capsule::table($_tableName)->insert($reissueNfData); - logModuleCall('NFEioServiceInvoices', __CLASS__ . '/' . __FUNCTION__, $reissueNfData, $result); + logModuleCall('nfeio_serviceinvoices', 'nf_reissue_series_by_nf', $reissueNfData, $result); return 'success'; } catch (\Exception $e) { - logModuleCall('NFEioServiceInvoices', __CLASS__ . '/' . __FUNCTION__, $reissueNfData, $e->getMessage()); + logModuleCall('nfeio_serviceinvoices', 'nf_reissue_series_by_nf_error', $reissueNfData, $e->getMessage()); return $e->getMessage(); } } @@ -511,7 +511,7 @@ public function reissueNfSeriesByInvoiceId($invoiceId) $result = $this->queue($invoiceId, true); - logModuleCall('NFEioServiceInvoices', __CLASS__ . '/' . __FUNCTION__, $invoiceId, $result); + logModuleCall('nfeio_serviceinvoices', 'nf_reissue_series_by_invoice', $invoiceId, $result); return ['status' => 'success']; } @@ -556,7 +556,7 @@ public function cancelNfSeriesByInvoiceId($invoiceId) if (count($existingNf) > 0) { foreach ($existingNf as $nf) { $result = $this->legacyFunctions->gnfe_delete_nfe($nf->nfe_id); - logModuleCall('NFEioServiceInvoices', __CLASS__ . '/' . __FUNCTION__, $nf, $result); + logModuleCall('nfeio_serviceinvoices', 'nf_cancel_series_by_invoice', $nf, $result); // $message sempre retornará erro para notas com status diferente de 'Issued' na API. // Esta condição garante que status local é alterada para 'Canceled' de qualquer maneira. if ($result->message or empty($result)) { @@ -566,8 +566,8 @@ public function cancelNfSeriesByInvoiceId($invoiceId) return ['status' => 'success']; } else { logModuleCall( - 'NFEioServiceInvoices', - __CLASS__ . '/' . __FUNCTION__, + 'nfeio_serviceinvoices', + 'nf_cancel_series_by_invoice', ['invoice ID' => $invoiceId], "Não existem notas para a fatura #{$invoiceId}." ); From 3fffe5057f561b8c2af7c6b3a96fcbbda8154385 Mon Sep 17 00:00:00 2001 From: Andre Kutianski Date: Thu, 11 Apr 2024 20:16:58 -0300 Subject: [PATCH 02/25] =?UTF-8?q?feat:=20adiciona=20classe=20de=20valida?= =?UTF-8?q?=C3=A7=C3=B5es=20para=20CPF=20e=20CNPJ?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Essa atualização inclui uma nova classe de auxílio `Validations` no módulo `NFEioServiceInvoices`. Essa classe contém métodos para validar CPFs e CNPJs, conforme regras de verificação do Brasil, garantindo a integridade dos dados tratados em nossos serviços. --- .../lib/Helpers/Validations.php | 55 +++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 modules/addons/NFEioServiceInvoices/lib/Helpers/Validations.php diff --git a/modules/addons/NFEioServiceInvoices/lib/Helpers/Validations.php b/modules/addons/NFEioServiceInvoices/lib/Helpers/Validations.php new file mode 100644 index 0000000..584b75b --- /dev/null +++ b/modules/addons/NFEioServiceInvoices/lib/Helpers/Validations.php @@ -0,0 +1,55 @@ + Date: Thu, 11 Apr 2024 20:18:32 -0300 Subject: [PATCH 03/25] =?UTF-8?q?refact:=20refatora=20e=20melhora=20valida?= =?UTF-8?q?=C3=A7=C3=B5es=20na=20fun=C3=A7=C3=A3o=20gnfe=5Fcustomer?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit O código foi refatorado na função gnfe_customer para melhorar as validações de CPF e CNPJ. Foram adicionadas novas condições de validação de CPF e CNPJ utilizando um novo helper de validações. Foi reformulado o retorno dos dados de CPF e CNPJ validados, adicionando o nome e tipo de documento conforme a validação. Melhorias extras também foram implementadas para validar e lidar com a inscrição municipal do cliente. --- .../lib/Legacy/Functions.php | 291 +++++++++++------- 1 file changed, 185 insertions(+), 106 deletions(-) diff --git a/modules/addons/NFEioServiceInvoices/lib/Legacy/Functions.php b/modules/addons/NFEioServiceInvoices/lib/Legacy/Functions.php index ae4c30c..1b40d78 100644 --- a/modules/addons/NFEioServiceInvoices/lib/Legacy/Functions.php +++ b/modules/addons/NFEioServiceInvoices/lib/Legacy/Functions.php @@ -4,6 +4,7 @@ use WHMCS\Database\Capsule; use NFEioServiceInvoices\Addon; +use NFEioServiceInvoices\Helpers\Validations; use WHMCSExpert\Addon\Storage; class Functions @@ -29,96 +30,159 @@ function gnfe_config($set = false) } } - function gnfe_customer($user_id, $client) + public function gnfe_customer($user_id, $client): array { //Determine custom fields id - $CPF_id = $this->gnfe_config('cpf_camp'); - $CNPJ_id = $this->gnfe_config('cnpj_camp'); - $insc_municipal_id = $this->gnfe_config('insc_municipal'); + $cpfCustomFieldId = $this->gnfe_config('cpf_camp'); + $cnpjCustomFieldId = $this->gnfe_config('cnpj_camp'); + $inscMunicipalCustomFieldId = $this->gnfe_config('insc_municipal'); + +// $insc_customfield_value = 'NF'; + $inscMunicipalCustomFieldValue = false; + // inicia array de retorno + $result = []; + + /** + * Este bloco de código verifica se os IDs dos campos personalizados para CPF e CNPJ estão definidos. + * Se ambos os IDs dos campos personalizados CPF e CNPJ não estiverem definidos (ou seja, eles são 0), + * ele define uma bandeira de erro e retorna uma mensagem de erro. + * + * @return array Se ocorrer um erro, retorna um array associativo com 'error' definido como true e 'message' + * contendo a mensagem de erro. + */ + if ($cpfCustomFieldId == 0 && $cnpjCustomFieldId == 0) { + $error = true; + $message = 'Campos para CPF e CNPJ não configurados.'; + $result['error'] = $error; + $result['message'] = $message; + return $result; + } - $insc_customfield_value = 'NF'; // insc_municipal - if ($insc_municipal_id != 0) { - foreach (Capsule::table('tblcustomfieldsvalues')->where('fieldid', '=', $insc_municipal_id)->where('relid', '=', $user_id)->get(['value']) as $customfieldvalue) { - $insc_customfield_value = $customfieldvalue->value; + if ($inscMunicipalCustomFieldId != 0) { + foreach (Capsule::table('tblcustomfieldsvalues')->where('fieldid', '=', $inscMunicipalCustomFieldId)->where('relid', '=', $user_id)->get(['value']) as $customfieldvalue) { +// $insc_customfield_value = $customfieldvalue->value; + $inscMunicipalCustomFieldValue = $customfieldvalue->value; } } // cpf - if ($CPF_id != 0) { - foreach (Capsule::table('tblcustomfieldsvalues')->where('fieldid', '=', $CPF_id)->where('relid', '=', $user_id)->get(['value']) as $customfieldvalue) { - $cpf_customfield_value = preg_replace('/[^0-9]/', '', $customfieldvalue->value); + if ($cpfCustomFieldId != 0) { + foreach (Capsule::table('tblcustomfieldsvalues')->where('fieldid', '=', $cpfCustomFieldId)->where('relid', '=', $user_id)->get(['value']) as $customfieldvalue) { +// $cpf_customfield_value = preg_replace('/[^0-9]/', '', $customfieldvalue->value); + $cpfCustomFieldValue = $customfieldvalue->value; } } //cnpj - if ($CNPJ_id != 0) { - foreach (Capsule::table('tblcustomfieldsvalues')->where('fieldid', '=', $CNPJ_id)->where('relid', '=', $user_id)->get(['value']) as $customfieldvalue) { - $cnpj_customfield_value = preg_replace('/[^0-9]/', '', $customfieldvalue->value); + if ($cnpjCustomFieldId != 0) { + foreach (Capsule::table('tblcustomfieldsvalues')->where('fieldid', '=', $cnpjCustomFieldId)->where('relid', '=', $user_id)->get(['value']) as $customfieldvalue) { +// $cnpj_customfield_value = preg_replace('/[^0-9]/', '', $customfieldvalue->value); + $cnpjCustomFieldValue = $customfieldvalue->value; } } - // Cliente possui CPF e CNPJ - // CPF com 1 nº a menos, adiciona 0 antes do documento - if (strlen($cpf_customfield_value) === 10) { - $cpf = '0' . $cpf_customfield_value; - } - // CPF com 11 dígitos - elseif (strlen($cpf_customfield_value) === 11) { - $cpf = $cpf_customfield_value; - } - // CNPJ no campo de CPF com um dígito a menos - elseif (strlen($cpf_customfield_value) === 13) { - $cpf = false; - $cnpj = '0' . $cpf_customfield_value; - } - // CNPJ no campo de CPF - elseif (strlen($cpf_customfield_value) === 14) { - $cpf = false; - $cnpj = $cpf_customfield_value; - } - // cadastro não possui CPF - elseif (!$cpf_customfield_value || strlen($cpf_customfield_value) !== 10 || strlen($cpf_customfield_value) !== 11 || strlen($cpf_customfield_value) != 13 || strlen($cpf_customfield_value) !== 14) { - $cpf = false; - } - // CNPJ com 1 nº a menos, adiciona 0 antes do documento - if (strlen($cnpj_customfield_value) === 13) { - $cnpj = '0' . $cnpj_customfield_value; - } - // CNPJ com nº de dígitos correto - elseif (strlen($cnpj_customfield_value) === 14) { - $cnpj = $cnpj_customfield_value; - } - // Cliente não possui CNPJ - elseif (!$cnpj_customfield_value and strlen($cnpj_customfield_value) !== 14 and strlen($cnpj_customfield_value) !== 13 and strlen($cpf_customfield_value) !== 13 and strlen($cpf_customfield_value) !== 14) { - $cnpj = false; - } - if (($cpf and $cnpj) or (!$cpf and $cnpj)) { - $custumer['doc_type'] = 2; - $custumer['document'] = $cnpj; - if ($client->companyname) { - $custumer['name'] = $client->companyname; - } elseif (!$client->companyname) { - $custumer['name'] = $client->firstname . ' ' . $client->lastname; - } - } elseif ($cpf and !$cnpj) { - $custumer['doc_type'] = 1; - $custumer['document'] = $cpf; - $custumer['name'] = $client->firstname . ' ' . $client->lastname; - } - if ($insc_customfield_value != 'NF') { - $custumer['insc_municipal'] = $insc_customfield_value; - } - if (!$cpf and !$cnpj) { - $error = 'CPF e/ou CNPJ ausente.'; - logModuleCall('nfeio_serviceinvoices', 'nf_customer_error', $custumer, $error); + $cpfIsValid = Validations::validateCPF($cpfCustomFieldValue); + $cnpjIsValid = Validations::validateCNPJ($cnpjCustomFieldValue); + + if (!$cpfIsValid && !$cnpjIsValid) { + $error = true; + $message = 'Documento cadastrado não é um CPF ou CNPJ válido.'; + $result['error'] = $error; + $result['message'] = $message; + return $result; } - if (!$error) { - return $custumer; + + $cpf = preg_replace('/[^0-9]/', '', $cpfCustomFieldValue); + $cnpj = preg_replace('/[^0-9]/', '', $cnpjCustomFieldValue); + $inscMunicipal = $inscMunicipalCustomFieldValue ? trim($inscMunicipalCustomFieldValue) : false; + + // adiciona a inscricao municipal ao retorno apenas se existir um valor registrado e documento for CNPJ + if ($inscMunicipal && $cnpjIsValid) { + $result['insc_municipal'] = $inscMunicipalCustomFieldValue; } - if ($error) { - logModuleCall('nfeio_serviceinvoices', 'nf_customer_error', $custumer, $error); - return $custumer['error'] = $error; + if ($cpfIsValid) { + $result['success'] = true; + $result['doc_type'] = 1; + $result['document'] = $cpf; + $result['name'] = $client->firstname . ' ' . $client->lastname; + } elseif ($cnpjIsValid) { + $result['success'] = true; + $result['doc_type'] = 2; + $result['document'] = $cnpj; + $result['name'] = $client->companyname ? $client->companyname : $client->firstname . ' ' . $client->lastname; + } else { + $result['error'] = true; + $result['message'] = 'Documento cadastrado não é um CPF ou CNPJ válido.'; } + + + /** + * // Cliente possui CPF e CNPJ + * // CPF com 1 nº a menos, adiciona 0 antes do documento + * if (strlen($cpf_customfield_value) === 10) { + * $cpf = '0' . $cpf_customfield_value; + * } + * // CPF com 11 dígitos + * elseif (strlen($cpf_customfield_value) === 11) { + * $cpf = $cpf_customfield_value; + * } + * // CNPJ no campo de CPF com um dígito a menos + * elseif (strlen($cpf_customfield_value) === 13) { + * $cpf = false; + * $cnpj = '0' . $cpf_customfield_value; + * } + * // CNPJ no campo de CPF + * elseif (strlen($cpf_customfield_value) === 14) { + * $cpf = false; + * $cnpj = $cpf_customfield_value; + * } + * // cadastro não possui CPF + * elseif (!$cpf_customfield_value || strlen($cpf_customfield_value) !== 10 || strlen($cpf_customfield_value) !== 11 || strlen($cpf_customfield_value) != 13 || strlen($cpf_customfield_value) !== 14) { + * $cpf = false; + * } + * // CNPJ com 1 nº a menos, adiciona 0 antes do documento + * if (strlen($cnpj_customfield_value) === 13) { + * $cnpj = '0' . $cnpj_customfield_value; + * } + * // CNPJ com nº de dígitos correto + * elseif (strlen($cnpj_customfield_value) === 14) { + * $cnpj = $cnpj_customfield_value; + * } + * // Cliente não possui CNPJ + * elseif (!$cnpj_customfield_value and strlen($cnpj_customfield_value) !== 14 and strlen($cnpj_customfield_value) !== 13 and strlen($cpf_customfield_value) !== 13 and strlen($cpf_customfield_value) !== 14) { + * $cnpj = false; + * } + * if (($cpf and $cnpj) or (!$cpf and $cnpj)) { + * $custumer['doc_type'] = 2; + * $custumer['document'] = $cnpj; + * if ($client->companyname) { + * $custumer['name'] = $client->companyname; + * } elseif (!$client->companyname) { + * $custumer['name'] = $client->firstname . ' ' . $client->lastname; + * } + * } elseif ($cpf and !$cnpj) { + * $custumer['doc_type'] = 1; + * $custumer['document'] = $cpf; + * $custumer['name'] = $client->firstname . ' ' . $client->lastname; + * } + * if ($insc_customfield_value != 'NF') { + * $custumer['insc_municipal'] = $insc_customfield_value; + * } + * if (!$cpf and !$cnpj) { + * $error = 'CPF e/ou CNPJ ausente.'; + * logModuleCall('nfeio_serviceinvoices', 'customer_error', $custumer, $error); + * } + * if (!$error) { + * return $custumer; + * } + * if ($error) { + * logModuleCall('nfeio_serviceinvoices', 'customer_error', $custumer, $error); + * + * return $custumer['error'] = $error; + * } */ + + + return $result; } function gnfe_customfields() @@ -167,20 +231,34 @@ function gnfe_ibge($zip) { $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, 'https://open.nfe.io/v1/cities/' . $zip . '/postalcode'); - curl_setopt($curl, CURLOPT_TIMEOUT, 30); + curl_setopt($curl, CURLOPT_TIMEOUT, 5); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); $response = curl_exec($curl); - $err = curl_error($curl); - + $error = curl_error($curl); curl_close($curl); - $city = json_decode(json_encode(json_decode($response))); - if ($city->message || $err) { - logModuleCall('nfeio_serviceinvoices', 'ibge_error', $zip, $response); - return 'ERROR'; + $data = json_decode($response); + $result = []; + + // se curl apresentar erro retorna imediatamente + if($error){ + $result['error'] = true; + $result['message'] = $error; + return $result; + } + + if ($data->city->code) { + $result['code'] = $data->city->code; + $result['success'] = true; + } else { - return $city->city->code; + $result['error'] = true; + $result['message'] = $data->message; + logModuleCall('nfeio_serviceinvoices', 'ibge_error', $zip, array('response' => $response, 'error' => $error)); + } + + return $result; } function gnfe_queue_nfe($invoice_id, $create_all = false) @@ -240,7 +318,7 @@ function gnfe_issue_nfe($postfields) $check_webhook = $this->gnfe_check_webhook($gnfe_webhook_id); if ($check_webhook == null) { - return (object) ['message' => 'Erro ao checar a existência de um webhook já cadastrado']; + return (object)['message' => 'Erro ao checar a existência de um webhook já cadastrado']; } if ($check_webhook == "ERRO 400" || $check_webhook == "ERRO 404") { @@ -248,11 +326,11 @@ function gnfe_issue_nfe($postfields) } } - if ($gnfe_webhook_id and (string) $check_webhook['hooks']['url'] !== (string) $webhook_url) { + if ($gnfe_webhook_id and (string)$check_webhook['hooks']['url'] !== (string)$webhook_url) { $delete_webhook = $this->gnfe_delete_webhook($gnfe_webhook_id); if ($delete_webhook == null) { - return (object) ['message' => 'Erro ao deletar webhook que estava com a url divergente']; + return (object)['message' => 'Erro ao deletar webhook que estava com a url divergente']; } $gnfe_webhook_id = null; @@ -262,7 +340,7 @@ function gnfe_issue_nfe($postfields) $create_webhook = $this->gnfe_create_webhook($webhook_url); if ($create_webhook == null) { - return (object) ['message' => 'Erro ao criar novo webhook']; + return (object)['message' => 'Erro ao criar novo webhook']; } if ($create_webhook['hooks']['id']) { @@ -286,7 +364,7 @@ function gnfe_issue_nfe($postfields) if ($error) { logModuleCall('nfeio_serviceinvoices', 'nf_issue_curl_error', $postfields, ['error' => $error, 'response' => $response, 'info' => $info], '', ''); - return (object) ['message' => $error, 'info' => $info]; + return (object)['message' => $error, 'info' => $info]; } else { logModuleCall('nfeio_serviceinvoices', 'nf_issue_curl_success', $postfields, $response, json_decode($response, true), ''); return json_decode(json_encode(json_decode($response))); @@ -305,14 +383,14 @@ function gnfe_get_company_info($set = false) curl_setopt_array( $curl, [ - CURLOPT_URL => 'https://api.nfe.io/v1/companies/' . $this->gnfe_config('company_id'), - CURLOPT_TIMEOUT => 30, - CURLOPT_RETURNTRANSFER => true, - CURLOPT_HTTPHEADER => [ - 'Content-Type: application/json', - 'Accept: application/json', - 'Authorization: ' . $this->gnfe_config('api_key') - ] + CURLOPT_URL => 'https://api.nfe.io/v1/companies/' . $this->gnfe_config('company_id'), + CURLOPT_TIMEOUT => 30, + CURLOPT_RETURNTRANSFER => true, + CURLOPT_HTTPHEADER => [ + 'Content-Type: application/json', + 'Accept: application/json', + 'Authorization: ' . $this->gnfe_config('api_key') + ] ] ); @@ -470,9 +548,9 @@ function gnfe_update_nfe($nfe, $user_id, $invoice_id, $pdf, $created_at, $update /** * Returns the data of a invoice from the local WHMCS database. * - * @var $invoice_id - * @var $values * @return string + * @var $values + * @var $invoice_id */ function gnfe_get_local_nfe($invoice_id, $values) { @@ -523,7 +601,7 @@ function gnfe_create_webhook($url) curl_setopt($curl, CURLOPT_HTTPHEADER, ['Content-Type: application/json', 'Accept: aplication/json', 'Authorization: ' . $this->gnfe_config('api_key')]); curl_setopt($curl, CURLOPT_TIMEOUT, 30); curl_setopt($curl, CURLOPT_POST, 1); - curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode(['url' => $url, 'contentType' => 'application/json', 'secret' => (string)time(), 'events' => ['issue', 'cancel', 'WaitingCalculateTaxes'], 'status' => 'Active', ])); + curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode(['url' => $url, 'contentType' => 'application/json', 'secret' => (string)time(), 'events' => ['issue', 'cancel', 'WaitingCalculateTaxes'], 'status' => 'Active',])); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); $response = curl_exec($curl); $info = curl_getinfo($curl); @@ -686,8 +764,8 @@ function update_status_nfe($invoice_id, $status) /** - * @var string $invoiceId vem do arquivo hooks.php. * @return string + * @var string $invoiceId vem do arquivo hooks.php. */ function gnfe_get_client_issue_invoice_cond_from_invoice_id($invoiceId) { @@ -715,8 +793,8 @@ function gnfe_get_client_issue_invoice_cond_from_invoice_id($invoiceId) * Returns a -
+
From 26a3796490073b19725432c05ddb50890c3e1a09 Mon Sep 17 00:00:00 2001 From: "Luiz NFE.io" <74252574+luiznfeio@users.noreply.github.com> Date: Fri, 26 Apr 2024 11:06:04 -0300 Subject: [PATCH 19/25] Delete case sensitive unused file (duplicated) (#157) --- .../lib/vendor/nfe/nfe/test/Nfe.php | 17 ----------------- 1 file changed, 17 deletions(-) delete mode 100755 modules/addons/NFEioServiceInvoices/lib/vendor/nfe/nfe/test/Nfe.php diff --git a/modules/addons/NFEioServiceInvoices/lib/vendor/nfe/nfe/test/Nfe.php b/modules/addons/NFEioServiceInvoices/lib/vendor/nfe/nfe/test/Nfe.php deleted file mode 100755 index 9050c09..0000000 --- a/modules/addons/NFEioServiceInvoices/lib/vendor/nfe/nfe/test/Nfe.php +++ /dev/null @@ -1,17 +0,0 @@ - Date: Sun, 28 Apr 2024 17:35:32 -0300 Subject: [PATCH 20/25] style: remocao de codigo comentado --- .../addons/NFEioServiceInvoices/lib/templates/admin/index.tpl | 3 --- 1 file changed, 3 deletions(-) diff --git a/modules/addons/NFEioServiceInvoices/lib/templates/admin/index.tpl b/modules/addons/NFEioServiceInvoices/lib/templates/admin/index.tpl index 9b503e1..e08a1a3 100644 --- a/modules/addons/NFEioServiceInvoices/lib/templates/admin/index.tpl +++ b/modules/addons/NFEioServiceInvoices/lib/templates/admin/index.tpl @@ -115,9 +115,6 @@
{if $nota->issue_note_conditions} -{* *}

{$nota->issue_note_conditions}

{/if} From 3c1dee41af858311254d61709d53ad0bc9c96b6c Mon Sep 17 00:00:00 2001 From: Andre Kutianski Date: Wed, 29 May 2024 19:46:55 -0300 Subject: [PATCH 21/25] refact: #156 refatora propriedades de colunas de timestamp Este commit refatora as propriedades das colunas de timestamp para o controle manual dos valores. Isso foi necessario para garantir interoperabilidade entre bancos em MariaDB e MySQL devido as diferentes formas na tratativa do valor para timestamps, o que poderia levar a inconsistencias do registro dependendo das definicoes de fuso horario do banco e PHP. ref: #156 --- .gitignore | 2 ++ .../lib/Configuration.php | 2 +- .../lib/Helpers/Timestamp.php | 17 ++++++++++ .../lib/Hooks/AfterCronJob.php | 3 +- .../lib/Legacy/Functions.php | 6 +++- .../lib/Migrations/Migrations.php | 33 ++++++++++++++----- .../lib/Models/Aliquots/Repository.php | 6 ++-- .../lib/Models/ProductCode/Repository.php | 6 ++-- .../lib/Models/ServiceInvoices/Repository.php | 13 ++++++-- .../NFEioServiceInvoices/lib/NFEio/Nfe.php | 7 +++- .../addons/NFEioServiceInvoices/whmcs.json | 2 +- 11 files changed, 74 insertions(+), 23 deletions(-) create mode 100644 modules/addons/NFEioServiceInvoices/lib/Helpers/Timestamp.php diff --git a/.gitignore b/.gitignore index f8cd337..7323189 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,7 @@ composer.phar .idea +.scripts +whmcs rsync-dev1.sh rsync-dev2.sh *.zip diff --git a/modules/addons/NFEioServiceInvoices/lib/Configuration.php b/modules/addons/NFEioServiceInvoices/lib/Configuration.php index a0f6054..1e4e1b5 100644 --- a/modules/addons/NFEioServiceInvoices/lib/Configuration.php +++ b/modules/addons/NFEioServiceInvoices/lib/Configuration.php @@ -22,7 +22,7 @@ final class Configuration extends \WHMCSExpert\mtLibs\process\AbstractConfigurat private $encryptHash = ''; - public $version = '2.1.8'; + public $version = '2.2.0'; public $tablePrefix = 'mod_nfeio_si_'; diff --git a/modules/addons/NFEioServiceInvoices/lib/Helpers/Timestamp.php b/modules/addons/NFEioServiceInvoices/lib/Helpers/Timestamp.php new file mode 100644 index 0000000..7ba4a08 --- /dev/null +++ b/modules/addons/NFEioServiceInvoices/lib/Helpers/Timestamp.php @@ -0,0 +1,17 @@ +config->getStorageKey(); $serviceInvoicesTable = $this->serviceInvoicesRepo->tableName(); $storage = new \WHMCSExpert\Addon\Storage($storageKey); - $dataAtual = date('Y-m-d H:i:s'); + $dataAtual = Timestamp::currentTimestamp(); // caso não exista valor para initial_date inicia define data que garanta a execução da rotina $initialDate = (! empty($storage->get('initial_date'))) ? $storage->get('initial_date') : '1970-01-01 00:00:00'; diff --git a/modules/addons/NFEioServiceInvoices/lib/Legacy/Functions.php b/modules/addons/NFEioServiceInvoices/lib/Legacy/Functions.php index 49b4915..67d1c0d 100644 --- a/modules/addons/NFEioServiceInvoices/lib/Legacy/Functions.php +++ b/modules/addons/NFEioServiceInvoices/lib/Legacy/Functions.php @@ -2,6 +2,7 @@ namespace NFEioServiceInvoices\Legacy; +use NFEioServiceInvoices\Helpers\Timestamp; use WHMCS\Database\Capsule; use NFEioServiceInvoices\Addon; use NFEioServiceInvoices\Helpers\Validations; @@ -681,7 +682,10 @@ function update_status_nfe($invoice_id, $status) $_tableName = $serviceInvoicesRepo->tableName(); try { - $return = Capsule::table($_tableName)->where('invoice_id', '=', $invoice_id)->update(['status' => $status]); + $return = Capsule::table($_tableName)->where('invoice_id', '=', $invoice_id)->update([ + 'status' => $status, + 'updated_at' => Timestamp::currentTimestamp(), + ]); return $return; } catch (Exception $e) { return $e->getMessage(); diff --git a/modules/addons/NFEioServiceInvoices/lib/Migrations/Migrations.php b/modules/addons/NFEioServiceInvoices/lib/Migrations/Migrations.php index 726605a..01b6f66 100644 --- a/modules/addons/NFEioServiceInvoices/lib/Migrations/Migrations.php +++ b/modules/addons/NFEioServiceInvoices/lib/Migrations/Migrations.php @@ -206,17 +206,14 @@ public static function migrateProductCodes() * * @param PDO $pdo The PDO object for database connection * @param string $columnName The name of the column to be altered - * @param string $alterStatement The ALTER statement for the column * @return void */ - private function createAlterColumnTimestampStatement($pdo, $columnName, $alterStatement, $tableName) + private function createAlterColumnTimestampStatement($pdo, $columnName, $tableName) { $statement = $pdo->prepare( - sprintf('ALTER TABLE %s CHANGE %s %s TIMESTAMP NOT NULL DEFAULT %s', + sprintf('ALTER TABLE %s MODIFY COLUMN %s TIMESTAMP NULL', $tableName, - $columnName, - $columnName, - $alterStatement + $columnName ) ); $statement->execute(); @@ -235,15 +232,21 @@ public static function migrateTimestampColumns(string $tableName) $pdo->beginTransaction(); try { $self = new self(); - $self->createAlterColumnTimestampStatement($pdo, 'created_at', 'CURRENT_TIMESTAMP', $tableName); - $self->createAlterColumnTimestampStatement($pdo, 'updated_at', 'CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP', $tableName); + $self->createAlterColumnTimestampStatement($pdo, 'created_at', $tableName); + $self->createAlterColumnTimestampStatement($pdo, 'updated_at', $tableName); if ($pdo->inTransaction()) { $pdo->commit(); + logModuleCall( + 'nfeio_serviceinvoices', + 'migrateTimestampColumns', + $tableName, + 'success' + ); } } catch (\Exception $e) { logModuleCall( 'nfeio_serviceinvoices', - 'upgradeServiceInvoicesTimestampColumns_error', + 'migrateTimestampColumns', $e->getMessage(), $e->getTraceAsString() ); @@ -266,6 +269,18 @@ public static function changeProductCodeTimestampColumnsName() if (Capsule::schema()->hasTable('mod_nfeio_si_productcode')) { + // verifica se a coluna create_at e update_at já foram migradas (existem) + $columns = Capsule::schema()->getColumnListing('mod_nfeio_si_productcode'); + if (!in_array('create_at', $columns) || !in_array('update_at', $columns)) { + logModuleCall( + 'nfeio_serviceinvoices', + 'changeProductCodeTimestampColumnsName', + 'nothing to do, columns already exist', + '' + ); + return; + } + $pdo = Capsule::connection()->getPdo(); $pdo->beginTransaction(); try { diff --git a/modules/addons/NFEioServiceInvoices/lib/Models/Aliquots/Repository.php b/modules/addons/NFEioServiceInvoices/lib/Models/Aliquots/Repository.php index d39ceea..83d8f54 100644 --- a/modules/addons/NFEioServiceInvoices/lib/Models/Aliquots/Repository.php +++ b/modules/addons/NFEioServiceInvoices/lib/Models/Aliquots/Repository.php @@ -93,13 +93,13 @@ function ($table) { $table->string('code_service', 30); // retenção de ISS $table->float('iss_held', 5, 2)->nullable(); - $table->timestamp('created_at')->useCurrent(); - $table->timestamp('updated_at')->useCurrent(); + $table->timestamp('created_at')->nullable(); + $table->timestamp('updated_at')->nullable(); } ); // Adiciona a coluna updated_at com a configuração de auto update #156 - $db->statement(sprintf('ALTER TABLE %s CHANGE updated_at updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP', $this->tableName)); +// $db->statement(sprintf('ALTER TABLE %s CHANGE updated_at updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP', $this->tableName)); } } diff --git a/modules/addons/NFEioServiceInvoices/lib/Models/ProductCode/Repository.php b/modules/addons/NFEioServiceInvoices/lib/Models/ProductCode/Repository.php index 9b5c14c..bd37d8c 100644 --- a/modules/addons/NFEioServiceInvoices/lib/Models/ProductCode/Repository.php +++ b/modules/addons/NFEioServiceInvoices/lib/Models/ProductCode/Repository.php @@ -120,14 +120,14 @@ function ($table) { $table->increments('id'); $table->integer('product_id'); $table->string('code_service', 30); - $table->timestamp('created_at')->useCurrent(); - $table->timestamp('updated_at')->useCurrent(); + $table->timestamp('created_at')->nullable(); + $table->timestamp('updated_at')->nullable(); $table->integer('ID_user'); } ); // Adiciona a coluna updated_at com a configuração de auto update #156 - $db->statement(sprintf('ALTER TABLE %s CHANGE updated_at updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP', $this->tableName)); +// $db->statement(sprintf('ALTER TABLE %s CHANGE updated_at updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP', $this->tableName)); } } diff --git a/modules/addons/NFEioServiceInvoices/lib/Models/ServiceInvoices/Repository.php b/modules/addons/NFEioServiceInvoices/lib/Models/ServiceInvoices/Repository.php index 60e5ef0..161fdeb 100644 --- a/modules/addons/NFEioServiceInvoices/lib/Models/ServiceInvoices/Repository.php +++ b/modules/addons/NFEioServiceInvoices/lib/Models/ServiceInvoices/Repository.php @@ -3,6 +3,7 @@ namespace NFEioServiceInvoices\Models\ServiceInvoices; use Illuminate\Database\Capsule\Manager as Capsule; +use NFEioServiceInvoices\Helpers\Timestamp; /** * Classe responsável pela definição do modelo de dados e operações @@ -118,8 +119,8 @@ function ($table) { $table->string('pdf'); $table->string('rpsSerialNumber'); $table->string('rpsNumber'); - $table->timestamp('created_at')->useCurrent(); - $table->timestamp('updated_at')->useCurrent(); + $table->timestamp('created_at')->nullable(); + $table->timestamp('updated_at')->nullable(); $table->string('service_code', 30)->nullable(true); $table->string('tics')->nullable(true); } @@ -127,7 +128,7 @@ function ($table) { } // Adiciona a coluna updated_at com a configuração de auto update #156 - $db->statement(sprintf('ALTER TABLE %s CHANGE updated_at updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP', $this->tableName)); +// $db->statement(sprintf('ALTER TABLE %s CHANGE updated_at updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP', $this->tableName)); } @@ -264,6 +265,9 @@ public function updateNfStatusByExternalId($externalId, $status, $flowStatus = n $data['flow_status'] = $flowStatus; } + // adiciona a data de atualização #156 + $data['updated_at'] = Timestamp::currentTimestamp(); + try { Capsule::table($this->tableName) ->where('nfe_external_id', $externalId) @@ -304,6 +308,9 @@ public function updateNfStatusByNfeId($nfeId, $status, $flowStatus = null) $data['flow_status'] = $flowStatus; } + // adiciona a data de atualização #156 + $data['updated_at'] = Timestamp::currentTimestamp(); + try { Capsule::table($this->tableName) ->where('nfe_id', $nfeId) diff --git a/modules/addons/NFEioServiceInvoices/lib/NFEio/Nfe.php b/modules/addons/NFEioServiceInvoices/lib/NFEio/Nfe.php index 41f02da..7799767 100644 --- a/modules/addons/NFEioServiceInvoices/lib/NFEio/Nfe.php +++ b/modules/addons/NFEioServiceInvoices/lib/NFEio/Nfe.php @@ -2,6 +2,7 @@ namespace NFEioServiceInvoices\NFEio; +use NFEioServiceInvoices\Helpers\Timestamp; use WHMCS\Database\Capsule; /** @@ -304,6 +305,10 @@ public function queue($invoiceId, $reissue = false) continue; } + // timestamps + $nf['created_at'] = Timestamp::currentTimestamp(); + $nf['updated_at'] = Timestamp::currentTimestamp(); + $result = Capsule::table($this->serviceInvoicesTable)->insert($nf); logModuleCall('nfeio_serviceinvoices', 'nf_queue', $nf, $result); } @@ -333,7 +338,7 @@ public function emit($data) // se dados do cliente retornarem erro, atualiza status da NF e para emissao if ($customer['error']) { - $this->legacyFunctions->update_status_nfe($invoiceId, 'Doc_Error'); + $this->updateLocalNfeStatusByExternalId($externalId, 'Doc_Error'); logModuleCall('nfeio_serviceinvoices', 'nf_emit_error', $data, $customer); return; } diff --git a/modules/addons/NFEioServiceInvoices/whmcs.json b/modules/addons/NFEioServiceInvoices/whmcs.json index a143b73..b6dcaa2 100644 --- a/modules/addons/NFEioServiceInvoices/whmcs.json +++ b/modules/addons/NFEioServiceInvoices/whmcs.json @@ -3,7 +3,7 @@ "type": "whmcs-addons", "name": "NFEioServiceInvoices", "license": "MIT", - "category": "utilities", + "category": "finance", "description": { "name": "NFE.io NFSe", "tagline": "Automatize a emissão de notas fiscais no WHMCS com a NFE.io", From 0fc968b0ce65ba21feeb21d5aeb1ae4d911b839a Mon Sep 17 00:00:00 2001 From: Andre Kutianski Date: Wed, 29 May 2024 20:25:37 -0300 Subject: [PATCH 22/25] fix(callback): corrige verificacao de cabecalho para assinatura Este commit implementa uma verificacao estendida dos cabecalhos para verificar o valor da assinatura do webhook. Esta correcao foi necessaria devido a possibilidade de alguns servidores web ou load balancers reescreverem os cabecalhos e podendo levar a falha na validacao. --- modules/addons/NFEioServiceInvoices/callback.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/modules/addons/NFEioServiceInvoices/callback.php b/modules/addons/NFEioServiceInvoices/callback.php index 1db7b5c..fea5d14 100644 --- a/modules/addons/NFEioServiceInvoices/callback.php +++ b/modules/addons/NFEioServiceInvoices/callback.php @@ -31,9 +31,17 @@ // armazena o cabecalho da requisição $headers = getallheaders(); -// calcula o hmac da requisição +function findSignatureHeader($headers) +{ + // normaliza todos os cabecalhos para lowercase + $headers = array_change_key_case($headers, CASE_LOWER); + // retorna os possiveis cabecalhos de assinatura da requisicao (X-Hub-Signature e X-Nfeio-Signature) + return $headers['x-hub-signature'] ?? $headers['x-nfeio-signature'] ?? null; + +} + // cabecalho com a assinatura -$signature = $headers['X-Hub-Signature']; +$signature = findSignatureHeader($headers); // corpo da requisição $body = file_get_contents('php://input'); From 7427feebf24386200bad5e180c438172e95fbc2a Mon Sep 17 00:00:00 2001 From: Andre Kutianski Date: Tue, 11 Jun 2024 14:31:56 -0300 Subject: [PATCH 23/25] refact: altera acoes da nota na visualizacao da fatura Este commit altera o comportamento das acoes de cancelamento e reemissao da nota na visualizacao da fatura para prevenir a re-submissao da acao quando administrador tentar atualizar a pagina apos envio do POST com o comando. ref: #160 --- .../lib/Hooks/AdminInvoicesControlsOutput.php | 8 ++--- .../admin/admininvoicescontrolsoutput.tpl | 35 +++++++++++++++++-- 2 files changed, 37 insertions(+), 6 deletions(-) diff --git a/modules/addons/NFEioServiceInvoices/lib/Hooks/AdminInvoicesControlsOutput.php b/modules/addons/NFEioServiceInvoices/lib/Hooks/AdminInvoicesControlsOutput.php index 4a90b2a..d7f5472 100644 --- a/modules/addons/NFEioServiceInvoices/lib/Hooks/AdminInvoicesControlsOutput.php +++ b/modules/addons/NFEioServiceInvoices/lib/Hooks/AdminInvoicesControlsOutput.php @@ -56,18 +56,18 @@ public function run() if ($request === 'reissue') { $result = $nfe->queue($this->invoiceId, true); if ($result['success']) { - $msg->success('Nota adicionada a fila para reemissão.'); + $msg->success('Nota adicionada a fila para reemissão.', $urn . '&nfeioreissue=true'); } else { - $msg->error("Problemas ao tentar reemitir a nota: {$result['message']}"); + $msg->error("Problemas ao tentar reemitir a nota: {$result['message']}", $urn . '&nfeioreissue=true'); } } if ($request === 'cancel') { $result = $nfe->cancelNfSeriesByInvoiceId($this->invoiceId); if ($result['status'] === 'success') { - $msg->info("Nota enviada para cancelamento, por favor aguarde."); + $msg->info("Nota enviada para cancelamento, por favor aguarde.", $urn . '&nfeiocancel=true'); } else { - $msg->warning("Nota fiscal cancelada, mas com aviso: {$result['message']}."); + $msg->warning("Nota fiscal cancelada, mas com aviso: {$result['message']}.", $urn . '&nfeiocancel=true'); } } diff --git a/modules/addons/NFEioServiceInvoices/lib/templates/admin/admininvoicescontrolsoutput.tpl b/modules/addons/NFEioServiceInvoices/lib/templates/admin/admininvoicescontrolsoutput.tpl index 6e6c191..ca18685 100644 --- a/modules/addons/NFEioServiceInvoices/lib/templates/admin/admininvoicescontrolsoutput.tpl +++ b/modules/addons/NFEioServiceInvoices/lib/templates/admin/admininvoicescontrolsoutput.tpl @@ -59,6 +59,17 @@

+ {if $smarty.get.nfeioreissue == true} + + + {/if} + {if $smarty.get.nfeiocancel == true} + + {/if}
{if $totalServiceInvoices > 0}
@@ -80,10 +91,30 @@ {if $hasAllNfCancelled} - + {/if} {if !$hasAllNfCancelled} - + {/if} From a8da25d8a31661768bf4165708eecd4e52f97fb0 Mon Sep 17 00:00:00 2001 From: Andre Kutianski Date: Tue, 11 Jun 2024 20:30:06 -0300 Subject: [PATCH 24/25] chore(dependencies): atualiza dependencias do projeto --- composer.json | 14 +- composer.lock | 506 ++++++++++++++++++++++++++++++++------------------ 2 files changed, 330 insertions(+), 190 deletions(-) diff --git a/composer.json b/composer.json index 23c49a9..7e94b48 100644 --- a/composer.json +++ b/composer.json @@ -1,8 +1,8 @@ { "require": { - "whmcsexpert/whmcsexpert": "^1.1.7", - "plasticbrain/php-flash-messages": "^1", - "guzzlehttp/psr7": "^1.8", + "whmcsexpert/whmcsexpert": "1.1.7", + "plasticbrain/php-flash-messages": "~1", + "guzzlehttp/psr7": "~1.9", "ext-curl": "*", "php": ">=7.4", "nfe/nfe": "^2.5", @@ -10,11 +10,11 @@ }, "require-dev": { "phpunit/phpunit": "@stable", - "kint-php/kint": "*", - "tracy/tracy": "2.7.6", - "phpmetrics/phpmetrics": "^2.7", + "kint-php/kint": "~5.0", + "tracy/tracy": "~2.7", + "phpmetrics/phpmetrics": "~2.8", "illuminate/database": "v5.8.36", - "squizlabs/php_codesniffer": "^3.7" + "squizlabs/php_codesniffer": "~3.7" }, "config": { "vendor-dir": "modules/addons/NFEioServiceInvoices/lib/vendor", diff --git a/composer.lock b/composer.lock index 2bccf72..d2e1f59 100644 --- a/composer.lock +++ b/composer.lock @@ -4,20 +4,20 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "9897988dffebd0816f5a06a49ad9ddcf", + "content-hash": "9d3328eb7139b63c91b644b63fb21216", "packages": [ { "name": "guzzlehttp/psr7", - "version": "1.9.0", + "version": "1.9.1", "source": { "type": "git", "url": "https://github.com/guzzle/psr7.git", - "reference": "e98e3e6d4f86621a9b75f623996e6bbdeb4b9318" + "reference": "e4490cabc77465aaee90b20cfc9a770f8c04be6b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/psr7/zipball/e98e3e6d4f86621a9b75f623996e6bbdeb4b9318", - "reference": "e98e3e6d4f86621a9b75f623996e6bbdeb4b9318", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/e4490cabc77465aaee90b20cfc9a770f8c04be6b", + "reference": "e4490cabc77465aaee90b20cfc9a770f8c04be6b", "shasum": "" }, "require": { @@ -36,11 +36,6 @@ "laminas/laminas-httphandlerrunner": "Emit PSR-7 responses" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.9-dev" - } - }, "autoload": { "files": [ "src/functions_include.php" @@ -98,7 +93,7 @@ ], "support": { "issues": "https://github.com/guzzle/psr7/issues", - "source": "https://github.com/guzzle/psr7/tree/1.9.0" + "source": "https://github.com/guzzle/psr7/tree/1.9.1" }, "funding": [ { @@ -114,7 +109,7 @@ "type": "tidelift" } ], - "time": "2022-06-20T21:43:03+00:00" + "time": "2023-04-17T16:00:37+00:00" }, { "name": "nfe/nfe", @@ -223,25 +218,25 @@ }, { "name": "psr/http-message", - "version": "1.0.1", + "version": "1.1", "source": { "type": "git", "url": "https://github.com/php-fig/http-message.git", - "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363" + "reference": "cb6ce4845ce34a8ad9e68117c10ee90a29919eba" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363", - "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363", + "url": "https://api.github.com/repos/php-fig/http-message/zipball/cb6ce4845ce34a8ad9e68117c10ee90a29919eba", + "reference": "cb6ce4845ce34a8ad9e68117c10ee90a29919eba", "shasum": "" }, "require": { - "php": ">=5.3.0" + "php": "^7.2 || ^8.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "1.1.x-dev" } }, "autoload": { @@ -270,9 +265,9 @@ "response" ], "support": { - "source": "https://github.com/php-fig/http-message/tree/master" + "source": "https://github.com/php-fig/http-message/tree/1.1" }, - "time": "2016-08-06T14:39:51+00:00" + "time": "2023-04-04T09:50:52+00:00" }, { "name": "ralouphie/getallheaders", @@ -364,6 +359,75 @@ } ], "packages-dev": [ + { + "name": "carbonphp/carbon-doctrine-types", + "version": "2.1.0", + "source": { + "type": "git", + "url": "https://github.com/CarbonPHP/carbon-doctrine-types.git", + "reference": "99f76ffa36cce3b70a4a6abce41dba15ca2e84cb" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/CarbonPHP/carbon-doctrine-types/zipball/99f76ffa36cce3b70a4a6abce41dba15ca2e84cb", + "reference": "99f76ffa36cce3b70a4a6abce41dba15ca2e84cb", + "shasum": "" + }, + "require": { + "php": "^7.4 || ^8.0" + }, + "conflict": { + "doctrine/dbal": "<3.7.0 || >=4.0.0" + }, + "require-dev": { + "doctrine/dbal": "^3.7.0", + "nesbot/carbon": "^2.71.0 || ^3.0.0", + "phpunit/phpunit": "^10.3" + }, + "type": "library", + "autoload": { + "psr-4": { + "Carbon\\Doctrine\\": "src/Carbon/Doctrine/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "KyleKatarn", + "email": "kylekatarnls@gmail.com" + } + ], + "description": "Types to use Carbon in Doctrine", + "keywords": [ + "carbon", + "date", + "datetime", + "doctrine", + "time" + ], + "support": { + "issues": "https://github.com/CarbonPHP/carbon-doctrine-types/issues", + "source": "https://github.com/CarbonPHP/carbon-doctrine-types/tree/2.1.0" + }, + "funding": [ + { + "url": "https://github.com/kylekatarnls", + "type": "github" + }, + { + "url": "https://opencollective.com/Carbon", + "type": "open_collective" + }, + { + "url": "https://tidelift.com/funding/github/packagist/nesbot/carbon", + "type": "tidelift" + } + ], + "time": "2023-12-11T17:09:12+00:00" + }, { "name": "doctrine/inflector", "version": "1.4.4", @@ -758,16 +822,16 @@ }, { "name": "kint-php/kint", - "version": "5.0.5", + "version": "5.1.1", "source": { "type": "git", "url": "https://github.com/kint-php/kint.git", - "reference": "1033fc4a5075e15b9b46be20c246069ab44bc243" + "reference": "8c5ec370c3382ceae0b88e91f9bbb00e6bb4f93b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/kint-php/kint/zipball/1033fc4a5075e15b9b46be20c246069ab44bc243", - "reference": "1033fc4a5075e15b9b46be20c246069ab44bc243", + "url": "https://api.github.com/repos/kint-php/kint/zipball/8c5ec370c3382ceae0b88e91f9bbb00e6bb4f93b", + "reference": "8c5ec370c3382ceae0b88e91f9bbb00e6bb4f93b", "shasum": "" }, "require": { @@ -778,8 +842,8 @@ "phpspec/prophecy-phpunit": "^2", "phpunit/phpunit": "^9", "seld/phar-utils": "^1", - "symfony/finder": "^4.0 || ^5.0 || ^6.0", - "vimeo/psalm": "^5@dev" + "symfony/finder": ">=4.0", + "vimeo/psalm": "^5" }, "suggest": { "kint-php/kint-helpers": "Provides extra helper functions", @@ -817,9 +881,9 @@ ], "support": { "issues": "https://github.com/kint-php/kint/issues", - "source": "https://github.com/kint-php/kint/tree/5.0.5" + "source": "https://github.com/kint-php/kint/tree/5.1.1" }, - "time": "2023-03-08T14:50:41+00:00" + "time": "2024-04-26T14:20:09+00:00" }, { "name": "myclabs/deep-copy", @@ -882,28 +946,33 @@ }, { "name": "nesbot/carbon", - "version": "2.66.0", + "version": "2.72.5", "source": { "type": "git", "url": "https://github.com/briannesbitt/Carbon.git", - "reference": "496712849902241f04902033b0441b269effe001" + "reference": "afd46589c216118ecd48ff2b95d77596af1e57ed" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/496712849902241f04902033b0441b269effe001", - "reference": "496712849902241f04902033b0441b269effe001", + "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/afd46589c216118ecd48ff2b95d77596af1e57ed", + "reference": "afd46589c216118ecd48ff2b95d77596af1e57ed", "shasum": "" }, "require": { + "carbonphp/carbon-doctrine-types": "*", "ext-json": "*", "php": "^7.1.8 || ^8.0", + "psr/clock": "^1.0", "symfony/polyfill-mbstring": "^1.0", "symfony/polyfill-php80": "^1.16", "symfony/translation": "^3.4 || ^4.0 || ^5.0 || ^6.0" }, + "provide": { + "psr/clock-implementation": "1.0" + }, "require-dev": { - "doctrine/dbal": "^2.0 || ^3.1.4", - "doctrine/orm": "^2.7", + "doctrine/dbal": "^2.0 || ^3.1.4 || ^4.0", + "doctrine/orm": "^2.7 || ^3.0", "friendsofphp/php-cs-fixer": "^3.0", "kylekatarnls/multi-tester": "^2.0", "ondrejmirtes/better-reflection": "*", @@ -920,8 +989,8 @@ "type": "library", "extra": { "branch-alias": { - "dev-3.x": "3.x-dev", - "dev-master": "2.x-dev" + "dev-master": "3.x-dev", + "dev-2.x": "2.x-dev" }, "laravel": { "providers": [ @@ -980,25 +1049,25 @@ "type": "tidelift" } ], - "time": "2023-01-29T18:53:47+00:00" + "time": "2024-06-03T19:18:41+00:00" }, { "name": "nikic/php-parser", - "version": "v4.15.4", + "version": "v4.19.1", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "6bb5176bc4af8bcb7d926f88718db9b96a2d4290" + "reference": "4e1b88d21c69391150ace211e9eaf05810858d0b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/6bb5176bc4af8bcb7d926f88718db9b96a2d4290", - "reference": "6bb5176bc4af8bcb7d926f88718db9b96a2d4290", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/4e1b88d21c69391150ace211e9eaf05810858d0b", + "reference": "4e1b88d21c69391150ace211e9eaf05810858d0b", "shasum": "" }, "require": { "ext-tokenizer": "*", - "php": ">=7.0" + "php": ">=7.1" }, "require-dev": { "ircmaxell/php-yacc": "^0.0.7", @@ -1034,26 +1103,27 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v4.15.4" + "source": "https://github.com/nikic/PHP-Parser/tree/v4.19.1" }, - "time": "2023-03-05T19:49:14+00:00" + "time": "2024-03-17T08:10:35+00:00" }, { "name": "phar-io/manifest", - "version": "2.0.3", + "version": "2.0.4", "source": { "type": "git", "url": "https://github.com/phar-io/manifest.git", - "reference": "97803eca37d319dfa7826cc2437fc020857acb53" + "reference": "54750ef60c58e43759730615a392c31c80e23176" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phar-io/manifest/zipball/97803eca37d319dfa7826cc2437fc020857acb53", - "reference": "97803eca37d319dfa7826cc2437fc020857acb53", + "url": "https://api.github.com/repos/phar-io/manifest/zipball/54750ef60c58e43759730615a392c31c80e23176", + "reference": "54750ef60c58e43759730615a392c31c80e23176", "shasum": "" }, "require": { "ext-dom": "*", + "ext-libxml": "*", "ext-phar": "*", "ext-xmlwriter": "*", "phar-io/version": "^3.0.1", @@ -1094,9 +1164,15 @@ "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", "support": { "issues": "https://github.com/phar-io/manifest/issues", - "source": "https://github.com/phar-io/manifest/tree/2.0.3" + "source": "https://github.com/phar-io/manifest/tree/2.0.4" }, - "time": "2021-07-20T11:28:43+00:00" + "funding": [ + { + "url": "https://github.com/theseer", + "type": "github" + } + ], + "time": "2024-03-03T12:33:53+00:00" }, { "name": "phar-io/version", @@ -1219,23 +1295,23 @@ }, { "name": "phpunit/php-code-coverage", - "version": "9.2.26", + "version": "9.2.31", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "443bc6912c9bd5b409254a40f4b0f4ced7c80ea1" + "reference": "48c34b5d8d983006bd2adc2d0de92963b9155965" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/443bc6912c9bd5b409254a40f4b0f4ced7c80ea1", - "reference": "443bc6912c9bd5b409254a40f4b0f4ced7c80ea1", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/48c34b5d8d983006bd2adc2d0de92963b9155965", + "reference": "48c34b5d8d983006bd2adc2d0de92963b9155965", "shasum": "" }, "require": { "ext-dom": "*", "ext-libxml": "*", "ext-xmlwriter": "*", - "nikic/php-parser": "^4.15", + "nikic/php-parser": "^4.18 || ^5.0", "php": ">=7.3", "phpunit/php-file-iterator": "^3.0.3", "phpunit/php-text-template": "^2.0.2", @@ -1284,7 +1360,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.26" + "security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy", + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.31" }, "funding": [ { @@ -1292,7 +1369,7 @@ "type": "github" } ], - "time": "2023-03-06T12:58:08+00:00" + "time": "2024-03-02T06:37:42+00:00" }, { "name": "phpunit/php-file-iterator", @@ -1537,16 +1614,16 @@ }, { "name": "phpunit/phpunit", - "version": "9.6.5", + "version": "9.6.19", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "86e761949019ae83f49240b2f2123fb5ab3b2fc5" + "reference": "a1a54a473501ef4cdeaae4e06891674114d79db8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/86e761949019ae83f49240b2f2123fb5ab3b2fc5", - "reference": "86e761949019ae83f49240b2f2123fb5ab3b2fc5", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/a1a54a473501ef4cdeaae4e06891674114d79db8", + "reference": "a1a54a473501ef4cdeaae4e06891674114d79db8", "shasum": "" }, "require": { @@ -1561,7 +1638,7 @@ "phar-io/manifest": "^2.0.3", "phar-io/version": "^3.0.2", "php": ">=7.3", - "phpunit/php-code-coverage": "^9.2.13", + "phpunit/php-code-coverage": "^9.2.28", "phpunit/php-file-iterator": "^3.0.5", "phpunit/php-invoker": "^3.1.1", "phpunit/php-text-template": "^2.0.3", @@ -1619,7 +1696,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.5" + "security": "https://github.com/sebastianbergmann/phpunit/security/policy", + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.19" }, "funding": [ { @@ -1635,7 +1713,55 @@ "type": "tidelift" } ], - "time": "2023-03-09T06:34:10+00:00" + "time": "2024-04-05T04:35:58+00:00" + }, + { + "name": "psr/clock", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/clock.git", + "reference": "e41a24703d4560fd0acb709162f73b8adfc3aa0d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/clock/zipball/e41a24703d4560fd0acb709162f73b8adfc3aa0d", + "reference": "e41a24703d4560fd0acb709162f73b8adfc3aa0d", + "shasum": "" + }, + "require": { + "php": "^7.0 || ^8.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Psr\\Clock\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interface for reading the clock.", + "homepage": "https://github.com/php-fig/clock", + "keywords": [ + "clock", + "now", + "psr", + "psr-20", + "time" + ], + "support": { + "issues": "https://github.com/php-fig/clock/issues", + "source": "https://github.com/php-fig/clock/tree/1.0.0" + }, + "time": "2022-11-25T14:36:26+00:00" }, { "name": "psr/container", @@ -1738,16 +1864,16 @@ }, { "name": "sebastian/cli-parser", - "version": "1.0.1", + "version": "1.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/cli-parser.git", - "reference": "442e7c7e687e42adc03470c7b668bc4b2402c0b2" + "reference": "2b56bea83a09de3ac06bb18b92f068e60cc6f50b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/442e7c7e687e42adc03470c7b668bc4b2402c0b2", - "reference": "442e7c7e687e42adc03470c7b668bc4b2402c0b2", + "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/2b56bea83a09de3ac06bb18b92f068e60cc6f50b", + "reference": "2b56bea83a09de3ac06bb18b92f068e60cc6f50b", "shasum": "" }, "require": { @@ -1782,7 +1908,7 @@ "homepage": "https://github.com/sebastianbergmann/cli-parser", "support": { "issues": "https://github.com/sebastianbergmann/cli-parser/issues", - "source": "https://github.com/sebastianbergmann/cli-parser/tree/1.0.1" + "source": "https://github.com/sebastianbergmann/cli-parser/tree/1.0.2" }, "funding": [ { @@ -1790,7 +1916,7 @@ "type": "github" } ], - "time": "2020-09-28T06:08:49+00:00" + "time": "2024-03-02T06:27:43+00:00" }, { "name": "sebastian/code-unit", @@ -1979,20 +2105,20 @@ }, { "name": "sebastian/complexity", - "version": "2.0.2", + "version": "2.0.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/complexity.git", - "reference": "739b35e53379900cc9ac327b2147867b8b6efd88" + "reference": "25f207c40d62b8b7aa32f5ab026c53561964053a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/739b35e53379900cc9ac327b2147867b8b6efd88", - "reference": "739b35e53379900cc9ac327b2147867b8b6efd88", + "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/25f207c40d62b8b7aa32f5ab026c53561964053a", + "reference": "25f207c40d62b8b7aa32f5ab026c53561964053a", "shasum": "" }, "require": { - "nikic/php-parser": "^4.7", + "nikic/php-parser": "^4.18 || ^5.0", "php": ">=7.3" }, "require-dev": { @@ -2024,7 +2150,7 @@ "homepage": "https://github.com/sebastianbergmann/complexity", "support": { "issues": "https://github.com/sebastianbergmann/complexity/issues", - "source": "https://github.com/sebastianbergmann/complexity/tree/2.0.2" + "source": "https://github.com/sebastianbergmann/complexity/tree/2.0.3" }, "funding": [ { @@ -2032,20 +2158,20 @@ "type": "github" } ], - "time": "2020-10-26T15:52:27+00:00" + "time": "2023-12-22T06:19:30+00:00" }, { "name": "sebastian/diff", - "version": "4.0.4", + "version": "4.0.6", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "3461e3fccc7cfdfc2720be910d3bd73c69be590d" + "reference": "ba01945089c3a293b01ba9badc29ad55b106b0bc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/3461e3fccc7cfdfc2720be910d3bd73c69be590d", - "reference": "3461e3fccc7cfdfc2720be910d3bd73c69be590d", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/ba01945089c3a293b01ba9badc29ad55b106b0bc", + "reference": "ba01945089c3a293b01ba9badc29ad55b106b0bc", "shasum": "" }, "require": { @@ -2090,7 +2216,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/diff/issues", - "source": "https://github.com/sebastianbergmann/diff/tree/4.0.4" + "source": "https://github.com/sebastianbergmann/diff/tree/4.0.6" }, "funding": [ { @@ -2098,7 +2224,7 @@ "type": "github" } ], - "time": "2020-10-26T13:10:38+00:00" + "time": "2024-03-02T06:30:58+00:00" }, { "name": "sebastian/environment", @@ -2165,16 +2291,16 @@ }, { "name": "sebastian/exporter", - "version": "4.0.5", + "version": "4.0.6", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d" + "reference": "78c00df8f170e02473b682df15bfcdacc3d32d72" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d", - "reference": "ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/78c00df8f170e02473b682df15bfcdacc3d32d72", + "reference": "78c00df8f170e02473b682df15bfcdacc3d32d72", "shasum": "" }, "require": { @@ -2230,7 +2356,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/exporter/issues", - "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.5" + "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.6" }, "funding": [ { @@ -2238,20 +2364,20 @@ "type": "github" } ], - "time": "2022-09-14T06:03:37+00:00" + "time": "2024-03-02T06:33:00+00:00" }, { "name": "sebastian/global-state", - "version": "5.0.5", + "version": "5.0.7", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "0ca8db5a5fc9c8646244e629625ac486fa286bf2" + "reference": "bca7df1f32ee6fe93b4d4a9abbf69e13a4ada2c9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/0ca8db5a5fc9c8646244e629625ac486fa286bf2", - "reference": "0ca8db5a5fc9c8646244e629625ac486fa286bf2", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bca7df1f32ee6fe93b4d4a9abbf69e13a4ada2c9", + "reference": "bca7df1f32ee6fe93b4d4a9abbf69e13a4ada2c9", "shasum": "" }, "require": { @@ -2294,7 +2420,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/global-state/issues", - "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.5" + "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.7" }, "funding": [ { @@ -2302,24 +2428,24 @@ "type": "github" } ], - "time": "2022-02-14T08:28:10+00:00" + "time": "2024-03-02T06:35:11+00:00" }, { "name": "sebastian/lines-of-code", - "version": "1.0.3", + "version": "1.0.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/lines-of-code.git", - "reference": "c1c2e997aa3146983ed888ad08b15470a2e22ecc" + "reference": "e1e4a170560925c26d424b6a03aed157e7dcc5c5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/c1c2e997aa3146983ed888ad08b15470a2e22ecc", - "reference": "c1c2e997aa3146983ed888ad08b15470a2e22ecc", + "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/e1e4a170560925c26d424b6a03aed157e7dcc5c5", + "reference": "e1e4a170560925c26d424b6a03aed157e7dcc5c5", "shasum": "" }, "require": { - "nikic/php-parser": "^4.6", + "nikic/php-parser": "^4.18 || ^5.0", "php": ">=7.3" }, "require-dev": { @@ -2351,7 +2477,7 @@ "homepage": "https://github.com/sebastianbergmann/lines-of-code", "support": { "issues": "https://github.com/sebastianbergmann/lines-of-code/issues", - "source": "https://github.com/sebastianbergmann/lines-of-code/tree/1.0.3" + "source": "https://github.com/sebastianbergmann/lines-of-code/tree/1.0.4" }, "funding": [ { @@ -2359,7 +2485,7 @@ "type": "github" } ], - "time": "2020-11-28T06:42:11+00:00" + "time": "2023-12-22T06:20:34+00:00" }, { "name": "sebastian/object-enumerator", @@ -2538,16 +2664,16 @@ }, { "name": "sebastian/resource-operations", - "version": "3.0.3", + "version": "3.0.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/resource-operations.git", - "reference": "0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8" + "reference": "05d5692a7993ecccd56a03e40cd7e5b09b1d404e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8", - "reference": "0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8", + "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/05d5692a7993ecccd56a03e40cd7e5b09b1d404e", + "reference": "05d5692a7993ecccd56a03e40cd7e5b09b1d404e", "shasum": "" }, "require": { @@ -2559,7 +2685,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-main": "3.0-dev" } }, "autoload": { @@ -2580,8 +2706,7 @@ "description": "Provides a list of PHP built-in functions that operate on resources", "homepage": "https://www.github.com/sebastianbergmann/resource-operations", "support": { - "issues": "https://github.com/sebastianbergmann/resource-operations/issues", - "source": "https://github.com/sebastianbergmann/resource-operations/tree/3.0.3" + "source": "https://github.com/sebastianbergmann/resource-operations/tree/3.0.4" }, "funding": [ { @@ -2589,7 +2714,7 @@ "type": "github" } ], - "time": "2020-09-28T06:45:17+00:00" + "time": "2024-03-14T16:00:52+00:00" }, { "name": "sebastian/type", @@ -2702,16 +2827,16 @@ }, { "name": "squizlabs/php_codesniffer", - "version": "3.7.2", + "version": "3.10.1", "source": { "type": "git", - "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", - "reference": "ed8e00df0a83aa96acf703f8c2979ff33341f879" + "url": "https://github.com/PHPCSStandards/PHP_CodeSniffer.git", + "reference": "8f90f7a53ce271935282967f53d0894f8f1ff877" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/ed8e00df0a83aa96acf703f8c2979ff33341f879", - "reference": "ed8e00df0a83aa96acf703f8c2979ff33341f879", + "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/8f90f7a53ce271935282967f53d0894f8f1ff877", + "reference": "8f90f7a53ce271935282967f53d0894f8f1ff877", "shasum": "" }, "require": { @@ -2721,11 +2846,11 @@ "php": ">=5.4.0" }, "require-dev": { - "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0" + "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0 || ^8.0 || ^9.3.4" }, "bin": [ - "bin/phpcs", - "bin/phpcbf" + "bin/phpcbf", + "bin/phpcs" ], "type": "library", "extra": { @@ -2740,35 +2865,58 @@ "authors": [ { "name": "Greg Sherwood", - "role": "lead" + "role": "Former lead" + }, + { + "name": "Juliette Reinders Folmer", + "role": "Current lead" + }, + { + "name": "Contributors", + "homepage": "https://github.com/PHPCSStandards/PHP_CodeSniffer/graphs/contributors" } ], "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.", - "homepage": "https://github.com/squizlabs/PHP_CodeSniffer", + "homepage": "https://github.com/PHPCSStandards/PHP_CodeSniffer", "keywords": [ "phpcs", "standards", "static analysis" ], "support": { - "issues": "https://github.com/squizlabs/PHP_CodeSniffer/issues", - "source": "https://github.com/squizlabs/PHP_CodeSniffer", - "wiki": "https://github.com/squizlabs/PHP_CodeSniffer/wiki" + "issues": "https://github.com/PHPCSStandards/PHP_CodeSniffer/issues", + "security": "https://github.com/PHPCSStandards/PHP_CodeSniffer/security/policy", + "source": "https://github.com/PHPCSStandards/PHP_CodeSniffer", + "wiki": "https://github.com/PHPCSStandards/PHP_CodeSniffer/wiki" }, - "time": "2023-02-22T23:07:41+00:00" + "funding": [ + { + "url": "https://github.com/PHPCSStandards", + "type": "github" + }, + { + "url": "https://github.com/jrfnl", + "type": "github" + }, + { + "url": "https://opencollective.com/php_codesniffer", + "type": "open_collective" + } + ], + "time": "2024-05-22T21:24:41+00:00" }, { "name": "symfony/deprecation-contracts", - "version": "v2.5.2", + "version": "v2.5.3", "source": { "type": "git", "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "e8b495ea28c1d97b5e0c121748d6f9b53d075c66" + "reference": "80d075412b557d41002320b96a096ca65aa2c98d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/e8b495ea28c1d97b5e0c121748d6f9b53d075c66", - "reference": "e8b495ea28c1d97b5e0c121748d6f9b53d075c66", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/80d075412b557d41002320b96a096ca65aa2c98d", + "reference": "80d075412b557d41002320b96a096ca65aa2c98d", "shasum": "" }, "require": { @@ -2806,7 +2954,7 @@ "description": "A generic function and convention to trigger deprecation notices", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/deprecation-contracts/tree/v2.5.2" + "source": "https://github.com/symfony/deprecation-contracts/tree/v2.5.3" }, "funding": [ { @@ -2822,20 +2970,20 @@ "type": "tidelift" } ], - "time": "2022-01-02T09:53:40+00:00" + "time": "2023-01-24T14:02:46+00:00" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.27.0", + "version": "v1.29.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "8ad114f6b39e2c98a8b0e3bd907732c207c2b534" + "reference": "9773676c8a1bb1f8d4340a62efe641cf76eda7ec" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/8ad114f6b39e2c98a8b0e3bd907732c207c2b534", - "reference": "8ad114f6b39e2c98a8b0e3bd907732c207c2b534", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/9773676c8a1bb1f8d4340a62efe641cf76eda7ec", + "reference": "9773676c8a1bb1f8d4340a62efe641cf76eda7ec", "shasum": "" }, "require": { @@ -2849,9 +2997,6 @@ }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "1.27-dev" - }, "thanks": { "name": "symfony/polyfill", "url": "https://github.com/symfony/polyfill" @@ -2889,7 +3034,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.27.0" + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.29.0" }, "funding": [ { @@ -2905,20 +3050,20 @@ "type": "tidelift" } ], - "time": "2022-11-03T14:55:06+00:00" + "time": "2024-01-29T20:11:03+00:00" }, { "name": "symfony/polyfill-php80", - "version": "v1.27.0", + "version": "v1.29.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936" + "reference": "87b68208d5c1188808dd7839ee1e6c8ec3b02f1b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936", - "reference": "7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/87b68208d5c1188808dd7839ee1e6c8ec3b02f1b", + "reference": "87b68208d5c1188808dd7839ee1e6c8ec3b02f1b", "shasum": "" }, "require": { @@ -2926,9 +3071,6 @@ }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "1.27-dev" - }, "thanks": { "name": "symfony/polyfill", "url": "https://github.com/symfony/polyfill" @@ -2972,7 +3114,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php80/tree/v1.27.0" + "source": "https://github.com/symfony/polyfill-php80/tree/v1.29.0" }, "funding": [ { @@ -2988,20 +3130,20 @@ "type": "tidelift" } ], - "time": "2022-11-03T14:55:06+00:00" + "time": "2024-01-29T20:11:03+00:00" }, { "name": "symfony/translation", - "version": "v5.4.21", + "version": "v5.4.40", "source": { "type": "git", "url": "https://github.com/symfony/translation.git", - "reference": "6996affeea65705086939894b77110e9a7f80874" + "reference": "bb51d7f183756d1ac03f50ea47dc5726518cc7e8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/6996affeea65705086939894b77110e9a7f80874", - "reference": "6996affeea65705086939894b77110e9a7f80874", + "url": "https://api.github.com/repos/symfony/translation/zipball/bb51d7f183756d1ac03f50ea47dc5726518cc7e8", + "reference": "bb51d7f183756d1ac03f50ea47dc5726518cc7e8", "shasum": "" }, "require": { @@ -3069,7 +3211,7 @@ "description": "Provides tools to internationalize your application", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/translation/tree/v5.4.21" + "source": "https://github.com/symfony/translation/tree/v5.4.40" }, "funding": [ { @@ -3085,20 +3227,20 @@ "type": "tidelift" } ], - "time": "2023-02-21T19:46:44+00:00" + "time": "2024-05-31T14:33:22+00:00" }, { "name": "symfony/translation-contracts", - "version": "v2.5.2", + "version": "v2.5.3", "source": { "type": "git", "url": "https://github.com/symfony/translation-contracts.git", - "reference": "136b19dd05cdf0709db6537d058bcab6dd6e2dbe" + "reference": "b0073a77ac0b7ea55131020e87b1e3af540f4664" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation-contracts/zipball/136b19dd05cdf0709db6537d058bcab6dd6e2dbe", - "reference": "136b19dd05cdf0709db6537d058bcab6dd6e2dbe", + "url": "https://api.github.com/repos/symfony/translation-contracts/zipball/b0073a77ac0b7ea55131020e87b1e3af540f4664", + "reference": "b0073a77ac0b7ea55131020e87b1e3af540f4664", "shasum": "" }, "require": { @@ -3147,7 +3289,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/translation-contracts/tree/v2.5.2" + "source": "https://github.com/symfony/translation-contracts/tree/v2.5.3" }, "funding": [ { @@ -3163,20 +3305,20 @@ "type": "tidelift" } ], - "time": "2022-06-27T16:58:25+00:00" + "time": "2024-01-23T13:51:25+00:00" }, { "name": "theseer/tokenizer", - "version": "1.2.1", + "version": "1.2.3", "source": { "type": "git", "url": "https://github.com/theseer/tokenizer.git", - "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e" + "reference": "737eda637ed5e28c3413cb1ebe8bb52cbf1ca7a2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/theseer/tokenizer/zipball/34a41e998c2183e22995f158c581e7b5e755ab9e", - "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e", + "url": "https://api.github.com/repos/theseer/tokenizer/zipball/737eda637ed5e28c3413cb1ebe8bb52cbf1ca7a2", + "reference": "737eda637ed5e28c3413cb1ebe8bb52cbf1ca7a2", "shasum": "" }, "require": { @@ -3205,7 +3347,7 @@ "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", "support": { "issues": "https://github.com/theseer/tokenizer/issues", - "source": "https://github.com/theseer/tokenizer/tree/1.2.1" + "source": "https://github.com/theseer/tokenizer/tree/1.2.3" }, "funding": [ { @@ -3213,26 +3355,26 @@ "type": "github" } ], - "time": "2021-07-28T10:34:58+00:00" + "time": "2024-03-03T12:36:25+00:00" }, { "name": "tracy/tracy", - "version": "v2.7.6", + "version": "v2.9.8", "source": { "type": "git", "url": "https://github.com/nette/tracy.git", - "reference": "7e7e73d52c7e9ff0fd29dbd5b1cfdc03f3947942" + "reference": "d84fb3ca4e9fa5a9352e6d18f0b8cd767f25901e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nette/tracy/zipball/7e7e73d52c7e9ff0fd29dbd5b1cfdc03f3947942", - "reference": "7e7e73d52c7e9ff0fd29dbd5b1cfdc03f3947942", + "url": "https://api.github.com/repos/nette/tracy/zipball/d84fb3ca4e9fa5a9352e6d18f0b8cd767f25901e", + "reference": "d84fb3ca4e9fa5a9352e6d18f0b8cd767f25901e", "shasum": "" }, "require": { "ext-json": "*", "ext-session": "*", - "php": ">=7.1" + "php": ">=7.2 <8.3" }, "conflict": { "nette/di": "<3.0" @@ -3243,21 +3385,18 @@ "nette/mail": "^3.0", "nette/tester": "^2.2", "nette/utils": "^3.0", - "phpstan/phpstan": "^0.12", - "psr/log": "^1.0" - }, - "suggest": { - "https://nette.org/donate": "Please support Tracy via a donation" + "phpstan/phpstan": "^1.0", + "psr/log": "^1.0 || ^2.0 || ^3.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.7-dev" + "dev-master": "2.9-dev" } }, "autoload": { "files": [ - "src/Tracy/shortcuts.php" + "src/Tracy/functions.php" ], "classmap": [ "src" @@ -3277,7 +3416,7 @@ "homepage": "https://nette.org/contributors" } ], - "description": "😎 Tracy: the addictive tool to ease debugging PHP code for cool developers. Friendly design, logging, profiler, advanced features like debugging AJAX calls or CLI support. You will love it.", + "description": "😎 Tracy: the addictive tool to ease debugging PHP code for cool developers. Friendly design, logging, profiler, advanced features like debugging AJAX calls or CLI support. You will love it.", "homepage": "https://tracy.nette.org", "keywords": [ "Xdebug", @@ -3288,9 +3427,9 @@ ], "support": { "issues": "https://github.com/nette/tracy/issues", - "source": "https://github.com/nette/tracy/tree/v2.7.6" + "source": "https://github.com/nette/tracy/tree/v2.9.8" }, - "time": "2020-11-02T17:06:27+00:00" + "time": "2023-09-25T10:36:51+00:00" } ], "aliases": [], @@ -3302,8 +3441,9 @@ "prefer-lowest": false, "platform": { "ext-curl": "*", - "php": ">=5.6" + "php": ">=7.4", + "ext-json": "*" }, "platform-dev": [], - "plugin-api-version": "2.3.0" + "plugin-api-version": "2.6.0" } From e5444129fd945f3fac50828e4c482d9a5aef9235 Mon Sep 17 00:00:00 2001 From: Andre Kutianski Date: Tue, 11 Jun 2024 20:32:24 -0300 Subject: [PATCH 25/25] chore(dependencies): atualiza dependencias do projeto --- .../lib/vendor/autoload.php | 2 +- .../lib/vendor/composer/ClassLoader.php | 108 +++++++++--------- .../lib/vendor/composer/InstalledVersions.php | 17 ++- .../lib/vendor/composer/autoload_classmap.php | 2 + .../lib/vendor/composer/autoload_real.php | 16 +-- .../lib/vendor/composer/autoload_static.php | 10 +- .../lib/vendor/composer/installed.json | 37 +++--- .../lib/vendor/composer/installed.php | 24 ++-- .../lib/vendor/composer/platform_check.php | 4 +- .../guzzlehttp/psr7/.github/workflows/ci.yml | 8 +- .../psr7/.github/workflows/integration.yml | 7 +- .../psr7/.github/workflows/static.yml | 4 +- .../lib/vendor/guzzlehttp/psr7/CHANGELOG.md | 6 + .../lib/vendor/guzzlehttp/psr7/composer.json | 5 - .../guzzlehttp/psr7/src/MessageTrait.php | 13 +-- .../lib/vendor/nfe/nfe/test/Nfe.php | 17 +++ .../lib/vendor/psr/http-message/README.md | 5 +- .../lib/vendor/psr/http-message/composer.json | 4 +- .../psr/http-message/src/MessageInterface.php | 16 +-- .../psr/http-message/src/RequestInterface.php | 10 +- .../http-message/src/ResponseInterface.php | 4 +- .../src/ServerRequestInterface.php | 8 +- .../psr/http-message/src/StreamInterface.php | 12 +- .../src/UploadedFileInterface.php | 4 +- .../psr/http-message/src/UriInterface.php | 17 +-- 25 files changed, 197 insertions(+), 163 deletions(-) create mode 100755 modules/addons/NFEioServiceInvoices/lib/vendor/nfe/nfe/test/Nfe.php diff --git a/modules/addons/NFEioServiceInvoices/lib/vendor/autoload.php b/modules/addons/NFEioServiceInvoices/lib/vendor/autoload.php index 849a254..de094c9 100644 --- a/modules/addons/NFEioServiceInvoices/lib/vendor/autoload.php +++ b/modules/addons/NFEioServiceInvoices/lib/vendor/autoload.php @@ -22,4 +22,4 @@ require_once __DIR__ . '/composer/autoload_real.php'; -return ComposerAutoloaderInitad00b92d12ac29d48d540e2bb75b0034::getLoader(); +return ComposerAutoloaderInit9d3328eb7139b63c91b644b63fb21216::getLoader(); diff --git a/modules/addons/NFEioServiceInvoices/lib/vendor/composer/ClassLoader.php b/modules/addons/NFEioServiceInvoices/lib/vendor/composer/ClassLoader.php index fd56bd7..7824d8f 100644 --- a/modules/addons/NFEioServiceInvoices/lib/vendor/composer/ClassLoader.php +++ b/modules/addons/NFEioServiceInvoices/lib/vendor/composer/ClassLoader.php @@ -45,35 +45,34 @@ class ClassLoader /** @var \Closure(string):void */ private static $includeFile; - /** @var ?string */ + /** @var string|null */ private $vendorDir; // PSR-4 /** - * @var array[] - * @psalm-var array> + * @var array> */ private $prefixLengthsPsr4 = array(); /** - * @var array[] - * @psalm-var array> + * @var array> */ private $prefixDirsPsr4 = array(); /** - * @var array[] - * @psalm-var array + * @var list */ private $fallbackDirsPsr4 = array(); // PSR-0 /** - * @var array[] - * @psalm-var array> + * List of PSR-0 prefixes + * + * Structured as array('F (first letter)' => array('Foo\Bar (full prefix)' => array('path', 'path2'))) + * + * @var array>> */ private $prefixesPsr0 = array(); /** - * @var array[] - * @psalm-var array + * @var list */ private $fallbackDirsPsr0 = array(); @@ -81,8 +80,7 @@ class ClassLoader private $useIncludePath = false; /** - * @var string[] - * @psalm-var array + * @var array */ private $classMap = array(); @@ -90,21 +88,20 @@ class ClassLoader private $classMapAuthoritative = false; /** - * @var bool[] - * @psalm-var array + * @var array */ private $missingClasses = array(); - /** @var ?string */ + /** @var string|null */ private $apcuPrefix; /** - * @var self[] + * @var array */ private static $registeredLoaders = array(); /** - * @param ?string $vendorDir + * @param string|null $vendorDir */ public function __construct($vendorDir = null) { @@ -113,7 +110,7 @@ public function __construct($vendorDir = null) } /** - * @return string[] + * @return array> */ public function getPrefixes() { @@ -125,8 +122,7 @@ public function getPrefixes() } /** - * @return array[] - * @psalm-return array> + * @return array> */ public function getPrefixesPsr4() { @@ -134,8 +130,7 @@ public function getPrefixesPsr4() } /** - * @return array[] - * @psalm-return array + * @return list */ public function getFallbackDirs() { @@ -143,8 +138,7 @@ public function getFallbackDirs() } /** - * @return array[] - * @psalm-return array + * @return list */ public function getFallbackDirsPsr4() { @@ -152,8 +146,7 @@ public function getFallbackDirsPsr4() } /** - * @return string[] Array of classname => path - * @psalm-return array + * @return array Array of classname => path */ public function getClassMap() { @@ -161,8 +154,7 @@ public function getClassMap() } /** - * @param string[] $classMap Class to filename map - * @psalm-param array $classMap + * @param array $classMap Class to filename map * * @return void */ @@ -179,24 +171,25 @@ public function addClassMap(array $classMap) * Registers a set of PSR-0 directories for a given prefix, either * appending or prepending to the ones previously set for this prefix. * - * @param string $prefix The prefix - * @param string[]|string $paths The PSR-0 root directories - * @param bool $prepend Whether to prepend the directories + * @param string $prefix The prefix + * @param list|string $paths The PSR-0 root directories + * @param bool $prepend Whether to prepend the directories * * @return void */ public function add($prefix, $paths, $prepend = false) { + $paths = (array) $paths; if (!$prefix) { if ($prepend) { $this->fallbackDirsPsr0 = array_merge( - (array) $paths, + $paths, $this->fallbackDirsPsr0 ); } else { $this->fallbackDirsPsr0 = array_merge( $this->fallbackDirsPsr0, - (array) $paths + $paths ); } @@ -205,19 +198,19 @@ public function add($prefix, $paths, $prepend = false) $first = $prefix[0]; if (!isset($this->prefixesPsr0[$first][$prefix])) { - $this->prefixesPsr0[$first][$prefix] = (array) $paths; + $this->prefixesPsr0[$first][$prefix] = $paths; return; } if ($prepend) { $this->prefixesPsr0[$first][$prefix] = array_merge( - (array) $paths, + $paths, $this->prefixesPsr0[$first][$prefix] ); } else { $this->prefixesPsr0[$first][$prefix] = array_merge( $this->prefixesPsr0[$first][$prefix], - (array) $paths + $paths ); } } @@ -226,9 +219,9 @@ public function add($prefix, $paths, $prepend = false) * Registers a set of PSR-4 directories for a given namespace, either * appending or prepending to the ones previously set for this namespace. * - * @param string $prefix The prefix/namespace, with trailing '\\' - * @param string[]|string $paths The PSR-4 base directories - * @param bool $prepend Whether to prepend the directories + * @param string $prefix The prefix/namespace, with trailing '\\' + * @param list|string $paths The PSR-4 base directories + * @param bool $prepend Whether to prepend the directories * * @throws \InvalidArgumentException * @@ -236,17 +229,18 @@ public function add($prefix, $paths, $prepend = false) */ public function addPsr4($prefix, $paths, $prepend = false) { + $paths = (array) $paths; if (!$prefix) { // Register directories for the root namespace. if ($prepend) { $this->fallbackDirsPsr4 = array_merge( - (array) $paths, + $paths, $this->fallbackDirsPsr4 ); } else { $this->fallbackDirsPsr4 = array_merge( $this->fallbackDirsPsr4, - (array) $paths + $paths ); } } elseif (!isset($this->prefixDirsPsr4[$prefix])) { @@ -256,18 +250,18 @@ public function addPsr4($prefix, $paths, $prepend = false) throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); } $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; - $this->prefixDirsPsr4[$prefix] = (array) $paths; + $this->prefixDirsPsr4[$prefix] = $paths; } elseif ($prepend) { // Prepend directories for an already registered namespace. $this->prefixDirsPsr4[$prefix] = array_merge( - (array) $paths, + $paths, $this->prefixDirsPsr4[$prefix] ); } else { // Append directories for an already registered namespace. $this->prefixDirsPsr4[$prefix] = array_merge( $this->prefixDirsPsr4[$prefix], - (array) $paths + $paths ); } } @@ -276,8 +270,8 @@ public function addPsr4($prefix, $paths, $prepend = false) * Registers a set of PSR-0 directories for a given prefix, * replacing any others previously set for this prefix. * - * @param string $prefix The prefix - * @param string[]|string $paths The PSR-0 base directories + * @param string $prefix The prefix + * @param list|string $paths The PSR-0 base directories * * @return void */ @@ -294,8 +288,8 @@ public function set($prefix, $paths) * Registers a set of PSR-4 directories for a given namespace, * replacing any others previously set for this namespace. * - * @param string $prefix The prefix/namespace, with trailing '\\' - * @param string[]|string $paths The PSR-4 base directories + * @param string $prefix The prefix/namespace, with trailing '\\' + * @param list|string $paths The PSR-4 base directories * * @throws \InvalidArgumentException * @@ -429,7 +423,8 @@ public function unregister() public function loadClass($class) { if ($file = $this->findFile($class)) { - (self::$includeFile)($file); + $includeFile = self::$includeFile; + $includeFile($file); return true; } @@ -480,9 +475,9 @@ public function findFile($class) } /** - * Returns the currently registered loaders indexed by their corresponding vendor directories. + * Returns the currently registered loaders keyed by their corresponding vendor directories. * - * @return self[] + * @return array */ public static function getRegisteredLoaders() { @@ -560,7 +555,10 @@ private function findFileWithExtension($class, $ext) return false; } - private static function initializeIncludeClosure(): void + /** + * @return void + */ + private static function initializeIncludeClosure() { if (self::$includeFile !== null) { return; @@ -574,8 +572,8 @@ private static function initializeIncludeClosure(): void * @param string $file * @return void */ - self::$includeFile = static function($file) { + self::$includeFile = \Closure::bind(static function($file) { include $file; - }; + }, null, null); } } diff --git a/modules/addons/NFEioServiceInvoices/lib/vendor/composer/InstalledVersions.php b/modules/addons/NFEioServiceInvoices/lib/vendor/composer/InstalledVersions.php index c6b54af..51e734a 100644 --- a/modules/addons/NFEioServiceInvoices/lib/vendor/composer/InstalledVersions.php +++ b/modules/addons/NFEioServiceInvoices/lib/vendor/composer/InstalledVersions.php @@ -98,7 +98,7 @@ public static function isInstalled($packageName, $includeDevRequirements = true) { foreach (self::getInstalled() as $installed) { if (isset($installed['versions'][$packageName])) { - return $includeDevRequirements || empty($installed['versions'][$packageName]['dev_requirement']); + return $includeDevRequirements || !isset($installed['versions'][$packageName]['dev_requirement']) || $installed['versions'][$packageName]['dev_requirement'] === false; } } @@ -119,7 +119,7 @@ public static function isInstalled($packageName, $includeDevRequirements = true) */ public static function satisfies(VersionParser $parser, $packageName, $constraint) { - $constraint = $parser->parseConstraints($constraint); + $constraint = $parser->parseConstraints((string) $constraint); $provided = $parser->parseConstraints(self::getVersionRanges($packageName)); return $provided->matches($constraint); @@ -328,7 +328,9 @@ private static function getInstalled() if (isset(self::$installedByVendor[$vendorDir])) { $installed[] = self::$installedByVendor[$vendorDir]; } elseif (is_file($vendorDir.'/composer/installed.php')) { - $installed[] = self::$installedByVendor[$vendorDir] = require $vendorDir.'/composer/installed.php'; + /** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array} $required */ + $required = require $vendorDir.'/composer/installed.php'; + $installed[] = self::$installedByVendor[$vendorDir] = $required; if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) { self::$installed = $installed[count($installed) - 1]; } @@ -340,12 +342,17 @@ private static function getInstalled() // only require the installed.php file if this file is loaded from its dumped location, // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937 if (substr(__DIR__, -8, 1) !== 'C') { - self::$installed = require __DIR__ . '/installed.php'; + /** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array} $required */ + $required = require __DIR__ . '/installed.php'; + self::$installed = $required; } else { self::$installed = array(); } } - $installed[] = self::$installed; + + if (self::$installed !== array()) { + $installed[] = self::$installed; + } return $installed; } diff --git a/modules/addons/NFEioServiceInvoices/lib/vendor/composer/autoload_classmap.php b/modules/addons/NFEioServiceInvoices/lib/vendor/composer/autoload_classmap.php index 4e96f91..f665615 100644 --- a/modules/addons/NFEioServiceInvoices/lib/vendor/composer/autoload_classmap.php +++ b/modules/addons/NFEioServiceInvoices/lib/vendor/composer/autoload_classmap.php @@ -44,6 +44,8 @@ 'NFEioServiceInvoices\\Configuration' => $baseDir . '/modules/addons/NFEioServiceInvoices/lib/Configuration.php', 'NFEioServiceInvoices\\CustomFields' => $baseDir . '/modules/addons/NFEioServiceInvoices/lib/CustomFields.php', 'NFEioServiceInvoices\\Helpers\\Invoices' => $baseDir . '/modules/addons/NFEioServiceInvoices/lib/Helpers/Invoices.php', + 'NFEioServiceInvoices\\Helpers\\Timestamp' => $baseDir . '/modules/addons/NFEioServiceInvoices/lib/Helpers/Timestamp.php', + 'NFEioServiceInvoices\\Helpers\\Validations' => $baseDir . '/modules/addons/NFEioServiceInvoices/lib/Helpers/Validations.php', 'NFEioServiceInvoices\\Helpers\\Versions' => $baseDir . '/modules/addons/NFEioServiceInvoices/lib/Helpers/Versions.php', 'NFEioServiceInvoices\\Hooks\\AdminInvoicesControlsOutput' => $baseDir . '/modules/addons/NFEioServiceInvoices/lib/Hooks/AdminInvoicesControlsOutput.php', 'NFEioServiceInvoices\\Hooks\\AfterCronJob' => $baseDir . '/modules/addons/NFEioServiceInvoices/lib/Hooks/AfterCronJob.php', diff --git a/modules/addons/NFEioServiceInvoices/lib/vendor/composer/autoload_real.php b/modules/addons/NFEioServiceInvoices/lib/vendor/composer/autoload_real.php index e637923..1a6ddf8 100644 --- a/modules/addons/NFEioServiceInvoices/lib/vendor/composer/autoload_real.php +++ b/modules/addons/NFEioServiceInvoices/lib/vendor/composer/autoload_real.php @@ -2,7 +2,7 @@ // autoload_real.php @generated by Composer -class ComposerAutoloaderInitad00b92d12ac29d48d540e2bb75b0034 +class ComposerAutoloaderInit9d3328eb7139b63c91b644b63fb21216 { private static $loader; @@ -24,25 +24,25 @@ public static function getLoader() require __DIR__ . '/platform_check.php'; - spl_autoload_register(array('ComposerAutoloaderInitad00b92d12ac29d48d540e2bb75b0034', 'loadClassLoader'), true, true); + spl_autoload_register(array('ComposerAutoloaderInit9d3328eb7139b63c91b644b63fb21216', 'loadClassLoader'), true, true); self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__)); - spl_autoload_unregister(array('ComposerAutoloaderInitad00b92d12ac29d48d540e2bb75b0034', 'loadClassLoader')); + spl_autoload_unregister(array('ComposerAutoloaderInit9d3328eb7139b63c91b644b63fb21216', 'loadClassLoader')); require __DIR__ . '/autoload_static.php'; - call_user_func(\Composer\Autoload\ComposerStaticInitad00b92d12ac29d48d540e2bb75b0034::getInitializer($loader)); + call_user_func(\Composer\Autoload\ComposerStaticInit9d3328eb7139b63c91b644b63fb21216::getInitializer($loader)); $loader->register(true); - $filesToLoad = \Composer\Autoload\ComposerStaticInitad00b92d12ac29d48d540e2bb75b0034::$files; - $requireFile = static function ($fileIdentifier, $file) { + $filesToLoad = \Composer\Autoload\ComposerStaticInit9d3328eb7139b63c91b644b63fb21216::$files; + $requireFile = \Closure::bind(static function ($fileIdentifier, $file) { if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true; require $file; } - }; + }, null, null); foreach ($filesToLoad as $fileIdentifier => $file) { - ($requireFile)($fileIdentifier, $file); + $requireFile($fileIdentifier, $file); } return $loader; diff --git a/modules/addons/NFEioServiceInvoices/lib/vendor/composer/autoload_static.php b/modules/addons/NFEioServiceInvoices/lib/vendor/composer/autoload_static.php index bffd982..711b155 100644 --- a/modules/addons/NFEioServiceInvoices/lib/vendor/composer/autoload_static.php +++ b/modules/addons/NFEioServiceInvoices/lib/vendor/composer/autoload_static.php @@ -4,7 +4,7 @@ namespace Composer\Autoload; -class ComposerStaticInitad00b92d12ac29d48d540e2bb75b0034 +class ComposerStaticInit9d3328eb7139b63c91b644b63fb21216 { public static $files = array ( '7b11c4dc42b3b3023073cb14e519683c' => __DIR__ . '/..' . '/ralouphie/getallheaders/src/getallheaders.php', @@ -93,6 +93,8 @@ class ComposerStaticInitad00b92d12ac29d48d540e2bb75b0034 'NFEioServiceInvoices\\Configuration' => __DIR__ . '/../../../../../..' . '/modules/addons/NFEioServiceInvoices/lib/Configuration.php', 'NFEioServiceInvoices\\CustomFields' => __DIR__ . '/../../../../../..' . '/modules/addons/NFEioServiceInvoices/lib/CustomFields.php', 'NFEioServiceInvoices\\Helpers\\Invoices' => __DIR__ . '/../../../../../..' . '/modules/addons/NFEioServiceInvoices/lib/Helpers/Invoices.php', + 'NFEioServiceInvoices\\Helpers\\Timestamp' => __DIR__ . '/../../../../../..' . '/modules/addons/NFEioServiceInvoices/lib/Helpers/Timestamp.php', + 'NFEioServiceInvoices\\Helpers\\Validations' => __DIR__ . '/../../../../../..' . '/modules/addons/NFEioServiceInvoices/lib/Helpers/Validations.php', 'NFEioServiceInvoices\\Helpers\\Versions' => __DIR__ . '/../../../../../..' . '/modules/addons/NFEioServiceInvoices/lib/Helpers/Versions.php', 'NFEioServiceInvoices\\Hooks\\AdminInvoicesControlsOutput' => __DIR__ . '/../../../../../..' . '/modules/addons/NFEioServiceInvoices/lib/Hooks/AdminInvoicesControlsOutput.php', 'NFEioServiceInvoices\\Hooks\\AfterCronJob' => __DIR__ . '/../../../../../..' . '/modules/addons/NFEioServiceInvoices/lib/Hooks/AfterCronJob.php', @@ -161,9 +163,9 @@ class ComposerStaticInitad00b92d12ac29d48d540e2bb75b0034 public static function getInitializer(ClassLoader $loader) { return \Closure::bind(function () use ($loader) { - $loader->prefixLengthsPsr4 = ComposerStaticInitad00b92d12ac29d48d540e2bb75b0034::$prefixLengthsPsr4; - $loader->prefixDirsPsr4 = ComposerStaticInitad00b92d12ac29d48d540e2bb75b0034::$prefixDirsPsr4; - $loader->classMap = ComposerStaticInitad00b92d12ac29d48d540e2bb75b0034::$classMap; + $loader->prefixLengthsPsr4 = ComposerStaticInit9d3328eb7139b63c91b644b63fb21216::$prefixLengthsPsr4; + $loader->prefixDirsPsr4 = ComposerStaticInit9d3328eb7139b63c91b644b63fb21216::$prefixDirsPsr4; + $loader->classMap = ComposerStaticInit9d3328eb7139b63c91b644b63fb21216::$classMap; }, null, ClassLoader::class); } diff --git a/modules/addons/NFEioServiceInvoices/lib/vendor/composer/installed.json b/modules/addons/NFEioServiceInvoices/lib/vendor/composer/installed.json index 07c8fbb..e3efd8e 100644 --- a/modules/addons/NFEioServiceInvoices/lib/vendor/composer/installed.json +++ b/modules/addons/NFEioServiceInvoices/lib/vendor/composer/installed.json @@ -2,17 +2,17 @@ "packages": [ { "name": "guzzlehttp/psr7", - "version": "1.9.0", - "version_normalized": "1.9.0.0", + "version": "1.9.1", + "version_normalized": "1.9.1.0", "source": { "type": "git", "url": "https://github.com/guzzle/psr7.git", - "reference": "e98e3e6d4f86621a9b75f623996e6bbdeb4b9318" + "reference": "e4490cabc77465aaee90b20cfc9a770f8c04be6b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/psr7/zipball/e98e3e6d4f86621a9b75f623996e6bbdeb4b9318", - "reference": "e98e3e6d4f86621a9b75f623996e6bbdeb4b9318", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/e4490cabc77465aaee90b20cfc9a770f8c04be6b", + "reference": "e4490cabc77465aaee90b20cfc9a770f8c04be6b", "shasum": "" }, "require": { @@ -30,13 +30,8 @@ "suggest": { "laminas/laminas-httphandlerrunner": "Emit PSR-7 responses" }, - "time": "2022-06-20T21:43:03+00:00", + "time": "2023-04-17T16:00:37+00:00", "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.9-dev" - } - }, "installation-source": "dist", "autoload": { "files": [ @@ -95,7 +90,7 @@ ], "support": { "issues": "https://github.com/guzzle/psr7/issues", - "source": "https://github.com/guzzle/psr7/tree/1.9.0" + "source": "https://github.com/guzzle/psr7/tree/1.9.1" }, "funding": [ { @@ -226,27 +221,27 @@ }, { "name": "psr/http-message", - "version": "1.0.1", - "version_normalized": "1.0.1.0", + "version": "1.1", + "version_normalized": "1.1.0.0", "source": { "type": "git", "url": "https://github.com/php-fig/http-message.git", - "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363" + "reference": "cb6ce4845ce34a8ad9e68117c10ee90a29919eba" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363", - "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363", + "url": "https://api.github.com/repos/php-fig/http-message/zipball/cb6ce4845ce34a8ad9e68117c10ee90a29919eba", + "reference": "cb6ce4845ce34a8ad9e68117c10ee90a29919eba", "shasum": "" }, "require": { - "php": ">=5.3.0" + "php": "^7.2 || ^8.0" }, - "time": "2016-08-06T14:39:51+00:00", + "time": "2023-04-04T09:50:52+00:00", "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "1.1.x-dev" } }, "installation-source": "dist", @@ -276,7 +271,7 @@ "response" ], "support": { - "source": "https://github.com/php-fig/http-message/tree/master" + "source": "https://github.com/php-fig/http-message/tree/1.1" }, "install-path": "../psr/http-message" }, diff --git a/modules/addons/NFEioServiceInvoices/lib/vendor/composer/installed.php b/modules/addons/NFEioServiceInvoices/lib/vendor/composer/installed.php index 64b654d..d2a9087 100644 --- a/modules/addons/NFEioServiceInvoices/lib/vendor/composer/installed.php +++ b/modules/addons/NFEioServiceInvoices/lib/vendor/composer/installed.php @@ -1,9 +1,9 @@ array( 'name' => '__root__', - 'pretty_version' => '1.0.0+no-version-set', - 'version' => '1.0.0.0', - 'reference' => NULL, + 'pretty_version' => 'dev-develop', + 'version' => 'dev-develop', + 'reference' => '7427feebf24386200bad5e180c438172e95fbc2a', 'type' => 'library', 'install_path' => __DIR__ . '/../../../../../../', 'aliases' => array(), @@ -11,18 +11,18 @@ ), 'versions' => array( '__root__' => array( - 'pretty_version' => '1.0.0+no-version-set', - 'version' => '1.0.0.0', - 'reference' => NULL, + 'pretty_version' => 'dev-develop', + 'version' => 'dev-develop', + 'reference' => '7427feebf24386200bad5e180c438172e95fbc2a', 'type' => 'library', 'install_path' => __DIR__ . '/../../../../../../', 'aliases' => array(), 'dev_requirement' => false, ), 'guzzlehttp/psr7' => array( - 'pretty_version' => '1.9.0', - 'version' => '1.9.0.0', - 'reference' => 'e98e3e6d4f86621a9b75f623996e6bbdeb4b9318', + 'pretty_version' => '1.9.1', + 'version' => '1.9.1.0', + 'reference' => 'e4490cabc77465aaee90b20cfc9a770f8c04be6b', 'type' => 'library', 'install_path' => __DIR__ . '/../guzzlehttp/psr7', 'aliases' => array(), @@ -47,9 +47,9 @@ 'dev_requirement' => false, ), 'psr/http-message' => array( - 'pretty_version' => '1.0.1', - 'version' => '1.0.1.0', - 'reference' => 'f6561bf28d520154e4b0ec72be95418abe6d9363', + 'pretty_version' => '1.1', + 'version' => '1.1.0.0', + 'reference' => 'cb6ce4845ce34a8ad9e68117c10ee90a29919eba', 'type' => 'library', 'install_path' => __DIR__ . '/../psr/http-message', 'aliases' => array(), diff --git a/modules/addons/NFEioServiceInvoices/lib/vendor/composer/platform_check.php b/modules/addons/NFEioServiceInvoices/lib/vendor/composer/platform_check.php index 8b379f4..580fa96 100644 --- a/modules/addons/NFEioServiceInvoices/lib/vendor/composer/platform_check.php +++ b/modules/addons/NFEioServiceInvoices/lib/vendor/composer/platform_check.php @@ -4,8 +4,8 @@ $issues = array(); -if (!(PHP_VERSION_ID >= 50600)) { - $issues[] = 'Your Composer dependencies require a PHP version ">= 5.6.0". You are running ' . PHP_VERSION . '.'; +if (!(PHP_VERSION_ID >= 70400)) { + $issues[] = 'Your Composer dependencies require a PHP version ">= 7.4.0". You are running ' . PHP_VERSION . '.'; } if ($issues) { diff --git a/modules/addons/NFEioServiceInvoices/lib/vendor/guzzlehttp/psr7/.github/workflows/ci.yml b/modules/addons/NFEioServiceInvoices/lib/vendor/guzzlehttp/psr7/.github/workflows/ci.yml index eda7dce..0850470 100644 --- a/modules/addons/NFEioServiceInvoices/lib/vendor/guzzlehttp/psr7/.github/workflows/ci.yml +++ b/modules/addons/NFEioServiceInvoices/lib/vendor/guzzlehttp/psr7/.github/workflows/ci.yml @@ -6,7 +6,7 @@ on: jobs: build: name: Build - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 strategy: max-parallel: 10 matrix: @@ -21,11 +21,7 @@ jobs: extensions: mbstring - name: Checkout code - uses: actions/checkout@v2 - - - name: Mimic PHP 8.0 - run: composer config platform.php 8.0.999 - if: matrix.php > 8 + uses: actions/checkout@v3 - name: Install dependencies run: composer update --no-interaction --no-progress diff --git a/modules/addons/NFEioServiceInvoices/lib/vendor/guzzlehttp/psr7/.github/workflows/integration.yml b/modules/addons/NFEioServiceInvoices/lib/vendor/guzzlehttp/psr7/.github/workflows/integration.yml index 3c31f9e..a55a256 100644 --- a/modules/addons/NFEioServiceInvoices/lib/vendor/guzzlehttp/psr7/.github/workflows/integration.yml +++ b/modules/addons/NFEioServiceInvoices/lib/vendor/guzzlehttp/psr7/.github/workflows/integration.yml @@ -4,14 +4,13 @@ on: pull_request: jobs: - build: name: Test - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 strategy: max-parallel: 10 matrix: - php: ['7.2', '7.3', '7.4', '8.0'] + php: ['7.2', '7.3', '7.4', '8.0', '8.1'] steps: - name: Set up PHP @@ -21,7 +20,7 @@ jobs: coverage: none - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Download dependencies uses: ramsey/composer-install@v1 diff --git a/modules/addons/NFEioServiceInvoices/lib/vendor/guzzlehttp/psr7/.github/workflows/static.yml b/modules/addons/NFEioServiceInvoices/lib/vendor/guzzlehttp/psr7/.github/workflows/static.yml index ab4d68b..f00351b 100644 --- a/modules/addons/NFEioServiceInvoices/lib/vendor/guzzlehttp/psr7/.github/workflows/static.yml +++ b/modules/addons/NFEioServiceInvoices/lib/vendor/guzzlehttp/psr7/.github/workflows/static.yml @@ -6,11 +6,11 @@ on: jobs: php-cs-fixer: name: PHP-CS-Fixer - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Setup PHP uses: shivammathur/setup-php@v2 diff --git a/modules/addons/NFEioServiceInvoices/lib/vendor/guzzlehttp/psr7/CHANGELOG.md b/modules/addons/NFEioServiceInvoices/lib/vendor/guzzlehttp/psr7/CHANGELOG.md index b4fdf3c..9b2b65c 100644 --- a/modules/addons/NFEioServiceInvoices/lib/vendor/guzzlehttp/psr7/CHANGELOG.md +++ b/modules/addons/NFEioServiceInvoices/lib/vendor/guzzlehttp/psr7/CHANGELOG.md @@ -9,6 +9,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Unreleased +## 1.9.1 - 2023-04-17 + +### Fixed + +- Fixed header validation issue + ## 1.9.0 - 2022-06-20 ### Added diff --git a/modules/addons/NFEioServiceInvoices/lib/vendor/guzzlehttp/psr7/composer.json b/modules/addons/NFEioServiceInvoices/lib/vendor/guzzlehttp/psr7/composer.json index 0e36920..2607f22 100644 --- a/modules/addons/NFEioServiceInvoices/lib/vendor/guzzlehttp/psr7/composer.json +++ b/modules/addons/NFEioServiceInvoices/lib/vendor/guzzlehttp/psr7/composer.json @@ -61,11 +61,6 @@ "GuzzleHttp\\Tests\\Psr7\\": "tests/" } }, - "extra": { - "branch-alias": { - "dev-master": "1.9-dev" - } - }, "config": { "preferred-install": "dist", "sort-packages": true, diff --git a/modules/addons/NFEioServiceInvoices/lib/vendor/guzzlehttp/psr7/src/MessageTrait.php b/modules/addons/NFEioServiceInvoices/lib/vendor/guzzlehttp/psr7/src/MessageTrait.php index 0ac8663..0bbd63e 100644 --- a/modules/addons/NFEioServiceInvoices/lib/vendor/guzzlehttp/psr7/src/MessageTrait.php +++ b/modules/addons/NFEioServiceInvoices/lib/vendor/guzzlehttp/psr7/src/MessageTrait.php @@ -226,12 +226,9 @@ private function assertHeader($header) throw new \InvalidArgumentException('Header name can not be empty.'); } - if (! preg_match('/^[a-zA-Z0-9\'`#$%&*+.^_|~!-]+$/', $header)) { + if (! preg_match('/^[a-zA-Z0-9\'`#$%&*+.^_|~!-]+$/D', $header)) { throw new \InvalidArgumentException( - sprintf( - '"%s" is not valid header name', - $header - ) + sprintf('"%s" is not valid header name.', $header) ); } } @@ -263,8 +260,10 @@ private function assertValue($value) // Clients must not send a request with line folding and a server sending folded headers is // likely very rare. Line folding is a fairly obscure feature of HTTP/1.1 and thus not accepting // folding is not likely to break any legitimate use case. - if (! preg_match('/^[\x20\x09\x21-\x7E\x80-\xFF]*$/', $value)) { - throw new \InvalidArgumentException(sprintf('"%s" is not valid header value', $value)); + if (! preg_match('/^[\x20\x09\x21-\x7E\x80-\xFF]*$/D', $value)) { + throw new \InvalidArgumentException( + sprintf('"%s" is not valid header value.', $value) + ); } } } diff --git a/modules/addons/NFEioServiceInvoices/lib/vendor/nfe/nfe/test/Nfe.php b/modules/addons/NFEioServiceInvoices/lib/vendor/nfe/nfe/test/Nfe.php new file mode 100755 index 0000000..9050c09 --- /dev/null +++ b/modules/addons/NFEioServiceInvoices/lib/vendor/nfe/nfe/test/Nfe.php @@ -0,0 +1,17 @@ +=5.3.0" + "php": "^7.2 || ^8.0" }, "autoload": { "psr-4": { @@ -20,7 +20,7 @@ }, "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "1.1.x-dev" } } } diff --git a/modules/addons/NFEioServiceInvoices/lib/vendor/psr/http-message/src/MessageInterface.php b/modules/addons/NFEioServiceInvoices/lib/vendor/psr/http-message/src/MessageInterface.php index dd46e5e..8cdb4ed 100644 --- a/modules/addons/NFEioServiceInvoices/lib/vendor/psr/http-message/src/MessageInterface.php +++ b/modules/addons/NFEioServiceInvoices/lib/vendor/psr/http-message/src/MessageInterface.php @@ -1,5 +1,7 @@