├── .github └── workflows │ └── CICD.yml ├── .gitignore ├── Auth ├── AuthResponseService.cs ├── AuthService.cs ├── IAuthService.cs └── Models │ ├── AuthResponse.cs │ ├── Digest.cs │ ├── Sat │ ├── AuthAutenticaResponse.cs │ ├── AuthBody.cs │ ├── AuthEnvelope.cs │ ├── AuthFault.cs │ ├── AuthFaultBody.cs │ ├── AuthFaultEnvelope.cs │ ├── AuthHeader.cs │ ├── AuthSecurity.cs │ └── AuthTimestamp.cs │ └── Token.cs ├── Common ├── Attributes │ ├── ComplementAttribute.cs │ └── EnumCodeAttribute.cs ├── Enums │ └── SatStatus.cs ├── Http │ ├── BaseResponse.cs │ ├── SatResponse.cs │ ├── SatService.cs │ └── SatUrl.cs ├── Models │ ├── AllComplements.cs │ ├── Complements │ │ ├── Payment │ │ │ ├── Pagos.cs │ │ │ ├── PagosPago.cs │ │ │ ├── PagosPagoDoctoRelacionado.cs │ │ │ ├── PagosPagoDoctoRelacionadoImpuestosDR.cs │ │ │ ├── PagosPagoDoctoRelacionadoImpuestosDRRetencionDR.cs │ │ │ ├── PagosPagoDoctoRelacionadoImpuestosDRTrasladoDR.cs │ │ │ ├── PagosPagoImpuestosP.cs │ │ │ ├── PagosPagoImpuestosPRetencionP.cs │ │ │ ├── PagosPagoImpuestosPTrasladoP.cs │ │ │ ├── PagosTotales.cs │ │ │ └── c_TipoCadenaPago.cs │ │ └── Signature │ │ │ └── TimbreFiscalDigital.cs │ ├── Comprobante.cs │ ├── ComprobanteAddenda.cs │ ├── ComprobanteCfdiRelacionados.cs │ ├── ComprobanteCfdiRelacionadosCfdiRelacionado.cs │ ├── ComprobanteComplemento.cs │ ├── ComprobanteConcepto.cs │ ├── ComprobanteConceptoACuentaTerceros.cs │ ├── ComprobanteConceptoComplementoConcepto.cs │ ├── ComprobanteConceptoCuentaPredial.cs │ ├── ComprobanteConceptoImpuestos.cs │ ├── ComprobanteConceptoImpuestosRetencion.cs │ ├── ComprobanteConceptoImpuestosTraslado.cs │ ├── ComprobanteConceptoInformacionAduanera.cs │ ├── ComprobanteConceptoParte.cs │ ├── ComprobanteConceptoParteInformacionAduanera.cs │ ├── ComprobanteEmisor.cs │ ├── ComprobanteImpuestos.cs │ ├── ComprobanteImpuestosRetencion.cs │ ├── ComprobanteImpuestosTraslado.cs │ ├── ComprobanteInformacionGlobal.cs │ ├── ComprobanteReceptor.cs │ ├── MetaItem.cs │ ├── c_Exportacion.cs │ ├── c_FormaPago.cs │ ├── c_Impuesto.cs │ ├── c_Meses.cs │ ├── c_MetodoPago.cs │ ├── c_Moneda.cs │ ├── c_ObjetoImp.cs │ ├── c_Pais.cs │ ├── c_Periodicidad.cs │ ├── c_RegimenFiscal.cs │ ├── c_TipoDeComprobante.cs │ ├── c_TipoFactor.cs │ ├── c_TipoRelacion.cs │ └── c_UsoCFDI.cs ├── XmlPlaceholders.cs ├── XmlSerializerService.cs └── XmlTemplates.cs ├── Download ├── DownloadResponseService.cs ├── DownloadService.cs ├── IDownloadService.cs └── Models │ ├── DownloadResponse.cs │ └── Sat │ ├── DownloadBody.cs │ ├── DownloadBodyData.cs │ ├── DownloadEnvelope.cs │ ├── DownloadHeader.cs │ └── DownloadHeaderResponse.cs ├── DownloaderExtensions.cs ├── FileStorage ├── FileDetails.cs ├── FileStorageService.cs ├── FileStorageSettings.cs └── IFileStorageService.cs ├── IXmlDownloaderService.cs ├── LICENSE.txt ├── Query ├── IQueryService.cs ├── Models │ ├── DownloadType.cs │ ├── InvoiceComplement.cs │ ├── InvoiceStatus.cs │ ├── InvoiceType.cs │ ├── QueryParameters.cs │ ├── QueryResponse.cs │ ├── QueryStatus.cs │ ├── QueryType.cs │ └── Sat │ │ ├── QueryBody.cs │ │ ├── QueryEnvelope.cs │ │ ├── QuerySoapFault.cs │ │ ├── QuerySolicitaDescargaEmitidosResponse.cs │ │ ├── QuerySolicitaDescargaFolioResponse.cs │ │ ├── QuerySolicitaDescargaRecibidosResponse.cs │ │ └── QuerySolicitaDescargaResult.cs ├── QueryResponseService.cs └── QueryService.cs ├── README.md ├── Verify ├── IVerifyService.cs ├── Models │ ├── RequestStatus.cs │ ├── Sat │ │ ├── VerifyBody.cs │ │ ├── VerifyDownloadRequestResponse.cs │ │ ├── VerifyDownloadRequestResult.cs │ │ └── VerifyEnvelope.cs │ └── VerifyResponse.cs ├── VerifyResponseService.cs └── VerifyService.cs ├── XmlDownloader.csproj ├── XmlDownloader.sln ├── XmlDownloaderService.cs ├── docs ├── 0_UR_Ls_WS_Descarga_Masiva_V1_5_VF_33e2cca681.pdf ├── 1_WS_Solicitud_Descarga_Masiva_V1_5_VF_89183c42e9.pdf ├── 2_WS_Verificacion_de_Descarga_Masiva_V1_5_VF_5e53cc2bb5.pdf └── 3_WS_Descarga_de_Solicitudes_Exitosas_V1_5_VF_74f66e46ec.pdf ├── fiscalapi.ico └── fiscalapi.png /.github/workflows/CICD.yml: -------------------------------------------------------------------------------- 1 | name: Publish NuGet Package 2 | 3 | on: 4 | workflow_dispatch: 5 | 6 | jobs: 7 | build-and-publish: 8 | runs-on: ubuntu-latest 9 | 10 | steps: 11 | # Checkout the repository 12 | - name: Checkout repository 13 | uses: actions/checkout@v3 14 | 15 | # Setup .NET 16 | - name: Setup .NET 17 | uses: actions/setup-dotnet@v3 18 | with: 19 | dotnet-version: '8.0.x' 20 | 21 | # Restore dependencies 22 | - name: Restore dependencies 23 | run: dotnet restore 24 | 25 | # Step to extract the AssemblyVersion from the .csproj file 26 | - name: Extract Package Version 27 | id: get_version 28 | run: | 29 | version=$(grep -oPm1 "(?<=)[^<]+" $(find . -name "*.csproj")) 30 | echo "PACKAGE_VERSION=$version" >> $GITHUB_ENV 31 | echo "Package Version extracted: $version" 32 | 33 | # Build the project 34 | - name: Build the project 35 | run: dotnet build --configuration Release 36 | 37 | # Pack the NuGet package 38 | - name: Pack NuGet Package 39 | run: dotnet pack --configuration Release --output ./nupkg 40 | 41 | # Publish the package to NuGet 42 | - name: Publish to NuGet 43 | env: 44 | NUGET_KEY: ${{ secrets.NUGET_KEY }} 45 | run: | 46 | dotnet nuget push ./nupkg/*.nupkg \ 47 | --api-key $NUGET_KEY \ 48 | --source https://api.nuget.org/v3/index.json 49 | -------------------------------------------------------------------------------- /Auth/AuthResponseService.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * ============================================================================ 3 | * Mozilla Public License 2.0 (MPL-2.0) 4 | * Autor: FISCAL API S. DE R.L. DE C.V. - https://fiscalapi.com 5 | * ============================================================================ 6 | * 7 | * Este código está sujeto a los términos de la Mozilla Public License v2.0. 8 | * Licencia completa: https://mozilla.org/MPL/2.0 9 | * 10 | * AVISO: Este software se proporciona "tal como está" sin garantías de ningún 11 | * tipo. Al usar, modificar o distribuir este código debe mantener esta 12 | * atribución y las referencias al autor. 13 | * 14 | * ============================================================================ 15 | */ 16 | 17 | using Fiscalapi.Credentials.Core; 18 | using Fiscalapi.XmlDownloader.Auth.Models; 19 | using Fiscalapi.XmlDownloader.Auth.Models.Sat; 20 | using Fiscalapi.XmlDownloader.Common; 21 | using Fiscalapi.XmlDownloader.Common.Enums; 22 | using Fiscalapi.XmlDownloader.Common.Http; 23 | 24 | namespace Fiscalapi.XmlDownloader.Auth; 25 | 26 | public static class AuthResponseService 27 | { 28 | public static AuthResponse Build(SatResponse satResponse, ICredential credential) 29 | { 30 | /* 31 | * 32 | 33 | 34 | 35 | 2023-07-14T15:42:58.786Z 36 | 2023-07-14T15:47:58.786Z 37 | 38 | 39 | 40 | 41 | 42 | token... 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | a:InvalidSecurity 51 | An error occurred when verifying security for the message. 52 | 53 | 54 | 55 | */ 56 | if (satResponse.IsSuccessStatusCode) 57 | { 58 | var envelope = XmlSerializerService.Deserialize(satResponse.RawResponse!); 59 | return new AuthResponse 60 | { 61 | Succeeded = true, 62 | SatStatus = SatStatus.RequestSucceeded, 63 | SatStatusCode = SatStatus.RequestSucceeded.ToEnumCode(), 64 | SatMessage = "", 65 | TokenValue = envelope?.Body?.AutenticaResponse?.AutenticaResult, 66 | ValidFrom = envelope?.Header?.Security?.Timestamp?.Created, 67 | ValidTo = envelope?.Header?.Security?.Timestamp?.Expires, 68 | RawRequest = satResponse.RawRequest, 69 | RawResponse = satResponse.RawResponse, 70 | Tin = credential.Certificate.Rfc 71 | }; 72 | } 73 | 74 | if (satResponse.RawResponse is not null && satResponse.RawResponse.ToLowerInvariant().Contains("fault")) 75 | { 76 | var faultEnvelope = XmlSerializerService.Deserialize(satResponse.RawResponse); 77 | return new AuthResponse 78 | { 79 | Succeeded = false, 80 | SatStatus = SatStatus.Unknown, 81 | SatStatusCode = faultEnvelope?.Body?.Fault?.FaultCode, 82 | SatMessage = faultEnvelope?.Body?.Fault?.FaultMessage, 83 | RawRequest = satResponse.RawRequest, 84 | RawResponse = satResponse.RawResponse, 85 | }; 86 | } 87 | 88 | return new AuthResponse 89 | { 90 | Succeeded = false, 91 | SatStatus = SatStatus.Unknown, 92 | SatStatusCode = "UnknownError", 93 | SatMessage = $"StatusCode: {satResponse.HttpStatusCode} Message: {satResponse.ReasonPhrase}", 94 | RawRequest = satResponse.RawRequest, 95 | RawResponse = satResponse.RawResponse, 96 | }; 97 | } 98 | } -------------------------------------------------------------------------------- /Auth/AuthService.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * ============================================================================ 3 | * Mozilla Public License 2.0 (MPL-2.0) 4 | * Autor: FISCAL API S. DE R.L. DE C.V. - https://fiscalapi.com 5 | * ============================================================================ 6 | * 7 | * Este código está sujeto a los términos de la Mozilla Public License v2.0. 8 | * Licencia completa: https://mozilla.org/MPL/2.0 9 | * 10 | * AVISO: Este software se proporciona "tal como está" sin garantías de ningún 11 | * tipo. Al usar, modificar o distribuir este código debe mantener esta 12 | * atribución y las referencias al autor. 13 | * 14 | * ============================================================================ 15 | */ 16 | 17 | using Fiscalapi.Credentials.Common; 18 | using Fiscalapi.Credentials.Core; 19 | using Fiscalapi.XmlDownloader.Auth.Models; 20 | using Fiscalapi.XmlDownloader.Common; 21 | using Fiscalapi.XmlDownloader.Common.Http; 22 | 23 | namespace Fiscalapi.XmlDownloader.Auth; 24 | 25 | /// 26 | /// SAT Authentication Service. 27 | /// 28 | public class AuthService : SatService, IAuthService 29 | { 30 | /// 31 | /// Authenticates with SAT using the provided credential and returns the authentication token 32 | /// 33 | public async Task AuthenticateAsync(ICredential credential, 34 | CancellationToken cancellationToken = default) 35 | { 36 | // Generate Sat XML security token ID 37 | var uuid = CreateSecurityToken(); 38 | 39 | // Create digest and signature using unified template 40 | var digest = CreateDigest(credential); 41 | var signature = CreateSignature(digest, credential, uuid); 42 | 43 | // Build SOAP envelope 44 | var authXml = BuildEnvelope(digest, uuid, credential.Certificate.RawDataBytes.ToBase64String(), 45 | signature); 46 | 47 | // Send request 48 | var satResponse = await SendRequestAsync( 49 | url: SatUrl.AuthUrl, 50 | action: SatUrl.AuthAction, 51 | payload: authXml, 52 | cancellationToken: cancellationToken); 53 | 54 | // Map response 55 | var authResponse = AuthResponseService.Build(satResponse, credential); 56 | 57 | return authResponse; 58 | } 59 | 60 | /// 61 | /// Creates the digest for authentication 62 | /// 63 | private static Digest CreateDigest(ICredential credential) 64 | { 65 | var created = DateTime.UtcNow; 66 | var expires = created.AddSeconds(300); 67 | 68 | var timestampXml = XmlTemplates.TimestampTemplate 69 | .Replace(XmlPlaceholders.Created, created.ToSatFormat()) 70 | .Replace(XmlPlaceholders.Expires, expires.ToSatFormat()); 71 | 72 | var base64Hash = credential.CreateHash(timestampXml.Clean()); 73 | 74 | return new Digest 75 | { 76 | Created = created, 77 | Expires = expires, 78 | Base64Digested = base64Hash 79 | }; 80 | } 81 | 82 | /// 83 | /// Creates the complete signature 84 | /// 85 | private static string CreateSignature(Digest digest, ICredential credential, string uuid) 86 | { 87 | // Create SignedInfo 88 | var signedInfo = XmlTemplates.SignedInfo 89 | .Replace(XmlPlaceholders.Base64Digested, digest.Base64Digested) 90 | .Replace(XmlPlaceholders.ReferenceUri, "#_0"); // Auth siempre usa #_0 91 | 92 | // Sign the SignedInfo 93 | var signatureValue = credential.SignData(signedInfo.Clean()).ToBase64String(); 94 | 95 | // Remove namespace from SignedInfo for embedding 96 | var cleanSignedInfo = signedInfo.Replace( 97 | @"", 98 | ""); 99 | 100 | // Create KeyInfo 101 | var keyInfo = XmlTemplates.SecurityTokenReferenceKeyInfo 102 | .Replace(XmlPlaceholders.Uuid, uuid); 103 | 104 | // Build complete signature 105 | var signature = XmlTemplates.SignatureTemplate 106 | .Replace(XmlPlaceholders.SignedInfo, cleanSignedInfo) 107 | .Replace(XmlPlaceholders.Base64Signature, signatureValue) 108 | .Replace(XmlPlaceholders.KeyInfo, keyInfo); 109 | 110 | return signature; 111 | } 112 | 113 | /// 114 | /// Builds the complete authentication envelope 115 | /// 116 | private static string BuildEnvelope(Digest digest, string uuid, string certificate, string signature) 117 | { 118 | var binarySecurityToken = XmlTemplates.BinarySecurityToken 119 | .Replace(XmlPlaceholders.Uuid, uuid) 120 | .Replace(XmlPlaceholders.Base64Cer, certificate); 121 | 122 | var authEnvelope = XmlTemplates.AuthEnvelope 123 | .Replace(XmlPlaceholders.Created, digest.Created.ToSatFormat()) 124 | .Replace(XmlPlaceholders.Expires, digest.Expires.ToSatFormat()) 125 | .Replace(XmlPlaceholders.Uuid, uuid) 126 | .Replace(XmlPlaceholders.Base64Cer, certificate) 127 | .Replace(XmlPlaceholders.SignatureData, signature); 128 | 129 | return authEnvelope.Clean(); 130 | } 131 | 132 | /// 133 | /// Creates a unique XML security token ID 134 | /// 135 | private static string CreateSecurityToken() 136 | { 137 | var uuid = Guid.NewGuid().ToString("D").ToLowerInvariant(); 138 | 139 | return $"uuid-{uuid}-4"; 140 | } 141 | } -------------------------------------------------------------------------------- /Auth/IAuthService.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * ============================================================================ 3 | * Mozilla Public License 2.0 (MPL-2.0) 4 | * Autor: FISCAL API S. DE R.L. DE C.V. - https://fiscalapi.com 5 | * ============================================================================ 6 | * 7 | * Este código está sujeto a los términos de la Mozilla Public License v2.0. 8 | * Licencia completa: https://mozilla.org/MPL/2.0 9 | * 10 | * AVISO: Este software se proporciona "tal como está" sin garantías de ningún 11 | * tipo. Al usar, modificar o distribuir este código debe mantener esta 12 | * atribución y las referencias al autor. 13 | * 14 | * ============================================================================ 15 | */ 16 | 17 | using Fiscalapi.Credentials.Core; 18 | using Fiscalapi.XmlDownloader.Auth.Models; 19 | 20 | namespace Fiscalapi.XmlDownloader.Auth; 21 | 22 | /// 23 | /// Interface for the SAT Authentication Service. 24 | /// 25 | public interface IAuthService 26 | { 27 | /// 28 | /// Authenticates with SAT using the provided credential and returns the authentication token. 29 | /// 30 | /// 31 | /// CancellationToken 32 | /// 33 | Task AuthenticateAsync(ICredential credential, CancellationToken cancellationToken = default); 34 | } -------------------------------------------------------------------------------- /Auth/Models/AuthResponse.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * ============================================================================ 3 | * Mozilla Public License 2.0 (MPL-2.0) 4 | * Autor: FISCAL API S. DE R.L. DE C.V. - https://fiscalapi.com 5 | * ============================================================================ 6 | * 7 | * Este código está sujeto a los términos de la Mozilla Public License v2.0. 8 | * Licencia completa: https://mozilla.org/MPL/2.0 9 | * 10 | * AVISO: Este software se proporciona "tal como está" sin garantías de ningún 11 | * tipo. Al usar, modificar o distribuir este código debe mantener esta 12 | * atribución y las referencias al autor. 13 | * 14 | * ============================================================================ 15 | */ 16 | 17 | using Fiscalapi.XmlDownloader.Common.Http; 18 | 19 | namespace Fiscalapi.XmlDownloader.Auth.Models; 20 | 21 | /// 22 | /// Response from the authentication service 23 | /// 24 | public class AuthResponse : BaseResponse 25 | { 26 | /// 27 | /// The JWT token returned in a successful response. 28 | /// 29 | public string? TokenValue { get; set; } 30 | 31 | /// 32 | /// The timestamp indicating when the token becomes valid. 33 | /// 34 | public DateTime? ValidFrom { get; set; } 35 | 36 | /// 37 | /// The timestamp indicating when the token expires. 38 | /// 39 | public DateTime? ValidTo { get; set; } 40 | 41 | /// 42 | /// RFC associated with the Auth response. The tax identification number (TIN) 43 | /// 44 | public string? Tin { get; set; } 45 | 46 | /// 47 | /// Get token details as a structured object 48 | /// 49 | public Token? Token 50 | { 51 | get 52 | { 53 | if (!string.IsNullOrWhiteSpace(TokenValue)) 54 | { 55 | return new Token 56 | { 57 | Value = TokenValue, 58 | ValidFrom = ValidFrom, 59 | ValidTo = ValidTo, 60 | Tin = Tin 61 | }; 62 | } 63 | 64 | return null; 65 | } 66 | } 67 | } -------------------------------------------------------------------------------- /Auth/Models/Digest.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * ============================================================================ 3 | * Mozilla Public License 2.0 (MPL-2.0) 4 | * Autor: FISCAL API S. DE R.L. DE C.V. - https://fiscalapi.com 5 | * ============================================================================ 6 | * 7 | * Este código está sujeto a los términos de la Mozilla Public License v2.0. 8 | * Licencia completa: https://mozilla.org/MPL/2.0 9 | * 10 | * AVISO: Este software se proporciona "tal como está" sin garantías de ningún 11 | * tipo. Al usar, modificar o distribuir este código debe mantener esta 12 | * atribución y las referencias al autor. 13 | * 14 | * ============================================================================ 15 | */ 16 | 17 | namespace Fiscalapi.XmlDownloader.Auth.Models; 18 | 19 | public class Digest 20 | { 21 | public DateTime Created { get; set; } 22 | public DateTime Expires { get; set; } 23 | public string Base64Digested { get; set; } = string.Empty; 24 | } -------------------------------------------------------------------------------- /Auth/Models/Sat/AuthAutenticaResponse.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * ============================================================================ 3 | * Mozilla Public License 2.0 (MPL-2.0) 4 | * Autor: FISCAL API S. DE R.L. DE C.V. - https://fiscalapi.com 5 | * ============================================================================ 6 | * 7 | * Este código está sujeto a los términos de la Mozilla Public License v2.0. 8 | * Licencia completa: https://mozilla.org/MPL/2.0 9 | * 10 | * AVISO: Este software se proporciona "tal como está" sin garantías de ningún 11 | * tipo. Al usar, modificar o distribuir este código debe mantener esta 12 | * atribución y las referencias al autor. 13 | * 14 | * ============================================================================ 15 | */ 16 | 17 | using System.Xml.Serialization; 18 | 19 | namespace Fiscalapi.XmlDownloader.Auth.Models.Sat; 20 | 21 | public class AuthAutenticaResponse 22 | { 23 | [XmlElement(ElementName = "AutenticaResult")] 24 | public string? AutenticaResult { get; set; } 25 | } -------------------------------------------------------------------------------- /Auth/Models/Sat/AuthBody.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * ============================================================================ 3 | * Mozilla Public License 2.0 (MPL-2.0) 4 | * Autor: FISCAL API S. DE R.L. DE C.V. - https://fiscalapi.com 5 | * ============================================================================ 6 | * 7 | * Este código está sujeto a los términos de la Mozilla Public License v2.0. 8 | * Licencia completa: https://mozilla.org/MPL/2.0 9 | * 10 | * AVISO: Este software se proporciona "tal como está" sin garantías de ningún 11 | * tipo. Al usar, modificar o distribuir este código debe mantener esta 12 | * atribución y las referencias al autor. 13 | * 14 | * ============================================================================ 15 | */ 16 | 17 | using System.Xml.Serialization; 18 | 19 | namespace Fiscalapi.XmlDownloader.Auth.Models.Sat; 20 | 21 | public class AuthBody 22 | { 23 | [XmlElement(ElementName = "AutenticaResponse", Namespace = "http://DescargaMasivaTerceros.gob.mx")] 24 | public AuthAutenticaResponse? AutenticaResponse { get; set; } 25 | 26 | [XmlElement(ElementName = "Fault", Namespace = "http://schemas.xmlsoap.org/soap/envelope/")] 27 | public AuthFault? Fault { get; set; } 28 | } -------------------------------------------------------------------------------- /Auth/Models/Sat/AuthEnvelope.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * ============================================================================ 3 | * Mozilla Public License 2.0 (MPL-2.0) 4 | * Autor: FISCAL API S. DE R.L. DE C.V. - https://fiscalapi.com 5 | * ============================================================================ 6 | * 7 | * Este código está sujeto a los términos de la Mozilla Public License v2.0. 8 | * Licencia completa: https://mozilla.org/MPL/2.0 9 | * 10 | * AVISO: Este software se proporciona "tal como está" sin garantías de ningún 11 | * tipo. Al usar, modificar o distribuir este código debe mantener esta 12 | * atribución y las referencias al autor. 13 | * 14 | * ============================================================================ 15 | */ 16 | 17 | using System.Xml.Serialization; 18 | 19 | namespace Fiscalapi.XmlDownloader.Auth.Models.Sat; 20 | 21 | // Envelope for Success Response 22 | [XmlRoot(ElementName = "Envelope", Namespace = "http://schemas.xmlsoap.org/soap/envelope/")] 23 | public class AuthEnvelope 24 | { 25 | [XmlElement(ElementName = "Header")] public AuthHeader? Header { get; set; } 26 | 27 | [XmlElement(ElementName = "Body")] public AuthBody? Body { get; set; } 28 | } -------------------------------------------------------------------------------- /Auth/Models/Sat/AuthFault.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * ============================================================================ 3 | * Mozilla Public License 2.0 (MPL-2.0) 4 | * Autor: FISCAL API S. DE R.L. DE C.V. - https://fiscalapi.com 5 | * ============================================================================ 6 | * 7 | * Este código está sujeto a los términos de la Mozilla Public License v2.0. 8 | * Licencia completa: https://mozilla.org/MPL/2.0 9 | * 10 | * AVISO: Este software se proporciona "tal como está" sin garantías de ningún 11 | * tipo. Al usar, modificar o distribuir este código debe mantener esta 12 | * atribución y las referencias al autor. 13 | * 14 | * ============================================================================ 15 | */ 16 | 17 | using System.Xml.Serialization; 18 | 19 | namespace Fiscalapi.XmlDownloader.Auth.Models.Sat; 20 | 21 | public class AuthFault 22 | { 23 | [XmlElement(ElementName = "FaultCode")] 24 | public string? FaultCode { get; set; } 25 | 26 | [XmlElement(ElementName = "FaultString")] 27 | public string? FaultMessage { get; set; } 28 | } -------------------------------------------------------------------------------- /Auth/Models/Sat/AuthFaultBody.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * ============================================================================ 3 | * Mozilla Public License 2.0 (MPL-2.0) 4 | * Autor: FISCAL API S. DE R.L. DE C.V. - https://fiscalapi.com 5 | * ============================================================================ 6 | * 7 | * Este código está sujeto a los términos de la Mozilla Public License v2.0. 8 | * Licencia completa: https://mozilla.org/MPL/2.0 9 | * 10 | * AVISO: Este software se proporciona "tal como está" sin garantías de ningún 11 | * tipo. Al usar, modificar o distribuir este código debe mantener esta 12 | * atribución y las referencias al autor. 13 | * 14 | * ============================================================================ 15 | */ 16 | 17 | using System.Xml.Serialization; 18 | 19 | namespace Fiscalapi.XmlDownloader.Auth.Models.Sat; 20 | 21 | public class AuthFaultBody 22 | { 23 | [XmlElement(ElementName = "Fault")] public AuthFault? Fault { get; set; } 24 | } -------------------------------------------------------------------------------- /Auth/Models/Sat/AuthFaultEnvelope.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * ============================================================================ 3 | * Mozilla Public License 2.0 (MPL-2.0) 4 | * Autor: FISCAL API S. DE R.L. DE C.V. - https://fiscalapi.com 5 | * ============================================================================ 6 | * 7 | * Este código está sujeto a los términos de la Mozilla Public License v2.0. 8 | * Licencia completa: https://mozilla.org/MPL/2.0 9 | * 10 | * AVISO: Este software se proporciona "tal como está" sin garantías de ningún 11 | * tipo. Al usar, modificar o distribuir este código debe mantener esta 12 | * atribución y las referencias al autor. 13 | * 14 | * ============================================================================ 15 | */ 16 | 17 | using System.Xml.Serialization; 18 | 19 | namespace Fiscalapi.XmlDownloader.Auth.Models.Sat; 20 | 21 | [XmlRoot(ElementName = "Envelope", Namespace = "http://schemas.xmlsoap.org/soap/envelope/")] 22 | public class AuthFaultEnvelope 23 | { 24 | [XmlElement(ElementName = "Body")] public AuthFaultBody? Body { get; set; } 25 | } -------------------------------------------------------------------------------- /Auth/Models/Sat/AuthHeader.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * ============================================================================ 3 | * Mozilla Public License 2.0 (MPL-2.0) 4 | * Autor: FISCAL API S. DE R.L. DE C.V. - https://fiscalapi.com 5 | * ============================================================================ 6 | * 7 | * Este código está sujeto a los términos de la Mozilla Public License v2.0. 8 | * Licencia completa: https://mozilla.org/MPL/2.0 9 | * 10 | * AVISO: Este software se proporciona "tal como está" sin garantías de ningún 11 | * tipo. Al usar, modificar o distribuir este código debe mantener esta 12 | * atribución y las referencias al autor. 13 | * 14 | * ============================================================================ 15 | */ 16 | 17 | using System.Xml.Serialization; 18 | 19 | namespace Fiscalapi.XmlDownloader.Auth.Models.Sat; 20 | 21 | public class AuthHeader 22 | { 23 | [XmlElement(ElementName = "Security", 24 | Namespace = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd")] 25 | public AuthSecurity? Security { get; set; } 26 | } -------------------------------------------------------------------------------- /Auth/Models/Sat/AuthSecurity.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * ============================================================================ 3 | * Mozilla Public License 2.0 (MPL-2.0) 4 | * Autor: FISCAL API S. DE R.L. DE C.V. - https://fiscalapi.com 5 | * ============================================================================ 6 | * 7 | * Este código está sujeto a los términos de la Mozilla Public License v2.0. 8 | * Licencia completa: https://mozilla.org/MPL/2.0 9 | * 10 | * AVISO: Este software se proporciona "tal como está" sin garantías de ningún 11 | * tipo. Al usar, modificar o distribuir este código debe mantener esta 12 | * atribución y las referencias al autor. 13 | * 14 | * ============================================================================ 15 | */ 16 | 17 | using System.Xml.Serialization; 18 | 19 | namespace Fiscalapi.XmlDownloader.Auth.Models.Sat; 20 | 21 | public class AuthSecurity 22 | { 23 | [XmlElement(ElementName = "Timestamp", 24 | Namespace = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd")] 25 | public AuthTimestamp? Timestamp { get; set; } 26 | } -------------------------------------------------------------------------------- /Auth/Models/Sat/AuthTimestamp.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * ============================================================================ 3 | * Mozilla Public License 2.0 (MPL-2.0) 4 | * Autor: FISCAL API S. DE R.L. DE C.V. - https://fiscalapi.com 5 | * ============================================================================ 6 | * 7 | * Este código está sujeto a los términos de la Mozilla Public License v2.0. 8 | * Licencia completa: https://mozilla.org/MPL/2.0 9 | * 10 | * AVISO: Este software se proporciona "tal como está" sin garantías de ningún 11 | * tipo. Al usar, modificar o distribuir este código debe mantener esta 12 | * atribución y las referencias al autor. 13 | * 14 | * ============================================================================ 15 | */ 16 | 17 | using System.Xml.Serialization; 18 | 19 | namespace Fiscalapi.XmlDownloader.Auth.Models.Sat; 20 | 21 | public class AuthTimestamp 22 | { 23 | [XmlElement(ElementName = "Created", 24 | Namespace = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd")] 25 | public DateTime Created { get; set; } 26 | 27 | [XmlElement(ElementName = "Expires", 28 | Namespace = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd")] 29 | public DateTime Expires { get; set; } 30 | } -------------------------------------------------------------------------------- /Auth/Models/Token.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * ============================================================================ 3 | * Mozilla Public License 2.0 (MPL-2.0) 4 | * Autor: FISCAL API S. DE R.L. DE C.V. - https://fiscalapi.com 5 | * ============================================================================ 6 | * 7 | * Este código está sujeto a los términos de la Mozilla Public License v2.0. 8 | * Licencia completa: https://mozilla.org/MPL/2.0 9 | * 10 | * AVISO: Este software se proporciona "tal como está" sin garantías de ningún 11 | * tipo. Al usar, modificar o distribuir este código debe mantener esta 12 | * atribución y las referencias al autor. 13 | * 14 | * ============================================================================ 15 | */ 16 | 17 | namespace Fiscalapi.XmlDownloader.Auth.Models; 18 | 19 | public class Token 20 | { 21 | /// 22 | /// The JWT token string. 23 | /// 24 | public string? Value { get; set; } 25 | 26 | /// 27 | /// The timestamp indicating when the token becomes valid. 28 | /// 29 | public DateTime? ValidFrom { get; set; } 30 | 31 | /// 32 | /// The timestamp indicating when the token expires. 33 | /// 34 | public DateTime? ValidTo { get; set; } 35 | 36 | /// 37 | /// RFC associated with the token. The tax identification number (TIN) 38 | /// 39 | public string? Tin { get; set; } 40 | 41 | /// 42 | /// Checks if the token is currently valid based on the current time. 43 | /// 44 | public bool IsValid => 45 | ValidFrom.HasValue && 46 | ValidTo.HasValue && 47 | !string.IsNullOrWhiteSpace(Value) && 48 | !string.IsNullOrWhiteSpace(Tin) && 49 | DateTime.UtcNow >= ValidFrom.Value && 50 | DateTime.UtcNow <= ValidTo.Value; 51 | } -------------------------------------------------------------------------------- /Common/Attributes/ComplementAttribute.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * ============================================================================ 3 | * Mozilla Public License 2.0 (MPL-2.0) 4 | * Autor: FISCAL API S. DE R.L. DE C.V. - https://fiscalapi.com 5 | * ============================================================================ 6 | * 7 | * Este código está sujeto a los términos de la Mozilla Public License v2.0. 8 | * Licencia completa: https://mozilla.org/MPL/2.0 9 | * 10 | * AVISO: Este software se proporciona "tal como está" sin garantías de ningún 11 | * tipo. Al usar, modificar o distribuir este código debe mantener esta 12 | * atribución y las referencias al autor. 13 | * 14 | * ============================================================================ 15 | */ 16 | 17 | namespace Fiscalapi.XmlDownloader.Common.Attributes; 18 | 19 | [AttributeUsage(AttributeTargets.Property)] 20 | public class ComplementAttribute(string prefix) : Attribute 21 | { 22 | public string Prefix { get; } = prefix; 23 | } -------------------------------------------------------------------------------- /Common/Attributes/EnumCodeAttribute.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * ============================================================================ 3 | * Mozilla Public License 2.0 (MPL-2.0) 4 | * Autor: FISCAL API S. DE R.L. DE C.V. - https://fiscalapi.com 5 | * ============================================================================ 6 | * 7 | * Este código está sujeto a los términos de la Mozilla Public License v2.0. 8 | * Licencia completa: https://mozilla.org/MPL/2.0 9 | * 10 | * AVISO: Este software se proporciona "tal como está" sin garantías de ningún 11 | * tipo. Al usar, modificar o distribuir este código debe mantener esta 12 | * atribución y las referencias al autor. 13 | * 14 | * ============================================================================ 15 | */ 16 | 17 | namespace Fiscalapi.XmlDownloader.Common.Attributes; 18 | 19 | [AttributeUsage(AttributeTargets.Field)] 20 | public class EnumCodeAttribute(string code) : Attribute 21 | { 22 | public string Code { get; } = code; 23 | } -------------------------------------------------------------------------------- /Common/Enums/SatStatus.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * ============================================================================ 3 | * Mozilla Public License 2.0 (MPL-2.0) 4 | * Autor: FISCAL API S. DE R.L. DE C.V. - https://fiscalapi.com 5 | * ============================================================================ 6 | * 7 | * Este código está sujeto a los términos de la Mozilla Public License v2.0. 8 | * Licencia completa: https://mozilla.org/MPL/2.0 9 | * 10 | * AVISO: Este software se proporciona "tal como está" sin garantías de ningún 11 | * tipo. Al usar, modificar o distribuir este código debe mantener esta 12 | * atribución y las referencias al autor. 13 | * 14 | * ============================================================================ 15 | */ 16 | 17 | using Fiscalapi.XmlDownloader.Common.Attributes; 18 | 19 | namespace Fiscalapi.XmlDownloader.Common.Enums; 20 | 21 | /// 22 | /// Mensajes recibidos desde todas las operaciones del Servicio de Descarga Masiva 23 | /// 24 | public enum SatStatus 25 | { 26 | /// 27 | /// Desconocido. 28 | /// 29 | [EnumCode("0")] Unknown = 0, 30 | 31 | /// 32 | /// Usuario No Válido 33 | /// 34 | [EnumCode("300")] InvalidUser = 300, 35 | 36 | /// 37 | /// XML Mal Formado. 38 | /// Este código de error se regresa cuando el request posee información inválida, ejemplo: un RFC de receptor no válido. 39 | /// 40 | [EnumCode("301")] InvalidXml = 301, 41 | 42 | /// 43 | /// Sello Mal Formado 44 | /// 45 | [EnumCode("302")] InvalidSignature = 302, 46 | 47 | /// 48 | /// Sello no corresponde con el RFC del solicitante. 49 | /// El sello digital no corresponde con el RFC del usuario que realiza la operación. 50 | /// 51 | [EnumCode("303")] SignatureAndRfcMismatch = 303, 52 | 53 | /// 54 | /// Certificado Revocado o Caduco. 55 | /// El certificado puede ser inválido por múltiples razones como son el tipo, la vigencia, etc. 56 | /// 57 | [EnumCode("304")] CertificateExpiredOrRevoked = 304, 58 | 59 | /// 60 | /// Certificado Inválido. 61 | /// El certificado puede ser inválido por múltiples razones como son el tipo, la vigencia, etc. 62 | /// 63 | [EnumCode("305")] InvalidCertificate = 305, 64 | 65 | /// 66 | /// Error no controlado 67 | /// 68 | [EnumCode("404")] UncontrolledError = 404, 69 | 70 | /// 71 | /// Solicitud recibida con éxito. 72 | /// La solicitud fue recibida y procesada correctamente por el servicio. 73 | /// 74 | [EnumCode("5000")] RequestSucceeded = 5000, 75 | 76 | /// 77 | /// Tercero no autorizado. 78 | /// Se da cuando se trata de descargar comprobantes que no son propios. 79 | /// 80 | [EnumCode("5001")] Unauthorized = 5001, 81 | 82 | /// 83 | /// Se han agotado las solicitudes de por vida. 84 | /// Se ha alcanzado el límite de solicitudes con el mismo criterio. 85 | /// 86 | [EnumCode("5002")] CriteriaLimitExceeded = 5002, 87 | 88 | /// 89 | /// Tope máximo de elementos de la consulta. 90 | /// La solicitud sobrepasa el máximo de resultados por tipo de solicitud (Metadata y CFDI). 91 | /// 92 | [EnumCode("5003")] ResultsLimitExceeded = 5003, 93 | 94 | /// 95 | /// No se encontró la información. 96 | /// No se encontró la información solicitada (solicitud de descarga o paquete según el contexto). 97 | /// 98 | [EnumCode("5004")] InformationNotFound = 5004, 99 | 100 | /// 101 | /// Ya se tiene una solicitud registrada. 102 | /// Ya existe una solicitud activa con los mismos criterios. 103 | /// 104 | [EnumCode("5005")] DuplicateRequest = 5005, 105 | 106 | /// 107 | /// No existe el paquete solicitado. 108 | /// Los paquetes solo tienen un periodo de vida de 72 horas. 109 | /// 110 | [EnumCode("5007")] PackageExpired = 5007, 111 | 112 | /// 113 | /// Máximo de descargas permitidas. 114 | /// Un paquete solo puede descargarse un total de 2 veces, una vez agotadas, ya no se podrá volver a descargar. 115 | /// 116 | [EnumCode("5008")] DownloadsExceeded = 5008, 117 | 118 | /// 119 | /// Límite de descargas por folio por día. 120 | /// Se ha alcanzado o sobrepasado el límite de descargas diarias por folio. 121 | /// 122 | [EnumCode("5011")] DailyDownloadExceeded = 5011, 123 | 124 | /// 125 | /// No se permite la descarga de xml que se encuentren cancelados 126 | /// 127 | [EnumCode("5012")] CancelledXmlNotAllowed = 5012 128 | } -------------------------------------------------------------------------------- /Common/Http/BaseResponse.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * ============================================================================ 3 | * Mozilla Public License 2.0 (MPL-2.0) 4 | * Autor: FISCAL API S. DE R.L. DE C.V. - https://fiscalapi.com 5 | * ============================================================================ 6 | * 7 | * Este código está sujeto a los términos de la Mozilla Public License v2.0. 8 | * Licencia completa: https://mozilla.org/MPL/2.0 9 | * 10 | * AVISO: Este software se proporciona "tal como está" sin garantías de ningún 11 | * tipo. Al usar, modificar o distribuir este código debe mantener esta 12 | * atribución y las referencias al autor. 13 | * 14 | * ============================================================================ 15 | */ 16 | 17 | using Fiscalapi.XmlDownloader.Common.Enums; 18 | 19 | namespace Fiscalapi.XmlDownloader.Common.Http; 20 | 21 | /// 22 | /// Base response class containing common properties for all SAT web service responses 23 | /// 24 | public abstract class BaseResponse 25 | { 26 | /// 27 | /// Indicates whether the response was successful. 28 | /// 29 | public bool Succeeded { get; set; } 30 | 31 | /// 32 | /// Raw request and response XML strings for debugging purposes. 33 | /// 34 | public string? RawRequest { get; set; } 35 | 36 | /// 37 | /// Raw response XML string as received from the SAT service. 38 | /// 39 | public string? RawResponse { get; set; } 40 | 41 | 42 | /// 43 | /// Operation status code from the SAT service 44 | /// 45 | public SatStatus SatStatus { get; set; } 46 | 47 | /// 48 | /// Sat 'CodEstatus' received from the service 49 | /// 50 | public string? SatStatusCode { get; set; } 51 | 52 | /// 53 | /// Sar 'Mensaje' from the SAT service 54 | /// 55 | public string? SatMessage { get; set; } 56 | } -------------------------------------------------------------------------------- /Common/Http/SatResponse.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * ============================================================================ 3 | * Mozilla Public License 2.0 (MPL-2.0) 4 | * Autor: FISCAL API S. DE R.L. DE C.V. - https://fiscalapi.com 5 | * ============================================================================ 6 | * 7 | * Este código está sujeto a los términos de la Mozilla Public License v2.0. 8 | * Licencia completa: https://mozilla.org/MPL/2.0 9 | * 10 | * AVISO: Este software se proporciona "tal como está" sin garantías de ningún 11 | * tipo. Al usar, modificar o distribuir este código debe mantener esta 12 | * atribución y las referencias al autor. 13 | * 14 | * ============================================================================ 15 | */ 16 | 17 | using System.Net; 18 | 19 | namespace Fiscalapi.XmlDownloader.Common.Http; 20 | 21 | /// 22 | /// Raw SAT Response 23 | /// 24 | public class SatResponse 25 | { 26 | public bool IsSuccessStatusCode { get; set; } 27 | public HttpStatusCode HttpStatusCode { get; set; } 28 | public string? ReasonPhrase { get; set; } 29 | public string? RawRequest { get; set; } 30 | public string? RawResponse { get; set; } 31 | } -------------------------------------------------------------------------------- /Common/Http/SatUrl.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * ============================================================================ 3 | * Mozilla Public License 2.0 (MPL-2.0) 4 | * Autor: FISCAL API S. DE R.L. DE C.V. - https://fiscalapi.com 5 | * ============================================================================ 6 | * 7 | * Este código está sujeto a los términos de la Mozilla Public License v2.0. 8 | * Licencia completa: https://mozilla.org/MPL/2.0 9 | * 10 | * AVISO: Este software se proporciona "tal como está" sin garantías de ningún 11 | * tipo. Al usar, modificar o distribuir este código debe mantener esta 12 | * atribución y las referencias al autor. 13 | * 14 | * ============================================================================ 15 | */ 16 | 17 | namespace Fiscalapi.XmlDownloader.Common.Http; 18 | 19 | /// 20 | /// Sat web services urls and it's actions 21 | /// 22 | public static class SatUrl 23 | { 24 | #region Auth 25 | 26 | public const string AuthUrl = 27 | "https://cfdidescargamasivasolicitud.clouda.sat.gob.mx/Autenticacion/Autenticacion.svc"; 28 | 29 | public const string AuthAction = "http://DescargaMasivaTerceros.gob.mx/IAutenticacion/Autentica"; 30 | 31 | #endregion 32 | 33 | #region Request 34 | 35 | public const string RequestUrl = 36 | "https://cfdidescargamasivasolicitud.clouda.sat.gob.mx/SolicitaDescargaService.svc"; 37 | 38 | public const string RequestIssuedAction = 39 | "http://DescargaMasivaTerceros.sat.gob.mx/ISolicitaDescargaService/SolicitaDescargaEmitidos"; 40 | 41 | public const string RequestReceivedAction = 42 | "http://DescargaMasivaTerceros.sat.gob.mx/ISolicitaDescargaService/SolicitaDescargaRecibidos"; 43 | 44 | public const string RequestUuidAction = 45 | "http://DescargaMasivaTerceros.sat.gob.mx/ISolicitaDescargaService/SolicitaDescargaFolio"; 46 | 47 | #endregion 48 | 49 | #region Verify 50 | 51 | public const string VerifyUrl = 52 | "https://cfdidescargamasivasolicitud.clouda.sat.gob.mx/VerificaSolicitudDescargaService.svc"; 53 | 54 | public const string VerifyAction = 55 | "http://DescargaMasivaTerceros.sat.gob.mx/IVerificaSolicitudDescargaService/VerificaSolicitudDescarga"; 56 | 57 | #endregion 58 | 59 | #region Download 60 | 61 | public const string DownloadUrl = 62 | "https://cfdidescargamasiva.clouda.sat.gob.mx/DescargaMasivaService.svc"; 63 | 64 | public const string DownloadAction = 65 | "http://DescargaMasivaTerceros.sat.gob.mx/IDescargaMasivaTercerosService/Descargar"; 66 | 67 | #endregion 68 | } -------------------------------------------------------------------------------- /Common/Models/AllComplements.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * ============================================================================ 3 | * Mozilla Public License 2.0 (MPL-2.0) 4 | * Autor: FISCAL API S. DE R.L. DE C.V. - https://fiscalapi.com 5 | * ============================================================================ 6 | * 7 | * Este código está sujeto a los términos de la Mozilla Public License v2.0. 8 | * Licencia completa: https://mozilla.org/MPL/2.0 9 | * 10 | * AVISO: Este software se proporciona "tal como está" sin garantías de ningún 11 | * tipo. Al usar, modificar o distribuir este código debe mantener esta 12 | * atribución y las referencias al autor. 13 | * 14 | * ============================================================================ 15 | */ 16 | 17 | using Fiscalapi.XmlDownloader.Common.Attributes; 18 | using Fiscalapi.XmlDownloader.Common.Models.Complements.Payment; 19 | using Fiscalapi.XmlDownloader.Common.Models.Complements.Signature; 20 | 21 | namespace Fiscalapi.XmlDownloader.Common.Models; 22 | 23 | public class AllComplements 24 | { 25 | /// 26 | /// Complemento del comprobante que contiene el Timbre Fiscal Digital. 27 | /// 28 | [Complement("tfd")] 29 | public TimbreFiscalDigital? TimbreFiscalDigital { get; set; } 30 | 31 | /// 32 | /// Complemento del comprobante con el complemento de pagos 2.0 33 | /// 34 | [Complement("pago20")] 35 | public Pagos Pago20 { get; set; } 36 | } -------------------------------------------------------------------------------- /Common/Models/Complements/Payment/Pagos.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * ============================================================================ 3 | * Mozilla Public License 2.0 (MPL-2.0) 4 | * Autor: FISCAL API S. DE R.L. DE C.V. - https://fiscalapi.com 5 | * ============================================================================ 6 | * 7 | * Este código está sujeto a los términos de la Mozilla Public License v2.0. 8 | * Licencia completa: https://mozilla.org/MPL/2.0 9 | * 10 | * AVISO: Este software se proporciona "tal como está" sin garantías de ningún 11 | * tipo. Al usar, modificar o distribuir este código debe mantener esta 12 | * atribución y las referencias al autor. 13 | * 14 | * ============================================================================ 15 | */ 16 | 17 | using System.Xml.Serialization; 18 | 19 | namespace Fiscalapi.XmlDownloader.Common.Models.Complements.Payment; 20 | 21 | /// 22 | [Serializable()] 23 | [XmlType(AnonymousType = true, Namespace = "http://www.sat.gob.mx/Pagos20")] 24 | [XmlRoot(Namespace = "http://www.sat.gob.mx/Pagos20", IsNullable = false)] 25 | public class Pagos 26 | { 27 | private PagosTotales totalesField; 28 | 29 | private PagosPago[] pagoField; 30 | 31 | private string versionField; 32 | 33 | public Pagos() 34 | { 35 | this.versionField = "2.0"; 36 | } 37 | 38 | /// 39 | public PagosTotales Totales 40 | { 41 | get { return this.totalesField; } 42 | set { this.totalesField = value; } 43 | } 44 | 45 | /// 46 | [XmlElement("Pago")] 47 | public PagosPago[] Pago 48 | { 49 | get { return this.pagoField; } 50 | set { this.pagoField = value; } 51 | } 52 | 53 | /// 54 | [XmlAttribute()] 55 | public string Version 56 | { 57 | get { return this.versionField; } 58 | set { this.versionField = value; } 59 | } 60 | } -------------------------------------------------------------------------------- /Common/Models/Complements/Payment/PagosPago.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * ============================================================================ 3 | * Mozilla Public License 2.0 (MPL-2.0) 4 | * Autor: FISCAL API S. DE R.L. DE C.V. - https://fiscalapi.com 5 | * ============================================================================ 6 | * 7 | * Este código está sujeto a los términos de la Mozilla Public License v2.0. 8 | * Licencia completa: https://mozilla.org/MPL/2.0 9 | * 10 | * AVISO: Este software se proporciona "tal como está" sin garantías de ningún 11 | * tipo. Al usar, modificar o distribuir este código debe mantener esta 12 | * atribución y las referencias al autor. 13 | * 14 | * ============================================================================ 15 | */ 16 | 17 | using System.Xml.Serialization; 18 | 19 | namespace Fiscalapi.XmlDownloader.Common.Models.Complements.Payment; 20 | 21 | /// 22 | [Serializable()] 23 | [XmlType(AnonymousType = true, Namespace = "http://www.sat.gob.mx/Pagos20")] 24 | public class PagosPago 25 | { 26 | private PagosPagoDoctoRelacionado[] doctoRelacionadoField; 27 | 28 | private PagosPagoImpuestosP impuestosPField; 29 | 30 | private System.DateTime fechaPagoField; 31 | 32 | private c_FormaPago formaDePagoPField; 33 | 34 | private c_Moneda monedaPField; 35 | 36 | private decimal tipoCambioPField; 37 | 38 | private bool tipoCambioPFieldSpecified; 39 | 40 | private decimal montoField; 41 | 42 | private string numOperacionField; 43 | 44 | private string rfcEmisorCtaOrdField; 45 | 46 | private string nomBancoOrdExtField; 47 | 48 | private string ctaOrdenanteField; 49 | 50 | private string rfcEmisorCtaBenField; 51 | 52 | private string ctaBeneficiarioField; 53 | 54 | private c_TipoCadenaPago tipoCadPagoField; 55 | 56 | private bool tipoCadPagoFieldSpecified; 57 | 58 | private byte[] certPagoField; 59 | 60 | private string cadPagoField; 61 | 62 | private byte[] selloPagoField; 63 | 64 | /// 65 | [XmlElement("DoctoRelacionado")] 66 | public PagosPagoDoctoRelacionado[] DoctoRelacionado 67 | { 68 | get { return this.doctoRelacionadoField; } 69 | set { this.doctoRelacionadoField = value; } 70 | } 71 | 72 | /// 73 | public PagosPagoImpuestosP ImpuestosP 74 | { 75 | get { return this.impuestosPField; } 76 | set { this.impuestosPField = value; } 77 | } 78 | 79 | /// 80 | [XmlAttribute()] 81 | public System.DateTime FechaPago 82 | { 83 | get { return this.fechaPagoField; } 84 | set { this.fechaPagoField = value; } 85 | } 86 | 87 | /// 88 | [XmlAttribute()] 89 | public c_FormaPago FormaDePagoP 90 | { 91 | get { return this.formaDePagoPField; } 92 | set { this.formaDePagoPField = value; } 93 | } 94 | 95 | /// 96 | [XmlAttribute()] 97 | public c_Moneda MonedaP 98 | { 99 | get { return this.monedaPField; } 100 | set { this.monedaPField = value; } 101 | } 102 | 103 | /// 104 | [XmlAttribute()] 105 | public decimal TipoCambioP 106 | { 107 | get { return this.tipoCambioPField; } 108 | set { this.tipoCambioPField = value; } 109 | } 110 | 111 | /// 112 | [XmlIgnore()] 113 | public bool TipoCambioPSpecified 114 | { 115 | get { return this.tipoCambioPFieldSpecified; } 116 | set { this.tipoCambioPFieldSpecified = value; } 117 | } 118 | 119 | /// 120 | [XmlAttribute()] 121 | public decimal Monto 122 | { 123 | get { return this.montoField; } 124 | set { this.montoField = value; } 125 | } 126 | 127 | /// 128 | [XmlAttribute()] 129 | public string NumOperacion 130 | { 131 | get { return this.numOperacionField; } 132 | set { this.numOperacionField = value; } 133 | } 134 | 135 | /// 136 | [XmlAttribute()] 137 | public string RfcEmisorCtaOrd 138 | { 139 | get { return this.rfcEmisorCtaOrdField; } 140 | set { this.rfcEmisorCtaOrdField = value; } 141 | } 142 | 143 | /// 144 | [XmlAttribute()] 145 | public string NomBancoOrdExt 146 | { 147 | get { return this.nomBancoOrdExtField; } 148 | set { this.nomBancoOrdExtField = value; } 149 | } 150 | 151 | /// 152 | [XmlAttribute()] 153 | public string CtaOrdenante 154 | { 155 | get { return this.ctaOrdenanteField; } 156 | set { this.ctaOrdenanteField = value; } 157 | } 158 | 159 | /// 160 | [XmlAttribute()] 161 | public string RfcEmisorCtaBen 162 | { 163 | get { return this.rfcEmisorCtaBenField; } 164 | set { this.rfcEmisorCtaBenField = value; } 165 | } 166 | 167 | /// 168 | [XmlAttribute()] 169 | public string CtaBeneficiario 170 | { 171 | get { return this.ctaBeneficiarioField; } 172 | set { this.ctaBeneficiarioField = value; } 173 | } 174 | 175 | /// 176 | [XmlAttribute()] 177 | public c_TipoCadenaPago TipoCadPago 178 | { 179 | get { return this.tipoCadPagoField; } 180 | set { this.tipoCadPagoField = value; } 181 | } 182 | 183 | /// 184 | [XmlIgnore()] 185 | public bool TipoCadPagoSpecified 186 | { 187 | get { return this.tipoCadPagoFieldSpecified; } 188 | set { this.tipoCadPagoFieldSpecified = value; } 189 | } 190 | 191 | /// 192 | [XmlAttribute(DataType = "base64Binary")] 193 | public byte[] CertPago 194 | { 195 | get { return this.certPagoField; } 196 | set { this.certPagoField = value; } 197 | } 198 | 199 | /// 200 | [XmlAttribute()] 201 | public string CadPago 202 | { 203 | get { return this.cadPagoField; } 204 | set { this.cadPagoField = value; } 205 | } 206 | 207 | /// 208 | [XmlAttribute(DataType = "base64Binary")] 209 | public byte[] SelloPago 210 | { 211 | get { return this.selloPagoField; } 212 | set { this.selloPagoField = value; } 213 | } 214 | } -------------------------------------------------------------------------------- /Common/Models/Complements/Payment/PagosPagoDoctoRelacionado.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * ============================================================================ 3 | * Mozilla Public License 2.0 (MPL-2.0) 4 | * Autor: FISCAL API S. DE R.L. DE C.V. - https://fiscalapi.com 5 | * ============================================================================ 6 | * 7 | * Este código está sujeto a los términos de la Mozilla Public License v2.0. 8 | * Licencia completa: https://mozilla.org/MPL/2.0 9 | * 10 | * AVISO: Este software se proporciona "tal como está" sin garantías de ningún 11 | * tipo. Al usar, modificar o distribuir este código debe mantener esta 12 | * atribución y las referencias al autor. 13 | * 14 | * ============================================================================ 15 | */ 16 | 17 | using System.Xml.Serialization; 18 | 19 | namespace Fiscalapi.XmlDownloader.Common.Models.Complements.Payment; 20 | 21 | /// 22 | [Serializable()] 23 | [XmlType(AnonymousType = true, Namespace = "http://www.sat.gob.mx/Pagos20")] 24 | public class PagosPagoDoctoRelacionado 25 | { 26 | private PagosPagoDoctoRelacionadoImpuestosDR impuestosDRField; 27 | 28 | private string idDocumentoField; 29 | 30 | private string serieField; 31 | 32 | private string folioField; 33 | 34 | private c_Moneda monedaDRField; 35 | 36 | private decimal equivalenciaDRField; 37 | 38 | private bool equivalenciaDRFieldSpecified; 39 | 40 | private string numParcialidadField; 41 | 42 | private decimal impSaldoAntField; 43 | 44 | private decimal impPagadoField; 45 | 46 | private decimal impSaldoInsolutoField; 47 | 48 | private c_ObjetoImp objetoImpDRField; 49 | 50 | /// 51 | public PagosPagoDoctoRelacionadoImpuestosDR ImpuestosDR 52 | { 53 | get { return this.impuestosDRField; } 54 | set { this.impuestosDRField = value; } 55 | } 56 | 57 | /// 58 | [XmlAttribute()] 59 | public string IdDocumento 60 | { 61 | get { return this.idDocumentoField; } 62 | set { this.idDocumentoField = value; } 63 | } 64 | 65 | /// 66 | [XmlAttribute()] 67 | public string Serie 68 | { 69 | get { return this.serieField; } 70 | set { this.serieField = value; } 71 | } 72 | 73 | /// 74 | [XmlAttribute()] 75 | public string Folio 76 | { 77 | get { return this.folioField; } 78 | set { this.folioField = value; } 79 | } 80 | 81 | /// 82 | [XmlAttribute()] 83 | public c_Moneda MonedaDR 84 | { 85 | get { return this.monedaDRField; } 86 | set { this.monedaDRField = value; } 87 | } 88 | 89 | /// 90 | [XmlAttribute()] 91 | public decimal EquivalenciaDR 92 | { 93 | get { return this.equivalenciaDRField; } 94 | set { this.equivalenciaDRField = value; } 95 | } 96 | 97 | /// 98 | [XmlIgnore()] 99 | public bool EquivalenciaDRSpecified 100 | { 101 | get { return this.equivalenciaDRFieldSpecified; } 102 | set { this.equivalenciaDRFieldSpecified = value; } 103 | } 104 | 105 | /// 106 | [XmlAttribute(DataType = "integer")] 107 | public string NumParcialidad 108 | { 109 | get { return this.numParcialidadField; } 110 | set { this.numParcialidadField = value; } 111 | } 112 | 113 | /// 114 | [XmlAttribute()] 115 | public decimal ImpSaldoAnt 116 | { 117 | get { return this.impSaldoAntField; } 118 | set { this.impSaldoAntField = value; } 119 | } 120 | 121 | /// 122 | [XmlAttribute()] 123 | public decimal ImpPagado 124 | { 125 | get { return this.impPagadoField; } 126 | set { this.impPagadoField = value; } 127 | } 128 | 129 | /// 130 | [XmlAttribute()] 131 | public decimal ImpSaldoInsoluto 132 | { 133 | get { return this.impSaldoInsolutoField; } 134 | set { this.impSaldoInsolutoField = value; } 135 | } 136 | 137 | /// 138 | [XmlAttribute()] 139 | public c_ObjetoImp ObjetoImpDR 140 | { 141 | get { return this.objetoImpDRField; } 142 | set { this.objetoImpDRField = value; } 143 | } 144 | } -------------------------------------------------------------------------------- /Common/Models/Complements/Payment/PagosPagoDoctoRelacionadoImpuestosDR.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * ============================================================================ 3 | * Mozilla Public License 2.0 (MPL-2.0) 4 | * Autor: FISCAL API S. DE R.L. DE C.V. - https://fiscalapi.com 5 | * ============================================================================ 6 | * 7 | * Este código está sujeto a los términos de la Mozilla Public License v2.0. 8 | * Licencia completa: https://mozilla.org/MPL/2.0 9 | * 10 | * AVISO: Este software se proporciona "tal como está" sin garantías de ningún 11 | * tipo. Al usar, modificar o distribuir este código debe mantener esta 12 | * atribución y las referencias al autor. 13 | * 14 | * ============================================================================ 15 | */ 16 | 17 | using System.Xml.Serialization; 18 | 19 | namespace Fiscalapi.XmlDownloader.Common.Models.Complements.Payment; 20 | 21 | /// 22 | [Serializable()] 23 | [XmlType(AnonymousType = true, Namespace = "http://www.sat.gob.mx/Pagos20")] 24 | public class PagosPagoDoctoRelacionadoImpuestosDR 25 | { 26 | private PagosPagoDoctoRelacionadoImpuestosDRRetencionDR[] retencionesDRField; 27 | 28 | private PagosPagoDoctoRelacionadoImpuestosDRTrasladoDR[] trasladosDRField; 29 | 30 | /// 31 | [XmlArrayItem("RetencionDR", IsNullable = false)] 32 | public PagosPagoDoctoRelacionadoImpuestosDRRetencionDR[] RetencionesDR 33 | { 34 | get { return this.retencionesDRField; } 35 | set { this.retencionesDRField = value; } 36 | } 37 | 38 | /// 39 | [XmlArrayItem("TrasladoDR", IsNullable = false)] 40 | public PagosPagoDoctoRelacionadoImpuestosDRTrasladoDR[] TrasladosDR 41 | { 42 | get { return this.trasladosDRField; } 43 | set { this.trasladosDRField = value; } 44 | } 45 | } -------------------------------------------------------------------------------- /Common/Models/Complements/Payment/PagosPagoDoctoRelacionadoImpuestosDRRetencionDR.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * ============================================================================ 3 | * Mozilla Public License 2.0 (MPL-2.0) 4 | * Autor: FISCAL API S. DE R.L. DE C.V. - https://fiscalapi.com 5 | * ============================================================================ 6 | * 7 | * Este código está sujeto a los términos de la Mozilla Public License v2.0. 8 | * Licencia completa: https://mozilla.org/MPL/2.0 9 | * 10 | * AVISO: Este software se proporciona "tal como está" sin garantías de ningún 11 | * tipo. Al usar, modificar o distribuir este código debe mantener esta 12 | * atribución y las referencias al autor. 13 | * 14 | * ============================================================================ 15 | */ 16 | 17 | using System.Xml.Serialization; 18 | 19 | namespace Fiscalapi.XmlDownloader.Common.Models.Complements.Payment; 20 | 21 | /// 22 | [Serializable()] 23 | [XmlType(AnonymousType = true, Namespace = "http://www.sat.gob.mx/Pagos20")] 24 | public class PagosPagoDoctoRelacionadoImpuestosDRRetencionDR 25 | { 26 | private decimal baseDRField; 27 | 28 | private c_Impuesto impuestoDRField; 29 | 30 | private c_TipoFactor tipoFactorDRField; 31 | 32 | private decimal tasaOCuotaDRField; 33 | 34 | private decimal importeDRField; 35 | 36 | /// 37 | [XmlAttribute()] 38 | public decimal BaseDR 39 | { 40 | get { return this.baseDRField; } 41 | set { this.baseDRField = value; } 42 | } 43 | 44 | /// 45 | [XmlAttribute()] 46 | public c_Impuesto ImpuestoDR 47 | { 48 | get { return this.impuestoDRField; } 49 | set { this.impuestoDRField = value; } 50 | } 51 | 52 | /// 53 | [XmlAttribute()] 54 | public c_TipoFactor TipoFactorDR 55 | { 56 | get { return this.tipoFactorDRField; } 57 | set { this.tipoFactorDRField = value; } 58 | } 59 | 60 | /// 61 | [XmlAttribute()] 62 | public decimal TasaOCuotaDR 63 | { 64 | get { return this.tasaOCuotaDRField; } 65 | set { this.tasaOCuotaDRField = value; } 66 | } 67 | 68 | /// 69 | [XmlAttribute()] 70 | public decimal ImporteDR 71 | { 72 | get { return this.importeDRField; } 73 | set { this.importeDRField = value; } 74 | } 75 | } -------------------------------------------------------------------------------- /Common/Models/Complements/Payment/PagosPagoDoctoRelacionadoImpuestosDRTrasladoDR.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * ============================================================================ 3 | * Mozilla Public License 2.0 (MPL-2.0) 4 | * Autor: FISCAL API S. DE R.L. DE C.V. - https://fiscalapi.com 5 | * ============================================================================ 6 | * 7 | * Este código está sujeto a los términos de la Mozilla Public License v2.0. 8 | * Licencia completa: https://mozilla.org/MPL/2.0 9 | * 10 | * AVISO: Este software se proporciona "tal como está" sin garantías de ningún 11 | * tipo. Al usar, modificar o distribuir este código debe mantener esta 12 | * atribución y las referencias al autor. 13 | * 14 | * ============================================================================ 15 | */ 16 | 17 | using System.Xml.Serialization; 18 | 19 | namespace Fiscalapi.XmlDownloader.Common.Models.Complements.Payment; 20 | 21 | /// 22 | [Serializable()] 23 | [XmlType(AnonymousType = true, Namespace = "http://www.sat.gob.mx/Pagos20")] 24 | public class PagosPagoDoctoRelacionadoImpuestosDRTrasladoDR 25 | { 26 | private decimal baseDRField; 27 | 28 | private c_Impuesto impuestoDRField; 29 | 30 | private c_TipoFactor tipoFactorDRField; 31 | 32 | private decimal tasaOCuotaDRField; 33 | 34 | private bool tasaOCuotaDRFieldSpecified; 35 | 36 | private decimal importeDRField; 37 | 38 | private bool importeDRFieldSpecified; 39 | 40 | /// 41 | [XmlAttribute()] 42 | public decimal BaseDR 43 | { 44 | get { return this.baseDRField; } 45 | set { this.baseDRField = value; } 46 | } 47 | 48 | /// 49 | [XmlAttribute()] 50 | public c_Impuesto ImpuestoDR 51 | { 52 | get { return this.impuestoDRField; } 53 | set { this.impuestoDRField = value; } 54 | } 55 | 56 | /// 57 | [XmlAttribute()] 58 | public c_TipoFactor TipoFactorDR 59 | { 60 | get { return this.tipoFactorDRField; } 61 | set { this.tipoFactorDRField = value; } 62 | } 63 | 64 | /// 65 | [XmlAttribute()] 66 | public decimal TasaOCuotaDR 67 | { 68 | get { return this.tasaOCuotaDRField; } 69 | set { this.tasaOCuotaDRField = value; } 70 | } 71 | 72 | /// 73 | [XmlIgnore()] 74 | public bool TasaOCuotaDRSpecified 75 | { 76 | get { return this.tasaOCuotaDRFieldSpecified; } 77 | set { this.tasaOCuotaDRFieldSpecified = value; } 78 | } 79 | 80 | /// 81 | [XmlAttribute()] 82 | public decimal ImporteDR 83 | { 84 | get { return this.importeDRField; } 85 | set { this.importeDRField = value; } 86 | } 87 | 88 | /// 89 | [XmlIgnore()] 90 | public bool ImporteDRSpecified 91 | { 92 | get { return this.importeDRFieldSpecified; } 93 | set { this.importeDRFieldSpecified = value; } 94 | } 95 | } -------------------------------------------------------------------------------- /Common/Models/Complements/Payment/PagosPagoImpuestosP.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * ============================================================================ 3 | * Mozilla Public License 2.0 (MPL-2.0) 4 | * Autor: FISCAL API S. DE R.L. DE C.V. - https://fiscalapi.com 5 | * ============================================================================ 6 | * 7 | * Este código está sujeto a los términos de la Mozilla Public License v2.0. 8 | * Licencia completa: https://mozilla.org/MPL/2.0 9 | * 10 | * AVISO: Este software se proporciona "tal como está" sin garantías de ningún 11 | * tipo. Al usar, modificar o distribuir este código debe mantener esta 12 | * atribución y las referencias al autor. 13 | * 14 | * ============================================================================ 15 | */ 16 | 17 | using System.Xml.Serialization; 18 | 19 | namespace Fiscalapi.XmlDownloader.Common.Models.Complements.Payment; 20 | 21 | /// 22 | [Serializable()] 23 | [XmlType(AnonymousType = true, Namespace = "http://www.sat.gob.mx/Pagos20")] 24 | public class PagosPagoImpuestosP 25 | { 26 | private PagosPagoImpuestosPRetencionP[] retencionesPField; 27 | 28 | private PagosPagoImpuestosPTrasladoP[] trasladosPField; 29 | 30 | /// 31 | [XmlArrayItem("RetencionP", IsNullable = false)] 32 | public PagosPagoImpuestosPRetencionP[] RetencionesP 33 | { 34 | get { return this.retencionesPField; } 35 | set { this.retencionesPField = value; } 36 | } 37 | 38 | /// 39 | [XmlArrayItem("TrasladoP", IsNullable = false)] 40 | public PagosPagoImpuestosPTrasladoP[] TrasladosP 41 | { 42 | get { return this.trasladosPField; } 43 | set { this.trasladosPField = value; } 44 | } 45 | } -------------------------------------------------------------------------------- /Common/Models/Complements/Payment/PagosPagoImpuestosPRetencionP.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * ============================================================================ 3 | * Mozilla Public License 2.0 (MPL-2.0) 4 | * Autor: FISCAL API S. DE R.L. DE C.V. - https://fiscalapi.com 5 | * ============================================================================ 6 | * 7 | * Este código está sujeto a los términos de la Mozilla Public License v2.0. 8 | * Licencia completa: https://mozilla.org/MPL/2.0 9 | * 10 | * AVISO: Este software se proporciona "tal como está" sin garantías de ningún 11 | * tipo. Al usar, modificar o distribuir este código debe mantener esta 12 | * atribución y las referencias al autor. 13 | * 14 | * ============================================================================ 15 | */ 16 | 17 | using System.Xml.Serialization; 18 | 19 | namespace Fiscalapi.XmlDownloader.Common.Models.Complements.Payment; 20 | 21 | /// 22 | [Serializable()] 23 | [XmlType(AnonymousType = true, Namespace = "http://www.sat.gob.mx/Pagos20")] 24 | public class PagosPagoImpuestosPRetencionP 25 | { 26 | private c_Impuesto impuestoPField; 27 | 28 | private decimal importePField; 29 | 30 | /// 31 | [XmlAttribute()] 32 | public c_Impuesto ImpuestoP 33 | { 34 | get { return this.impuestoPField; } 35 | set { this.impuestoPField = value; } 36 | } 37 | 38 | /// 39 | [XmlAttribute()] 40 | public decimal ImporteP 41 | { 42 | get { return this.importePField; } 43 | set { this.importePField = value; } 44 | } 45 | } -------------------------------------------------------------------------------- /Common/Models/Complements/Payment/PagosPagoImpuestosPTrasladoP.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * ============================================================================ 3 | * Mozilla Public License 2.0 (MPL-2.0) 4 | * Autor: FISCAL API S. DE R.L. DE C.V. - https://fiscalapi.com 5 | * ============================================================================ 6 | * 7 | * Este código está sujeto a los términos de la Mozilla Public License v2.0. 8 | * Licencia completa: https://mozilla.org/MPL/2.0 9 | * 10 | * AVISO: Este software se proporciona "tal como está" sin garantías de ningún 11 | * tipo. Al usar, modificar o distribuir este código debe mantener esta 12 | * atribución y las referencias al autor. 13 | * 14 | * ============================================================================ 15 | */ 16 | 17 | 18 | using System.Xml.Serialization; 19 | 20 | namespace Fiscalapi.XmlDownloader.Common.Models.Complements.Payment; 21 | 22 | /// 23 | [Serializable()] 24 | [XmlType(AnonymousType = true, Namespace = "http://www.sat.gob.mx/Pagos20")] 25 | public class PagosPagoImpuestosPTrasladoP 26 | { 27 | private decimal basePField; 28 | 29 | private c_Impuesto impuestoPField; 30 | 31 | private c_TipoFactor tipoFactorPField; 32 | 33 | private decimal tasaOCuotaPField; 34 | 35 | private bool tasaOCuotaPFieldSpecified; 36 | 37 | private decimal importePField; 38 | 39 | private bool importePFieldSpecified; 40 | 41 | /// 42 | [XmlAttribute()] 43 | public decimal BaseP 44 | { 45 | get { return this.basePField; } 46 | set { this.basePField = value; } 47 | } 48 | 49 | /// 50 | [XmlAttribute()] 51 | public c_Impuesto ImpuestoP 52 | { 53 | get { return this.impuestoPField; } 54 | set { this.impuestoPField = value; } 55 | } 56 | 57 | /// 58 | [XmlAttribute()] 59 | public c_TipoFactor TipoFactorP 60 | { 61 | get { return this.tipoFactorPField; } 62 | set { this.tipoFactorPField = value; } 63 | } 64 | 65 | /// 66 | [XmlAttribute()] 67 | public decimal TasaOCuotaP 68 | { 69 | get { return this.tasaOCuotaPField; } 70 | set { this.tasaOCuotaPField = value; } 71 | } 72 | 73 | /// 74 | [XmlIgnore()] 75 | public bool TasaOCuotaPSpecified 76 | { 77 | get { return this.tasaOCuotaPFieldSpecified; } 78 | set { this.tasaOCuotaPFieldSpecified = value; } 79 | } 80 | 81 | /// 82 | [XmlAttribute()] 83 | public decimal ImporteP 84 | { 85 | get { return this.importePField; } 86 | set { this.importePField = value; } 87 | } 88 | 89 | /// 90 | [XmlIgnore()] 91 | public bool ImportePSpecified 92 | { 93 | get { return this.importePFieldSpecified; } 94 | set { this.importePFieldSpecified = value; } 95 | } 96 | } -------------------------------------------------------------------------------- /Common/Models/Complements/Payment/c_TipoCadenaPago.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * ============================================================================ 3 | * Mozilla Public License 2.0 (MPL-2.0) 4 | * Autor: FISCAL API S. DE R.L. DE C.V. - https://fiscalapi.com 5 | * ============================================================================ 6 | * 7 | * Este código está sujeto a los términos de la Mozilla Public License v2.0. 8 | * Licencia completa: https://mozilla.org/MPL/2.0 9 | * 10 | * AVISO: Este software se proporciona "tal como está" sin garantías de ningún 11 | * tipo. Al usar, modificar o distribuir este código debe mantener esta 12 | * atribución y las referencias al autor. 13 | * 14 | * ============================================================================ 15 | */ 16 | 17 | 18 | using System.Xml.Serialization; 19 | 20 | namespace Fiscalapi.XmlDownloader.Common.Models.Complements.Payment; 21 | 22 | /// 23 | [Serializable()] 24 | [XmlType(Namespace = "http://www.sat.gob.mx/sitio_internet/cfd/catalogos/Pagos")] 25 | public enum c_TipoCadenaPago 26 | { 27 | /// 28 | [XmlEnum("01")] Item01, 29 | } -------------------------------------------------------------------------------- /Common/Models/Complements/Signature/TimbreFiscalDigital.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * ============================================================================ 3 | * Mozilla Public License 2.0 (MPL-2.0) 4 | * Autor: FISCAL API S. DE R.L. DE C.V. - https://fiscalapi.com 5 | * ============================================================================ 6 | * 7 | * Este código está sujeto a los términos de la Mozilla Public License v2.0. 8 | * Licencia completa: https://mozilla.org/MPL/2.0 9 | * 10 | * AVISO: Este software se proporciona "tal como está" sin garantías de ningún 11 | * tipo. Al usar, modificar o distribuir este código debe mantener esta 12 | * atribución y las referencias al autor. 13 | * 14 | * ============================================================================ 15 | */ 16 | 17 | using System.Xml.Serialization; 18 | 19 | namespace Fiscalapi.XmlDownloader.Common.Models.Complements.Signature; 20 | 21 | [Serializable()] 22 | [XmlType(AnonymousType = true, Namespace = "http://www.sat.gob.mx/TimbreFiscalDigital")] 23 | [XmlRoot(Namespace = "http://www.sat.gob.mx/TimbreFiscalDigital", IsNullable = false)] 24 | public class TimbreFiscalDigital 25 | { 26 | private string versionField; 27 | 28 | private string uUIDField; 29 | 30 | private DateTime fechaTimbradoField; 31 | 32 | private string rfcProvCertifField; 33 | 34 | private string leyendaField; 35 | 36 | private string selloCFDField; 37 | 38 | private string noCertificadoSATField; 39 | 40 | private string selloSATField; 41 | 42 | public TimbreFiscalDigital() 43 | { 44 | versionField = "1.1"; 45 | } 46 | 47 | /// 48 | [XmlAttribute()] 49 | public string Version 50 | { 51 | get { return versionField; } 52 | set { versionField = value; } 53 | } 54 | 55 | /// 56 | [XmlAttribute()] 57 | public string UUID 58 | { 59 | get { return uUIDField; } 60 | set { uUIDField = value; } 61 | } 62 | 63 | /// 64 | [XmlAttribute()] 65 | public DateTime FechaTimbrado 66 | { 67 | get { return fechaTimbradoField; } 68 | set { fechaTimbradoField = value; } 69 | } 70 | 71 | /// 72 | [XmlAttribute()] 73 | public string RfcProvCertif 74 | { 75 | get { return rfcProvCertifField; } 76 | set { rfcProvCertifField = value; } 77 | } 78 | 79 | /// 80 | [XmlAttribute()] 81 | public string Leyenda 82 | { 83 | get { return leyendaField; } 84 | set { leyendaField = value; } 85 | } 86 | 87 | /// 88 | [XmlAttribute()] 89 | public string SelloCFD 90 | { 91 | get { return selloCFDField; } 92 | set { selloCFDField = value; } 93 | } 94 | 95 | /// 96 | [XmlAttribute()] 97 | public string NoCertificadoSAT 98 | { 99 | get { return noCertificadoSATField; } 100 | set { noCertificadoSATField = value; } 101 | } 102 | 103 | /// 104 | [XmlAttribute()] 105 | public string SelloSAT 106 | { 107 | get { return selloSATField; } 108 | set { selloSATField = value; } 109 | } 110 | } -------------------------------------------------------------------------------- /Common/Models/ComprobanteAddenda.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * ============================================================================ 3 | * Mozilla Public License 2.0 (MPL-2.0) 4 | * Autor: FISCAL API S. DE R.L. DE C.V. - https://fiscalapi.com 5 | * ============================================================================ 6 | * 7 | * Este código está sujeto a los términos de la Mozilla Public License v2.0. 8 | * Licencia completa: https://mozilla.org/MPL/2.0 9 | * 10 | * AVISO: Este software se proporciona "tal como está" sin garantías de ningún 11 | * tipo. Al usar, modificar o distribuir este código debe mantener esta 12 | * atribución y las referencias al autor. 13 | * 14 | * ============================================================================ 15 | */ 16 | 17 | 18 | namespace Fiscalapi.XmlDownloader.Common.Models; 19 | 20 | /// 21 | [Serializable()] 22 | [System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true, Namespace = "http://www.sat.gob.mx/cfd/4")] 23 | public class ComprobanteAddenda 24 | { 25 | private System.Xml.XmlElement[] anyField; 26 | 27 | /// 28 | [System.Xml.Serialization.XmlAnyElementAttribute()] 29 | public System.Xml.XmlElement[] Any 30 | { 31 | get { return anyField; } 32 | set { anyField = value; } 33 | } 34 | } -------------------------------------------------------------------------------- /Common/Models/ComprobanteCfdiRelacionados.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * ============================================================================ 3 | * Mozilla Public License 2.0 (MPL-2.0) 4 | * Autor: FISCAL API S. DE R.L. DE C.V. - https://fiscalapi.com 5 | * ============================================================================ 6 | * 7 | * Este código está sujeto a los términos de la Mozilla Public License v2.0. 8 | * Licencia completa: https://mozilla.org/MPL/2.0 9 | * 10 | * AVISO: Este software se proporciona "tal como está" sin garantías de ningún 11 | * tipo. Al usar, modificar o distribuir este código debe mantener esta 12 | * atribución y las referencias al autor. 13 | * 14 | * ============================================================================ 15 | */ 16 | 17 | 18 | namespace Fiscalapi.XmlDownloader.Common.Models; 19 | 20 | /// 21 | [Serializable()] 22 | 23 | 24 | [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="http://www.sat.gob.mx/cfd/4")] 25 | public class ComprobanteCfdiRelacionados { 26 | 27 | private ComprobanteCfdiRelacionadosCfdiRelacionado[] cfdiRelacionadoField; 28 | 29 | private c_TipoRelacion tipoRelacionField; 30 | 31 | /// 32 | [System.Xml.Serialization.XmlElementAttribute("CfdiRelacionado")] 33 | public ComprobanteCfdiRelacionadosCfdiRelacionado[] CfdiRelacionado { 34 | get { 35 | return cfdiRelacionadoField; 36 | } 37 | set { 38 | cfdiRelacionadoField = value; 39 | } 40 | } 41 | 42 | /// 43 | [System.Xml.Serialization.XmlAttributeAttribute()] 44 | public c_TipoRelacion TipoRelacion { 45 | get { 46 | return tipoRelacionField; 47 | } 48 | set { 49 | tipoRelacionField = value; 50 | } 51 | } 52 | } -------------------------------------------------------------------------------- /Common/Models/ComprobanteCfdiRelacionadosCfdiRelacionado.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * ============================================================================ 3 | * Mozilla Public License 2.0 (MPL-2.0) 4 | * Autor: FISCAL API S. DE R.L. DE C.V. - https://fiscalapi.com 5 | * ============================================================================ 6 | * 7 | * Este código está sujeto a los términos de la Mozilla Public License v2.0. 8 | * Licencia completa: https://mozilla.org/MPL/2.0 9 | * 10 | * AVISO: Este software se proporciona "tal como está" sin garantías de ningún 11 | * tipo. Al usar, modificar o distribuir este código debe mantener esta 12 | * atribución y las referencias al autor. 13 | * 14 | * ============================================================================ 15 | */ 16 | 17 | 18 | namespace Fiscalapi.XmlDownloader.Common.Models; 19 | 20 | /// 21 | [Serializable()] 22 | 23 | 24 | [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="http://www.sat.gob.mx/cfd/4")] 25 | public class ComprobanteCfdiRelacionadosCfdiRelacionado { 26 | 27 | private string uUIDField; 28 | 29 | /// 30 | [System.Xml.Serialization.XmlAttributeAttribute()] 31 | public string UUID { 32 | get { 33 | return uUIDField; 34 | } 35 | set { 36 | uUIDField = value; 37 | } 38 | } 39 | } -------------------------------------------------------------------------------- /Common/Models/ComprobanteComplemento.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * ============================================================================ 3 | * Mozilla Public License 2.0 (MPL-2.0) 4 | * Autor: FISCAL API S. DE R.L. DE C.V. - https://fiscalapi.com 5 | * ============================================================================ 6 | * 7 | * Este código está sujeto a los términos de la Mozilla Public License v2.0. 8 | * Licencia completa: https://mozilla.org/MPL/2.0 9 | * 10 | * AVISO: Este software se proporciona "tal como está" sin garantías de ningún 11 | * tipo. Al usar, modificar o distribuir este código debe mantener esta 12 | * atribución y las referencias al autor. 13 | * 14 | * ============================================================================ 15 | */ 16 | 17 | 18 | namespace Fiscalapi.XmlDownloader.Common.Models; 19 | 20 | /// 21 | [Serializable()] 22 | [System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true, Namespace = "http://www.sat.gob.mx/cfd/4")] 23 | public class ComprobanteComplemento 24 | { 25 | private System.Xml.XmlElement[] anyField; 26 | 27 | /// 28 | [System.Xml.Serialization.XmlAnyElementAttribute()] 29 | public System.Xml.XmlElement[] Any 30 | { 31 | get { return anyField; } 32 | set { anyField = value; } 33 | } 34 | } -------------------------------------------------------------------------------- /Common/Models/ComprobanteConceptoACuentaTerceros.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * ============================================================================ 3 | * Mozilla Public License 2.0 (MPL-2.0) 4 | * Autor: FISCAL API S. DE R.L. DE C.V. - https://fiscalapi.com 5 | * ============================================================================ 6 | * 7 | * Este código está sujeto a los términos de la Mozilla Public License v2.0. 8 | * Licencia completa: https://mozilla.org/MPL/2.0 9 | * 10 | * AVISO: Este software se proporciona "tal como está" sin garantías de ningún 11 | * tipo. Al usar, modificar o distribuir este código debe mantener esta 12 | * atribución y las referencias al autor. 13 | * 14 | * ============================================================================ 15 | */ 16 | 17 | 18 | namespace Fiscalapi.XmlDownloader.Common.Models; 19 | 20 | /// 21 | [Serializable()] 22 | 23 | 24 | [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="http://www.sat.gob.mx/cfd/4")] 25 | public class ComprobanteConceptoACuentaTerceros { 26 | 27 | private string rfcACuentaTercerosField; 28 | 29 | private string nombreACuentaTercerosField; 30 | 31 | private c_RegimenFiscal regimenFiscalACuentaTercerosField; 32 | 33 | private string domicilioFiscalACuentaTercerosField; 34 | 35 | /// 36 | [System.Xml.Serialization.XmlAttributeAttribute()] 37 | public string RfcACuentaTerceros { 38 | get { 39 | return rfcACuentaTercerosField; 40 | } 41 | set { 42 | rfcACuentaTercerosField = value; 43 | } 44 | } 45 | 46 | /// 47 | [System.Xml.Serialization.XmlAttributeAttribute()] 48 | public string NombreACuentaTerceros { 49 | get { 50 | return nombreACuentaTercerosField; 51 | } 52 | set { 53 | nombreACuentaTercerosField = value; 54 | } 55 | } 56 | 57 | /// 58 | [System.Xml.Serialization.XmlAttributeAttribute()] 59 | public c_RegimenFiscal RegimenFiscalACuentaTerceros { 60 | get { 61 | return regimenFiscalACuentaTercerosField; 62 | } 63 | set { 64 | regimenFiscalACuentaTercerosField = value; 65 | } 66 | } 67 | 68 | /// 69 | [System.Xml.Serialization.XmlAttributeAttribute()] 70 | public string DomicilioFiscalACuentaTerceros { 71 | get { 72 | return domicilioFiscalACuentaTercerosField; 73 | } 74 | set { 75 | domicilioFiscalACuentaTercerosField = value; 76 | } 77 | } 78 | } -------------------------------------------------------------------------------- /Common/Models/ComprobanteConceptoComplementoConcepto.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * ============================================================================ 3 | * Mozilla Public License 2.0 (MPL-2.0) 4 | * Autor: FISCAL API S. DE R.L. DE C.V. - https://fiscalapi.com 5 | * ============================================================================ 6 | * 7 | * Este código está sujeto a los términos de la Mozilla Public License v2.0. 8 | * Licencia completa: https://mozilla.org/MPL/2.0 9 | * 10 | * AVISO: Este software se proporciona "tal como está" sin garantías de ningún 11 | * tipo. Al usar, modificar o distribuir este código debe mantener esta 12 | * atribución y las referencias al autor. 13 | * 14 | * ============================================================================ 15 | */ 16 | 17 | 18 | namespace Fiscalapi.XmlDownloader.Common.Models; 19 | 20 | /// 21 | [Serializable()] 22 | 23 | 24 | [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="http://www.sat.gob.mx/cfd/4")] 25 | public class ComprobanteConceptoComplementoConcepto { 26 | 27 | private System.Xml.XmlElement[] anyField; 28 | 29 | /// 30 | [System.Xml.Serialization.XmlAnyElementAttribute()] 31 | public System.Xml.XmlElement[] Any { 32 | get { 33 | return anyField; 34 | } 35 | set { 36 | anyField = value; 37 | } 38 | } 39 | } -------------------------------------------------------------------------------- /Common/Models/ComprobanteConceptoCuentaPredial.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * ============================================================================ 3 | * Mozilla Public License 2.0 (MPL-2.0) 4 | * Autor: FISCAL API S. DE R.L. DE C.V. - https://fiscalapi.com 5 | * ============================================================================ 6 | * 7 | * Este código está sujeto a los términos de la Mozilla Public License v2.0. 8 | * Licencia completa: https://mozilla.org/MPL/2.0 9 | * 10 | * AVISO: Este software se proporciona "tal como está" sin garantías de ningún 11 | * tipo. Al usar, modificar o distribuir este código debe mantener esta 12 | * atribución y las referencias al autor. 13 | * 14 | * ============================================================================ 15 | */ 16 | 17 | 18 | namespace Fiscalapi.XmlDownloader.Common.Models; 19 | 20 | 21 | /// 22 | [Serializable()] 23 | 24 | 25 | [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="http://www.sat.gob.mx/cfd/4")] 26 | public class ComprobanteConceptoCuentaPredial { 27 | 28 | private string numeroField; 29 | 30 | /// 31 | [System.Xml.Serialization.XmlAttributeAttribute()] 32 | public string Numero { 33 | get { 34 | return numeroField; 35 | } 36 | set { 37 | numeroField = value; 38 | } 39 | } 40 | } -------------------------------------------------------------------------------- /Common/Models/ComprobanteConceptoImpuestos.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * ============================================================================ 3 | * Mozilla Public License 2.0 (MPL-2.0) 4 | * Autor: FISCAL API S. DE R.L. DE C.V. - https://fiscalapi.com 5 | * ============================================================================ 6 | * 7 | * Este código está sujeto a los términos de la Mozilla Public License v2.0. 8 | * Licencia completa: https://mozilla.org/MPL/2.0 9 | * 10 | * AVISO: Este software se proporciona "tal como está" sin garantías de ningún 11 | * tipo. Al usar, modificar o distribuir este código debe mantener esta 12 | * atribución y las referencias al autor. 13 | * 14 | * ============================================================================ 15 | */ 16 | 17 | 18 | namespace Fiscalapi.XmlDownloader.Common.Models; 19 | 20 | /// 21 | [Serializable()] 22 | 23 | 24 | [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="http://www.sat.gob.mx/cfd/4")] 25 | public class ComprobanteConceptoImpuestos { 26 | 27 | private ComprobanteConceptoImpuestosTraslado[] trasladosField; 28 | 29 | private ComprobanteConceptoImpuestosRetencion[] retencionesField; 30 | 31 | /// 32 | [System.Xml.Serialization.XmlArrayItemAttribute("Traslado", IsNullable=false)] 33 | public ComprobanteConceptoImpuestosTraslado[] Traslados { 34 | get { 35 | return trasladosField; 36 | } 37 | set { 38 | trasladosField = value; 39 | } 40 | } 41 | 42 | /// 43 | [System.Xml.Serialization.XmlArrayItemAttribute("Retencion", IsNullable=false)] 44 | public ComprobanteConceptoImpuestosRetencion[] Retenciones { 45 | get { 46 | return retencionesField; 47 | } 48 | set { 49 | retencionesField = value; 50 | } 51 | } 52 | } -------------------------------------------------------------------------------- /Common/Models/ComprobanteConceptoImpuestosRetencion.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * ============================================================================ 3 | * Mozilla Public License 2.0 (MPL-2.0) 4 | * Autor: FISCAL API S. DE R.L. DE C.V. - https://fiscalapi.com 5 | * ============================================================================ 6 | * 7 | * Este código está sujeto a los términos de la Mozilla Public License v2.0. 8 | * Licencia completa: https://mozilla.org/MPL/2.0 9 | * 10 | * AVISO: Este software se proporciona "tal como está" sin garantías de ningún 11 | * tipo. Al usar, modificar o distribuir este código debe mantener esta 12 | * atribución y las referencias al autor. 13 | * 14 | * ============================================================================ 15 | */ 16 | 17 | 18 | namespace Fiscalapi.XmlDownloader.Common.Models; 19 | 20 | /// 21 | [Serializable()] 22 | 23 | 24 | [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="http://www.sat.gob.mx/cfd/4")] 25 | public class ComprobanteConceptoImpuestosRetencion { 26 | 27 | private decimal baseField; 28 | 29 | private c_Impuesto impuestoField; 30 | 31 | private c_TipoFactor tipoFactorField; 32 | 33 | private decimal tasaOCuotaField; 34 | 35 | private decimal importeField; 36 | 37 | /// 38 | [System.Xml.Serialization.XmlAttributeAttribute()] 39 | public decimal Base { 40 | get { 41 | return baseField; 42 | } 43 | set { 44 | baseField = value; 45 | } 46 | } 47 | 48 | /// 49 | [System.Xml.Serialization.XmlAttributeAttribute()] 50 | public c_Impuesto Impuesto { 51 | get { 52 | return impuestoField; 53 | } 54 | set { 55 | impuestoField = value; 56 | } 57 | } 58 | 59 | /// 60 | [System.Xml.Serialization.XmlAttributeAttribute()] 61 | public c_TipoFactor TipoFactor { 62 | get { 63 | return tipoFactorField; 64 | } 65 | set { 66 | tipoFactorField = value; 67 | } 68 | } 69 | 70 | /// 71 | [System.Xml.Serialization.XmlAttributeAttribute()] 72 | public decimal TasaOCuota { 73 | get { 74 | return tasaOCuotaField; 75 | } 76 | set { 77 | tasaOCuotaField = value; 78 | } 79 | } 80 | 81 | /// 82 | [System.Xml.Serialization.XmlAttributeAttribute()] 83 | public decimal Importe { 84 | get { 85 | return importeField; 86 | } 87 | set { 88 | importeField = value; 89 | } 90 | } 91 | } -------------------------------------------------------------------------------- /Common/Models/ComprobanteConceptoImpuestosTraslado.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * ============================================================================ 3 | * Mozilla Public License 2.0 (MPL-2.0) 4 | * Autor: FISCAL API S. DE R.L. DE C.V. - https://fiscalapi.com 5 | * ============================================================================ 6 | * 7 | * Este código está sujeto a los términos de la Mozilla Public License v2.0. 8 | * Licencia completa: https://mozilla.org/MPL/2.0 9 | * 10 | * AVISO: Este software se proporciona "tal como está" sin garantías de ningún 11 | * tipo. Al usar, modificar o distribuir este código debe mantener esta 12 | * atribución y las referencias al autor. 13 | * 14 | * ============================================================================ 15 | */ 16 | 17 | 18 | namespace Fiscalapi.XmlDownloader.Common.Models; 19 | 20 | /// 21 | [Serializable()] 22 | 23 | 24 | [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="http://www.sat.gob.mx/cfd/4")] 25 | public class ComprobanteConceptoImpuestosTraslado { 26 | 27 | private decimal baseField; 28 | 29 | private c_Impuesto impuestoField; 30 | 31 | private c_TipoFactor tipoFactorField; 32 | 33 | private decimal tasaOCuotaField; 34 | 35 | private bool tasaOCuotaFieldSpecified; 36 | 37 | private decimal importeField; 38 | 39 | private bool importeFieldSpecified; 40 | 41 | /// 42 | [System.Xml.Serialization.XmlAttributeAttribute()] 43 | public decimal Base { 44 | get { 45 | return baseField; 46 | } 47 | set { 48 | baseField = value; 49 | } 50 | } 51 | 52 | /// 53 | [System.Xml.Serialization.XmlAttributeAttribute()] 54 | public c_Impuesto Impuesto { 55 | get { 56 | return impuestoField; 57 | } 58 | set { 59 | impuestoField = value; 60 | } 61 | } 62 | 63 | /// 64 | [System.Xml.Serialization.XmlAttributeAttribute()] 65 | public c_TipoFactor TipoFactor { 66 | get { 67 | return tipoFactorField; 68 | } 69 | set { 70 | tipoFactorField = value; 71 | } 72 | } 73 | 74 | /// 75 | [System.Xml.Serialization.XmlAttributeAttribute()] 76 | public decimal TasaOCuota { 77 | get { 78 | return tasaOCuotaField; 79 | } 80 | set { 81 | tasaOCuotaField = value; 82 | } 83 | } 84 | 85 | /// 86 | [System.Xml.Serialization.XmlIgnoreAttribute()] 87 | public bool TasaOCuotaSpecified { 88 | get { 89 | return tasaOCuotaFieldSpecified; 90 | } 91 | set { 92 | tasaOCuotaFieldSpecified = value; 93 | } 94 | } 95 | 96 | /// 97 | [System.Xml.Serialization.XmlAttributeAttribute()] 98 | public decimal Importe { 99 | get { 100 | return importeField; 101 | } 102 | set { 103 | importeField = value; 104 | } 105 | } 106 | 107 | /// 108 | [System.Xml.Serialization.XmlIgnoreAttribute()] 109 | public bool ImporteSpecified { 110 | get { 111 | return importeFieldSpecified; 112 | } 113 | set { 114 | importeFieldSpecified = value; 115 | } 116 | } 117 | } -------------------------------------------------------------------------------- /Common/Models/ComprobanteConceptoInformacionAduanera.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * ============================================================================ 3 | * Mozilla Public License 2.0 (MPL-2.0) 4 | * Autor: FISCAL API S. DE R.L. DE C.V. - https://fiscalapi.com 5 | * ============================================================================ 6 | * 7 | * Este código está sujeto a los términos de la Mozilla Public License v2.0. 8 | * Licencia completa: https://mozilla.org/MPL/2.0 9 | * 10 | * AVISO: Este software se proporciona "tal como está" sin garantías de ningún 11 | * tipo. Al usar, modificar o distribuir este código debe mantener esta 12 | * atribución y las referencias al autor. 13 | * 14 | * ============================================================================ 15 | */ 16 | 17 | 18 | namespace Fiscalapi.XmlDownloader.Common.Models; 19 | 20 | /// 21 | [Serializable()] 22 | 23 | 24 | [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="http://www.sat.gob.mx/cfd/4")] 25 | public class ComprobanteConceptoInformacionAduanera { 26 | 27 | private string numeroPedimentoField; 28 | 29 | /// 30 | [System.Xml.Serialization.XmlAttributeAttribute()] 31 | public string NumeroPedimento { 32 | get { 33 | return numeroPedimentoField; 34 | } 35 | set { 36 | numeroPedimentoField = value; 37 | } 38 | } 39 | } -------------------------------------------------------------------------------- /Common/Models/ComprobanteConceptoParte.cs: -------------------------------------------------------------------------------- 1 |  2 | /* 3 | * ============================================================================ 4 | * Mozilla Public License 2.0 (MPL-2.0) 5 | * Autor: FISCAL API S. DE R.L. DE C.V. - https://fiscalapi.com 6 | * ============================================================================ 7 | * 8 | * Este código está sujeto a los términos de la Mozilla Public License v2.0. 9 | * Licencia completa: https://mozilla.org/MPL/2.0 10 | * 11 | * AVISO: Este software se proporciona "tal como está" sin garantías de ningún 12 | * tipo. Al usar, modificar o distribuir este código debe mantener esta 13 | * atribución y las referencias al autor. 14 | * 15 | * ============================================================================ 16 | */ 17 | 18 | namespace Fiscalapi.XmlDownloader.Common.Models; 19 | 20 | /// 21 | [Serializable()] 22 | 23 | 24 | [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="http://www.sat.gob.mx/cfd/4")] 25 | public class ComprobanteConceptoParte { 26 | 27 | private ComprobanteConceptoParteInformacionAduanera[] informacionAduaneraField; 28 | 29 | private string claveProdServField; 30 | 31 | private string noIdentificacionField; 32 | 33 | private decimal cantidadField; 34 | 35 | private string unidadField; 36 | 37 | private string descripcionField; 38 | 39 | private decimal valorUnitarioField; 40 | 41 | private bool valorUnitarioFieldSpecified; 42 | 43 | private decimal importeField; 44 | 45 | private bool importeFieldSpecified; 46 | 47 | /// 48 | [System.Xml.Serialization.XmlElementAttribute("InformacionAduanera")] 49 | public ComprobanteConceptoParteInformacionAduanera[] InformacionAduanera { 50 | get { 51 | return informacionAduaneraField; 52 | } 53 | set { 54 | informacionAduaneraField = value; 55 | } 56 | } 57 | 58 | /// 59 | [System.Xml.Serialization.XmlAttributeAttribute()] 60 | public string ClaveProdServ { 61 | get { 62 | return claveProdServField; 63 | } 64 | set { 65 | claveProdServField = value; 66 | } 67 | } 68 | 69 | /// 70 | [System.Xml.Serialization.XmlAttributeAttribute()] 71 | public string NoIdentificacion { 72 | get { 73 | return noIdentificacionField; 74 | } 75 | set { 76 | noIdentificacionField = value; 77 | } 78 | } 79 | 80 | /// 81 | [System.Xml.Serialization.XmlAttributeAttribute()] 82 | public decimal Cantidad { 83 | get { 84 | return cantidadField; 85 | } 86 | set { 87 | cantidadField = value; 88 | } 89 | } 90 | 91 | /// 92 | [System.Xml.Serialization.XmlAttributeAttribute()] 93 | public string Unidad { 94 | get { 95 | return unidadField; 96 | } 97 | set { 98 | unidadField = value; 99 | } 100 | } 101 | 102 | /// 103 | [System.Xml.Serialization.XmlAttributeAttribute()] 104 | public string Descripcion { 105 | get { 106 | return descripcionField; 107 | } 108 | set { 109 | descripcionField = value; 110 | } 111 | } 112 | 113 | /// 114 | [System.Xml.Serialization.XmlAttributeAttribute()] 115 | public decimal ValorUnitario { 116 | get { 117 | return valorUnitarioField; 118 | } 119 | set { 120 | valorUnitarioField = value; 121 | } 122 | } 123 | 124 | /// 125 | [System.Xml.Serialization.XmlIgnoreAttribute()] 126 | public bool ValorUnitarioSpecified { 127 | get { 128 | return valorUnitarioFieldSpecified; 129 | } 130 | set { 131 | valorUnitarioFieldSpecified = value; 132 | } 133 | } 134 | 135 | /// 136 | [System.Xml.Serialization.XmlAttributeAttribute()] 137 | public decimal Importe { 138 | get { 139 | return importeField; 140 | } 141 | set { 142 | importeField = value; 143 | } 144 | } 145 | 146 | /// 147 | [System.Xml.Serialization.XmlIgnoreAttribute()] 148 | public bool ImporteSpecified { 149 | get { 150 | return importeFieldSpecified; 151 | } 152 | set { 153 | importeFieldSpecified = value; 154 | } 155 | } 156 | } -------------------------------------------------------------------------------- /Common/Models/ComprobanteConceptoParteInformacionAduanera.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * ============================================================================ 3 | * Mozilla Public License 2.0 (MPL-2.0) 4 | * Autor: FISCAL API S. DE R.L. DE C.V. - https://fiscalapi.com 5 | * ============================================================================ 6 | * 7 | * Este código está sujeto a los términos de la Mozilla Public License v2.0. 8 | * Licencia completa: https://mozilla.org/MPL/2.0 9 | * 10 | * AVISO: Este software se proporciona "tal como está" sin garantías de ningún 11 | * tipo. Al usar, modificar o distribuir este código debe mantener esta 12 | * atribución y las referencias al autor. 13 | * 14 | * ============================================================================ 15 | */ 16 | 17 | 18 | namespace Fiscalapi.XmlDownloader.Common.Models; 19 | 20 | /// 21 | [Serializable()] 22 | 23 | 24 | [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="http://www.sat.gob.mx/cfd/4")] 25 | public class ComprobanteConceptoParteInformacionAduanera { 26 | 27 | private string numeroPedimentoField; 28 | 29 | /// 30 | [System.Xml.Serialization.XmlAttributeAttribute()] 31 | public string NumeroPedimento { 32 | get { 33 | return numeroPedimentoField; 34 | } 35 | set { 36 | numeroPedimentoField = value; 37 | } 38 | } 39 | } -------------------------------------------------------------------------------- /Common/Models/ComprobanteEmisor.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * ============================================================================ 3 | * Mozilla Public License 2.0 (MPL-2.0) 4 | * Autor: FISCAL API S. DE R.L. DE C.V. - https://fiscalapi.com 5 | * ============================================================================ 6 | * 7 | * Este código está sujeto a los términos de la Mozilla Public License v2.0. 8 | * Licencia completa: https://mozilla.org/MPL/2.0 9 | * 10 | * AVISO: Este software se proporciona "tal como está" sin garantías de ningún 11 | * tipo. Al usar, modificar o distribuir este código debe mantener esta 12 | * atribución y las referencias al autor. 13 | * 14 | * ============================================================================ 15 | */ 16 | 17 | 18 | namespace Fiscalapi.XmlDownloader.Common.Models; 19 | 20 | /// 21 | [Serializable()] 22 | 23 | 24 | [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="http://www.sat.gob.mx/cfd/4")] 25 | public class ComprobanteEmisor { 26 | 27 | private string rfcField; 28 | 29 | private string nombreField; 30 | 31 | private c_RegimenFiscal regimenFiscalField; 32 | 33 | private string facAtrAdquirenteField; 34 | 35 | /// 36 | [System.Xml.Serialization.XmlAttributeAttribute()] 37 | public string Rfc { 38 | get { 39 | return rfcField; 40 | } 41 | set { 42 | rfcField = value; 43 | } 44 | } 45 | 46 | /// 47 | [System.Xml.Serialization.XmlAttributeAttribute()] 48 | public string Nombre { 49 | get { 50 | return nombreField; 51 | } 52 | set { 53 | nombreField = value; 54 | } 55 | } 56 | 57 | /// 58 | [System.Xml.Serialization.XmlAttributeAttribute()] 59 | public c_RegimenFiscal RegimenFiscal { 60 | get { 61 | return regimenFiscalField; 62 | } 63 | set { 64 | regimenFiscalField = value; 65 | } 66 | } 67 | 68 | /// 69 | [System.Xml.Serialization.XmlAttributeAttribute()] 70 | public string FacAtrAdquirente { 71 | get { 72 | return facAtrAdquirenteField; 73 | } 74 | set { 75 | facAtrAdquirenteField = value; 76 | } 77 | } 78 | } -------------------------------------------------------------------------------- /Common/Models/ComprobanteImpuestos.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * ============================================================================ 3 | * Mozilla Public License 2.0 (MPL-2.0) 4 | * Autor: FISCAL API S. DE R.L. DE C.V. - https://fiscalapi.com 5 | * ============================================================================ 6 | * 7 | * Este código está sujeto a los términos de la Mozilla Public License v2.0. 8 | * Licencia completa: https://mozilla.org/MPL/2.0 9 | * 10 | * AVISO: Este software se proporciona "tal como está" sin garantías de ningún 11 | * tipo. Al usar, modificar o distribuir este código debe mantener esta 12 | * atribución y las referencias al autor. 13 | * 14 | * ============================================================================ 15 | */ 16 | 17 | 18 | namespace Fiscalapi.XmlDownloader.Common.Models; 19 | 20 | /// 21 | [Serializable()] 22 | 23 | 24 | [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="http://www.sat.gob.mx/cfd/4")] 25 | public class ComprobanteImpuestos { 26 | 27 | private ComprobanteImpuestosRetencion[] retencionesField; 28 | 29 | private ComprobanteImpuestosTraslado[] trasladosField; 30 | 31 | private decimal totalImpuestosRetenidosField; 32 | 33 | private bool totalImpuestosRetenidosFieldSpecified; 34 | 35 | private decimal totalImpuestosTrasladadosField; 36 | 37 | private bool totalImpuestosTrasladadosFieldSpecified; 38 | 39 | /// 40 | [System.Xml.Serialization.XmlArrayItemAttribute("Retencion", IsNullable=false)] 41 | public ComprobanteImpuestosRetencion[] Retenciones { 42 | get { 43 | return retencionesField; 44 | } 45 | set { 46 | retencionesField = value; 47 | } 48 | } 49 | 50 | /// 51 | [System.Xml.Serialization.XmlArrayItemAttribute("Traslado", IsNullable=false)] 52 | public ComprobanteImpuestosTraslado[] Traslados { 53 | get { 54 | return trasladosField; 55 | } 56 | set { 57 | trasladosField = value; 58 | } 59 | } 60 | 61 | /// 62 | [System.Xml.Serialization.XmlAttributeAttribute()] 63 | public decimal TotalImpuestosRetenidos { 64 | get { 65 | return totalImpuestosRetenidosField; 66 | } 67 | set { 68 | totalImpuestosRetenidosField = value; 69 | } 70 | } 71 | 72 | /// 73 | [System.Xml.Serialization.XmlIgnoreAttribute()] 74 | public bool TotalImpuestosRetenidosSpecified { 75 | get { 76 | return totalImpuestosRetenidosFieldSpecified; 77 | } 78 | set { 79 | totalImpuestosRetenidosFieldSpecified = value; 80 | } 81 | } 82 | 83 | /// 84 | [System.Xml.Serialization.XmlAttributeAttribute()] 85 | public decimal TotalImpuestosTrasladados { 86 | get { 87 | return totalImpuestosTrasladadosField; 88 | } 89 | set { 90 | totalImpuestosTrasladadosField = value; 91 | } 92 | } 93 | 94 | /// 95 | [System.Xml.Serialization.XmlIgnoreAttribute()] 96 | public bool TotalImpuestosTrasladadosSpecified { 97 | get { 98 | return totalImpuestosTrasladadosFieldSpecified; 99 | } 100 | set { 101 | totalImpuestosTrasladadosFieldSpecified = value; 102 | } 103 | } 104 | } -------------------------------------------------------------------------------- /Common/Models/ComprobanteImpuestosRetencion.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * ============================================================================ 3 | * Mozilla Public License 2.0 (MPL-2.0) 4 | * Autor: FISCAL API S. DE R.L. DE C.V. - https://fiscalapi.com 5 | * ============================================================================ 6 | * 7 | * Este código está sujeto a los términos de la Mozilla Public License v2.0. 8 | * Licencia completa: https://mozilla.org/MPL/2.0 9 | * 10 | * AVISO: Este software se proporciona "tal como está" sin garantías de ningún 11 | * tipo. Al usar, modificar o distribuir este código debe mantener esta 12 | * atribución y las referencias al autor. 13 | * 14 | * ============================================================================ 15 | */ 16 | 17 | 18 | namespace Fiscalapi.XmlDownloader.Common.Models; 19 | 20 | /// 21 | [Serializable()] 22 | 23 | 24 | [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="http://www.sat.gob.mx/cfd/4")] 25 | public class ComprobanteImpuestosRetencion { 26 | 27 | private c_Impuesto impuestoField; 28 | 29 | private decimal importeField; 30 | 31 | /// 32 | [System.Xml.Serialization.XmlAttributeAttribute()] 33 | public c_Impuesto Impuesto { 34 | get { 35 | return impuestoField; 36 | } 37 | set { 38 | impuestoField = value; 39 | } 40 | } 41 | 42 | /// 43 | [System.Xml.Serialization.XmlAttributeAttribute()] 44 | public decimal Importe { 45 | get { 46 | return importeField; 47 | } 48 | set { 49 | importeField = value; 50 | } 51 | } 52 | } -------------------------------------------------------------------------------- /Common/Models/ComprobanteImpuestosTraslado.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * ============================================================================ 3 | * Mozilla Public License 2.0 (MPL-2.0) 4 | * Autor: FISCAL API S. DE R.L. DE C.V. - https://fiscalapi.com 5 | * ============================================================================ 6 | * 7 | * Este código está sujeto a los términos de la Mozilla Public License v2.0. 8 | * Licencia completa: https://mozilla.org/MPL/2.0 9 | * 10 | * AVISO: Este software se proporciona "tal como está" sin garantías de ningún 11 | * tipo. Al usar, modificar o distribuir este código debe mantener esta 12 | * atribución y las referencias al autor. 13 | * 14 | * ============================================================================ 15 | */ 16 | 17 | 18 | namespace Fiscalapi.XmlDownloader.Common.Models; 19 | 20 | /// 21 | [Serializable()] 22 | 23 | 24 | [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="http://www.sat.gob.mx/cfd/4")] 25 | public class ComprobanteImpuestosTraslado { 26 | 27 | private decimal baseField; 28 | 29 | private c_Impuesto impuestoField; 30 | 31 | private c_TipoFactor tipoFactorField; 32 | 33 | private decimal tasaOCuotaField; 34 | 35 | private bool tasaOCuotaFieldSpecified; 36 | 37 | private decimal importeField; 38 | 39 | private bool importeFieldSpecified; 40 | 41 | /// 42 | [System.Xml.Serialization.XmlAttributeAttribute()] 43 | public decimal Base { 44 | get { 45 | return baseField; 46 | } 47 | set { 48 | baseField = value; 49 | } 50 | } 51 | 52 | /// 53 | [System.Xml.Serialization.XmlAttributeAttribute()] 54 | public c_Impuesto Impuesto { 55 | get { 56 | return impuestoField; 57 | } 58 | set { 59 | impuestoField = value; 60 | } 61 | } 62 | 63 | /// 64 | [System.Xml.Serialization.XmlAttributeAttribute()] 65 | public c_TipoFactor TipoFactor { 66 | get { 67 | return tipoFactorField; 68 | } 69 | set { 70 | tipoFactorField = value; 71 | } 72 | } 73 | 74 | /// 75 | [System.Xml.Serialization.XmlAttributeAttribute()] 76 | public decimal TasaOCuota { 77 | get { 78 | return tasaOCuotaField; 79 | } 80 | set { 81 | tasaOCuotaField = value; 82 | } 83 | } 84 | 85 | /// 86 | [System.Xml.Serialization.XmlIgnoreAttribute()] 87 | public bool TasaOCuotaSpecified { 88 | get { 89 | return tasaOCuotaFieldSpecified; 90 | } 91 | set { 92 | tasaOCuotaFieldSpecified = value; 93 | } 94 | } 95 | 96 | /// 97 | [System.Xml.Serialization.XmlAttributeAttribute()] 98 | public decimal Importe { 99 | get { 100 | return importeField; 101 | } 102 | set { 103 | importeField = value; 104 | } 105 | } 106 | 107 | /// 108 | [System.Xml.Serialization.XmlIgnoreAttribute()] 109 | public bool ImporteSpecified { 110 | get { 111 | return importeFieldSpecified; 112 | } 113 | set { 114 | importeFieldSpecified = value; 115 | } 116 | } 117 | } -------------------------------------------------------------------------------- /Common/Models/ComprobanteInformacionGlobal.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * ============================================================================ 3 | * Mozilla Public License 2.0 (MPL-2.0) 4 | * Autor: FISCAL API S. DE R.L. DE C.V. - https://fiscalapi.com 5 | * ============================================================================ 6 | * 7 | * Este código está sujeto a los términos de la Mozilla Public License v2.0. 8 | * Licencia completa: https://mozilla.org/MPL/2.0 9 | * 10 | * AVISO: Este software se proporciona "tal como está" sin garantías de ningún 11 | * tipo. Al usar, modificar o distribuir este código debe mantener esta 12 | * atribución y las referencias al autor. 13 | * 14 | * ============================================================================ 15 | */ 16 | 17 | 18 | namespace Fiscalapi.XmlDownloader.Common.Models; 19 | 20 | /// 21 | [Serializable()] 22 | 23 | 24 | [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="http://www.sat.gob.mx/cfd/4")] 25 | public class ComprobanteInformacionGlobal { 26 | 27 | private c_Periodicidad periodicidadField; 28 | 29 | private c_Meses mesesField; 30 | 31 | private short añoField; 32 | 33 | /// 34 | [System.Xml.Serialization.XmlAttributeAttribute()] 35 | public c_Periodicidad Periodicidad { 36 | get { 37 | return periodicidadField; 38 | } 39 | set { 40 | periodicidadField = value; 41 | } 42 | } 43 | 44 | /// 45 | [System.Xml.Serialization.XmlAttributeAttribute()] 46 | public c_Meses Meses { 47 | get { 48 | return mesesField; 49 | } 50 | set { 51 | mesesField = value; 52 | } 53 | } 54 | 55 | /// 56 | [System.Xml.Serialization.XmlAttributeAttribute()] 57 | public short Año { 58 | get { 59 | return añoField; 60 | } 61 | set { 62 | añoField = value; 63 | } 64 | } 65 | } -------------------------------------------------------------------------------- /Common/Models/ComprobanteReceptor.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * ============================================================================ 3 | * Mozilla Public License 2.0 (MPL-2.0) 4 | * Autor: FISCAL API S. DE R.L. DE C.V. - https://fiscalapi.com 5 | * ============================================================================ 6 | * 7 | * Este código está sujeto a los términos de la Mozilla Public License v2.0. 8 | * Licencia completa: https://mozilla.org/MPL/2.0 9 | * 10 | * AVISO: Este software se proporciona "tal como está" sin garantías de ningún 11 | * tipo. Al usar, modificar o distribuir este código debe mantener esta 12 | * atribución y las referencias al autor. 13 | * 14 | * ============================================================================ 15 | */ 16 | 17 | 18 | namespace Fiscalapi.XmlDownloader.Common.Models; 19 | 20 | /// 21 | [Serializable()] 22 | 23 | 24 | [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="http://www.sat.gob.mx/cfd/4")] 25 | public class ComprobanteReceptor { 26 | 27 | private string rfcField; 28 | 29 | private string nombreField; 30 | 31 | private string domicilioFiscalReceptorField; 32 | 33 | private c_Pais residenciaFiscalField; 34 | 35 | private bool residenciaFiscalFieldSpecified; 36 | 37 | private string numRegIdTribField; 38 | 39 | private c_RegimenFiscal regimenFiscalReceptorField; 40 | 41 | private c_UsoCFDI usoCFDIField; 42 | 43 | /// 44 | [System.Xml.Serialization.XmlAttributeAttribute()] 45 | public string Rfc { 46 | get { 47 | return rfcField; 48 | } 49 | set { 50 | rfcField = value; 51 | } 52 | } 53 | 54 | /// 55 | [System.Xml.Serialization.XmlAttributeAttribute()] 56 | public string Nombre { 57 | get { 58 | return nombreField; 59 | } 60 | set { 61 | nombreField = value; 62 | } 63 | } 64 | 65 | /// 66 | [System.Xml.Serialization.XmlAttributeAttribute()] 67 | public string DomicilioFiscalReceptor { 68 | get { 69 | return domicilioFiscalReceptorField; 70 | } 71 | set { 72 | domicilioFiscalReceptorField = value; 73 | } 74 | } 75 | 76 | /// 77 | [System.Xml.Serialization.XmlAttributeAttribute()] 78 | public c_Pais ResidenciaFiscal { 79 | get { 80 | return residenciaFiscalField; 81 | } 82 | set { 83 | residenciaFiscalField = value; 84 | } 85 | } 86 | 87 | /// 88 | [System.Xml.Serialization.XmlIgnoreAttribute()] 89 | public bool ResidenciaFiscalSpecified { 90 | get { 91 | return residenciaFiscalFieldSpecified; 92 | } 93 | set { 94 | residenciaFiscalFieldSpecified = value; 95 | } 96 | } 97 | 98 | /// 99 | [System.Xml.Serialization.XmlAttributeAttribute()] 100 | public string NumRegIdTrib { 101 | get { 102 | return numRegIdTribField; 103 | } 104 | set { 105 | numRegIdTribField = value; 106 | } 107 | } 108 | 109 | /// 110 | [System.Xml.Serialization.XmlAttributeAttribute()] 111 | public c_RegimenFiscal RegimenFiscalReceptor { 112 | get { 113 | return regimenFiscalReceptorField; 114 | } 115 | set { 116 | regimenFiscalReceptorField = value; 117 | } 118 | } 119 | 120 | /// 121 | [System.Xml.Serialization.XmlAttributeAttribute()] 122 | public c_UsoCFDI UsoCFDI { 123 | get { 124 | return usoCFDIField; 125 | } 126 | set { 127 | usoCFDIField = value; 128 | } 129 | } 130 | } -------------------------------------------------------------------------------- /Common/Models/c_Exportacion.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * ============================================================================ 3 | * Mozilla Public License 2.0 (MPL-2.0) 4 | * Autor: FISCAL API S. DE R.L. DE C.V. - https://fiscalapi.com 5 | * ============================================================================ 6 | * 7 | * Este código está sujeto a los términos de la Mozilla Public License v2.0. 8 | * Licencia completa: https://mozilla.org/MPL/2.0 9 | * 10 | * AVISO: Este software se proporciona "tal como está" sin garantías de ningún 11 | * tipo. Al usar, modificar o distribuir este código debe mantener esta 12 | * atribución y las referencias al autor. 13 | * 14 | * ============================================================================ 15 | */ 16 | 17 | 18 | 19 | namespace Fiscalapi.XmlDownloader.Common.Models; 20 | 21 | /// 22 | [Serializable()] 23 | [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://www.sat.gob.mx/sitio_internet/cfd/catalogos")] 24 | public enum c_Exportacion { 25 | 26 | /// 27 | [System.Xml.Serialization.XmlEnumAttribute("01")] 28 | Item01, 29 | 30 | /// 31 | [System.Xml.Serialization.XmlEnumAttribute("02")] 32 | Item02, 33 | 34 | /// 35 | [System.Xml.Serialization.XmlEnumAttribute("03")] 36 | Item03, 37 | 38 | /// 39 | [System.Xml.Serialization.XmlEnumAttribute("04")] 40 | Item04, 41 | } -------------------------------------------------------------------------------- /Common/Models/c_FormaPago.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * ============================================================================ 3 | * Mozilla Public License 2.0 (MPL-2.0) 4 | * Autor: FISCAL API S. DE R.L. DE C.V. - https://fiscalapi.com 5 | * ============================================================================ 6 | * 7 | * Este código está sujeto a los términos de la Mozilla Public License v2.0. 8 | * Licencia completa: https://mozilla.org/MPL/2.0 9 | * 10 | * AVISO: Este software se proporciona "tal como está" sin garantías de ningún 11 | * tipo. Al usar, modificar o distribuir este código debe mantener esta 12 | * atribución y las referencias al autor. 13 | * 14 | * ============================================================================ 15 | */ 16 | 17 | 18 | namespace Fiscalapi.XmlDownloader.Common.Models; 19 | 20 | /// 21 | [Serializable()] 22 | [System.Xml.Serialization.XmlTypeAttribute(Namespace = "http://www.sat.gob.mx/sitio_internet/cfd/catalogos")] 23 | public enum c_FormaPago 24 | { 25 | /// 26 | [System.Xml.Serialization.XmlEnumAttribute("01")] 27 | Item01, 28 | 29 | /// 30 | [System.Xml.Serialization.XmlEnumAttribute("02")] 31 | Item02, 32 | 33 | /// 34 | [System.Xml.Serialization.XmlEnumAttribute("03")] 35 | Item03, 36 | 37 | /// 38 | [System.Xml.Serialization.XmlEnumAttribute("04")] 39 | Item04, 40 | 41 | /// 42 | [System.Xml.Serialization.XmlEnumAttribute("05")] 43 | Item05, 44 | 45 | /// 46 | [System.Xml.Serialization.XmlEnumAttribute("06")] 47 | Item06, 48 | 49 | /// 50 | [System.Xml.Serialization.XmlEnumAttribute("08")] 51 | Item08, 52 | 53 | /// 54 | [System.Xml.Serialization.XmlEnumAttribute("12")] 55 | Item12, 56 | 57 | /// 58 | [System.Xml.Serialization.XmlEnumAttribute("13")] 59 | Item13, 60 | 61 | /// 62 | [System.Xml.Serialization.XmlEnumAttribute("14")] 63 | Item14, 64 | 65 | /// 66 | [System.Xml.Serialization.XmlEnumAttribute("15")] 67 | Item15, 68 | 69 | /// 70 | [System.Xml.Serialization.XmlEnumAttribute("17")] 71 | Item17, 72 | 73 | /// 74 | [System.Xml.Serialization.XmlEnumAttribute("23")] 75 | Item23, 76 | 77 | /// 78 | [System.Xml.Serialization.XmlEnumAttribute("24")] 79 | Item24, 80 | 81 | /// 82 | [System.Xml.Serialization.XmlEnumAttribute("25")] 83 | Item25, 84 | 85 | /// 86 | [System.Xml.Serialization.XmlEnumAttribute("26")] 87 | Item26, 88 | 89 | /// 90 | [System.Xml.Serialization.XmlEnumAttribute("27")] 91 | Item27, 92 | 93 | /// 94 | [System.Xml.Serialization.XmlEnumAttribute("28")] 95 | Item28, 96 | 97 | /// 98 | [System.Xml.Serialization.XmlEnumAttribute("29")] 99 | Item29, 100 | 101 | /// 102 | [System.Xml.Serialization.XmlEnumAttribute("30")] 103 | Item30, 104 | 105 | /// 106 | [System.Xml.Serialization.XmlEnumAttribute("31")] 107 | Item31, 108 | 109 | /// 110 | [System.Xml.Serialization.XmlEnumAttribute("99")] 111 | Item99, 112 | } -------------------------------------------------------------------------------- /Common/Models/c_Impuesto.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * ============================================================================ 3 | * Mozilla Public License 2.0 (MPL-2.0) 4 | * Autor: FISCAL API S. DE R.L. DE C.V. - https://fiscalapi.com 5 | * ============================================================================ 6 | * 7 | * Este código está sujeto a los términos de la Mozilla Public License v2.0. 8 | * Licencia completa: https://mozilla.org/MPL/2.0 9 | * 10 | * AVISO: Este software se proporciona "tal como está" sin garantías de ningún 11 | * tipo. Al usar, modificar o distribuir este código debe mantener esta 12 | * atribución y las referencias al autor. 13 | * 14 | * ============================================================================ 15 | */ 16 | 17 | 18 | namespace Fiscalapi.XmlDownloader.Common.Models; 19 | 20 | /// 21 | [Serializable()] 22 | [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://www.sat.gob.mx/sitio_internet/cfd/catalogos")] 23 | public enum c_Impuesto { 24 | 25 | /// 26 | [System.Xml.Serialization.XmlEnumAttribute("001")] 27 | Item001, 28 | 29 | /// 30 | [System.Xml.Serialization.XmlEnumAttribute("002")] 31 | Item002, 32 | 33 | /// 34 | [System.Xml.Serialization.XmlEnumAttribute("003")] 35 | Item003, 36 | } -------------------------------------------------------------------------------- /Common/Models/c_Meses.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * ============================================================================ 3 | * Mozilla Public License 2.0 (MPL-2.0) 4 | * Autor: FISCAL API S. DE R.L. DE C.V. - https://fiscalapi.com 5 | * ============================================================================ 6 | * 7 | * Este código está sujeto a los términos de la Mozilla Public License v2.0. 8 | * Licencia completa: https://mozilla.org/MPL/2.0 9 | * 10 | * AVISO: Este software se proporciona "tal como está" sin garantías de ningún 11 | * tipo. Al usar, modificar o distribuir este código debe mantener esta 12 | * atribución y las referencias al autor. 13 | * 14 | * ============================================================================ 15 | */ 16 | 17 | 18 | namespace Fiscalapi.XmlDownloader.Common.Models; 19 | 20 | /// 21 | [Serializable()] 22 | [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://www.sat.gob.mx/sitio_internet/cfd/catalogos")] 23 | public enum c_Meses { 24 | 25 | /// 26 | [System.Xml.Serialization.XmlEnumAttribute("01")] 27 | Item01, 28 | 29 | /// 30 | [System.Xml.Serialization.XmlEnumAttribute("02")] 31 | Item02, 32 | 33 | /// 34 | [System.Xml.Serialization.XmlEnumAttribute("03")] 35 | Item03, 36 | 37 | /// 38 | [System.Xml.Serialization.XmlEnumAttribute("04")] 39 | Item04, 40 | 41 | /// 42 | [System.Xml.Serialization.XmlEnumAttribute("05")] 43 | Item05, 44 | 45 | /// 46 | [System.Xml.Serialization.XmlEnumAttribute("06")] 47 | Item06, 48 | 49 | /// 50 | [System.Xml.Serialization.XmlEnumAttribute("07")] 51 | Item07, 52 | 53 | /// 54 | [System.Xml.Serialization.XmlEnumAttribute("08")] 55 | Item08, 56 | 57 | /// 58 | [System.Xml.Serialization.XmlEnumAttribute("09")] 59 | Item09, 60 | 61 | /// 62 | [System.Xml.Serialization.XmlEnumAttribute("10")] 63 | Item10, 64 | 65 | /// 66 | [System.Xml.Serialization.XmlEnumAttribute("11")] 67 | Item11, 68 | 69 | /// 70 | [System.Xml.Serialization.XmlEnumAttribute("12")] 71 | Item12, 72 | 73 | /// 74 | [System.Xml.Serialization.XmlEnumAttribute("13")] 75 | Item13, 76 | 77 | /// 78 | [System.Xml.Serialization.XmlEnumAttribute("14")] 79 | Item14, 80 | 81 | /// 82 | [System.Xml.Serialization.XmlEnumAttribute("15")] 83 | Item15, 84 | 85 | /// 86 | [System.Xml.Serialization.XmlEnumAttribute("16")] 87 | Item16, 88 | 89 | /// 90 | [System.Xml.Serialization.XmlEnumAttribute("17")] 91 | Item17, 92 | 93 | /// 94 | [System.Xml.Serialization.XmlEnumAttribute("18")] 95 | Item18, 96 | } -------------------------------------------------------------------------------- /Common/Models/c_MetodoPago.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * ============================================================================ 3 | * Mozilla Public License 2.0 (MPL-2.0) 4 | * Autor: FISCAL API S. DE R.L. DE C.V. - https://fiscalapi.com 5 | * ============================================================================ 6 | * 7 | * Este código está sujeto a los términos de la Mozilla Public License v2.0. 8 | * Licencia completa: https://mozilla.org/MPL/2.0 9 | * 10 | * AVISO: Este software se proporciona "tal como está" sin garantías de ningún 11 | * tipo. Al usar, modificar o distribuir este código debe mantener esta 12 | * atribución y las referencias al autor. 13 | * 14 | * ============================================================================ 15 | */ 16 | 17 | 18 | namespace Fiscalapi.XmlDownloader.Common.Models; 19 | 20 | /// 21 | [Serializable()] 22 | [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://www.sat.gob.mx/sitio_internet/cfd/catalogos")] 23 | public enum c_MetodoPago { 24 | 25 | /// 26 | PUE, 27 | 28 | /// 29 | PPD, 30 | } -------------------------------------------------------------------------------- /Common/Models/c_ObjetoImp.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * ============================================================================ 3 | * Mozilla Public License 2.0 (MPL-2.0) 4 | * Autor: FISCAL API S. DE R.L. DE C.V. - https://fiscalapi.com 5 | * ============================================================================ 6 | * 7 | * Este código está sujeto a los términos de la Mozilla Public License v2.0. 8 | * Licencia completa: https://mozilla.org/MPL/2.0 9 | * 10 | * AVISO: Este software se proporciona "tal como está" sin garantías de ningún 11 | * tipo. Al usar, modificar o distribuir este código debe mantener esta 12 | * atribución y las referencias al autor. 13 | * 14 | * ============================================================================ 15 | */ 16 | 17 | 18 | namespace Fiscalapi.XmlDownloader.Common.Models; 19 | 20 | /// 21 | [Serializable()] 22 | [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://www.sat.gob.mx/sitio_internet/cfd/catalogos")] 23 | public enum c_ObjetoImp { 24 | 25 | /// 26 | [System.Xml.Serialization.XmlEnumAttribute("01")] 27 | Item01, 28 | 29 | /// 30 | [System.Xml.Serialization.XmlEnumAttribute("02")] 31 | Item02, 32 | 33 | /// 34 | [System.Xml.Serialization.XmlEnumAttribute("03")] 35 | Item03, 36 | 37 | /// 38 | [System.Xml.Serialization.XmlEnumAttribute("04")] 39 | Item04, 40 | 41 | /// 42 | [System.Xml.Serialization.XmlEnumAttribute("05")] 43 | Item05, 44 | 45 | /// 46 | [System.Xml.Serialization.XmlEnumAttribute("06")] 47 | Item06, 48 | 49 | /// 50 | [System.Xml.Serialization.XmlEnumAttribute("07")] 51 | Item07, 52 | 53 | /// 54 | [System.Xml.Serialization.XmlEnumAttribute("08")] 55 | Item08, 56 | } -------------------------------------------------------------------------------- /Common/Models/c_Periodicidad.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * ============================================================================ 3 | * Mozilla Public License 2.0 (MPL-2.0) 4 | * Autor: FISCAL API S. DE R.L. DE C.V. - https://fiscalapi.com 5 | * ============================================================================ 6 | * 7 | * Este código está sujeto a los términos de la Mozilla Public License v2.0. 8 | * Licencia completa: https://mozilla.org/MPL/2.0 9 | * 10 | * AVISO: Este software se proporciona "tal como está" sin garantías de ningún 11 | * tipo. Al usar, modificar o distribuir este código debe mantener esta 12 | * atribución y las referencias al autor. 13 | * 14 | * ============================================================================ 15 | */ 16 | 17 | 18 | namespace Fiscalapi.XmlDownloader.Common.Models; 19 | 20 | /// 21 | [Serializable()] 22 | [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://www.sat.gob.mx/sitio_internet/cfd/catalogos")] 23 | public enum c_Periodicidad { 24 | 25 | /// 26 | [System.Xml.Serialization.XmlEnumAttribute("01")] 27 | Item01, 28 | 29 | /// 30 | [System.Xml.Serialization.XmlEnumAttribute("02")] 31 | Item02, 32 | 33 | /// 34 | [System.Xml.Serialization.XmlEnumAttribute("03")] 35 | Item03, 36 | 37 | /// 38 | [System.Xml.Serialization.XmlEnumAttribute("04")] 39 | Item04, 40 | 41 | /// 42 | [System.Xml.Serialization.XmlEnumAttribute("05")] 43 | Item05, 44 | } -------------------------------------------------------------------------------- /Common/Models/c_RegimenFiscal.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * ============================================================================ 3 | * Mozilla Public License 2.0 (MPL-2.0) 4 | * Autor: FISCAL API S. DE R.L. DE C.V. - https://fiscalapi.com 5 | * ============================================================================ 6 | * 7 | * Este código está sujeto a los términos de la Mozilla Public License v2.0. 8 | * Licencia completa: https://mozilla.org/MPL/2.0 9 | * 10 | * AVISO: Este software se proporciona "tal como está" sin garantías de ningún 11 | * tipo. Al usar, modificar o distribuir este código debe mantener esta 12 | * atribución y las referencias al autor. 13 | * 14 | * ============================================================================ 15 | */ 16 | 17 | 18 | namespace Fiscalapi.XmlDownloader.Common.Models; 19 | 20 | /// 21 | [Serializable()] 22 | [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://www.sat.gob.mx/sitio_internet/cfd/catalogos")] 23 | public enum c_RegimenFiscal { 24 | 25 | /// 26 | [System.Xml.Serialization.XmlEnumAttribute("601")] 27 | Item601, 28 | 29 | /// 30 | [System.Xml.Serialization.XmlEnumAttribute("603")] 31 | Item603, 32 | 33 | /// 34 | [System.Xml.Serialization.XmlEnumAttribute("605")] 35 | Item605, 36 | 37 | /// 38 | [System.Xml.Serialization.XmlEnumAttribute("606")] 39 | Item606, 40 | 41 | /// 42 | [System.Xml.Serialization.XmlEnumAttribute("607")] 43 | Item607, 44 | 45 | /// 46 | [System.Xml.Serialization.XmlEnumAttribute("608")] 47 | Item608, 48 | 49 | /// 50 | [System.Xml.Serialization.XmlEnumAttribute("609")] 51 | Item609, 52 | 53 | /// 54 | [System.Xml.Serialization.XmlEnumAttribute("610")] 55 | Item610, 56 | 57 | /// 58 | [System.Xml.Serialization.XmlEnumAttribute("611")] 59 | Item611, 60 | 61 | /// 62 | [System.Xml.Serialization.XmlEnumAttribute("612")] 63 | Item612, 64 | 65 | /// 66 | [System.Xml.Serialization.XmlEnumAttribute("614")] 67 | Item614, 68 | 69 | /// 70 | [System.Xml.Serialization.XmlEnumAttribute("615")] 71 | Item615, 72 | 73 | /// 74 | [System.Xml.Serialization.XmlEnumAttribute("616")] 75 | Item616, 76 | 77 | /// 78 | [System.Xml.Serialization.XmlEnumAttribute("620")] 79 | Item620, 80 | 81 | /// 82 | [System.Xml.Serialization.XmlEnumAttribute("621")] 83 | Item621, 84 | 85 | /// 86 | [System.Xml.Serialization.XmlEnumAttribute("622")] 87 | Item622, 88 | 89 | /// 90 | [System.Xml.Serialization.XmlEnumAttribute("623")] 91 | Item623, 92 | 93 | /// 94 | [System.Xml.Serialization.XmlEnumAttribute("624")] 95 | Item624, 96 | 97 | /// 98 | [System.Xml.Serialization.XmlEnumAttribute("625")] 99 | Item625, 100 | 101 | /// 102 | [System.Xml.Serialization.XmlEnumAttribute("626")] 103 | Item626, 104 | 105 | /// 106 | [System.Xml.Serialization.XmlEnumAttribute("628")] 107 | Item628, 108 | 109 | /// 110 | [System.Xml.Serialization.XmlEnumAttribute("629")] 111 | Item629, 112 | 113 | /// 114 | [System.Xml.Serialization.XmlEnumAttribute("630")] 115 | Item630, 116 | } -------------------------------------------------------------------------------- /Common/Models/c_TipoDeComprobante.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * ============================================================================ 3 | * Mozilla Public License 2.0 (MPL-2.0) 4 | * Autor: FISCAL API S. DE R.L. DE C.V. - https://fiscalapi.com 5 | * ============================================================================ 6 | * 7 | * Este código está sujeto a los términos de la Mozilla Public License v2.0. 8 | * Licencia completa: https://mozilla.org/MPL/2.0 9 | * 10 | * AVISO: Este software se proporciona "tal como está" sin garantías de ningún 11 | * tipo. Al usar, modificar o distribuir este código debe mantener esta 12 | * atribución y las referencias al autor. 13 | * 14 | * ============================================================================ 15 | */ 16 | 17 | 18 | namespace Fiscalapi.XmlDownloader.Common.Models; 19 | 20 | /// 21 | [Serializable()] 22 | [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://www.sat.gob.mx/sitio_internet/cfd/catalogos")] 23 | public enum c_TipoDeComprobante { 24 | 25 | /// 26 | I, 27 | 28 | /// 29 | E, 30 | 31 | /// 32 | T, 33 | 34 | /// 35 | N, 36 | 37 | /// 38 | P, 39 | } -------------------------------------------------------------------------------- /Common/Models/c_TipoFactor.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * ============================================================================ 3 | * Mozilla Public License 2.0 (MPL-2.0) 4 | * Autor: FISCAL API S. DE R.L. DE C.V. - https://fiscalapi.com 5 | * ============================================================================ 6 | * 7 | * Este código está sujeto a los términos de la Mozilla Public License v2.0. 8 | * Licencia completa: https://mozilla.org/MPL/2.0 9 | * 10 | * AVISO: Este software se proporciona "tal como está" sin garantías de ningún 11 | * tipo. Al usar, modificar o distribuir este código debe mantener esta 12 | * atribución y las referencias al autor. 13 | * 14 | * ============================================================================ 15 | */ 16 | 17 | 18 | namespace Fiscalapi.XmlDownloader.Common.Models; 19 | 20 | /// 21 | [Serializable()] 22 | [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://www.sat.gob.mx/sitio_internet/cfd/catalogos")] 23 | public enum c_TipoFactor { 24 | 25 | /// 26 | Tasa, 27 | 28 | /// 29 | Cuota, 30 | 31 | /// 32 | Exento, 33 | } -------------------------------------------------------------------------------- /Common/Models/c_TipoRelacion.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * ============================================================================ 3 | * Mozilla Public License 2.0 (MPL-2.0) 4 | * Autor: FISCAL API S. DE R.L. DE C.V. - https://fiscalapi.com 5 | * ============================================================================ 6 | * 7 | * Este código está sujeto a los términos de la Mozilla Public License v2.0. 8 | * Licencia completa: https://mozilla.org/MPL/2.0 9 | * 10 | * AVISO: Este software se proporciona "tal como está" sin garantías de ningún 11 | * tipo. Al usar, modificar o distribuir este código debe mantener esta 12 | * atribución y las referencias al autor. 13 | * 14 | * ============================================================================ 15 | */ 16 | 17 | 18 | namespace Fiscalapi.XmlDownloader.Common.Models; 19 | 20 | /// 21 | [Serializable()] 22 | [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://www.sat.gob.mx/sitio_internet/cfd/catalogos")] 23 | public enum c_TipoRelacion { 24 | 25 | /// 26 | [System.Xml.Serialization.XmlEnumAttribute("01")] 27 | Item01, 28 | 29 | /// 30 | [System.Xml.Serialization.XmlEnumAttribute("02")] 31 | Item02, 32 | 33 | /// 34 | [System.Xml.Serialization.XmlEnumAttribute("03")] 35 | Item03, 36 | 37 | /// 38 | [System.Xml.Serialization.XmlEnumAttribute("04")] 39 | Item04, 40 | 41 | /// 42 | [System.Xml.Serialization.XmlEnumAttribute("05")] 43 | Item05, 44 | 45 | /// 46 | [System.Xml.Serialization.XmlEnumAttribute("06")] 47 | Item06, 48 | 49 | /// 50 | [System.Xml.Serialization.XmlEnumAttribute("07")] 51 | Item07, 52 | 53 | /// 54 | [System.Xml.Serialization.XmlEnumAttribute("08")] 55 | Item08, 56 | 57 | /// 58 | [System.Xml.Serialization.XmlEnumAttribute("09")] 59 | Item09, 60 | } -------------------------------------------------------------------------------- /Common/Models/c_UsoCFDI.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * ============================================================================ 3 | * Mozilla Public License 2.0 (MPL-2.0) 4 | * Autor: FISCAL API S. DE R.L. DE C.V. - https://fiscalapi.com 5 | * ============================================================================ 6 | * 7 | * Este código está sujeto a los términos de la Mozilla Public License v2.0. 8 | * Licencia completa: https://mozilla.org/MPL/2.0 9 | * 10 | * AVISO: Este software se proporciona "tal como está" sin garantías de ningún 11 | * tipo. Al usar, modificar o distribuir este código debe mantener esta 12 | * atribución y las referencias al autor. 13 | * 14 | * ============================================================================ 15 | */ 16 | 17 | 18 | namespace Fiscalapi.XmlDownloader.Common.Models; 19 | 20 | /// 21 | [Serializable()] 22 | [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://www.sat.gob.mx/sitio_internet/cfd/catalogos")] 23 | public enum c_UsoCFDI { 24 | 25 | /// 26 | G01, 27 | 28 | /// 29 | G02, 30 | 31 | /// 32 | G03, 33 | 34 | /// 35 | I01, 36 | 37 | /// 38 | I02, 39 | 40 | /// 41 | I03, 42 | 43 | /// 44 | I04, 45 | 46 | /// 47 | I05, 48 | 49 | /// 50 | I06, 51 | 52 | /// 53 | I07, 54 | 55 | /// 56 | I08, 57 | 58 | /// 59 | D01, 60 | 61 | /// 62 | D02, 63 | 64 | /// 65 | D03, 66 | 67 | /// 68 | D04, 69 | 70 | /// 71 | D05, 72 | 73 | /// 74 | D06, 75 | 76 | /// 77 | D07, 78 | 79 | /// 80 | D08, 81 | 82 | /// 83 | D09, 84 | 85 | /// 86 | D10, 87 | 88 | /// 89 | P01, 90 | 91 | /// 92 | S01, 93 | 94 | /// 95 | CP01, 96 | 97 | /// 98 | CN01, 99 | } -------------------------------------------------------------------------------- /Common/XmlPlaceholders.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * ============================================================================ 3 | * Mozilla Public License 2.0 (MPL-2.0) 4 | * Autor: FISCAL API S. DE R.L. DE C.V. - https://fiscalapi.com 5 | * ============================================================================ 6 | * 7 | * Este código está sujeto a los términos de la Mozilla Public License v2.0. 8 | * Licencia completa: https://mozilla.org/MPL/2.0 9 | * 10 | * AVISO: Este software se proporciona "tal como está" sin garantías de ningún 11 | * tipo. Al usar, modificar o distribuir este código debe mantener esta 12 | * atribución y las referencias al autor. 13 | * 14 | * ============================================================================ 15 | */ 16 | 17 | namespace Fiscalapi.XmlDownloader.Common; 18 | 19 | /// 20 | /// Placeholders used in XML templates for SAT web services. 21 | /// 22 | public static class XmlPlaceholders 23 | { 24 | #region Common Placeholders 25 | 26 | public const string Base64Cer = $"___{nameof(Base64Cer)}___"; 27 | public const string Base64Digested = $"___{nameof(Base64Digested)}___"; 28 | public const string Base64Signature = $"___{nameof(Base64Signature)}___"; 29 | public const string X509IssuerName = $"___{nameof(X509IssuerName)}___"; 30 | public const string X509SerialNumber = $"___{nameof(X509SerialNumber)}___"; 31 | 32 | public const string SignedInfo = $"___{nameof(SignedInfo)}___"; 33 | public const string KeyInfo = $"___{nameof(KeyInfo)}___"; 34 | public const string SignatureData = $"___{nameof(SignatureData)}___"; 35 | public const string ReferenceUri = $"___{nameof(ReferenceUri)}___"; 36 | 37 | #endregion 38 | 39 | #region Auth Specific Placeholders 40 | 41 | public const string Created = $"___{nameof(Created)}___"; 42 | public const string Expires = $"___{nameof(Expires)}___"; 43 | public const string Uuid = $"___{nameof(Uuid)}___"; 44 | 45 | #endregion 46 | 47 | #region Query Specific Placeholders 48 | 49 | public const string RequestAttributes = $"___{nameof(RequestAttributes)}___"; 50 | public const string ExtraXml = $"___{nameof(ExtraXml)}___"; 51 | public const string NodeName = $"___{nameof(NodeName)}___"; 52 | public const string RecipientTin = $"___{nameof(RecipientTin)}___"; 53 | public const string RfcReceptorItems = $"___{nameof(RfcReceptorItems)}___"; 54 | 55 | #endregion 56 | 57 | #region Verify Service Placeholders 58 | 59 | public const string RequestId = $"___{nameof(RequestId)}___"; 60 | public const string RequesterTin = $"___{nameof(RequesterTin)}___"; 61 | 62 | #endregion 63 | 64 | #region Download Service Placeholders 65 | 66 | public const string PackageId = $"___{nameof(PackageId)}___"; 67 | 68 | #endregion 69 | } -------------------------------------------------------------------------------- /Common/XmlSerializerService.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * ============================================================================ 3 | * Mozilla Public License 2.0 (MPL-2.0) 4 | * Autor: FISCAL API S. DE R.L. DE C.V. - https://fiscalapi.com 5 | * ============================================================================ 6 | * 7 | * Este código está sujeto a los términos de la Mozilla Public License v2.0. 8 | * Licencia completa: https://mozilla.org/MPL/2.0 9 | * 10 | * AVISO: Este software se proporciona "tal como está" sin garantías de ningún 11 | * tipo. Al usar, modificar o distribuir este código debe mantener esta 12 | * atribución y las referencias al autor. 13 | * 14 | * ============================================================================ 15 | */ 16 | 17 | using System.Xml.Serialization; 18 | 19 | namespace Fiscalapi.XmlDownloader.Common; 20 | 21 | /// 22 | /// Service for serializing and deserializing XML data. 23 | /// 24 | public static class XmlSerializerService 25 | { 26 | public static T? Deserialize(string xml) where T : class 27 | { 28 | var serializer = new XmlSerializer(typeof(T)); 29 | using var reader = new StringReader(xml); 30 | return serializer.Deserialize(reader) as T; 31 | } 32 | 33 | public static string Serialize(T obj) 34 | { 35 | var serializer = new XmlSerializer(typeof(T)); 36 | using var stringWriter = new StringWriter(); 37 | serializer.Serialize(stringWriter, obj); 38 | return stringWriter.ToString(); 39 | } 40 | } -------------------------------------------------------------------------------- /Download/DownloadResponseService.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * ============================================================================ 3 | * Mozilla Public License 2.0 (MPL-2.0) 4 | * Autor: FISCAL API S. DE R.L. DE C.V. - https://fiscalapi.com 5 | * ============================================================================ 6 | * 7 | * Este código está sujeto a los términos de la Mozilla Public License v2.0. 8 | * Licencia completa: https://mozilla.org/MPL/2.0 9 | * 10 | * AVISO: Este software se proporciona "tal como está" sin garantías de ningún 11 | * tipo. Al usar, modificar o distribuir este código debe mantener esta 12 | * atribución y las referencias al autor. 13 | * 14 | * ============================================================================ 15 | */ 16 | 17 | using Fiscalapi.XmlDownloader.Common; 18 | using Fiscalapi.XmlDownloader.Common.Enums; 19 | using Fiscalapi.XmlDownloader.Common.Http; 20 | using Fiscalapi.XmlDownloader.Download.Models; 21 | using Fiscalapi.XmlDownloader.Download.Models.Sat; 22 | 23 | namespace Fiscalapi.XmlDownloader.Download; 24 | 25 | public static class DownloadResponseService 26 | { 27 | public static DownloadResponse Build(SatResponse satResponse) 28 | { 29 | if (satResponse.IsSuccessStatusCode) 30 | { 31 | /* 32 | * 33 | 34 | 39 | 40 | 42 | 43 | base64... 44 | 45 | 46 | 47 | */ 48 | var envelope = XmlSerializerService.Deserialize(satResponse.RawResponse!); 49 | 50 | 51 | // CodEstatus 52 | var codEstatus = envelope?.Header?.HeaderResponse?.CodEstatus ?? "000"; 53 | var status = codEstatus.ToEnumElement(); 54 | 55 | // Mensaje 56 | var mensaje = envelope?.Header?.HeaderResponse?.Mensaje ?? ""; 57 | 58 | 59 | return new DownloadResponse 60 | { 61 | Succeeded = true, 62 | SatStatus = status, 63 | SatStatusCode = codEstatus, 64 | SatMessage = mensaje, 65 | Base64Package = envelope?.Body.BodyData?.Base64Package, 66 | RawRequest = satResponse.RawRequest, 67 | RawResponse = satResponse.RawResponse 68 | }; 69 | } 70 | 71 | 72 | return new DownloadResponse 73 | { 74 | Succeeded = false, 75 | SatStatus = SatStatus.Unknown, 76 | SatStatusCode = "UnknownError", 77 | SatMessage = $"StatusCode: {satResponse.HttpStatusCode} Message: {satResponse.ReasonPhrase}", 78 | RawRequest = satResponse.RawRequest, 79 | RawResponse = satResponse.RawResponse 80 | }; 81 | } 82 | } -------------------------------------------------------------------------------- /Download/DownloadService.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * ============================================================================ 3 | * Mozilla Public License 2.0 (MPL-2.0) 4 | * Autor: FISCAL API S. DE R.L. DE C.V. - https://fiscalapi.com 5 | * ============================================================================ 6 | * 7 | * Este código está sujeto a los términos de la Mozilla Public License v2.0. 8 | * Licencia completa: https://mozilla.org/MPL/2.0 9 | * 10 | * AVISO: Este software se proporciona "tal como está" sin garantías de ningún 11 | * tipo. Al usar, modificar o distribuir este código debe mantener esta 12 | * atribución y las referencias al autor. 13 | * 14 | * ============================================================================ 15 | */ 16 | 17 | using Fiscalapi.Credentials.Common; 18 | using Fiscalapi.Credentials.Core; 19 | using Fiscalapi.XmlDownloader.Auth.Models; 20 | using Fiscalapi.XmlDownloader.Common; 21 | using Fiscalapi.XmlDownloader.Common.Http; 22 | using Fiscalapi.XmlDownloader.Download.Models; 23 | 24 | namespace Fiscalapi.XmlDownloader.Download; 25 | 26 | /// 27 | /// Service for downloading packages from SAT. 28 | /// 29 | public class DownloadService : SatService, IDownloadService 30 | { 31 | /// 32 | /// Downloads a package from SAT using the provided credential, authentication token and package ID.s 33 | /// 34 | /// Fiel 35 | /// Authentication token 36 | /// PackageID 37 | /// CancellationToken 38 | /// DownloadResponse 39 | public async Task DownloadAsync(ICredential credential, Token authToken, string packageId, 40 | CancellationToken cancellationToken = default) 41 | { 42 | var toDigest = CreateDigest(packageId, credential.Certificate.Rfc); 43 | var signature = CreateSignature(credential, toDigest); 44 | var requestXml = BuildEnvelope(packageId, credential.Certificate.Rfc, signature); 45 | 46 | var satResponse = await SendRequestAsync( 47 | url: SatUrl.DownloadUrl, 48 | action: SatUrl.DownloadAction, 49 | payload: requestXml, 50 | token: authToken.Value, 51 | cancellationToken: cancellationToken); 52 | 53 | var downloadResponse = DownloadResponseService.Build(satResponse); 54 | 55 | return downloadResponse; 56 | } 57 | 58 | private string CreateDigest(string packageId, string requesterTin) 59 | { 60 | var xml = XmlTemplates.DownloadToDigest 61 | .Replace(XmlPlaceholders.PackageId, packageId) 62 | .Replace(XmlPlaceholders.RequesterTin, requesterTin); 63 | 64 | return xml.Clean(); 65 | } 66 | 67 | private string CreateSignature(ICredential credential, string toDigest) 68 | { 69 | toDigest = toDigest.Clean(); 70 | var digestValue = credential.CreateHash(toDigest); 71 | 72 | // Create signed info 73 | var signedInfo = XmlTemplates.SignedInfo 74 | .Replace(XmlPlaceholders.Base64Digested, digestValue) 75 | .Replace(XmlPlaceholders.ReferenceUri, ""); 76 | 77 | var cleanedSignedInfo = signedInfo.Clean(); 78 | var signatureValue = credential.SignData(cleanedSignedInfo).ToBase64String(); 79 | 80 | var cleanSignedInfoForTemplate = cleanedSignedInfo.Replace( 81 | @"", 82 | ""); 83 | 84 | var keyInfo = XmlTemplates.X509KeyInfo 85 | .Replace(XmlPlaceholders.X509IssuerName, credential.Certificate.Issuer) 86 | .Replace(XmlPlaceholders.X509SerialNumber, credential.Certificate.SerialNumber) 87 | .Replace(XmlPlaceholders.Base64Cer, credential.Certificate.RawDataBytes.ToBase64String()); 88 | 89 | var signature = XmlTemplates.SignatureTemplate 90 | .Replace(XmlPlaceholders.SignedInfo, cleanSignedInfoForTemplate) 91 | .Replace(XmlPlaceholders.Base64Signature, signatureValue) 92 | .Replace(XmlPlaceholders.KeyInfo, keyInfo); 93 | 94 | return signature; 95 | } 96 | 97 | private string BuildEnvelope(string packageId, string requesterTin, string signature) 98 | { 99 | var envelope = XmlTemplates.DownloadEnvelope 100 | .Replace(XmlPlaceholders.PackageId, packageId) 101 | .Replace(XmlPlaceholders.RequesterTin, requesterTin) 102 | .Replace(XmlPlaceholders.SignatureData, signature); 103 | 104 | return envelope.Clean(); 105 | } 106 | } -------------------------------------------------------------------------------- /Download/IDownloadService.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * ============================================================================ 3 | * Mozilla Public License 2.0 (MPL-2.0) 4 | * Autor: FISCAL API S. DE R.L. DE C.V. - https://fiscalapi.com 5 | * ============================================================================ 6 | * 7 | * Este código está sujeto a los términos de la Mozilla Public License v2.0. 8 | * Licencia completa: https://mozilla.org/MPL/2.0 9 | * 10 | * AVISO: Este software se proporciona "tal como está" sin garantías de ningún 11 | * tipo. Al usar, modificar o distribuir este código debe mantener esta 12 | * atribución y las referencias al autor. 13 | * 14 | * ============================================================================ 15 | */ 16 | 17 | using Fiscalapi.Credentials.Core; 18 | using Fiscalapi.XmlDownloader.Auth.Models; 19 | using Fiscalapi.XmlDownloader.Download.Models; 20 | 21 | namespace Fiscalapi.XmlDownloader.Download; 22 | 23 | /// 24 | /// Service interface for downloading packages from SAT. 25 | /// 26 | public interface IDownloadService 27 | { 28 | /// 29 | /// Downloads a package from SAT using the provided credential, authentication token and package ID.s 30 | /// 31 | /// Fiel 32 | /// Authentication token 33 | /// PackageID 34 | /// CancellationToken 35 | /// DownloadResponse 36 | Task DownloadAsync(ICredential credential, Token authToken, string packageId, 37 | CancellationToken cancellationToken = default); 38 | } -------------------------------------------------------------------------------- /Download/Models/DownloadResponse.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * ============================================================================ 3 | * Mozilla Public License 2.0 (MPL-2.0) 4 | * Autor: FISCAL API S. DE R.L. DE C.V. - https://fiscalapi.com 5 | * ============================================================================ 6 | * 7 | * Este código está sujeto a los términos de la Mozilla Public License v2.0. 8 | * Licencia completa: https://mozilla.org/MPL/2.0 9 | * 10 | * AVISO: Este software se proporciona "tal como está" sin garantías de ningún 11 | * tipo. Al usar, modificar o distribuir este código debe mantener esta 12 | * atribución y las referencias al autor. 13 | * 14 | * ============================================================================ 15 | */ 16 | 17 | using Fiscalapi.XmlDownloader.Common.Http; 18 | 19 | namespace Fiscalapi.XmlDownloader.Download.Models; 20 | 21 | /// 22 | /// Response from package download service 23 | /// 24 | public class DownloadResponse : BaseResponse 25 | { 26 | /// 27 | /// Base64 encoded package containing the downloaded data. 28 | /// 29 | public string? Base64Package { get; set; } 30 | 31 | /// 32 | /// Bytes of the package containing the downloaded data. 33 | /// 34 | public byte[] PackageBytes => !string.IsNullOrWhiteSpace(Base64Package) 35 | ? Convert.FromBase64String(Base64Package) 36 | : Array.Empty(); 37 | 38 | /// 39 | /// Size of the package in bytes 40 | /// 41 | public int PackageSize => PackageBytes.Length; 42 | } -------------------------------------------------------------------------------- /Download/Models/Sat/DownloadBody.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * ============================================================================ 3 | * Mozilla Public License 2.0 (MPL-2.0) 4 | * Autor: FISCAL API S. DE R.L. DE C.V. - https://fiscalapi.com 5 | * ============================================================================ 6 | * 7 | * Este código está sujeto a los términos de la Mozilla Public License v2.0. 8 | * Licencia completa: https://mozilla.org/MPL/2.0 9 | * 10 | * AVISO: Este software se proporciona "tal como está" sin garantías de ningún 11 | * tipo. Al usar, modificar o distribuir este código debe mantener esta 12 | * atribución y las referencias al autor. 13 | * 14 | * ============================================================================ 15 | */ 16 | 17 | using System.Xml.Serialization; 18 | 19 | namespace Fiscalapi.XmlDownloader.Download.Models.Sat; 20 | 21 | public class DownloadBody 22 | { 23 | [XmlElement("RespuestaDescargaMasivaTercerosSalida", Namespace = "http://DescargaMasivaTerceros.sat.gob.mx")] 24 | public DownloadBodyData? BodyData { get; set; } 25 | } -------------------------------------------------------------------------------- /Download/Models/Sat/DownloadBodyData.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * ============================================================================ 3 | * Mozilla Public License 2.0 (MPL-2.0) 4 | * Autor: FISCAL API S. DE R.L. DE C.V. - https://fiscalapi.com 5 | * ============================================================================ 6 | * 7 | * Este código está sujeto a los términos de la Mozilla Public License v2.0. 8 | * Licencia completa: https://mozilla.org/MPL/2.0 9 | * 10 | * AVISO: Este software se proporciona "tal como está" sin garantías de ningún 11 | * tipo. Al usar, modificar o distribuir este código debe mantener esta 12 | * atribución y las referencias al autor. 13 | * 14 | * ============================================================================ 15 | */ 16 | 17 | using System.Xml.Serialization; 18 | 19 | namespace Fiscalapi.XmlDownloader.Download.Models.Sat; 20 | 21 | public class DownloadBodyData 22 | { 23 | /// 24 | /// Base64 encoded package containing the downloaded data. 25 | /// 26 | [XmlElement("Paquete")] 27 | public string? Base64Package { get; set; } 28 | } -------------------------------------------------------------------------------- /Download/Models/Sat/DownloadEnvelope.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * ============================================================================ 3 | * Mozilla Public License 2.0 (MPL-2.0) 4 | * Autor: FISCAL API S. DE R.L. DE C.V. - https://fiscalapi.com 5 | * ============================================================================ 6 | * 7 | * Este código está sujeto a los términos de la Mozilla Public License v2.0. 8 | * Licencia completa: https://mozilla.org/MPL/2.0 9 | * 10 | * AVISO: Este software se proporciona "tal como está" sin garantías de ningún 11 | * tipo. Al usar, modificar o distribuir este código debe mantener esta 12 | * atribución y las referencias al autor. 13 | * 14 | * ============================================================================ 15 | */ 16 | 17 | using System.Xml.Serialization; 18 | 19 | namespace Fiscalapi.XmlDownloader.Download.Models.Sat; 20 | 21 | [XmlRoot("Envelope", Namespace = "http://schemas.xmlsoap.org/soap/envelope/")] 22 | public class DownloadEnvelope 23 | { 24 | [XmlNamespaceDeclarations] public XmlSerializerNamespaces Namespaces { get; set; } 25 | 26 | [XmlElement("Header", Namespace = "http://schemas.xmlsoap.org/soap/envelope/")] 27 | public DownloadHeader Header { get; set; } 28 | 29 | [XmlElement("Body", Namespace = "http://schemas.xmlsoap.org/soap/envelope/")] 30 | public DownloadBody Body { get; set; } 31 | 32 | public DownloadEnvelope() 33 | { 34 | Namespaces = new XmlSerializerNamespaces(); 35 | Namespaces.Add("s", "http://schemas.xmlsoap.org/soap/envelope/"); 36 | Namespaces.Add("h", "http://DescargaMasivaTerceros.sat.gob.mx"); 37 | } 38 | } -------------------------------------------------------------------------------- /Download/Models/Sat/DownloadHeader.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * ============================================================================ 3 | * Mozilla Public License 2.0 (MPL-2.0) 4 | * Autor: FISCAL API S. DE R.L. DE C.V. - https://fiscalapi.com 5 | * ============================================================================ 6 | * 7 | * Este código está sujeto a los términos de la Mozilla Public License v2.0. 8 | * Licencia completa: https://mozilla.org/MPL/2.0 9 | * 10 | * AVISO: Este software se proporciona "tal como está" sin garantías de ningún 11 | * tipo. Al usar, modificar o distribuir este código debe mantener esta 12 | * atribución y las referencias al autor. 13 | * 14 | * ============================================================================ 15 | */ 16 | 17 | using System.Xml.Serialization; 18 | 19 | namespace Fiscalapi.XmlDownloader.Download.Models.Sat; 20 | 21 | public class DownloadHeader 22 | { 23 | [XmlElement("respuesta", Namespace = "http://DescargaMasivaTerceros.sat.gob.mx")] 24 | public DownloadHeaderResponse? HeaderResponse { get; set; } 25 | } -------------------------------------------------------------------------------- /Download/Models/Sat/DownloadHeaderResponse.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * ============================================================================ 3 | * Mozilla Public License 2.0 (MPL-2.0) 4 | * Autor: FISCAL API S. DE R.L. DE C.V. - https://fiscalapi.com 5 | * ============================================================================ 6 | * 7 | * Este código está sujeto a los términos de la Mozilla Public License v2.0. 8 | * Licencia completa: https://mozilla.org/MPL/2.0 9 | * 10 | * AVISO: Este software se proporciona "tal como está" sin garantías de ningún 11 | * tipo. Al usar, modificar o distribuir este código debe mantener esta 12 | * atribución y las referencias al autor. 13 | * 14 | * ============================================================================ 15 | */ 16 | 17 | using System.Xml.Serialization; 18 | 19 | namespace Fiscalapi.XmlDownloader.Download.Models.Sat; 20 | 21 | public class DownloadHeaderResponse 22 | { 23 | [XmlAttribute("CodEstatus")] public string? CodEstatus { get; set; } 24 | 25 | [XmlAttribute("Mensaje")] public string? Mensaje { get; set; } 26 | } -------------------------------------------------------------------------------- /FileStorage/FileDetails.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * ============================================================================ 3 | * Mozilla Public License 2.0 (MPL-2.0) 4 | * Autor: FISCAL API S. DE R.L. DE C.V. - https://fiscalapi.com 5 | * ============================================================================ 6 | * 7 | * Este código está sujeto a los términos de la Mozilla Public License v2.0. 8 | * Licencia completa: https://mozilla.org/MPL/2.0 9 | * 10 | * AVISO: Este software se proporciona "tal como está" sin garantías de ningún 11 | * tipo. Al usar, modificar o distribuir este código debe mantener esta 12 | * atribución y las referencias al autor. 13 | * 14 | * ============================================================================ 15 | */ 16 | 17 | namespace Fiscalapi.XmlDownloader.FileStorage; 18 | 19 | /// 20 | /// Represents a file with its basic information 21 | /// 22 | public class FileDetails 23 | { 24 | public string FileName { get; set; } = string.Empty; 25 | public string FilePath { get; set; } = string.Empty; 26 | public long Size { get; set; } 27 | public DateTime CreatedAt { get; set; } 28 | public DateTime ModifiedAt { get; set; } 29 | } -------------------------------------------------------------------------------- /FileStorage/FileStorageSettings.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * ============================================================================ 3 | * Mozilla Public License 2.0 (MPL-2.0) 4 | * Autor: FISCAL API S. DE R.L. DE C.V. - https://fiscalapi.com 5 | * ============================================================================ 6 | * 7 | * Este código está sujeto a los términos de la Mozilla Public License v2.0. 8 | * Licencia completa: https://mozilla.org/MPL/2.0 9 | * 10 | * AVISO: Este software se proporciona "tal como está" sin garantías de ningún 11 | * tipo. Al usar, modificar o distribuir este código debe mantener esta 12 | * atribución y las referencias al autor. 13 | * 14 | * ============================================================================ 15 | */ 16 | 17 | namespace Fiscalapi.XmlDownloader.FileStorage; 18 | 19 | public static class FileStorageSettings 20 | { 21 | /// 22 | /// Package file extension 23 | /// 24 | public static string PackageExtension { get; set; } = ".zip"; 25 | 26 | /// 27 | /// CFDI file extension 28 | /// 29 | public static string CfdiExtension { get; set; } = ".xml"; 30 | 31 | /// 32 | /// Metadata file extension 33 | /// 34 | public static string MetaExtension { get; set; } = ".txt"; 35 | } -------------------------------------------------------------------------------- /FileStorage/IFileStorageService.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * ============================================================================ 3 | * Mozilla Public License 2.0 (MPL-2.0) 4 | * Autor: FISCAL API S. DE R.L. DE C.V. - https://fiscalapi.com 5 | * ============================================================================ 6 | * 7 | * Este código está sujeto a los términos de la Mozilla Public License v2.0. 8 | * Licencia completa: https://mozilla.org/MPL/2.0 9 | * 10 | * AVISO: Este software se proporciona "tal como está" sin garantías de ningún 11 | * tipo. Al usar, modificar o distribuir este código debe mantener esta 12 | * atribución y las referencias al autor. 13 | * 14 | * ============================================================================ 15 | */ 16 | 17 | namespace Fiscalapi.XmlDownloader.FileStorage; 18 | 19 | /// 20 | /// Interface for file system operations. 21 | /// 22 | public interface IFileStorageService 23 | { 24 | /// 25 | /// Check if a directory exists at the specified path 26 | /// 27 | /// Full path to the directory 28 | /// True if directory exists 29 | bool DirectoryExists(string directoryPath); 30 | 31 | /// 32 | /// Delete all files and folders recursively from the specified directory 33 | /// 34 | /// Full path to the directory to clean 35 | /// Cancellation token 36 | void CleanDirectory(string directoryPath, CancellationToken cancellationToken = default); 37 | 38 | /// 39 | /// Create a directory if it doesn't exist 40 | /// 41 | /// Full path to the directory to create 42 | void CreateDirectoryIfNotExist(string directoryPath); 43 | 44 | /// 45 | /// Check if a file exists at the specified path 46 | /// 47 | /// Full path to the file 48 | /// True if file exists 49 | bool FileExists(string fullFilePath); 50 | 51 | /// 52 | /// Extract a ZIP file to the specified destination path 53 | /// 54 | /// Full path to the ZIP file 55 | /// Path to extract files to 56 | /// Cancellation token 57 | /// Completion Task 58 | void ExtractZipFile(string fullFilePath, string extractToPath, 59 | CancellationToken cancellationToken = default); 60 | 61 | /// 62 | /// Get a list of files from the specified directory with optional file extension filter 63 | /// 64 | /// Full path to the directory 65 | /// File extension filter (optional) 66 | /// List of file details 67 | List GetFiles(string directoryPath, string? fileExtension = null); 68 | 69 | /// 70 | /// Write binary data to a file 71 | /// 72 | /// Full path to the file 73 | /// Binary data to write 74 | /// Cancellation token 75 | Task WriteFileAsync(string fullFilePath, byte[] data, CancellationToken cancellationToken = default); 76 | 77 | /// 78 | /// Write base64 encoded data to a file 79 | /// 80 | /// Full path to the file 81 | /// Base64 encoded data to write 82 | /// Cancellation token 83 | Task WriteFileAsync(string fullFilePath, string base64Data, CancellationToken cancellationToken = default); 84 | 85 | /// 86 | /// Read file content as byte array 87 | /// 88 | /// Full path to the file 89 | /// Cancellation token 90 | /// File content as byte array 91 | Task ReadFileAsync(string fullFilePath, CancellationToken cancellationToken = default); 92 | 93 | /// 94 | /// Read file content as string 95 | /// 96 | /// Full path to the file 97 | /// Cancellation token 98 | /// File content as string 99 | Task ReadFileContentAsync(string fullFilePath, CancellationToken cancellationToken = default); 100 | 101 | /// 102 | /// Delete a file 103 | /// 104 | /// Full path to the file 105 | /// True if file was deleted successfully 106 | void DeleteFile(string fullFilePath); 107 | } -------------------------------------------------------------------------------- /Query/IQueryService.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * ============================================================================ 3 | * Mozilla Public License 2.0 (MPL-2.0) 4 | * Autor: FISCAL API S. DE R.L. DE C.V. - https://fiscalapi.com 5 | * ============================================================================ 6 | * 7 | * Este código está sujeto a los términos de la Mozilla Public License v2.0. 8 | * Licencia completa: https://mozilla.org/MPL/2.0 9 | * 10 | * AVISO: Este software se proporciona "tal como está" sin garantías de ningún 11 | * tipo. Al usar, modificar o distribuir este código debe mantener esta 12 | * atribución y las referencias al autor. 13 | * 14 | * ============================================================================ 15 | */ 16 | 17 | using Fiscalapi.Credentials.Core; 18 | using Fiscalapi.XmlDownloader.Auth.Models; 19 | using Fiscalapi.XmlDownloader.Query.Models; 20 | 21 | namespace Fiscalapi.XmlDownloader.Query; 22 | 23 | /// 24 | /// Service for creating download requests from the SAT. 25 | /// 26 | public interface IQueryService 27 | { 28 | /// 29 | /// Creates a download request based on the provided parameters. 30 | /// 31 | /// Fiel 32 | /// Authentication token 33 | /// Request parameters 34 | /// CancellationToken 35 | /// QueryResponse 36 | Task CreateAsync(ICredential credential, Token authToken, 37 | QueryParameters parameters, CancellationToken cancellationToken); 38 | } -------------------------------------------------------------------------------- /Query/Models/DownloadType.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * ============================================================================ 3 | * Mozilla Public License 2.0 (MPL-2.0) 4 | * Autor: FISCAL API S. DE R.L. DE C.V. - https://fiscalapi.com 5 | * ============================================================================ 6 | * 7 | * Este código está sujeto a los términos de la Mozilla Public License v2.0. 8 | * Licencia completa: https://mozilla.org/MPL/2.0 9 | * 10 | * AVISO: Este software se proporciona "tal como está" sin garantías de ningún 11 | * tipo. Al usar, modificar o distribuir este código debe mantener esta 12 | * atribución y las referencias al autor. 13 | * 14 | * ============================================================================ 15 | */ 16 | 17 | namespace Fiscalapi.XmlDownloader.Query.Models; 18 | 19 | /// 20 | /// Enum for identifying operation types in query service. 21 | /// 22 | public enum DownloadType 23 | { 24 | Emitidos, 25 | Recibidos, 26 | Uuid 27 | } -------------------------------------------------------------------------------- /Query/Models/InvoiceComplement.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * ============================================================================ 3 | * Mozilla Public License 2.0 (MPL-2.0) 4 | * Autor: FISCAL API S. DE R.L. DE C.V. - https://fiscalapi.com 5 | * ============================================================================ 6 | * 7 | * Este código está sujeto a los términos de la Mozilla Public License v2.0. 8 | * Licencia completa: https://mozilla.org/MPL/2.0 9 | * 10 | * AVISO: Este software se proporciona "tal como está" sin garantías de ningún 11 | * tipo. Al usar, modificar o distribuir este código debe mantener esta 12 | * atribución y las referencias al autor. 13 | * 14 | * ============================================================================ 15 | */ 16 | 17 | using Fiscalapi.XmlDownloader.Common.Attributes; 18 | 19 | namespace Fiscalapi.XmlDownloader.Query.Models; 20 | 21 | public enum InvoiceComplement 22 | { 23 | [EnumCode("")] Any, 24 | [EnumCode("acreditamientoieps10")] AcreditamientoIeps10, 25 | [EnumCode("aerolineas")] Aerolineas, 26 | [EnumCode("certificadodedestruccion")] CertificadoDeDestruccion, 27 | [EnumCode("cfdiregistrofiscal")] CfdiRegistroFiscal, 28 | [EnumCode("comercioexterior10")] ComercioExterior10, 29 | [EnumCode("comercioexterior11")] ComercioExterior11, 30 | [EnumCode("comprobante")] Comprobante, 31 | [EnumCode("consumodecombustibles")] ConsumoDecombustibles, 32 | [EnumCode("consumodecombustibles11")] ConsumoDecombustibles11, 33 | [EnumCode("detallista")] Detallista, 34 | [EnumCode("divisas")] Divisas, 35 | [EnumCode("donat11")] Donat11, 36 | [EnumCode("ecc11")] Ecc11, 37 | [EnumCode("ecc12")] Ecc12, 38 | [EnumCode("gastoshidrocarburos10")] GastosHidrocarburos10, 39 | [EnumCode("iedu")] Iedu, 40 | [EnumCode("implocal")] ImpLocal, 41 | [EnumCode("ine11")] Ine11, 42 | [EnumCode("ingresoshidrocarburos")] IngresosHidrocarburos, 43 | [EnumCode("leyendasfisc")] LeyendasFisc, 44 | [EnumCode("nomina11")] Nomina11, 45 | [EnumCode("nomina12")] Nomina12, 46 | [EnumCode("notariospublicos")] NotariosPublicos, 47 | [EnumCode("obrasarteantiguedades")] ObrasArteAntiguedades, 48 | [EnumCode("pagoenespecie")] PagoEnEspecie, 49 | [EnumCode("pagos10")] Pagos10, 50 | [EnumCode("pfic")] Pfic, 51 | 52 | [EnumCode("renovacionysustitucionvehiculos")] 53 | RenovacionYSustitucionVehiculos, 54 | 55 | [EnumCode("servicioparcialconstruccion")] 56 | ServicioParcialConstruccion, 57 | [EnumCode("spei")] Spei, 58 | [EnumCode("terceros11")] Terceros11, 59 | 60 | [EnumCode("turistapasajeroextranjero")] 61 | TuristaPasajeroExtranjero, 62 | [EnumCode("valesdedespensa")] ValesDeDespensa, 63 | [EnumCode("vehiculousado")] VehiculoUsado, 64 | [EnumCode("ventavehiculos11")] VentaVehiculos11 65 | } -------------------------------------------------------------------------------- /Query/Models/InvoiceStatus.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * ============================================================================ 3 | * Mozilla Public License 2.0 (MPL-2.0) 4 | * Autor: FISCAL API S. DE R.L. DE C.V. - https://fiscalapi.com 5 | * ============================================================================ 6 | * 7 | * Este código está sujeto a los términos de la Mozilla Public License v2.0. 8 | * Licencia completa: https://mozilla.org/MPL/2.0 9 | * 10 | * AVISO: Este software se proporciona "tal como está" sin garantías de ningún 11 | * tipo. Al usar, modificar o distribuir este código debe mantener esta 12 | * atribución y las referencias al autor. 13 | * 14 | * ============================================================================ 15 | */ 16 | 17 | using Fiscalapi.XmlDownloader.Common.Attributes; 18 | 19 | namespace Fiscalapi.XmlDownloader.Query.Models; 20 | 21 | public enum InvoiceStatus 22 | { 23 | [EnumCode("")] Any, 24 | [EnumCode("Vigente")] Vigente, 25 | [EnumCode("Cancelado")] Cancelado, 26 | } -------------------------------------------------------------------------------- /Query/Models/InvoiceType.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * ============================================================================ 3 | * Mozilla Public License 2.0 (MPL-2.0) 4 | * Autor: FISCAL API S. DE R.L. DE C.V. - https://fiscalapi.com 5 | * ============================================================================ 6 | * 7 | * Este código está sujeto a los términos de la Mozilla Public License v2.0. 8 | * Licencia completa: https://mozilla.org/MPL/2.0 9 | * 10 | * AVISO: Este software se proporciona "tal como está" sin garantías de ningún 11 | * tipo. Al usar, modificar o distribuir este código debe mantener esta 12 | * atribución y las referencias al autor. 13 | * 14 | * ============================================================================ 15 | */ 16 | 17 | using Fiscalapi.XmlDownloader.Common.Attributes; 18 | 19 | namespace Fiscalapi.XmlDownloader.Query.Models; 20 | 21 | public enum InvoiceType 22 | { 23 | [EnumCode("")] Any, 24 | [EnumCode("I")] Ingreso, 25 | [EnumCode("E")] Egreso, 26 | [EnumCode("T")] Traslado, 27 | [EnumCode("N")] Nomina, 28 | [EnumCode("P")] Pago 29 | } -------------------------------------------------------------------------------- /Query/Models/QueryParameters.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * ============================================================================ 3 | * Mozilla Public License 2.0 (MPL-2.0) 4 | * Autor: FISCAL API S. DE R.L. DE C.V. - https://fiscalapi.com 5 | * ============================================================================ 6 | * 7 | * Este código está sujeto a los términos de la Mozilla Public License v2.0. 8 | * Licencia completa: https://mozilla.org/MPL/2.0 9 | * 10 | * AVISO: Este software se proporciona "tal como está" sin garantías de ningún 11 | * tipo. Al usar, modificar o distribuir este código debe mantener esta 12 | * atribución y las referencias al autor. 13 | * 14 | * ============================================================================ 15 | */ 16 | 17 | namespace Fiscalapi.XmlDownloader.Query.Models; 18 | 19 | public class QueryParameters 20 | { 21 | // 'Folio' attribute 22 | public string? InvoiceUuid { get; set; } 23 | 24 | // 'RfcSolicitante' attribute 25 | public string? RequesterTin { get; set; } 26 | 27 | // 'TipoSolicitud' attribute 28 | public QueryType RequestType { get; set; } 29 | 30 | // 'TipoComprobante' attribute 31 | public InvoiceType InvoiceType { get; set; } 32 | 33 | // 'FechaInicial' attribute 34 | public DateTime StartDate { get; set; } 35 | 36 | // 'FechaFinal' attribute 37 | public DateTime EndDate { get; set; } 38 | 39 | // 'RfcReceptor' attribute 40 | public string? RecipientTin { get; set; } 41 | 42 | // 'RfcEmisor' attribute 43 | public string? IssuerTin { get; set; } 44 | 45 | // 'EstadoComprobante' attribute 46 | public InvoiceStatus InvoiceStatus { get; set; } 47 | 48 | // 'Complemento' attribute 49 | public InvoiceComplement InvoiceComplement { get; set; } 50 | 51 | // 'RfcACuentaTerceros' attribute 52 | public string? ThirdPartyTin { get; set; } 53 | } -------------------------------------------------------------------------------- /Query/Models/QueryResponse.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * ============================================================================ 3 | * Mozilla Public License 2.0 (MPL-2.0) 4 | * Autor: FISCAL API S. DE R.L. DE C.V. - https://fiscalapi.com 5 | * ============================================================================ 6 | * 7 | * Este código está sujeto a los términos de la Mozilla Public License v2.0. 8 | * Licencia completa: https://mozilla.org/MPL/2.0 9 | * 10 | * AVISO: Este software se proporciona "tal como está" sin garantías de ningún 11 | * tipo. Al usar, modificar o distribuir este código debe mantener esta 12 | * atribución y las referencias al autor. 13 | * 14 | * ============================================================================ 15 | */ 16 | 17 | using Fiscalapi.XmlDownloader.Common.Http; 18 | 19 | namespace Fiscalapi.XmlDownloader.Query.Models; 20 | 21 | /// 22 | /// Response from download request operations (Emitidos, Recibidos, Folio) 23 | /// 24 | public class QueryResponse : BaseResponse 25 | { 26 | /// 27 | /// Unique identifier for the download request 28 | /// 29 | public string? RequestId { get; set; } 30 | 31 | /// 32 | /// RFC Solicitante 33 | /// 34 | public string? RequesterRfc { get; set; } 35 | } -------------------------------------------------------------------------------- /Query/Models/QueryStatus.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * ============================================================================ 3 | * Mozilla Public License 2.0 (MPL-2.0) 4 | * Autor: FISCAL API S. DE R.L. DE C.V. - https://fiscalapi.com 5 | * ============================================================================ 6 | * 7 | * Este código está sujeto a los términos de la Mozilla Public License v2.0. 8 | * Licencia completa: https://mozilla.org/MPL/2.0 9 | * 10 | * AVISO: Este software se proporciona "tal como está" sin garantías de ningún 11 | * tipo. Al usar, modificar o distribuir este código debe mantener esta 12 | * atribución y las referencias al autor. 13 | * 14 | * ============================================================================ 15 | */ 16 | 17 | using Fiscalapi.XmlDownloader.Common.Attributes; 18 | 19 | namespace Fiscalapi.XmlDownloader.Query.Models; 20 | 21 | /// 22 | /// Mensajes recibidos desde las operaciones "SolicitaDescargaEmitidos", "SolicitaDescargaRecibidos" y "SolicitaDescargaFolio" del Servicio de Solicitud Descarga Masiva 23 | /// 24 | public enum QueryStatus 25 | { 26 | /// 27 | /// Usuario No Válido 28 | /// 29 | [EnumCode("300")] InvalidUser = 300, 30 | 31 | /// 32 | /// XML Mal Formado. 33 | /// Este código de error se regresa cuando el request posee información inválida, ejemplo: un RFC de receptor no válido. 34 | /// 35 | [EnumCode("301")] InvalidXml = 301, 36 | 37 | /// 38 | /// Sello Mal Formado 39 | /// 40 | [EnumCode("302")] InvalidSignatureFormat = 302, 41 | 42 | /// 43 | /// Sello no corresponde con RfcEmisor (SolicitaDescargaEmitidos, SolicitaDescargaRecibidos, SolicitaDescargaFolio) 44 | /// 45 | [EnumCode("303")] SignatureAndRfcMismatch = 303, 46 | 47 | 48 | /// 49 | /// Certificado Revocado o Caduco. 50 | /// El certificado puede ser inválido por múltiples razones como son el tipo, la vigencia, etc. 51 | /// 52 | [EnumCode("304")] ExpiredCert = 304, 53 | 54 | /// 55 | /// Certificado Inválido. 56 | /// El certificado puede ser inválido por múltiples razones como son el tipo, la vigencia, etc. 57 | /// 58 | [EnumCode("305")] InvalidCert = 305, 59 | 60 | /// 61 | /// Solicitud de descarga recibida con éxito 62 | /// 63 | [EnumCode("5000")] Success = 5000, 64 | 65 | /// 66 | /// Tercero no autorizado. 67 | /// Se da cuando se trata de descargar comprobantes que no son propios. 68 | /// 69 | [EnumCode("5001")] UnauthorizedThirdParty = 5001, 70 | 71 | /// 72 | /// Se han agotado las solicitudes de por vida. 73 | /// Se ha alcanzado el límite de solicitudes, con el mismo criterio. 74 | /// 75 | [EnumCode("5002")] RequestConfigurationLimitReached = 5002, 76 | 77 | /// 78 | /// Ya se tiene una solicitud registrada. 79 | /// Ya existe una solicitud activa con los mismos criterios. 80 | /// 81 | [EnumCode("5005")] DuplicateRequest = 5005, 82 | 83 | /// 84 | /// No se permite la descarga de xml que se encuentren cancelados. 85 | /// Específico para la operación SolicitaDescargaFolio. 86 | /// 87 | [EnumCode("5012")] NotAllowed = 5012, 88 | 89 | /// 90 | /// Error no controlado 91 | /// 92 | [EnumCode("404")] UncontrolledError = 404 93 | } -------------------------------------------------------------------------------- /Query/Models/QueryType.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * ============================================================================ 3 | * Mozilla Public License 2.0 (MPL-2.0) 4 | * Autor: FISCAL API S. DE R.L. DE C.V. - https://fiscalapi.com 5 | * ============================================================================ 6 | * 7 | * Este código está sujeto a los términos de la Mozilla Public License v2.0. 8 | * Licencia completa: https://mozilla.org/MPL/2.0 9 | * 10 | * AVISO: Este software se proporciona "tal como está" sin garantías de ningún 11 | * tipo. Al usar, modificar o distribuir este código debe mantener esta 12 | * atribución y las referencias al autor. 13 | * 14 | * ============================================================================ 15 | */ 16 | 17 | using Fiscalapi.XmlDownloader.Common.Attributes; 18 | 19 | namespace Fiscalapi.XmlDownloader.Query.Models; 20 | 21 | public enum QueryType 22 | { 23 | [EnumCode("Metadata")] Metadata, 24 | [EnumCode("CFDI")] CFDI 25 | } -------------------------------------------------------------------------------- /Query/Models/Sat/QueryBody.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * ============================================================================ 3 | * Mozilla Public License 2.0 (MPL-2.0) 4 | * Autor: FISCAL API S. DE R.L. DE C.V. - https://fiscalapi.com 5 | * ============================================================================ 6 | * 7 | * Este código está sujeto a los términos de la Mozilla Public License v2.0. 8 | * Licencia completa: https://mozilla.org/MPL/2.0 9 | * 10 | * AVISO: Este software se proporciona "tal como está" sin garantías de ningún 11 | * tipo. Al usar, modificar o distribuir este código debe mantener esta 12 | * atribución y las referencias al autor. 13 | * 14 | * ============================================================================ 15 | */ 16 | 17 | using System.Xml.Serialization; 18 | 19 | namespace Fiscalapi.XmlDownloader.Query.Models.Sat; 20 | 21 | public class QueryBody 22 | { 23 | [XmlElement(Namespace = "http://DescargaMasivaTerceros.sat.gob.mx")] 24 | public QuerySolicitaDescargaEmitidosResponse? SolicitaDescargaEmitidosResponse { get; set; } 25 | 26 | [XmlElement(Namespace = "http://DescargaMasivaTerceros.sat.gob.mx")] 27 | public QuerySolicitaDescargaRecibidosResponse? SolicitaDescargaRecibidosResponse { get; set; } 28 | 29 | [XmlElement(Namespace = "http://DescargaMasivaTerceros.sat.gob.mx")] 30 | public QuerySolicitaDescargaFolioResponse? SolicitaDescargaFolioResponse { get; set; } 31 | 32 | [XmlElement("Fault", Namespace = "http://schemas.xmlsoap.org/soap/envelope/")] 33 | public QuerySoapFault? Fault { get; set; } 34 | } -------------------------------------------------------------------------------- /Query/Models/Sat/QueryEnvelope.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * ============================================================================ 3 | * Mozilla Public License 2.0 (MPL-2.0) 4 | * Autor: FISCAL API S. DE R.L. DE C.V. - https://fiscalapi.com 5 | * ============================================================================ 6 | * 7 | * Este código está sujeto a los términos de la Mozilla Public License v2.0. 8 | * Licencia completa: https://mozilla.org/MPL/2.0 9 | * 10 | * AVISO: Este software se proporciona "tal como está" sin garantías de ningún 11 | * tipo. Al usar, modificar o distribuir este código debe mantener esta 12 | * atribución y las referencias al autor. 13 | * 14 | * ============================================================================ 15 | */ 16 | 17 | using System.Xml.Serialization; 18 | 19 | namespace Fiscalapi.XmlDownloader.Query.Models.Sat; 20 | 21 | [XmlRoot(ElementName = "Envelope", Namespace = "http://schemas.xmlsoap.org/soap/envelope/")] 22 | public class QueryEnvelope 23 | { 24 | [XmlElement(ElementName = "Body")] public QueryBody Body { get; set; } 25 | } -------------------------------------------------------------------------------- /Query/Models/Sat/QuerySoapFault.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * ============================================================================ 3 | * Mozilla Public License 2.0 (MPL-2.0) 4 | * Autor: FISCAL API S. DE R.L. DE C.V. - https://fiscalapi.com 5 | * ============================================================================ 6 | * 7 | * Este código está sujeto a los términos de la Mozilla Public License v2.0. 8 | * Licencia completa: https://mozilla.org/MPL/2.0 9 | * 10 | * AVISO: Este software se proporciona "tal como está" sin garantías de ningún 11 | * tipo. Al usar, modificar o distribuir este código debe mantener esta 12 | * atribución y las referencias al autor. 13 | * 14 | * ============================================================================ 15 | */ 16 | 17 | using System.Xml.Serialization; 18 | 19 | namespace Fiscalapi.XmlDownloader.Query.Models.Sat; 20 | 21 | public class QuerySoapFault 22 | { 23 | [XmlElement(ElementName = "faultcode")] 24 | public string FaultCode { get; set; } 25 | 26 | [XmlElement(ElementName = "faultstring")] 27 | public string FaultMessage { get; set; } 28 | } -------------------------------------------------------------------------------- /Query/Models/Sat/QuerySolicitaDescargaEmitidosResponse.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * ============================================================================ 3 | * Mozilla Public License 2.0 (MPL-2.0) 4 | * Autor: FISCAL API S. DE R.L. DE C.V. - https://fiscalapi.com 5 | * ============================================================================ 6 | * 7 | * Este código está sujeto a los términos de la Mozilla Public License v2.0. 8 | * Licencia completa: https://mozilla.org/MPL/2.0 9 | * 10 | * AVISO: Este software se proporciona "tal como está" sin garantías de ningún 11 | * tipo. Al usar, modificar o distribuir este código debe mantener esta 12 | * atribución y las referencias al autor. 13 | * 14 | * ============================================================================ 15 | */ 16 | 17 | namespace Fiscalapi.XmlDownloader.Query.Models.Sat; 18 | 19 | public class QuerySolicitaDescargaEmitidosResponse 20 | { 21 | public QuerySolicitaDescargaResult SolicitaDescargaEmitidosResult { get; set; } 22 | } -------------------------------------------------------------------------------- /Query/Models/Sat/QuerySolicitaDescargaFolioResponse.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * ============================================================================ 3 | * Mozilla Public License 2.0 (MPL-2.0) 4 | * Autor: FISCAL API S. DE R.L. DE C.V. - https://fiscalapi.com 5 | * ============================================================================ 6 | * 7 | * Este código está sujeto a los términos de la Mozilla Public License v2.0. 8 | * Licencia completa: https://mozilla.org/MPL/2.0 9 | * 10 | * AVISO: Este software se proporciona "tal como está" sin garantías de ningún 11 | * tipo. Al usar, modificar o distribuir este código debe mantener esta 12 | * atribución y las referencias al autor. 13 | * 14 | * ============================================================================ 15 | */ 16 | 17 | namespace Fiscalapi.XmlDownloader.Query.Models.Sat; 18 | 19 | public class QuerySolicitaDescargaFolioResponse 20 | { 21 | public QuerySolicitaDescargaResult SolicitaDescargaFolioResult { get; set; } 22 | } -------------------------------------------------------------------------------- /Query/Models/Sat/QuerySolicitaDescargaRecibidosResponse.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * ============================================================================ 3 | * Mozilla Public License 2.0 (MPL-2.0) 4 | * Autor: FISCAL API S. DE R.L. DE C.V. - https://fiscalapi.com 5 | * ============================================================================ 6 | * 7 | * Este código está sujeto a los términos de la Mozilla Public License v2.0. 8 | * Licencia completa: https://mozilla.org/MPL/2.0 9 | * 10 | * AVISO: Este software se proporciona "tal como está" sin garantías de ningún 11 | * tipo. Al usar, modificar o distribuir este código debe mantener esta 12 | * atribución y las referencias al autor. 13 | * 14 | * ============================================================================ 15 | */ 16 | 17 | namespace Fiscalapi.XmlDownloader.Query.Models.Sat; 18 | 19 | public class QuerySolicitaDescargaRecibidosResponse 20 | { 21 | public QuerySolicitaDescargaResult SolicitaDescargaRecibidosResult { get; set; } 22 | } -------------------------------------------------------------------------------- /Query/Models/Sat/QuerySolicitaDescargaResult.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * ============================================================================ 3 | * Mozilla Public License 2.0 (MPL-2.0) 4 | * Autor: FISCAL API S. DE R.L. DE C.V. - https://fiscalapi.com 5 | * ============================================================================ 6 | * 7 | * Este código está sujeto a los términos de la Mozilla Public License v2.0. 8 | * Licencia completa: https://mozilla.org/MPL/2.0 9 | * 10 | * AVISO: Este software se proporciona "tal como está" sin garantías de ningún 11 | * tipo. Al usar, modificar o distribuir este código debe mantener esta 12 | * atribución y las referencias al autor. 13 | * 14 | * ============================================================================ 15 | */ 16 | 17 | using System.Xml.Serialization; 18 | 19 | namespace Fiscalapi.XmlDownloader.Query.Models.Sat; 20 | 21 | public class QuerySolicitaDescargaResult 22 | { 23 | [XmlAttribute] public string IdSolicitud { get; set; } 24 | 25 | [XmlAttribute] public string RfcSolicitante { get; set; } 26 | 27 | [XmlAttribute] public string CodEstatus { get; set; } 28 | 29 | [XmlAttribute] public string Mensaje { get; set; } 30 | } -------------------------------------------------------------------------------- /Verify/IVerifyService.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * ============================================================================ 3 | * Mozilla Public License 2.0 (MPL-2.0) 4 | * Autor: FISCAL API S. DE R.L. DE C.V. - https://fiscalapi.com 5 | * ============================================================================ 6 | * 7 | * Este código está sujeto a los términos de la Mozilla Public License v2.0. 8 | * Licencia completa: https://mozilla.org/MPL/2.0 9 | * 10 | * AVISO: Este software se proporciona "tal como está" sin garantías de ningún 11 | * tipo. Al usar, modificar o distribuir este código debe mantener esta 12 | * atribución y las referencias al autor. 13 | * 14 | * ============================================================================ 15 | */ 16 | 17 | using Fiscalapi.Credentials.Core; 18 | using Fiscalapi.XmlDownloader.Auth.Models; 19 | using Fiscalapi.XmlDownloader.Verify.Models; 20 | 21 | namespace Fiscalapi.XmlDownloader.Verify; 22 | 23 | /// 24 | /// Service interface for verifying download requests with SAT. 25 | /// 26 | public interface IVerifyService 27 | { 28 | /// 29 | /// Verifies a download request with SAT using the provided credential, authentication token, and request ID. 30 | /// 31 | /// Fiel 32 | /// Authentication token 33 | /// Request ID 34 | /// CancellationToken 35 | /// VerifyResponse 36 | Task VerifyAsync(ICredential credential, Token authToken, string requestId, 37 | CancellationToken cancellationToken = default); 38 | } -------------------------------------------------------------------------------- /Verify/Models/RequestStatus.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * ============================================================================ 3 | * Mozilla Public License 2.0 (MPL-2.0) 4 | * Autor: FISCAL API S. DE R.L. DE C.V. - https://fiscalapi.com 5 | * ============================================================================ 6 | * 7 | * Este código está sujeto a los términos de la Mozilla Public License v2.0. 8 | * Licencia completa: https://mozilla.org/MPL/2.0 9 | * 10 | * AVISO: Este software se proporciona "tal como está" sin garantías de ningún 11 | * tipo. Al usar, modificar o distribuir este código debe mantener esta 12 | * atribución y las referencias al autor. 13 | * 14 | * ============================================================================ 15 | */ 16 | 17 | using Fiscalapi.XmlDownloader.Common.Attributes; 18 | 19 | namespace Fiscalapi.XmlDownloader.Verify.Models; 20 | 21 | /// 22 | /// Estado de la solicitud de descarga 23 | /// 24 | public enum RequestStatus 25 | { 26 | /// 27 | /// Desconocido 28 | /// 29 | [EnumCode("0")] Desconocido = 0, 30 | 31 | 32 | /// 33 | /// Aceptada 34 | /// 35 | [EnumCode("1")] Aceptada = 1, 36 | 37 | /// 38 | /// En Proceso 39 | /// 40 | [EnumCode("2")] EnProceso = 2, 41 | 42 | /// 43 | /// Terminada 44 | /// 45 | [EnumCode("3")] Terminada = 3, 46 | 47 | /// 48 | /// Error 49 | /// 50 | [EnumCode("4")] Error = 4, 51 | 52 | /// 53 | /// Rechazada 54 | /// 55 | [EnumCode("5")] Rechazada = 5, 56 | 57 | /// 58 | /// Vencida (sucede 72 horas después de que se generó el paquete de descarga) 59 | /// 60 | [EnumCode("6")] Vencida = 6 61 | } -------------------------------------------------------------------------------- /Verify/Models/Sat/VerifyBody.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * ============================================================================ 3 | * Mozilla Public License 2.0 (MPL-2.0) 4 | * Autor: FISCAL API S. DE R.L. DE C.V. - https://fiscalapi.com 5 | * ============================================================================ 6 | * 7 | * Este código está sujeto a los términos de la Mozilla Public License v2.0. 8 | * Licencia completa: https://mozilla.org/MPL/2.0 9 | * 10 | * AVISO: Este software se proporciona "tal como está" sin garantías de ningún 11 | * tipo. Al usar, modificar o distribuir este código debe mantener esta 12 | * atribución y las referencias al autor. 13 | * 14 | * ============================================================================ 15 | */ 16 | 17 | using System.Xml.Serialization; 18 | 19 | namespace Fiscalapi.XmlDownloader.Verify.Models.Sat; 20 | 21 | /// 22 | /// SOAP Body containing the verification response 23 | /// 24 | public class VerifyBody 25 | { 26 | [XmlElement("VerificaSolicitudDescargaResponse", Namespace = "http://DescargaMasivaTerceros.sat.gob.mx")] 27 | public VerifyDownloadRequestResponse VerifyDownloadRequestResponse { get; set; } 28 | } -------------------------------------------------------------------------------- /Verify/Models/Sat/VerifyDownloadRequestResponse.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * ============================================================================ 3 | * Mozilla Public License 2.0 (MPL-2.0) 4 | * Autor: FISCAL API S. DE R.L. DE C.V. - https://fiscalapi.com 5 | * ============================================================================ 6 | * 7 | * Este código está sujeto a los términos de la Mozilla Public License v2.0. 8 | * Licencia completa: https://mozilla.org/MPL/2.0 9 | * 10 | * AVISO: Este software se proporciona "tal como está" sin garantías de ningún 11 | * tipo. Al usar, modificar o distribuir este código debe mantener esta 12 | * atribución y las referencias al autor. 13 | * 14 | * ============================================================================ 15 | */ 16 | 17 | using System.Xml.Serialization; 18 | 19 | namespace Fiscalapi.XmlDownloader.Verify.Models.Sat; 20 | 21 | /// 22 | /// Main response wrapper for download verification 23 | /// 24 | public class VerifyDownloadRequestResponse 25 | { 26 | [XmlElement("VerificaSolicitudDescargaResult")] 27 | public VerifyDownloadRequestResult VerifyDownloadRequestResult { get; set; } 28 | } -------------------------------------------------------------------------------- /Verify/Models/Sat/VerifyDownloadRequestResult.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * ============================================================================ 3 | * Mozilla Public License 2.0 (MPL-2.0) 4 | * Autor: FISCAL API S. DE R.L. DE C.V. - https://fiscalapi.com 5 | * ============================================================================ 6 | * 7 | * Este código está sujeto a los términos de la Mozilla Public License v2.0. 8 | * Licencia completa: https://mozilla.org/MPL/2.0 9 | * 10 | * AVISO: Este software se proporciona "tal como está" sin garantías de ningún 11 | * tipo. Al usar, modificar o distribuir este código debe mantener esta 12 | * atribución y las referencias al autor. 13 | * 14 | * ============================================================================ 15 | */ 16 | 17 | using System.Xml.Serialization; 18 | 19 | namespace Fiscalapi.XmlDownloader.Verify.Models.Sat; 20 | 21 | /// 22 | /// Main result containing download request verification data 23 | /// 24 | public class VerifyDownloadRequestResult 25 | { 26 | /// 27 | /// Status code of the verification request 28 | /// 29 | [XmlAttribute("CodEstatus")] 30 | public string? CodEstatus { get; set; } 31 | 32 | /// 33 | /// State of the download request (1=Accepted, 2=InProcess, 3=Finished, 4=Error, 5=Rejected, 6=Expired) 34 | /// 35 | [XmlAttribute("EstadoSolicitud")] 36 | public string EstadoSolicitud { get; set; } 37 | 38 | /// 39 | /// Status code of the download request state 40 | /// 41 | [XmlAttribute("CodigoEstadoSolicitud")] 42 | public string? CodigoEstadoSolicitud { get; set; } 43 | 44 | /// 45 | /// Number of CFDIs that make up the download request 46 | /// 47 | [XmlAttribute("NumeroCFDIs")] 48 | public string? NumeroCFDIs { get; set; } 49 | 50 | /// 51 | /// Description message for the status code 52 | /// 53 | [XmlAttribute("Mensaje")] 54 | public string Mensaje { get; set; } 55 | 56 | /// 57 | /// List of package identifiers (only returned when request status is finished) 58 | /// 59 | [XmlElement("IdsPaquetes")] 60 | public List PackageIds { get; set; } = []; 61 | } -------------------------------------------------------------------------------- /Verify/Models/Sat/VerifyEnvelope.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * ============================================================================ 3 | * Mozilla Public License 2.0 (MPL-2.0) 4 | * Autor: FISCAL API S. DE R.L. DE C.V. - https://fiscalapi.com 5 | * ============================================================================ 6 | * 7 | * Este código está sujeto a los términos de la Mozilla Public License v2.0. 8 | * Licencia completa: https://mozilla.org/MPL/2.0 9 | * 10 | * AVISO: Este software se proporciona "tal como está" sin garantías de ningún 11 | * tipo. Al usar, modificar o distribuir este código debe mantener esta 12 | * atribución y las referencias al autor. 13 | * 14 | * ============================================================================ 15 | */ 16 | 17 | using System.Xml.Serialization; 18 | 19 | namespace Fiscalapi.XmlDownloader.Verify.Models.Sat; 20 | 21 | /// 22 | /// SOAP Envelope for SAT download verification response 23 | /// 24 | [XmlRoot("Envelope", Namespace = "http://schemas.xmlsoap.org/soap/envelope/")] 25 | public class VerifyEnvelope 26 | { 27 | [XmlElement("Body")] public VerifyBody Body { get; set; } 28 | } -------------------------------------------------------------------------------- /Verify/Models/VerifyResponse.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * ============================================================================ 3 | * Mozilla Public License 2.0 (MPL-2.0) 4 | * Autor: FISCAL API S. DE R.L. DE C.V. - https://fiscalapi.com 5 | * ============================================================================ 6 | * 7 | * Este código está sujeto a los términos de la Mozilla Public License v2.0. 8 | * Licencia completa: https://mozilla.org/MPL/2.0 9 | * 10 | * AVISO: Este software se proporciona "tal como está" sin garantías de ningún 11 | * tipo. Al usar, modificar o distribuir este código debe mantener esta 12 | * atribución y las referencias al autor. 13 | * 14 | * ============================================================================ 15 | */ 16 | 17 | using Fiscalapi.XmlDownloader.Common.Http; 18 | 19 | namespace Fiscalapi.XmlDownloader.Verify.Models; 20 | 21 | /// 22 | /// Response from request verification service 23 | /// 24 | public class VerifyResponse : BaseResponse 25 | { 26 | /// 27 | /// Current status of the request 28 | /// 29 | public RequestStatus RequestStatus { get; set; } 30 | 31 | /// 32 | /// Number of CFDIs found for the request 33 | /// 34 | public int InvoiceCount { get; set; } 35 | 36 | /// 37 | /// List of package IDs available for download 38 | /// 39 | public List PackageIds { get; set; } = new(); 40 | 41 | /// 42 | /// Indicates if the request is ready for download 43 | /// 44 | public bool IsReadyToDownload => RequestStatus == RequestStatus.Terminada && InvoiceCount > 0; 45 | } -------------------------------------------------------------------------------- /Verify/VerifyResponseService.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * ============================================================================ 3 | * Mozilla Public License 2.0 (MPL-2.0) 4 | * Autor: FISCAL API S. DE R.L. DE C.V. - https://fiscalapi.com 5 | * ============================================================================ 6 | * 7 | * Este código está sujeto a los términos de la Mozilla Public License v2.0. 8 | * Licencia completa: https://mozilla.org/MPL/2.0 9 | * 10 | * AVISO: Este software se proporciona "tal como está" sin garantías de ningún 11 | * tipo. Al usar, modificar o distribuir este código debe mantener esta 12 | * atribución y las referencias al autor. 13 | * 14 | * ============================================================================ 15 | */ 16 | 17 | using Fiscalapi.XmlDownloader.Common; 18 | using Fiscalapi.XmlDownloader.Common.Enums; 19 | using Fiscalapi.XmlDownloader.Common.Http; 20 | using Fiscalapi.XmlDownloader.Verify.Models; 21 | using Fiscalapi.XmlDownloader.Verify.Models.Sat; 22 | 23 | namespace Fiscalapi.XmlDownloader.Verify; 24 | 25 | public static class VerifyResponseService 26 | { 27 | /// 28 | /// Builds a VerifyResponse from the SAT response. 29 | /// 30 | public static VerifyResponse Build(SatResponse satResponse) 31 | { 32 | if (satResponse.IsSuccessStatusCode) 33 | { 34 | var envelope = XmlSerializerService.Deserialize(satResponse.RawResponse!); 35 | 36 | /* 37 | * 38 | 40 | 41 | 47 | 4e80345d-917f-40bb-a98f4a73939343c5_01 48 | 4e80345d-917f-40bb-a98f4a73939343c5_02 49 | 4e80345d-917f-40bb-a98f4a73939343c5_03 50 | 4e80345d-917f-40bb-a98f4a73939343c5_04 51 | 4e80345d-917f-40bb-a98f4a73939343c5_05 52 | 4e80345d-917f-40bb-a98f4a73939343c5_06 53 | 54 | 55 | 56 | 57 | */ 58 | 59 | //CodEstatus="5000" 60 | var codEstatus = envelope?.Body.VerifyDownloadRequestResponse 61 | .VerifyDownloadRequestResult.CodEstatus; 62 | 63 | var status = !string.IsNullOrWhiteSpace(codEstatus) 64 | ? codEstatus.ToEnumElement() 65 | : SatStatus.Unknown; 66 | 67 | // EstadoSolicitud="3" 68 | var estadoSolicitud = envelope?.Body.VerifyDownloadRequestResponse 69 | .VerifyDownloadRequestResult.EstadoSolicitud; 70 | 71 | 72 | var requestStatus = !string.IsNullOrWhiteSpace(estadoSolicitud) 73 | ? estadoSolicitud.ToEnumElement() 74 | : RequestStatus.Desconocido; 75 | 76 | // NumeroCFDIs="0" 77 | var numeroCfdis = envelope?.Body?.VerifyDownloadRequestResponse 78 | .VerifyDownloadRequestResult?.NumeroCFDIs ?? "0"; 79 | 80 | numeroCfdis = numeroCfdis.Trim().Equals("") ? "0" : numeroCfdis; 81 | 82 | var invoiceCount = int.Parse(numeroCfdis); 83 | 84 | //Mensaje 85 | var mensaje = envelope?.Body?.VerifyDownloadRequestResponse? 86 | .VerifyDownloadRequestResult?.Mensaje ?? ""; 87 | 88 | // IdsPaquetes 89 | var idsPaquetes = envelope?.Body?.VerifyDownloadRequestResponse? 90 | .VerifyDownloadRequestResult?.PackageIds ?? []; 91 | 92 | 93 | return new VerifyResponse 94 | { 95 | Succeeded = true, 96 | SatStatus = status, 97 | SatStatusCode = status.ToEnumCode(), 98 | SatMessage = mensaje, 99 | RequestStatus = requestStatus, 100 | InvoiceCount = invoiceCount, 101 | PackageIds = idsPaquetes, 102 | RawRequest = satResponse.RawRequest, 103 | RawResponse = satResponse.RawResponse 104 | }; 105 | } 106 | 107 | return new VerifyResponse 108 | { 109 | Succeeded = false, 110 | SatStatusCode = "UnknownError", 111 | SatMessage = $"StatusCode: {satResponse.HttpStatusCode} Message: {satResponse.ReasonPhrase}", 112 | RawRequest = satResponse.RawRequest, 113 | RawResponse = satResponse.RawResponse, 114 | }; 115 | } 116 | } -------------------------------------------------------------------------------- /Verify/VerifyService.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * ============================================================================ 3 | * Mozilla Public License 2.0 (MPL-2.0) 4 | * Autor: FISCAL API S. DE R.L. DE C.V. - https://fiscalapi.com 5 | * ============================================================================ 6 | * 7 | * Este código está sujeto a los términos de la Mozilla Public License v2.0. 8 | * Licencia completa: https://mozilla.org/MPL/2.0 9 | * 10 | * AVISO: Este software se proporciona "tal como está" sin garantías de ningún 11 | * tipo. Al usar, modificar o distribuir este código debe mantener esta 12 | * atribución y las referencias al autor. 13 | * 14 | * ============================================================================ 15 | */ 16 | 17 | using Fiscalapi.Credentials.Common; 18 | using Fiscalapi.Credentials.Core; 19 | using Fiscalapi.XmlDownloader.Auth.Models; 20 | using Fiscalapi.XmlDownloader.Common; 21 | using Fiscalapi.XmlDownloader.Common.Http; 22 | using Fiscalapi.XmlDownloader.Verify.Models; 23 | 24 | namespace Fiscalapi.XmlDownloader.Verify; 25 | 26 | /// 27 | /// Service for verifying download requests with SAT. 28 | /// 29 | public class VerifyService : SatService, IVerifyService 30 | { 31 | /// 32 | /// Verifies a download request with SAT using the provided credential, authentication token, and request ID. 33 | /// 34 | /// Fiel 35 | /// Authentication token 36 | /// Request ID 37 | /// CancellationToken 38 | /// VerifyResponse 39 | public async Task VerifyAsync(ICredential credential, Token authToken, 40 | string requestId, CancellationToken cancellationToken = default) 41 | { 42 | var toDigest = CreateDigest(requestId, credential.Certificate.Rfc); 43 | var signature = CreateSignature(credential, toDigest); 44 | var requestXml = BuildEnvelope(requestId, credential.Certificate.Rfc, signature); 45 | 46 | var satResponse = await SendRequestAsync( 47 | url: SatUrl.VerifyUrl, 48 | action: SatUrl.VerifyAction, 49 | payload: requestXml, 50 | token: authToken.Value, 51 | cancellationToken: cancellationToken); 52 | 53 | var verifyResponse = VerifyResponseService.Build(satResponse); 54 | return verifyResponse; 55 | } 56 | 57 | private static string CreateDigest(string requestId, string rfcSolicitante) 58 | { 59 | var xml = XmlTemplates.VerifyToDigest 60 | .Replace(XmlPlaceholders.RequestId, requestId) 61 | .Replace(XmlPlaceholders.RequesterTin, rfcSolicitante); 62 | 63 | return xml.Clean(); 64 | } 65 | 66 | private static string CreateSignature(ICredential credential, string toDigest) 67 | { 68 | toDigest = toDigest.Clean(); 69 | var digestValue = credential.CreateHash(toDigest); 70 | 71 | // Create the SignedInfo element with the digest value 72 | var signedInfo = XmlTemplates.SignedInfo 73 | .Replace(XmlPlaceholders.Base64Digested, digestValue) 74 | .Replace(XmlPlaceholders.ReferenceUri, ""); 75 | 76 | var cleanedSignedInfo = signedInfo.Clean(); 77 | var signatureValue = credential.SignData(cleanedSignedInfo).ToBase64String(); 78 | 79 | var cleanSignedInfoForTemplate = cleanedSignedInfo.Replace( 80 | @"", 81 | ""); 82 | 83 | var keyInfo = XmlTemplates.X509KeyInfo 84 | .Replace(XmlPlaceholders.X509IssuerName, credential.Certificate.Issuer) 85 | .Replace(XmlPlaceholders.X509SerialNumber, credential.Certificate.SerialNumber) 86 | .Replace(XmlPlaceholders.Base64Cer, credential.Certificate.RawDataBytes.ToBase64String()); 87 | 88 | var signature = XmlTemplates.SignatureTemplate 89 | .Replace(XmlPlaceholders.SignedInfo, cleanSignedInfoForTemplate) 90 | .Replace(XmlPlaceholders.Base64Signature, signatureValue) 91 | .Replace(XmlPlaceholders.KeyInfo, keyInfo); 92 | 93 | return signature; 94 | } 95 | 96 | private static string BuildEnvelope(string requestId, string rfcSolicitante, string signature) //BuildEnvelope 97 | { 98 | var envelope = XmlTemplates.VerifyEnvelope 99 | .Replace(XmlPlaceholders.RequestId, requestId) 100 | .Replace(XmlPlaceholders.RequesterTin, rfcSolicitante) 101 | .Replace(XmlPlaceholders.SignatureData, signature); 102 | 103 | return envelope.Clean(); 104 | } 105 | } -------------------------------------------------------------------------------- /XmlDownloader.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | net8.0 5 | enable 6 | enable 7 | 5.0.7 8 | $(Version) 9 | $(Version) 10 | $(Version) 11 | Fiscalapi.XmlDownloader 12 | Fiscalapi.XmlDownloader 13 | Fiscalapi.XmlDownloader 14 | Fiscalapi 15 | fiscalapi.png 16 | Descarga masiva de xml o metadata de facturas CFDI 17 | factura cfdi descarga-masiva-xml sat 18 | Descarga Masiva de XML del SAT 19 | Fiscalapi 20 | fiscalapi.ico 21 | True 22 | FISCAL API S DE R.L DE C.V 23 | FISCAL API S DE R.L DE C.V © 2019 24 | https://www.fiscalapi.com 25 | README.md 26 | https://github.com/FiscalAPI/xml-downloader 27 | git 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /XmlDownloader.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.12.35514.174 d17.12 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "XmlDownloader", "XmlDownloader.csproj", "{DB606B95-4DFD-41A1-85E8-1B7E6102129B}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {DB606B95-4DFD-41A1-85E8-1B7E6102129B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {DB606B95-4DFD-41A1-85E8-1B7E6102129B}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {DB606B95-4DFD-41A1-85E8-1B7E6102129B}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {DB606B95-4DFD-41A1-85E8-1B7E6102129B}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | EndGlobal 23 | -------------------------------------------------------------------------------- /docs/0_UR_Ls_WS_Descarga_Masiva_V1_5_VF_33e2cca681.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FiscalAPI/xml-downloader/5f2b1b1accb708c2ec6439e72e1e960dc4137cad/docs/0_UR_Ls_WS_Descarga_Masiva_V1_5_VF_33e2cca681.pdf -------------------------------------------------------------------------------- /docs/1_WS_Solicitud_Descarga_Masiva_V1_5_VF_89183c42e9.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FiscalAPI/xml-downloader/5f2b1b1accb708c2ec6439e72e1e960dc4137cad/docs/1_WS_Solicitud_Descarga_Masiva_V1_5_VF_89183c42e9.pdf -------------------------------------------------------------------------------- /docs/2_WS_Verificacion_de_Descarga_Masiva_V1_5_VF_5e53cc2bb5.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FiscalAPI/xml-downloader/5f2b1b1accb708c2ec6439e72e1e960dc4137cad/docs/2_WS_Verificacion_de_Descarga_Masiva_V1_5_VF_5e53cc2bb5.pdf -------------------------------------------------------------------------------- /docs/3_WS_Descarga_de_Solicitudes_Exitosas_V1_5_VF_74f66e46ec.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FiscalAPI/xml-downloader/5f2b1b1accb708c2ec6439e72e1e960dc4137cad/docs/3_WS_Descarga_de_Solicitudes_Exitosas_V1_5_VF_74f66e46ec.pdf -------------------------------------------------------------------------------- /fiscalapi.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FiscalAPI/xml-downloader/5f2b1b1accb708c2ec6439e72e1e960dc4137cad/fiscalapi.ico -------------------------------------------------------------------------------- /fiscalapi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FiscalAPI/xml-downloader/5f2b1b1accb708c2ec6439e72e1e960dc4137cad/fiscalapi.png --------------------------------------------------------------------------------