Ejemplo n.º 1
0
        public void realProcessPaymentHelp(bankEntity bankEntity, int processTime = 2000, string result = "ok")
        {
            Thread.Sleep(processTime);
            var res = new inTimeEntity { PaymentResult = result, BankEnt = new bankEntity { PayId = bankEntity.PayId } };
            var t = Task.Factory.StartNew(() =>
            {
                using (var client = new HttpClient())
                {
                    client.BaseAddress = new Uri("http://win8dev");
                    client.DefaultRequestHeaders.Accept.Add(
                        new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));
                    var resp = client.PostAsJsonAsync("inTimePayment/api/paySOA/paymentResultHookHelp", res).Result;
                    var resContent = resp.Content.ReadAsAsync<string>();
                    //using (var req = new BankServiceClient())
                    //{
                    //    req.processPaymentHelp(be);
                    //}
                    ////using (var req = new PaymentServiceClient())
                    //{
                    //    req.paymentResultHookHelp(res);
                    //}
                }
            });

            t.Wait(100);

            //Thread.Sleep(3000);
            //    var res = new inTimeEntity();
            //    res.PaymentResult = "ok";
        }
Ejemplo n.º 2
0
        public void paymentResultHookHelp(inTimeEntity payResult)
        {
            var ip = "jimmyMStation";// "172.16.144.70";
            var port = 6379;

            using (var help = helpBase.init(ip, port, new TimeSpan(0, 5, 0)))
            {
                var strTmp = help.get(payResult.BankEnt.PayId);
                var payInfoTmp = strTmp.FromJson<Dictionary<string, string>>();
                var subItem = payInfoTmp["reqId"];
                payMethod method;
                Enum.TryParse<payMethod>(payInfoTmp["payMethod"], out method);
                //var subItem = help.get(payResult.BankEnt.PayId);
                //var waitTime = 5000;
                //var res = help.inTimePaymentResultHelp(subItem, payResult.PaymentResult, waitTime, () =>
                //{
                //    return true;
                //});
                var resToPub = new inTimeRes { PaymentResult = payResult.PaymentResult, PayMethod = method };

                var pubItem = resToPub.ToJson();

                var res = help.inTimePaymentResultHelpWithSetnx(subItem, pubItem, method);

                //return res;

                var methodRes = res;
                //var syncStr = "sync";
                if (payMethod.sync.Equals(methodRes))
                {
                    //go sync
                }
                else
                {
                    //go async
                }


            }
        }