Skip to content

Commit ca7da7c

Browse files
committed
DownloadType added
1 parent e66301d commit ca7da7c

File tree

2 files changed

+24
-24
lines changed

2 files changed

+24
-24
lines changed

Query/Models/OperationType.cs renamed to Query/Models/DownloadType.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ namespace Fiscalapi.XmlDownloader.Query.Models;
1919
/// <summary>
2020
/// Enum for identifying operation types in query service.
2121
/// </summary>
22-
public enum OperationType
22+
public enum DownloadType
2323
{
24-
RequestIssued,
25-
RequestReceived,
26-
RequestUuid
24+
Emitidos,
25+
Recibidos,
26+
Uuid
2727
}

Query/QueryService.cs

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public async Task<QueryResponse> CreateAsync(ICredential credential, Token authT
5959
/// <summary>
6060
/// Creates the digest
6161
/// </summary>
62-
private string CreateDigest(QueryParameters parameters, OperationType operationType)
62+
private string CreateDigest(QueryParameters parameters, DownloadType operationType)
6363
{
6464
var extraXml = string.Empty;
6565
var requestAttributes = BuildRequestAttributes(parameters, operationType, ref extraXml);
@@ -75,9 +75,9 @@ private string CreateDigest(QueryParameters parameters, OperationType operationT
7575

7676
var digestTemplate = operationType switch
7777
{
78-
OperationType.RequestIssued => XmlTemplates.EmitidosToDigest,
79-
OperationType.RequestReceived => XmlTemplates.RecibidosToDigest,
80-
OperationType.RequestUuid => XmlTemplates.FolioToDigest,
78+
DownloadType.Emitidos => XmlTemplates.EmitidosToDigest,
79+
DownloadType.Recibidos => XmlTemplates.RecibidosToDigest,
80+
DownloadType.Uuid => XmlTemplates.FolioToDigest,
8181
_ => throw new InvalidOperationException($"Unsupported operation type: {operationType}")
8282
};
8383

@@ -125,7 +125,7 @@ private string CreateSignature(ICredential credential, string toDigest)
125125
/// Builds the complete request envelope BuildEnvelope
126126
/// </summary>
127127
private string BuildEnvelope(QueryParameters parameters, string signature,
128-
OperationType operationType)
128+
DownloadType operationType)
129129
{
130130
var extraXml = string.Empty;
131131
var requestAttributes = BuildRequestAttributes(parameters, operationType, ref extraXml);
@@ -141,9 +141,9 @@ private string BuildEnvelope(QueryParameters parameters, string signature,
141141

142142
var nodeName = operationType switch
143143
{
144-
OperationType.RequestIssued => "SolicitaDescargaEmitidos",
145-
OperationType.RequestReceived => "SolicitaDescargaRecibidos",
146-
OperationType.RequestUuid => "SolicitaDescargaFolio",
144+
DownloadType.Emitidos => "SolicitaDescargaEmitidos",
145+
DownloadType.Recibidos => "SolicitaDescargaRecibidos",
146+
DownloadType.Uuid => "SolicitaDescargaFolio",
147147
_ => throw new InvalidOperationException($"Unsupported operation type: {operationType}")
148148
};
149149

@@ -160,21 +160,21 @@ private string BuildEnvelope(QueryParameters parameters, string signature,
160160
/// Builds request attributes
161161
/// </summary>
162162
private Dictionary<string, string> BuildRequestAttributes(QueryParameters parameters,
163-
OperationType operationType, ref string extraXml)
163+
DownloadType operationType, ref string extraXml)
164164
{
165165
var requestAttributes = new Dictionary<string, string>();
166166

167167
switch (operationType)
168168
{
169-
case OperationType.RequestIssued:
169+
case DownloadType.Emitidos:
170170
BuildEmitidosAttributes(parameters, requestAttributes, ref extraXml);
171171
break;
172172

173-
case OperationType.RequestReceived:
173+
case DownloadType.Recibidos:
174174
BuildRecibidosAttributes(parameters, requestAttributes);
175175
break;
176176

177-
case OperationType.RequestUuid:
177+
case DownloadType.Uuid:
178178
BuildFolioAttributes(parameters, requestAttributes);
179179
break;
180180
default:
@@ -259,24 +259,24 @@ private static void BuildFolioAttributes(QueryParameters parameters,
259259
requestAttributes["RfcSolicitante"] = parameters.RequesterTin.ToUpperInvariant();
260260
}
261261

262-
private static string GetSoapActionByOperation(OperationType operationType)
262+
private static string GetSoapActionByOperation(DownloadType operationType)
263263
{
264264
return operationType switch
265265
{
266-
OperationType.RequestIssued => SatUrl.RequestIssuedAction,
267-
OperationType.RequestReceived => SatUrl.RequestReceivedAction,
268-
OperationType.RequestUuid => SatUrl.RequestUuidAction,
266+
DownloadType.Emitidos => SatUrl.RequestIssuedAction,
267+
DownloadType.Recibidos => SatUrl.RequestReceivedAction,
268+
DownloadType.Uuid => SatUrl.RequestUuidAction,
269269
_ => throw new InvalidOperationException($"Unsupported operation type: {operationType}")
270270
};
271271
}
272272

273-
private static OperationType DetermineOperationType(QueryParameters parameters)
273+
private static DownloadType DetermineOperationType(QueryParameters parameters)
274274
{
275275
if (!string.IsNullOrEmpty(parameters.InvoiceUuid))
276-
return OperationType.RequestUuid;
276+
return DownloadType.Uuid;
277277

278278
return !string.IsNullOrEmpty(parameters.IssuerTin)
279-
? OperationType.RequestIssued
280-
: OperationType.RequestReceived;
279+
? DownloadType.Emitidos
280+
: DownloadType.Recibidos;
281281
}
282282
}

0 commit comments

Comments
 (0)