ns (node:internal/process/task_queues:105:5)] 2025-12-01 14:33:47.169 [info] [fetchCompletions] Request f009d8da-82d1-4a03-b722-8ee7c50820ae at finished with 200 status after 151.83098899992183ms 2025-12-01 14:33:47.303 [info] [streamChoices] solution 0 returned. finish reason: [stop] 2025-12-01 14:33:47.557 [info] [fetchCompletions] Request 9f63f49c-eeef-4cac-8fc3-5114168a4f54 at finished with 200 status after 178.09430900006555ms 2025-12-01 14:33:47.643 [info] [streamChoices] solution 0 returned. finish reason: [stop] 2025-12-01 14:33:52.652 [info] [fetchCompletions] Request 3c09cd17-0158-45a9-957f-230e902d02cf at finished with 200 status after 152.49968500016257ms 2025-12-01 14:33:52.717 [error] [AsyncCompletionManager] [3c09cd17-0158-45a9-957f-230e902d02cf] Request errored with [DOMException [AbortError]: This operation was aborted at new DOMException (node:internal/per_context/domexception:76:18) at AbortController.abort (node:internal/abort_controller:504:18) at /home/ubuntu/.vscode-server/extensions/github.copilot-chat-0.33.3/dist/extension.js:1920:11561 at UJe.invoke (/home/ubuntu/.vscode-server/extensions/github.copilot-chat-0.33.3/dist/extension.js:114:46214) at n.fire (/home/ubuntu/.vscode-server/extensions/github.copilot-chat-0.33.3/dist/extension.js:114:46986) at HIe.cancel (/home/ubuntu/.vscode-server/extensions/github.copilot-chat-0.33.3/dist/extension.js:114:47920) at $Je.cancel (/home/ubuntu/.vscode-server/extensions/github.copilot-chat-0.33.3/dist/extension.js:114:48316) at $A.cancelRequest (/home/ubuntu/.vscode-server/extensions/github.copilot-chat-0.33.3/dist/extension.js:2143:2203) at $A.getFirstMatchingRequest (/home/ubuntu/.vscode-server/extensions/github.copilot-chat-0.33.3/dist/extension.js:2143:1955) at /home/ubuntu/.vscode-server/extensions/github.copilot-chat-0.33.3/dist/extension.js:2155:5203 at process.processTicksAndRejections (node:internal/process/task_queues:105:5)] 2025-12-01 14:33:52.920 [info] [fetchCompletions] Request 3fd9352f-5d22-4946-a933-2602032ca63a at finished with 200 status after 201.12422099988908ms 2025-12-01 14:33:52.987 [info] [streamChoices] solution 0 returned. finish reason: [stop] 2025-12-01 14:33:53.194 [info] [fetchCompletions] Request 0398b16c-87b0-4046-b650-971326f8d984 at finished with 200 status after 144.34310100018047ms 2025-12-01 14:33:53.285 [info] [streamChoices] solution 0 returned. finish reason: [stop] 2025-12-01 14:33:56.352 [info] [fetchCompletions] Request f8ce685c-0287-4236-a1b8-d09f2e7f8774 at finished with 200 status after 257.5493789999746ms 2025-12-01 14:33:56.419 [info] [streamChoices] solution 0 returned. finish reason: [stop] 2025-12-01 14:33:56.947 [info] [fetchCompletions] Request 8a660e32-1462-405d-9d02-b6e8583c5bc3 at finished with 200 status after 290.5821730000898ms 2025-12-01 14:33:57.019 [info] [streamChoices] solution 0 returned. finish reason: [stop] 2025-12-01 14:33:59.712 [info] [fetchCompletions] Request a3c66aee-2faf-4b23-8350-3ba373e1f976 at finished with 200 status after 189.45114900008775ms 2025-12-01 14:34:00.068 [info] [fetchCompletions] Request 1dcc22e4-baf3-4823-8e74-e90ea02b95e9 at finished with 200 status after 196.63051100005396ms 2025-12-01 14:34:00.311 [info] [fetchCompletions] Request 258b005d-3abd-4ce7-8b97-238303b17e1b at finished with 200 status after 216.57979599991813ms 2025-12-01 14:34:00.392 [info] [streamChoices] solution 0 returned. finish reason: [stop] 2025-12-01 14:34:00.573 [info] [fetchCompletions] Request accf9e91-aae6-49cf-bb37-2b06a79e96d1 at finished with 200 status after 199.3360709999688ms 2025-12-01 14:34:00.923 [info] [fetchCompletions] Request 9ee51119-5e63-453c-b5de-db1d69cab987 at finished with 200 status after 241.5790239998605ms 2025-12-01 14:34:01.001 [info] [streamChoices] solution 0 returned. finish reason: [stop] 2025-12-01 14:34:11.228 [info] [fetchCompletions] Request 4eed7e94-097a-46c9-8391-edcb7567943a at finished with 200 status after 245.86398999998346ms 2025-12-01 14:34:11.320 [info] [streamChoices] solution 0 returned. finish reason: [stop] 2025-12-01 14:34:11.547 [info] [fetchCompletions] Request 487d248d-940f-46af-bc57-0fabb5756a05 at finished with 200 status after 153.71225200011395ms 2025-12-01 14:34:11.549 [info] [streamChoices] solution 0 returned. finish reason: [stop] 2025-12-01 14:34:47.113 [info] [fetchCompletions] Request 1833a667-dffd-477e-8d78-a4e4f33cc6de at finished with 200 status after 175.87945000012405ms 2025-12-01 14:34:47.203 [info] [streamChoices] solution 0 returned. finish reason: [stop] 2025-12-01 14:34:47.449 [info] [fetchCompletions] Request e3ffb00f-cf47-4042-a7bc-8f96b597bb70 at finished with 200 status after 173.13828400010243ms 2025-12-01 14:34:47.451 [info] [streamChoices] solution 0 returned. finish reason: [stop] 2025-12-01 14:35:43.487 [info] [fetchCompletions] Request 0d3dbb74-5774-4395-a752-c46d0a3c4be0 at finished with 200 status after 193.34197700000368ms 2025-12-01 14:35:43.669 [info] [streamChoices] solution 0 returned. finish reason: [stop] 2025-12-01 14:35:43.921 [info] [fetchCompletions] Request 8b14924f-a9bd-4cc0-8c5e-a92886ad5db7 at finished with 200 status after 176.4339040000923ms 2025-12-01 14:35:43.993 [info] [streamChoices] solution 0 returned. finish reason: [stop] 2025-12-01 14:36:20.670 [info] [fetchCompletions] Request e8a9fa7b-3996-4e62-8c26-00e5e12cf2d5 at finished with 200 status after 236.8323059999384ms 2025-12-01 14:36:20.751 [info] [streamChoices] solution 0 returned. finish reason: [stop] 2025-12-01 14:36:50.393 [info] [fetchCompletions] Request 3084ffa4-aac5-4386-8b0a-9b1e95e73edb at finished with 200 status after 157.0524039999582ms 2025-12-01 14:36:50.469 [info] [streamChoices] solution 0 returned. finish reason: [stop] 2025-12-01 14:52:58.461 [info] [fetchCompletions] Request c2f06587-cee7-4ff0-a74b-a342285498c1 at finished with 200 status after 350.86448900029063ms 2025-12-01 14:52:58.707 [info] [streamChoices] solution 0 returned. finish reason: [stop] 2025-12-01 14:52:58.949 [info] [fetchCompletions] Request 149df469-0ca8-4d26-ac09-b83f63632510 at finished with 200 status after 165.86518800025806ms 2025-12-01 14:52:59.018 [info] [streamChoices] solution 0 returned. finish reason: [stop] 2025-12-01 14:53:04.390 [info] Logged in as CarlosAlmendarez 2025-12-01 14:53:04.785 [info] Got Copilot token for CarlosAlmendarez 2025-12- "300", "message" => "ERROR - [wsCancelInvoiceSFJ] Parametros incompletos para el Servicio Web, faltan el ID del CFDI a actualizar"); $Resultado = json_encode($j_array); echo $Resultado; return; } if($bDatPAC == "") { $j_array = array('code' => "300", "message" => "ERROR - [wsCancelInvoiceSFJ] Parametros incompletos para el Servicio Web, faltan los Datos del PAC"); $Resultado = json_encode($j_array); echo $Resultado; return; } ### 0. EXTRACCION DE PARAMETROS PARA EL CFDI ###################################################### #== Primero, extraemos el JSON del string en base 64 $bdDatPAC = base64_decode($bDatPAC); #== Segundo, decodificamos el JSON a un arreglo $abdDatPAC = json_decode($bdDatPAC,true); $dirBase = realpath("../"); # Configuración de zona horaria date_default_timezone_set('America/Mexico_City'); // ### DEFINICIÓN DE CONSTANTES ################################################### $SendaPEMS = "archs_pem/"; $SendaCFDI = "archs_cfdi/"; // Datos de acceso del usuario (proporcionados por el PAC). if($abdDatPAC["tipoTim"] == 1){ ## Timbrado en producción $urlPAC = "https://solucionfactible.com/ws/services/Timbrado?wsdl"; } else { ## Timbrado en pruebas $urlPAC = "https://testing.solucionfactible.com/ws/services/Timbrado?wsdl"; } // Datos para la configuracion del SOAP y los resultados. $username = $abdDatPAC["username"]; $password = $abdDatPAC["password"]; $bdUUID = $abdDatPAC["UUID"]; $fact_serie = $abdDatPAC["serie"]; $fact_folio = $abdDatPAC["folio"]; $invoiceNumber = $abdDatPAC["invoice"]; $invoiceID = $abdDatPAC["invoiceID"]; // Datos "constantes" para los archivos CER y KEY del cliente $noCertificado = $abdDatPAC["Certificado_SAT"]; $file_cer = $abdDatPAC["Archivo_CER"]; $file_key = $abdDatPAC["Archivo_KEY"]; $clavePrivada = $abdDatPAC["Clave_Privada"]; $noCertificado = "00001000000509986153"; $file_cer = "00001000000509986153.cer.pem"; $file_key = "00001000000509986153.key.pem"; $clavePrivada = "SEASOC21"; $organi_id_ZB = $abdDatPAC["organization_id_ZB"]; $authtoken_ZB = $abdDatPAC["authtoken_ZB"]; $authtoken_ZC = $abdDatPAC["authtoken_ZC"]; // Leemos el archivo CER del cliente $nombre_fichero = $SendaPEMS.$file_cer; $gestor = fopen($nombre_fichero, "r"); $cerFile = fread($gestor, filesize($nombre_fichero)); fclose($gestor); // Leemos el archivo KEY del cliente $nombre_fichero = $SendaPEMS.$file_key; $gestor = fopen($nombre_fichero, "r"); $keyFile = fread($gestor, filesize($nombre_fichero)); fclose($gestor); // Conversion de los archivos CER y KEY leidos a formato Base64 $bCertB64 = base64_encode($cerFile); $bKeyB64 = base64_encode($keyFile); ### PROCESO DE CACELACION ######################################################## $response = ''; if($abdDatPAC["tipoTim"] == 1){ ## Timbrado en producción $urlLocation = 'https://solucionfactible.com/ws/services/Timbrado'; } else { ## Timbrado en pruebas $urlLocation = 'https://testing.solucionfactible.com/ws/services/Timbrado'; } #== Se lleva a cabo cancelacion del CFDI ============================ try { $client = new SoapClient($urlPAC); $client->__setLocation($urlLocation); $params = array('usuario' => $username, 'password' => $password, 'uuids' => $bdUUID, 'derCertCSDBase64' => $bCertB64, 'derKeyCSDBase64' => $bKeyB64, 'contrasenaCSD' => $clavePrivada); $response = $client->__soapCall('cancelarBase64', array('parameters' => $params)); } catch (SoapFault $fault) { $j_array = array('code' => "400", "message" => $fault->faultcode."-".$fault->faultstring); $Resultado = json_encode($j_array); echo $Resultado; return; } $ret = $response->return; if($ret->status != 200) { $j_array = array('code' => "500", "message" => "ERROR EN EL PROCESO DE CANCELACION. ".$ret->status." - ".$ret->mensaje); $Resultado = json_encode($j_array); echo $Resultado; return; } $RespServ = $ret; #== Se asigna la respuesta del servidor a una variable de tipo DOM ==== //$NomArchXML = $invoiceNumber."_CFDI_".$fact_serie.str_pad($fact_folio, 6, "0", STR_PAD_LEFT)."_CC.xml"; $NomArchXML = "CFDI_".$fact_serie.str_pad($fact_folio, 6, "0", STR_PAD_LEFT)."_".$invoiceNumber."_CC.xml"; $xml = new DOMdocument('1.0', 'UTF-8'); $root = $xml->createElement("CFDICancelacion"); $root = $xml->appendChild($root); $root->setAttribute("status",$ret->status); $root->setAttribute("mensaje",$ret->mensaje); $child = $xml->createElement("CFDIResultadoCancelacion"); $child = $root->appendChild($child); $child->setAttribute("status", $ret->resultados->status); $child->setAttribute("mensaje", $ret->resultados->mensaje); $child->setAttribute("statusUUID", $ret->resultados->statusUUID); $child->setAttribute("UUID", $ret->resultados->uuid); $cfdi = $xml->saveXML(); $xml->formatOutput = true; $xml->save($SendaCFDI.$NomArchXML); unset($xml); chmod($SendaCFDI.$NomArchXML, 0777); //print_r($ret); $sUUID = $ret->resultados->uuid; $statusUUID = $ret->resultados->statusUUID; if ($statusUUID == "201") { $mensaje = $ret->resultados->mensaje; $iPosAcuse = mb_strpos($mensaje, "Acuse:"); $sMensaje = substr($mensaje, $iPosAcuse+7, 1000); $iPosDigest = mb_strpos($sMensaje, "Digest:"); $sAcuse = substr($sMensaje, 1, $iPosDigest-3); $sMensaje = substr($sMensaje, $iPosDigest+7, 1000); $iPosCerti = mb_strpos($sMensaje, "Certificado:"); $sDigest = substr($sMensaje, 1, $iPosCerti-3); $sMensaje = substr($sMensaje, $iPosCerti+13, 100); $sCertif = substr($sMensaje, 1, 25); # 13.3 Envio del Archivos a Invoice de Zoho Creator $file_name_with_full_path = '/var/www/html/aptusCFDIRF/archs_cfdi/'.$NomArchXML; $request_url = 'https://creator.zoho.com/api/xml/fileupload/scope=creatorapi'; if (function_exists('curl_file_create')) { // php 5.6+ $cFile = curl_file_create($file_name_with_full_path); } else { $cFile = '@' . realpath($file_name_with_full_path); } $post = array( 'authtoken' => $authtoken_ZC, 'applinkname' => 'cfdi', 'formname' => 'CreacionCFDIv33', 'fieldname' => 'File_CFDI_XML_CANC', 'recordId' => $bRecId, 'filename' => $NomArchXML, 'file'=> $cFile); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $request_url); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $post); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); $r = curl_exec($ch); curl_close ($ch); # 13.4 Envio del Archivos a Invoice de Zoho Books $file_name_with_full_path = '/var/www/html/aptusCFDIRF/archs_cfdi/'.$NomArchXML; $request_url = 'https://www.zohoapis.com/books/v3/invoices/'.$invoiceID.'/attachment'; if (function_exists('curl_file_create')) { // php 5.6+ $cFile = curl_file_create($file_name_with_full_path); } else { $cFile = '@' . realpath($file_name_with_full_path); } $post = array( 'authtoken' => $authtoken_ZB, 'organization_id' => $organi_id_ZB, 'can_send_in_mail' => 'true', 'attachment'=> $cFile); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $request_url); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $post); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); $r = curl_exec($ch); curl_close ($ch); $ra = json_decode($r); $resultXML = $ra->code.' - '.$ra->message; $j_array = array('code' => "200", "message" => "Proceso de cancelacion de CFDI fue exitoso", 'acuse' => $sAcuse, 'digest' => $sDigest, 'certificado' => $sCertif, 'uuid' => $sUUID, "statusUUID" => $statusUUID); } else { $mensaje = $ret->resultados->mensaje; $j_array = array('code' => $statusUUID, "message" => $mensaje, "statusUUID" => $statusUUID); } $Resultado = json_encode($j_array); echo $Resultado; return;