Exemplo n.º 1
0
        public async Task GetUbl_response_have_xml_tags()
        {
            var query = new QueryFilterBuilder <OutboxInvoiceGetModel>()
                        .PageIndex(1)
                        .PageSize(3)
                        .QueryFor(q => q.Currency, Operator.Equal, "TRY")
                        .Build();
            var pageList = await inboxInvoiceClient.Get(query);

            var model = pageList.Items.FirstOrDefault();

            var streamData = await inboxInvoiceClient.GetUbl(model.Id);

            using (var reader = new StreamReader(streamData, Encoding.UTF8))
            {
                string value = reader.ReadToEnd();
                Assert.NotEmpty(value);
                Assert.Contains("<Invoice", value);
                Assert.Contains("<cbc:ID schemeID=", value);
                Assert.Contains("<cac:PartyIdentification>", value);
                Assert.Contains("<cac:PartyIdentification>", value);
            }
        }
        [HttpGet("ubl/{id}")] //f201ba2e-881f-4798-a715-d6090a28d7b2
        public async Task <IActionResult> GetUbl(Guid id)
        {
            var data = await inboxInvoiceClient.GetUbl(id);

            return(File(data, "application/pdf", $"{id}.zip"));
        }