debug: add logging to verify SAT status
This commit is contained in:
@@ -116,6 +116,16 @@ export async function verifySatRequest(
|
|||||||
const result = await service.verify(requestId);
|
const result = await service.verify(requestId);
|
||||||
const statusRequest = result.getStatusRequest();
|
const statusRequest = result.getStatusRequest();
|
||||||
|
|
||||||
|
// Debug logging
|
||||||
|
console.log('[SAT Verify Debug]', {
|
||||||
|
statusRequestValue: statusRequest.getValue(),
|
||||||
|
statusRequestEntryId: statusRequest.getEntryId(),
|
||||||
|
cfdis: result.getNumberCfdis(),
|
||||||
|
packages: result.getPackageIds(),
|
||||||
|
statusCode: result.getStatus().getCode(),
|
||||||
|
statusMsg: result.getStatus().getMessage(),
|
||||||
|
});
|
||||||
|
|
||||||
// Usar isTypeOf para determinar el estado
|
// Usar isTypeOf para determinar el estado
|
||||||
let status: VerifyResult['status'];
|
let status: VerifyResult['status'];
|
||||||
if (statusRequest.isTypeOf('Finished')) {
|
if (statusRequest.isTypeOf('Finished')) {
|
||||||
@@ -129,7 +139,12 @@ export async function verifySatRequest(
|
|||||||
} else if (statusRequest.isTypeOf('Rejected')) {
|
} else if (statusRequest.isTypeOf('Rejected')) {
|
||||||
status = 'rejected';
|
status = 'rejected';
|
||||||
} else {
|
} else {
|
||||||
status = 'pending';
|
// Default: check by entryId
|
||||||
|
const entryId = statusRequest.getEntryId();
|
||||||
|
if (entryId === 'Finished') status = 'ready';
|
||||||
|
else if (entryId === 'InProgress') status = 'processing';
|
||||||
|
else if (entryId === 'Accepted') status = 'pending';
|
||||||
|
else status = 'pending';
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|||||||
Reference in New Issue
Block a user