Esempio n. 1
0
        public async Task ShouldGetAllOrderReturnAddresses()
        {
            var env     = LaunchSettingsProvider.GetEnvironmentalVariables();
            var client  = OrderApiClientFactory.Create();
            var request = new OrderDeliveryNote
            {
                AddressId        = env["CDON_RETURN_ADDRESS_ID"],
                OrderId          = int.Parse(env["GETORDER_ORDERID"]),
                DeliveryNoteRows = new[]
                {
                    new OrderDeliveryNoteRow
                    {
                        ProductId       = "test_sku",
                        ProductName     = "test_name",
                        Quantity        = 1,
                        PickingLocation = "test_picking_location",
                    }
                }
            };
            var stream = await client.GetDeliveryNote(request);

            var base64 = StreamToBase64(stream);

            Assert.True(base64.Length > 30_000);
        }
Esempio n. 2
0
        public async Task <Stream> GetDeliveryNote(OrderDeliveryNote orderDeliveryNote)
        {
            const string url      = "api/deliverynote";
            var          response = await _client.PostJsonAsync(url, orderDeliveryNote);

            if (!response.IsSuccessStatusCode)
            {
                throw new ApiException
                      (
                          (int)response.StatusCode,
                          null,
                          $"{_client.BaseAddress}/{url}"
                      );
            }

            return(await response.Content.ReadAsStreamAsync());
        }