public async Task <SupplierInvoice> Get(string entityNumber, SupplierDocumentType documentType = SupplierDocumentType.Invoice) { SupplierInvoice rsp; if (documentType == SupplierDocumentType.Invoice) // documentType = invoice use default endpoint. { rsp = await VismaNetApiHelper.Get <SupplierInvoice>(entityNumber, ApiControllerUri, Authorization); } else { rsp = await VismaNetApiHelper.Get <SupplierInvoice>(entityNumber, ApiControllerUri, Authorization, $"{documentType.ToString()}/{entityNumber}"); } rsp.InternalPrepareForUpdate(); return(rsp); }
public async Task <string> AddAttachmentToInvoice(string invoiceNumber, byte[] byteArray, string fileName, SupplierDocumentType documentType = SupplierDocumentType.Invoice) { if (byteArray == default(byte[])) { throw new ArgumentNullException(nameof(byteArray), "ByteArray is missing"); } if (string.IsNullOrEmpty(fileName) || string.IsNullOrEmpty(Path.GetExtension(fileName))) { throw new ArgumentNullException(nameof(fileName), "File name must be provided and have an extention"); } if (documentType != SupplierDocumentType.Invoice) { invoiceNumber = $"documentType/{documentType}/{invoiceNumber}"; } return(await VismaNetApiHelper.AddAttachmentToSupplierInvoice(Authorization, invoiceNumber, byteArray, fileName)); }
public async Task <string> AddAttachmentToInvoice(string invoiceNumber, Stream stream, string fileName, SupplierDocumentType documentType = SupplierDocumentType.Invoice) { if (stream == default(Stream)) { throw new ArgumentNullException(nameof(stream), "Stream is missing"); } if (string.IsNullOrEmpty(fileName) || string.IsNullOrEmpty(Path.GetExtension(fileName))) { throw new ArgumentNullException(nameof(fileName), "File name must be provided and have an extention"); } using (var memoryStream = new MemoryStream()) { stream.CopyTo(memoryStream); if (documentType != SupplierDocumentType.Invoice) { invoiceNumber = $"documentType/{documentType}/{invoiceNumber}"; } return(await VismaNetApiHelper.AddAttachmentToSupplierInvoice(Authorization, invoiceNumber, memoryStream.ToArray(), fileName)); } }
public async Task <string> AddAttachmentToInvoice(string invoiceNumber, string content, string fileName, SupplierDocumentType documentType = SupplierDocumentType.Invoice) { return(await AddAttachmentToInvoice(invoiceNumber, Encoding.UTF8.GetBytes(content), fileName, documentType)); }