├── fiscalapi.ico
├── fiscalapi.png
├── 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
├── Auth
├── Models
│ ├── Sat
│ │ ├── AuthFaultBody.cs
│ │ ├── AuthAutenticaResponse.cs
│ │ ├── AuthFaultEnvelope.cs
│ │ ├── AuthFault.cs
│ │ ├── AuthHeader.cs
│ │ ├── AuthSecurity.cs
│ │ ├── AuthEnvelope.cs
│ │ ├── AuthBody.cs
│ │ └── AuthTimestamp.cs
│ ├── Digest.cs
│ ├── Token.cs
│ └── AuthResponse.cs
└── IAuthService.cs
├── Common
├── Attributes
│ ├── EnumCodeAttribute.cs
│ └── ComplementAttribute.cs
├── Models
│ ├── c_MetodoPago.cs
│ ├── Complements
│ │ ├── Payment
│ │ │ ├── c_TipoCadenaPago.cs
│ │ │ ├── PagosPagoImpuestosPRetencionP.cs
│ │ │ ├── PagosPagoImpuestosP.cs
│ │ │ ├── PagosPagoDoctoRelacionadoImpuestosDR.cs
│ │ │ ├── Pagos.cs
│ │ │ ├── PagosPagoDoctoRelacionadoImpuestosDRRetencionDR.cs
│ │ │ ├── PagosPagoImpuestosPTrasladoP.cs
│ │ │ ├── PagosPagoDoctoRelacionadoImpuestosDRTrasladoDR.cs
│ │ │ ├── PagosPagoDoctoRelacionado.cs
│ │ │ └── PagosPago.cs
│ │ └── Signature
│ │ │ └── TimbreFiscalDigital.cs
│ ├── c_TipoFactor.cs
│ ├── c_TipoDeComprobante.cs
│ ├── ComprobanteAddenda.cs
│ ├── ComprobanteComplemento.cs
│ ├── c_Impuesto.cs
│ ├── ComprobanteConceptoCuentaPredial.cs
│ ├── ComprobanteCfdiRelacionadosCfdiRelacionado.cs
│ ├── ComprobanteConceptoComplementoConcepto.cs
│ ├── ComprobanteConceptoInformacionAduanera.cs
│ ├── ComprobanteConceptoParteInformacionAduanera.cs
│ ├── c_Exportacion.cs
│ ├── AllComplements.cs
│ ├── c_Periodicidad.cs
│ ├── ComprobanteImpuestosRetencion.cs
│ ├── ComprobanteCfdiRelacionados.cs
│ ├── c_ObjetoImp.cs
│ ├── ComprobanteConceptoImpuestos.cs
│ ├── c_TipoRelacion.cs
│ ├── ComprobanteInformacionGlobal.cs
│ ├── c_UsoCFDI.cs
│ ├── ComprobanteEmisor.cs
│ ├── ComprobanteConceptoACuentaTerceros.cs
│ ├── ComprobanteConceptoImpuestosRetencion.cs
│ ├── c_Meses.cs
│ ├── c_FormaPago.cs
│ ├── ComprobanteImpuestosTraslado.cs
│ ├── ComprobanteConceptoImpuestosTraslado.cs
│ ├── ComprobanteImpuestos.cs
│ ├── c_RegimenFiscal.cs
│ ├── ComprobanteReceptor.cs
│ └── ComprobanteConceptoParte.cs
├── Http
│ ├── SatResponse.cs
│ ├── BaseResponse.cs
│ └── ServiceEndpoints.cs
├── Enums
│ ├── ServiceType.cs
│ └── SatStatus.cs
├── XmlSerializerService.cs
└── XmlPlaceholders.cs
├── Query
├── Models
│ ├── Sat
│ │ ├── QuerySolicitaDescargaFolioResponse.cs
│ │ ├── QuerySolicitaDescargaEmitidosResponse.cs
│ │ ├── QuerySolicitaDescargaRecibidosResponse.cs
│ │ ├── QueryEnvelope.cs
│ │ ├── QuerySoapFault.cs
│ │ ├── QuerySolicitaDescargaResult.cs
│ │ └── QueryBody.cs
│ ├── DownloadType.cs
│ ├── InvoiceStatus.cs
│ ├── QueryType.cs
│ ├── InvoiceType.cs
│ ├── QueryResponse.cs
│ ├── InvoiceComplement.cs
│ ├── QueryStatus.cs
│ └── QueryParameters.cs
└── IQueryService.cs
├── XmlDownloader.sln
├── Download
├── Models
│ ├── Sat
│ │ ├── DownloadHeader.cs
│ │ ├── DownloadBody.cs
│ │ ├── DownloadHeaderResponse.cs
│ │ ├── DownloadBodyData.cs
│ │ └── DownloadEnvelope.cs
│ └── DownloadResponse.cs
├── IDownloadService.cs
├── DownloadResponseService.cs
└── DownloadService.cs
├── Verify
├── Models
│ ├── Sat
│ │ ├── VerifyEnvelope.cs
│ │ ├── VerifyDownloadRequestResponse.cs
│ │ ├── VerifyBody.cs
│ │ └── VerifyDownloadRequestResult.cs
│ ├── VerifyResponse.cs
│ └── RequestStatus.cs
├── IVerifyService.cs
├── VerifyResponseService.cs
└── VerifyService.cs
├── FileStorage
├── FileDetails.cs
├── FileStorageSettings.cs
└── IFileStorageService.cs
├── .github
└── workflows
│ └── CICD.yml
└── XmlDownloader.csproj
/fiscalapi.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FiscalAPI/xml-downloader/HEAD/fiscalapi.ico
--------------------------------------------------------------------------------
/fiscalapi.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FiscalAPI/xml-downloader/HEAD/fiscalapi.png
--------------------------------------------------------------------------------
/docs/0_UR_Ls_WS_Descarga_Masiva_V1_5_VF_33e2cca681.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FiscalAPI/xml-downloader/HEAD/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/HEAD/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/HEAD/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/HEAD/docs/3_WS_Descarga_de_Solicitudes_Exitosas_V1_5_VF_74f66e46ec.pdf
--------------------------------------------------------------------------------
/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 | }
--------------------------------------------------------------------------------
/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 | }
--------------------------------------------------------------------------------
/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 | }
--------------------------------------------------------------------------------
/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 | }
--------------------------------------------------------------------------------
/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 | }
--------------------------------------------------------------------------------
/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/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/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/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 | }
--------------------------------------------------------------------------------
/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 | }
--------------------------------------------------------------------------------
/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 | [EnumCode("CFDI")] Retenciones,
26 |
27 | }
--------------------------------------------------------------------------------
/XmlDownloader.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 18
4 | VisualStudioVersion = 18.0.11217.181
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 |
--------------------------------------------------------------------------------
/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/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/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 | }
--------------------------------------------------------------------------------
/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 | }
--------------------------------------------------------------------------------
/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/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 | }
--------------------------------------------------------------------------------
/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 | }
--------------------------------------------------------------------------------
/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 | }
--------------------------------------------------------------------------------
/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 | }
--------------------------------------------------------------------------------
/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 | }
--------------------------------------------------------------------------------
/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 | }
--------------------------------------------------------------------------------
/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 | }
--------------------------------------------------------------------------------
/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/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 | }
--------------------------------------------------------------------------------
/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/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/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 | }
--------------------------------------------------------------------------------
/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 | }
--------------------------------------------------------------------------------
/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 | }
--------------------------------------------------------------------------------
/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 | }
--------------------------------------------------------------------------------
/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/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 | }
--------------------------------------------------------------------------------
/Common/Enums/ServiceType.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.Enums;
18 |
19 | ///
20 | /// Tipo de servicio de descarga masiva del SAT.
21 | ///
22 | public enum ServiceType
23 | {
24 | ///
25 | /// Servicio para descarga de CFDI regulares y metadatos
26 | ///
27 | Cfdi,
28 |
29 | ///
30 | /// Servicio para descarga de CFDI de retenciones e información de pagos
31 | ///
32 | Retenciones
33 | }
34 |
35 |
--------------------------------------------------------------------------------
/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/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 | }
--------------------------------------------------------------------------------
/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 | }
--------------------------------------------------------------------------------
/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 | }
--------------------------------------------------------------------------------
/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 | }
--------------------------------------------------------------------------------
/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 | }
--------------------------------------------------------------------------------
/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/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/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/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/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/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/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 | }
--------------------------------------------------------------------------------
/.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 |
--------------------------------------------------------------------------------
/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/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/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 | }
--------------------------------------------------------------------------------
/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 | }
--------------------------------------------------------------------------------
/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 | }
--------------------------------------------------------------------------------
/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/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 | }
--------------------------------------------------------------------------------
/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 | }
--------------------------------------------------------------------------------
/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 | using Fiscalapi.XmlDownloader.Common.Http;
20 | using Microsoft.Extensions.Logging;
21 |
22 | namespace Fiscalapi.XmlDownloader.Auth;
23 |
24 | ///
25 | /// Interface for the SAT Authentication Service.
26 | ///
27 | public interface IAuthService
28 | {
29 | ///
30 | /// Authenticates with SAT using the provided credential and returns the authentication token.
31 | ///
32 | ///
33 | /// Service endpoints to use for authentication
34 | /// CancellationToken
35 | /// Logger
36 | ///
37 | Task AuthenticateAsync(ICredential credential, ServiceEndpoints endpoints, ILogger logger, CancellationToken cancellationToken = default);
38 | }
--------------------------------------------------------------------------------
/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/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 | }
--------------------------------------------------------------------------------
/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 | }
--------------------------------------------------------------------------------
/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/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/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 | }
--------------------------------------------------------------------------------
/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/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/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 | }
--------------------------------------------------------------------------------
/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.Common.Http;
20 | using Fiscalapi.XmlDownloader.Query.Models;
21 | using Microsoft.Extensions.Logging;
22 |
23 | namespace Fiscalapi.XmlDownloader.Query;
24 |
25 | ///
26 | /// Service for creating download requests from the SAT.
27 | ///
28 | public interface IQueryService
29 | {
30 | ///
31 | /// Creates a download request based on the provided parameters.
32 | ///
33 | /// Fiel
34 | /// Authentication token
35 | /// Request parameters
36 | /// Service endpoints to use for the query
37 | /// CancellationToken
38 | /// Logger
39 | /// QueryResponse
40 | Task CreateAsync(ICredential credential, Token authToken,
41 | QueryParameters parameters, ServiceEndpoints endpoints, ILogger logger, CancellationToken cancellationToken = default);
42 | }
--------------------------------------------------------------------------------
/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.Common.Http;
20 | using Fiscalapi.XmlDownloader.Download.Models;
21 | using Microsoft.Extensions.Logging;
22 |
23 | namespace Fiscalapi.XmlDownloader.Download;
24 |
25 | ///
26 | /// Service interface for downloading packages from SAT.
27 | ///
28 | public interface IDownloadService
29 | {
30 | ///
31 | /// Downloads a package from SAT using the provided credential, authentication token and package ID.s
32 | ///
33 | /// Fiel
34 | /// Authentication token
35 | /// PackageID
36 | /// Service endpoints to use for download
37 | /// CancellationToken
38 | /// Logger
39 | /// DownloadResponse
40 | Task DownloadAsync(ICredential credential, Token authToken, string packageId,
41 | ServiceEndpoints endpoints, ILogger logger, CancellationToken cancellationToken = default);
42 | }
--------------------------------------------------------------------------------
/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.Common.Http;
20 | using Fiscalapi.XmlDownloader.Verify.Models;
21 | using Microsoft.Extensions.Logging;
22 |
23 | namespace Fiscalapi.XmlDownloader.Verify;
24 |
25 | ///
26 | /// Service interface for verifying download requests with SAT.
27 | ///
28 | public interface IVerifyService
29 | {
30 | ///
31 | /// Verifies a download request with SAT using the provided credential, authentication token, and request ID.
32 | ///
33 | /// Fiel
34 | /// Authentication token
35 | /// Request ID
36 | /// Service endpoints to use for verification
37 | /// CancellationToken
38 | /// Logger
39 | /// VerifyResponse
40 | Task VerifyAsync(ICredential credential, Token authToken, string requestId,
41 | ServiceEndpoints endpoints, ILogger logger, CancellationToken cancellationToken = default);
42 | }
--------------------------------------------------------------------------------
/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/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/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 | }
--------------------------------------------------------------------------------
/XmlDownloader.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net8.0
5 | enable
6 | enable
7 | 5.0.15
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 |
--------------------------------------------------------------------------------
/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 | }
--------------------------------------------------------------------------------
/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 | }
--------------------------------------------------------------------------------
/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 | }
--------------------------------------------------------------------------------
/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/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/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/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/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 | }
--------------------------------------------------------------------------------
/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 | }
--------------------------------------------------------------------------------
/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/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/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/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/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/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/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 | }
--------------------------------------------------------------------------------
/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 | }
--------------------------------------------------------------------------------
/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/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 | }
--------------------------------------------------------------------------------
/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 | using Microsoft.Extensions.Logging;
23 |
24 | namespace Fiscalapi.XmlDownloader.Download;
25 |
26 | public static class DownloadResponseService
27 | {
28 | public static DownloadResponse Build(SatResponse satResponse, ILogger logger)
29 | {
30 | if (satResponse.IsSuccessStatusCode)
31 | {
32 | /*
33 | *
34 |
35 |
40 |
41 |
43 |
44 | base64...
45 |
46 |
47 |
48 | */
49 | var envelope = XmlSerializerService.Deserialize(satResponse.RawResponse!);
50 |
51 |
52 | // CodEstatus
53 | var codEstatus = envelope?.Header?.HeaderResponse?.CodEstatus ?? "000";
54 | var status = codEstatus.ToEnumElement();
55 |
56 | // Mensaje
57 | var mensaje = envelope?.Header?.HeaderResponse?.Mensaje ?? "";
58 |
59 |
60 | return new DownloadResponse
61 | {
62 | Succeeded = true,
63 | SatStatus = status,
64 | SatStatusCode = codEstatus,
65 | SatMessage = mensaje,
66 | Base64Package = envelope?.Body.BodyData?.Base64Package,
67 | RawRequest = satResponse.RawRequest,
68 | RawResponse = satResponse.RawResponse
69 | };
70 | }
71 |
72 |
73 | return new DownloadResponse
74 | {
75 | Succeeded = false,
76 | SatStatus = SatStatus.Unknown,
77 | SatStatusCode = "UnknownError",
78 | SatMessage = $"StatusCode: {satResponse.HttpStatusCode} Message: {satResponse.ReasonPhrase}",
79 | RawRequest = satResponse.RawRequest,
80 | RawResponse = satResponse.RawResponse
81 | };
82 | }
83 | }
--------------------------------------------------------------------------------
/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/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/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 | }
--------------------------------------------------------------------------------
/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 | using Fiscalapi.XmlDownloader.Common.Enums;
18 | using Fiscalapi.XmlDownloader.Common.Http;
19 |
20 | namespace Fiscalapi.XmlDownloader.Query.Models;
21 |
22 | public class QueryParameters
23 | {
24 | // 'Folio' attribute
25 | public string? InvoiceUuid { get; set; }
26 |
27 | // 'RfcSolicitante' attribute
28 | public string? RequesterTin { get; set; }
29 |
30 | // 'TipoSolicitud' attribute
31 | public QueryType RequestType { get; set; }
32 |
33 | // 'TipoComprobante' attribute
34 | public InvoiceType InvoiceType { get; set; }
35 |
36 | // 'FechaInicial' attribute
37 | public DateTime StartDate { get; set; }
38 |
39 | // 'FechaFinal' attribute
40 | public DateTime EndDate { get; set; }
41 |
42 | // 'RfcReceptor' attribute
43 | public string? RecipientTin { get; set; }
44 |
45 | // 'RfcEmisor' attribute
46 | public string? IssuerTin { get; set; }
47 |
48 | // 'EstadoComprobante' attribute
49 | public InvoiceStatus InvoiceStatus { get; set; }
50 |
51 | // 'Complemento' attribute
52 | public InvoiceComplement InvoiceComplement { get; set; }
53 |
54 | // 'RfcACuentaTerceros' attribute
55 | public string? ThirdPartyTin { get; set; }
56 |
57 |
58 | public void Validate(ServiceEndpoints endpoints)
59 | {
60 | // Check: No se permite la descarga de retenciones en el servicio de CFDI | Metadatos.
61 | if (RequestType == QueryType.Retenciones && endpoints.ServiceType != ServiceType.Retenciones)
62 | {
63 | throw new InvalidOperationException(
64 | $"No se permite la descarga de retenciones en el servicio de CFDI | Metadatos.");
65 | }
66 |
67 | // Check: No se permite la descarga de CFDI | Metadatos en el servicio de retenciones.
68 | if (RequestType is QueryType.CFDI or QueryType.Metadata && endpoints.ServiceType != ServiceType.Cfdi)
69 | {
70 | throw new InvalidOperationException(
71 | $"No se permite la descarga de CFDI | Metadatos en el servicio de retenciones.");
72 | }
73 |
74 | // Check: No se permite la descarga de retenciones canceladas
75 | if (RequestType == QueryType.Retenciones && InvoiceStatus == InvoiceStatus.Cancelado)
76 | {
77 | throw new InvalidOperationException($"No se permite la descarga de retenciones cancelados.");
78 | }
79 |
80 | // Check: No se permite la descarga de CFDI recibidos cancelados.
81 | if (RequestType == QueryType.CFDI && RecipientTin is not null && InvoiceStatus == InvoiceStatus.Cancelado)
82 | {
83 | throw new InvalidOperationException($"No se permite la descarga de CFDI recibidos cancelados.");
84 | }
85 | }
86 |
87 | // Method to know what ServiceType is using this QueryParameters
88 | public ServiceEndpoints GetServiceEndpoints()
89 | {
90 | return RequestType switch
91 | {
92 | QueryType.CFDI => ServiceEndpoints.Cfdi(),
93 | QueryType.Metadata => ServiceEndpoints.Cfdi(),
94 | QueryType.Retenciones => ServiceEndpoints.Retenciones(),
95 | _ => throw new InvalidOperationException("Tipo de solicitud no válido.")
96 | };
97 | }
98 |
99 | public bool IsCfdiServiceType()
100 | {
101 | return RequestType switch
102 | {
103 | QueryType.CFDI => true,
104 | QueryType.Metadata => true,
105 | QueryType.Retenciones => false,
106 | _ => throw new InvalidOperationException("Tipo de solicitud no válido.")
107 | };
108 | }
109 |
110 | public bool IsRetencionesServiceType()
111 | {
112 | return RequestType switch
113 | {
114 | QueryType.CFDI => false,
115 | QueryType.Metadata => false,
116 | QueryType.Retenciones => true,
117 | _ => throw new InvalidOperationException("Tipo de solicitud no válido.")
118 | };
119 | }
120 | }
--------------------------------------------------------------------------------
/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/ServiceEndpoints.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 | /// Clase inmutable que encapsula todos los endpoints del servicio de descarga masiva del SAT.
23 | /// Use ServiceEndpoints.Cfdi() para "CFDI regulares"
24 | /// Use ServiceEndpoints.Retenciones() para "CFDI de retenciones e información de pagos"
25 | ///
26 | public sealed class ServiceEndpoints
27 | {
28 | ///
29 | /// URL del servicio de autenticación
30 | ///
31 | public string AuthUrl { get; }
32 |
33 | ///
34 | /// URL del servicio de solicitud de descarga
35 | ///
36 | public string QueryUrl { get; }
37 |
38 | ///
39 | /// URL del servicio de verificación de solicitud
40 | ///
41 | public string VerifyUrl { get; }
42 |
43 | ///
44 | /// URL del servicio de descarga de paquetes
45 | ///
46 | public string DownloadUrl { get; }
47 |
48 | ///
49 | /// Tipo de servicio (CFDI o Retenciones)
50 | ///
51 | public ServiceType ServiceType { get; }
52 |
53 | // SOAP Actions (constantes que no cambian entre CFDI y Retenciones)
54 | public const string AuthAction = "http://DescargaMasivaTerceros.gob.mx/IAutenticacion/Autentica";
55 | public const string RequestIssuedAction = "http://DescargaMasivaTerceros.sat.gob.mx/ISolicitaDescargaService/SolicitaDescargaEmitidos";
56 | public const string RequestReceivedAction = "http://DescargaMasivaTerceros.sat.gob.mx/ISolicitaDescargaService/SolicitaDescargaRecibidos";
57 | public const string RequestUuidAction = "http://DescargaMasivaTerceros.sat.gob.mx/ISolicitaDescargaService/SolicitaDescargaFolio";
58 | public const string VerifyAction = "http://DescargaMasivaTerceros.sat.gob.mx/IVerificaSolicitudDescargaService/VerificaSolicitudDescarga";
59 | public const string DownloadAction = "http://DescargaMasivaTerceros.sat.gob.mx/IDescargaMasivaTercerosService/Descargar";
60 |
61 | ///
62 | /// Constructor privado para crear instancias inmutables
63 | ///
64 | private ServiceEndpoints(string authUrl, string queryUrl, string verifyUrl, string downloadUrl, ServiceType serviceType)
65 | {
66 | AuthUrl = authUrl ?? throw new ArgumentNullException(nameof(authUrl));
67 | QueryUrl = queryUrl ?? throw new ArgumentNullException(nameof(queryUrl));
68 | VerifyUrl = verifyUrl ?? throw new ArgumentNullException(nameof(verifyUrl));
69 | DownloadUrl = downloadUrl ?? throw new ArgumentNullException(nameof(downloadUrl));
70 | ServiceType = serviceType;
71 | }
72 |
73 | ///
74 | /// Crea una instancia con los endpoints para "CFDI regulares"
75 | ///
76 | public static ServiceEndpoints Cfdi()
77 | {
78 | return new ServiceEndpoints(
79 | authUrl: "https://cfdidescargamasivasolicitud.clouda.sat.gob.mx/Autenticacion/Autenticacion.svc",
80 | queryUrl: "https://cfdidescargamasivasolicitud.clouda.sat.gob.mx/SolicitaDescargaService.svc",
81 | verifyUrl: "https://cfdidescargamasivasolicitud.clouda.sat.gob.mx/VerificaSolicitudDescargaService.svc",
82 | downloadUrl: "https://cfdidescargamasiva.clouda.sat.gob.mx/DescargaMasivaService.svc",
83 | serviceType: ServiceType.Cfdi
84 | );
85 | }
86 |
87 | ///
88 | /// Crea una instancia con los endpoints para "CFDI de retenciones e información de pagos"
89 | ///
90 | public static ServiceEndpoints Retenciones()
91 | {
92 | return new ServiceEndpoints(
93 | authUrl: "https://retendescargamasivasolicitud.clouda.sat.gob.mx/Autenticacion/Autenticacion.svc",
94 | queryUrl: "https://retendescargamasivasolicitud.clouda.sat.gob.mx/SolicitaDescargaService.svc",
95 | verifyUrl: "https://retendescargamasivasolicitud.clouda.sat.gob.mx/VerificaSolicitudDescargaService.svc",
96 | downloadUrl: "https://retendescargamasiva.clouda.sat.gob.mx/DescargaMasivaService.svc",
97 | serviceType: ServiceType.Retenciones
98 | );
99 | }
100 | }
101 |
102 |
--------------------------------------------------------------------------------
/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 | using Microsoft.Extensions.Logging;
23 |
24 | namespace Fiscalapi.XmlDownloader.Verify;
25 |
26 | public static class VerifyResponseService
27 | {
28 | ///
29 | /// Builds a VerifyResponse from the SAT response.
30 | ///
31 | public static VerifyResponse Build(SatResponse satResponse, ILogger logger)
32 | {
33 | if (satResponse.IsSuccessStatusCode)
34 | {
35 | var envelope = XmlSerializerService.Deserialize(satResponse.RawResponse!);
36 |
37 | /*
38 | *
39 |
41 |
42 |
48 | 4e80345d-917f-40bb-a98f4a73939343c5_01
49 | 4e80345d-917f-40bb-a98f4a73939343c5_02
50 | 4e80345d-917f-40bb-a98f4a73939343c5_03
51 | 4e80345d-917f-40bb-a98f4a73939343c5_04
52 | 4e80345d-917f-40bb-a98f4a73939343c5_05
53 | 4e80345d-917f-40bb-a98f4a73939343c5_06
54 |
55 |
56 |
57 |
58 | */
59 |
60 | //CodEstatus="5000"
61 | var codEstatus = envelope?.Body.VerifyDownloadRequestResponse
62 | .VerifyDownloadRequestResult.CodEstatus;
63 |
64 | var status = !string.IsNullOrWhiteSpace(codEstatus)
65 | ? codEstatus.ToEnumElement()
66 | : SatStatus.Unknown;
67 |
68 | // EstadoSolicitud="3"
69 | var estadoSolicitud = envelope?.Body.VerifyDownloadRequestResponse
70 | .VerifyDownloadRequestResult.EstadoSolicitud;
71 |
72 |
73 | var requestStatus = !string.IsNullOrWhiteSpace(estadoSolicitud)
74 | ? estadoSolicitud.ToEnumElement()
75 | : RequestStatus.Desconocido;
76 |
77 | // NumeroCFDIs="0"
78 | var numeroCfdis = envelope?.Body?.VerifyDownloadRequestResponse
79 | .VerifyDownloadRequestResult?.NumeroCFDIs ?? "0";
80 |
81 | numeroCfdis = numeroCfdis.Trim().Equals("") ? "0" : numeroCfdis;
82 |
83 | var invoiceCount = int.Parse(numeroCfdis);
84 |
85 | //Mensaje
86 | var mensaje = envelope?.Body?.VerifyDownloadRequestResponse?
87 | .VerifyDownloadRequestResult?.Mensaje ?? "";
88 |
89 | // IdsPaquetes
90 | var idsPaquetes = envelope?.Body?.VerifyDownloadRequestResponse?
91 | .VerifyDownloadRequestResult?.PackageIds ?? [];
92 |
93 |
94 | return new VerifyResponse
95 | {
96 | Succeeded = true,
97 | SatStatus = status,
98 | SatStatusCode = status.ToEnumCode(),
99 | SatMessage = mensaje,
100 | RequestStatus = requestStatus,
101 | InvoiceCount = invoiceCount,
102 | PackageIds = idsPaquetes,
103 | RawRequest = satResponse.RawRequest,
104 | RawResponse = satResponse.RawResponse
105 | };
106 | }
107 |
108 | return new VerifyResponse
109 | {
110 | Succeeded = false,
111 | SatStatusCode = "UnknownError",
112 | SatMessage = $"StatusCode: {satResponse.HttpStatusCode} Message: {satResponse.ReasonPhrase}",
113 | RawRequest = satResponse.RawRequest,
114 | RawResponse = satResponse.RawResponse,
115 | };
116 | }
117 | }
--------------------------------------------------------------------------------
/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 | using Microsoft.Extensions.Logging;
18 |
19 | namespace Fiscalapi.XmlDownloader.FileStorage;
20 |
21 | ///
22 | /// Interface for file system operations.
23 | ///
24 | public interface IFileStorageService
25 | {
26 | ///
27 | /// Check if a directory exists at the specified path
28 | ///
29 | /// Full path to the directory
30 | /// True if directory exists
31 | bool DirectoryExists(string directoryPath);
32 |
33 | ///
34 | /// Delete all files and folders recursively from the specified directory
35 | ///
36 | /// Full path to the directory to clean
37 | /// Cancellation token
38 | void CleanDirectory(string directoryPath, CancellationToken cancellationToken = default);
39 |
40 | ///
41 | /// Create a directory if it doesn't exist
42 | ///
43 | /// Full path to the directory to create
44 | void CreateDirectoryIfNotExist(string directoryPath);
45 |
46 | ///
47 | /// Check if a file exists at the specified path
48 | ///
49 | /// Full path to the file
50 | /// True if file exists
51 | bool FileExists(string fullFilePath);
52 |
53 | ///
54 | /// Extract a ZIP file to the specified destination path
55 | ///
56 | /// Full path to the ZIP file
57 | /// Path to extract files to
58 | /// Cancellation token
59 | /// Logger
60 | /// Completion Task
61 | void ExtractZipFile(string fullFilePath, string extractToPath,
62 | CancellationToken cancellationToken = default, ILogger? logger = null);
63 |
64 | ///
65 | /// Get a list of files from the specified directory with optional file extension filter
66 | ///
67 | /// Full path to the directory
68 | /// File extension filter (optional)
69 | /// List of file details
70 | List GetFiles(string directoryPath, string? fileExtension = null);
71 |
72 | ///
73 | /// Write binary data to a file
74 | ///
75 | /// Full path to the file
76 | /// Binary data to write
77 | /// Cancellation token
78 | /// Logger
79 | Task WriteFileAsync(string fullFilePath, byte[] data, CancellationToken cancellationToken = default,
80 | ILogger? logger = null);
81 |
82 | ///
83 | /// Write base64 encoded data to a file
84 | ///
85 | /// Full path to the file
86 | /// Base64 encoded data to write
87 | /// Cancellation token
88 | /// Logger
89 | Task WriteFileAsync(string fullFilePath, string base64Data, CancellationToken cancellationToken = default,
90 | ILogger? logger = null);
91 |
92 | ///
93 | /// Read file content as byte array
94 | ///
95 | /// Full path to the file
96 | /// Cancellation token
97 | /// Logger
98 | /// File content as byte array
99 | Task ReadFileAsync(string fullFilePath, CancellationToken cancellationToken = default,
100 | ILogger? logger = null);
101 |
102 | ///
103 | /// Read file content as string
104 | ///
105 | /// Full path to the file
106 | /// Cancellation token
107 | /// Logger
108 | /// File content as string
109 | Task ReadFileContentAsync(string fullFilePath, CancellationToken cancellationToken = default,
110 | ILogger? logger = null);
111 |
112 | ///
113 | /// Delete a file
114 | ///
115 | /// Full path to the file
116 | /// True if file was deleted successfully
117 | void DeleteFile(string fullFilePath);
118 | }
--------------------------------------------------------------------------------
/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 | using Microsoft.Extensions.Logging;
24 |
25 | namespace Fiscalapi.XmlDownloader.Download;
26 |
27 | ///
28 | /// Service for downloading packages from SAT.
29 | ///
30 | public class DownloadService : SatService, IDownloadService
31 | {
32 | ///
33 | /// Constructor for dependency injection scenarios
34 | ///
35 | /// HttpClient instance
36 | /// Logger instance
37 | public DownloadService(HttpClient httpClient, ILogger logger)
38 | : base(httpClient, logger)
39 | {
40 | }
41 |
42 | ///
43 | /// Constructor for direct instantiation scenarios
44 | ///
45 | /// Logger instance
46 | public DownloadService(ILogger logger)
47 | : base(logger)
48 | {
49 | }
50 |
51 | ///
52 | /// Downloads a package from SAT using the provided credential, authentication token and package ID.s
53 | ///
54 | /// Fiel
55 | /// Authentication token
56 | /// PackageID
57 | /// Service endpoints to use for download
58 | /// CancellationToken
59 | /// Logger
60 | /// DownloadResponse
61 | public async Task DownloadAsync(ICredential credential, Token authToken, string packageId,
62 | ServiceEndpoints endpoints, ILogger logger, CancellationToken cancellationToken = default)
63 | {
64 | var toDigest = CreateDigest(packageId, credential.Certificate.Rfc);
65 | var signature = CreateSignature(credential, toDigest);
66 | var requestXml = BuildEnvelope(packageId, credential.Certificate.Rfc, signature);
67 |
68 | var satResponse = await SendRequestAsync(
69 | url: endpoints.DownloadUrl,
70 | action: ServiceEndpoints.DownloadAction,
71 | payload: requestXml,
72 | token: authToken.Value,
73 | cancellationToken: cancellationToken);
74 |
75 | var downloadResponse = DownloadResponseService.Build(satResponse, logger);
76 |
77 | return downloadResponse;
78 | }
79 |
80 | private string CreateDigest(string packageId, string requesterTin)
81 | {
82 | var xml = XmlTemplates.DownloadToDigest
83 | .Replace(XmlPlaceholders.PackageId, packageId)
84 | .Replace(XmlPlaceholders.RequesterTin, requesterTin);
85 |
86 | return xml.Clean();
87 | }
88 |
89 | private string CreateSignature(ICredential credential, string toDigest)
90 | {
91 | toDigest = toDigest.Clean();
92 | var digestValue = credential.CreateHash(toDigest);
93 |
94 | // Create signed info
95 | var signedInfo = XmlTemplates.SignedInfo
96 | .Replace(XmlPlaceholders.Base64Digested, digestValue)
97 | .Replace(XmlPlaceholders.ReferenceUri, "");
98 |
99 | var cleanedSignedInfo = signedInfo.Clean();
100 | var signatureValue = credential.SignData(cleanedSignedInfo).ToBase64String();
101 |
102 | var cleanSignedInfoForTemplate = cleanedSignedInfo.Replace(
103 | @"",
104 | "");
105 |
106 | var keyInfo = XmlTemplates.X509KeyInfo
107 | .Replace(XmlPlaceholders.X509IssuerName, credential.Certificate.Issuer)
108 | .Replace(XmlPlaceholders.X509SerialNumber, credential.Certificate.SerialNumber)
109 | .Replace(XmlPlaceholders.Base64Cer, credential.Certificate.RawDataBytes.ToBase64String());
110 |
111 | var signature = XmlTemplates.SignatureTemplate
112 | .Replace(XmlPlaceholders.SignedInfo, cleanSignedInfoForTemplate)
113 | .Replace(XmlPlaceholders.Base64Signature, signatureValue)
114 | .Replace(XmlPlaceholders.KeyInfo, keyInfo);
115 |
116 | return signature;
117 | }
118 |
119 | private string BuildEnvelope(string packageId, string requesterTin, string signature)
120 | {
121 | var envelope = XmlTemplates.DownloadEnvelope
122 | .Replace(XmlPlaceholders.PackageId, packageId)
123 | .Replace(XmlPlaceholders.RequesterTin, requesterTin)
124 | .Replace(XmlPlaceholders.SignatureData, signature);
125 |
126 | return envelope.Clean();
127 | }
128 | }
--------------------------------------------------------------------------------
/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 | using Microsoft.Extensions.Logging;
24 |
25 | namespace Fiscalapi.XmlDownloader.Verify;
26 |
27 | ///
28 | /// Service for verifying download requests with SAT.
29 | ///
30 | public class VerifyService : SatService, IVerifyService
31 | {
32 | ///
33 | /// Constructor for dependency injection scenarios
34 | ///
35 | /// HttpClient instance
36 | /// Logger instance
37 | public VerifyService(HttpClient httpClient, ILogger logger)
38 | : base(httpClient, logger)
39 | {
40 | }
41 |
42 | ///
43 | /// Constructor for direct instantiation scenarios
44 | ///
45 | /// Logger instance
46 | public VerifyService(ILogger logger)
47 | : base(logger)
48 | {
49 | }
50 |
51 | ///
52 | /// Verifies a download request with SAT using the provided credential, authentication token, and request ID.
53 | ///
54 | /// Fiel
55 | /// Authentication token
56 | /// Request ID
57 | /// Service endpoints to use for verification
58 | /// CancellationToken
59 | /// Logger
60 | /// VerifyResponse
61 | public async Task VerifyAsync(ICredential credential, Token authToken,
62 | string requestId, ServiceEndpoints endpoints, ILogger logger, CancellationToken cancellationToken = default)
63 | {
64 | var toDigest = CreateDigest(requestId, credential.Certificate.Rfc);
65 | var signature = CreateSignature(credential, toDigest);
66 | var requestXml = BuildEnvelope(requestId, credential.Certificate.Rfc, signature);
67 |
68 | var satResponse = await SendRequestAsync(
69 | url: endpoints.VerifyUrl,
70 | action: ServiceEndpoints.VerifyAction,
71 | payload: requestXml,
72 | token: authToken.Value,
73 | cancellationToken: cancellationToken);
74 |
75 | var verifyResponse = VerifyResponseService.Build(satResponse, logger);
76 | return verifyResponse;
77 | }
78 |
79 | private static string CreateDigest(string requestId, string rfcSolicitante)
80 | {
81 | var xml = XmlTemplates.VerifyToDigest
82 | .Replace(XmlPlaceholders.RequestId, requestId)
83 | .Replace(XmlPlaceholders.RequesterTin, rfcSolicitante);
84 |
85 | return xml.Clean();
86 | }
87 |
88 | private static string CreateSignature(ICredential credential, string toDigest)
89 | {
90 | toDigest = toDigest.Clean();
91 | var digestValue = credential.CreateHash(toDigest);
92 |
93 | // Create the SignedInfo element with the digest value
94 | var signedInfo = XmlTemplates.SignedInfo
95 | .Replace(XmlPlaceholders.Base64Digested, digestValue)
96 | .Replace(XmlPlaceholders.ReferenceUri, "");
97 |
98 | var cleanedSignedInfo = signedInfo.Clean();
99 | var signatureValue = credential.SignData(cleanedSignedInfo).ToBase64String();
100 |
101 | var cleanSignedInfoForTemplate = cleanedSignedInfo.Replace(
102 | @"",
103 | "");
104 |
105 | var keyInfo = XmlTemplates.X509KeyInfo
106 | .Replace(XmlPlaceholders.X509IssuerName, credential.Certificate.Issuer)
107 | .Replace(XmlPlaceholders.X509SerialNumber, credential.Certificate.SerialNumber)
108 | .Replace(XmlPlaceholders.Base64Cer, credential.Certificate.RawDataBytes.ToBase64String());
109 |
110 | var signature = XmlTemplates.SignatureTemplate
111 | .Replace(XmlPlaceholders.SignedInfo, cleanSignedInfoForTemplate)
112 | .Replace(XmlPlaceholders.Base64Signature, signatureValue)
113 | .Replace(XmlPlaceholders.KeyInfo, keyInfo);
114 |
115 | return signature;
116 | }
117 |
118 | private static string BuildEnvelope(string requestId, string rfcSolicitante, string signature) //BuildEnvelope
119 | {
120 | var envelope = XmlTemplates.VerifyEnvelope
121 | .Replace(XmlPlaceholders.RequestId, requestId)
122 | .Replace(XmlPlaceholders.RequesterTin, rfcSolicitante)
123 | .Replace(XmlPlaceholders.SignatureData, signature);
124 |
125 | return envelope.Clean();
126 | }
127 | }
--------------------------------------------------------------------------------
/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 | }
--------------------------------------------------------------------------------