Exemplo n.º 1
0
        public async Task GetStatus(IDialogContext context, LuisResult result)
        {
            GetStatusForm getStatusForm = new GetStatusForm();
            var           form          = new FormDialog <GetStatusForm>(new GetStatusForm(), new BuildFormDelegate <GetStatusForm>(getStatusForm.BuildForm), FormOptions.PromptInStart);

            context.Call <GetStatusForm>(form, callback.CallbackGlobal);
        }
        public GetStatusForm CreatStatusForm(string numberOrder)
        {
            GetStatusForm statusForm = new GetStatusForm();

            statusForm.UserName = "******";
            statusForm.Password = Helper.GetPassword(statusForm.UserName);
            statusForm.orderId  = db.Find(numberOrder).OrderId;

            return(statusForm);
        }
        public async Task <string> GetInformationFromSever(GetStatusForm getStatusForm, string urlAddress)
        {
            using (HttpClient client = new HttpClient()
            {
                BaseAddress = new Uri("http://attest.turkmen-tranzit.com")
            })
            {
                var answer = await client.PostAsJsonAsync($"{client.BaseAddress}{urlAddress}", getStatusForm);

                return(await answer.Content.ReadAsStringAsync());
            }
        }
        public async Task ChecStatus(string numberOrder)
        {
            string urlChecStatus = "payment/rest/getOrderStatus.do";

            GetStatusForm statusForm = CreatStatusForm(numberOrder);

            OrderStatus orderStatus = JsonSerializer.Deserialize <OrderStatus>(await GetInformationFromSever(statusForm, urlChecStatus));

            Order order = db.Find(numberOrder);

            order.OrderStatus = orderStatus.orderStatus;
            if (orderStatus.errorCode == 0)
            {
                await ActionOptions(order);
            }
        }