En este artículo aprenderá a cargar recibos en formato PDF en RetailForce Cloud mediante el client fiscal (cuando se utiliza la fiscalización) y a obtener un enlace para que su cliente pueda descargar o acceder a los recibos.
Esta funcionalidad está disponible a partir de la versión 1.2 del cliente y ofrece la correspondiente capacidad de uso sin conexión para el recibo digital.
Importante: Si no se emplea fiscalización, la invocación del API debe diseñarse de forma diferente; consulte el artículo «Transferencia de recibos digitales a través del client fiscal».
Para poder utilizar esta función, debe estar activada la licencia de «Recibo digital (producto completo)» en la configuración del cliente correspondiente.
Atención: Para que el sistema pueda leer los metadatos del documento fiscal, este debe transmitirse al client fiscal ANTES de que se invoquen los siguientes métodos.
Uso mediante FiscalClient/FiscalService
Al utilizar el FiscalClient, se dispone de los dos métodos siguientes para transferir recibos digitales:
Método mediante nombre de archivo
/// <summary>
/// Uploads digital receipt with digital receipt metadata.
/// </summary>
/// <param name="uniqueClientId">The client id of the client where the digital receipt should be uploaded.</param>
/// <param name="filename">The name of the file to be uploaded. The file must exist and must be readable.</param>
/// <param name="documentGuid">The document guid of the document to get the receipt meta data. Document must be transferred before to fiscalisation.</param>
/// <returns>A unique url to download the file for the customer.</returns>
/// <exception cref="ArgumentNullException">Thrown if parameter <paramref name="uniqueClientId"/> is set to <see cref="Guid.Empty"/>.</exception>
/// <exception cref="ArgumentNullException">Thrown if parameter <paramref name="filename"/> is null or <see cref="string.Empty"/>.</exception>
/// <exception cref="FileNotFoundException">Thrown if given filename is not found.</exception>
/// <exception cref="ArgumentNullException">Thrown if parameter <paramref name="documentGuid"/> is set to <see cref="Guid.Empty"/>.</exception>
/// <exception cref="UnauthorizedAccessException"><paramref name="filename" /> specified a directory.-or- The caller does not have the required permission. </exception>
/// <exception cref="IOException">An I/O error occurred while opening the file. </exception>
public string UploadDigitalReceipt(Guid uniqueClientId, string filename, Guid documentGuid)
Esta función le permite cargar el recibo digital utilizando un archivo del disco duro (nombre de archivo).
Parámetros
- uniqueClientId: el ID único del cliente fiscal.
- filename: el nombre del archivo (incluida la ruta) del archivo PDF que se va a cargar.
- documentGuid: el GUID del documento fiscal (Document.DocumentGuid)
Valor de retorno: URL para su visualización.
Método de streaming
/// <summary>
/// Uploads digital receipt with digital receipt metadata.
/// </summary>
/// <param name="uniqueClientId">The client id of the client where the digital receipt should be uploaded.</param>
/// <param name="file">The stream of the file to be uploaded.</param>
/// <param name="documentGuid">The document guid of the document to get the receipt meta data. Document must be transferred before to fiscalisation.</param>
/// <returns>A unique url to download the file for the customer.</returns>
/// <remarks>You can only use documents from the actual day.</remarks>
/// <exception cref="ArgumentNullException">Thrown if parameter <paramref name="uniqueClientId"/> is set to <see cref="Guid.Empty"/>.</exception>
/// <exception cref="ArgumentNullException">Thrown if parameter <paramref name="file"/> is set to null.</exception>
/// <exception cref="ArgumentNullException">Thrown if parameter <paramref name="documentGuid"/> is set to <see cref="Guid.Empty"/>.</exception>
public string UploadDigitalReceipt(Guid uniqueClientId, Stream file, Guid documentGuid)
Con esta función puede cargar el recibo digital mediante la transferencia de un stream (o varios streams).
Parámetros
- uniqueClientId: el ID único del cliente fiscal.
- file: el stream con el contenido del archivo PDF (el stream debe comenzar desde el principio)
- documentGuid: el GUID del documento fiscal (Document.DocumentGuid)
Valor de retorno: URL para su visualización.
Uso mediante la implementación de NuGet
Al utilizar la implementación directa de Fiskaclient (TrustedFiscalModule) con NuGet, solo está disponible un método con FileStream:
/// <summary>
/// Upload digital receipt (if proper license exists). Only in combination with fiscalisation.
/// </summary>
/// <param name="file">The file to upload.</param>
/// <param name="documentGuid">The document guid of the document to get the receipt meta data. Document must be transferred before to fiscalisation.</param>
/// <returns>An url to request the file in the cloud.</returns>
/// <remarks>You can only use documents from the actual day.</remarks>
/// <exception cref="ArgumentNullException">Thrown if parameter <paramref name="file"/> is set to null.</exception>
/// <exception cref="ArgumentNullException">Thrown if parameter <paramref name="documentGuid"/> is set to <see cref="Guid.Empty"/>.</exception>
/// <exception cref="KeyNotFoundException">Thrown if the given documentGuid does not found a document in the document store.</exception>
public string UploadDigitalReceipt(Stream file, Guid documentGuid)
Con esta función puede cargar el recibo digital transfiriendo un stream de archivos (o varios streams).
Parámetros
- file: el stream con el contenido del archivo PDF (el stream debe estar al principio)
- documentGuid: el GUID del documento fiscal (Document.DocumentGuid)
Valor de retorno: URL para su visualización.
Este artículo ha sido traducido automáticamente.
Comentarios
0 comentarios
Inicie sesión para dejar un comentario.