예제 #1
0
        public async Task <string> ServeRequest(FormRegistrationIdOrder idOrder, string UrlAddress)
        {
            using (HttpClient client = new HttpClient()
            {
                BaseAddress = new Uri($" http://attest.turkmen-tranzit.com")
            })
            {
                var answer = await client.PostAsJsonAsync($"{client.BaseAddress}{UrlAddress}", idOrder);

                var jsonAnswer = await answer.Content.ReadAsStringAsync();

                return(jsonAnswer);
            }
        }
예제 #2
0
        public async Task <IdOrder> RegistredOrder(Order order)
        {
            string urlRegisterd = "payment/rest/register.do";

            operationDB.Creat(order);
            order.orderNumber = order.Id.ToString();
            FormRegistrationIdOrder registrationIdOrder = new FormRegistrationIdOrder(order);

            IdOrder idOrder = JsonSerializer.Deserialize <IdOrder>(await ServeRequest(registrationIdOrder, urlRegisterd));

            order.orderId = idOrder.orderId;
            operationDB.UpDate(order);

            return(idOrder);
        }