|
| 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 | +/// <summary> |
| 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 | +/// </summary> |
| 26 | +public sealed class ServiceEndpoints |
| 27 | +{ |
| 28 | + /// <summary> |
| 29 | + /// URL del servicio de autenticación |
| 30 | + /// </summary> |
| 31 | + public string AuthUrl { get; } |
| 32 | + |
| 33 | + /// <summary> |
| 34 | + /// URL del servicio de solicitud de descarga |
| 35 | + /// </summary> |
| 36 | + public string QueryUrl { get; } |
| 37 | + |
| 38 | + /// <summary> |
| 39 | + /// URL del servicio de verificación de solicitud |
| 40 | + /// </summary> |
| 41 | + public string VerifyUrl { get; } |
| 42 | + |
| 43 | + /// <summary> |
| 44 | + /// URL del servicio de descarga de paquetes |
| 45 | + /// </summary> |
| 46 | + public string DownloadUrl { get; } |
| 47 | + |
| 48 | + /// <summary> |
| 49 | + /// Tipo de servicio (CFDI o Retenciones) |
| 50 | + /// </summary> |
| 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 | + /// <summary> |
| 62 | + /// Constructor privado para crear instancias inmutables |
| 63 | + /// </summary> |
| 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 | + /// <summary> |
| 74 | + /// Crea una instancia con los endpoints para "CFDI regulares" |
| 75 | + /// </summary> |
| 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 | + /// <summary> |
| 88 | + /// Crea una instancia con los endpoints para "CFDI de retenciones e información de pagos" |
| 89 | + /// </summary> |
| 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 | + |
0 commit comments