Beispiel #1
0
        static void Main(string[] args)
        {
            // This switch must be set before creating the GrpcChannel/HttpClient.
            AppContext.SetSwitch(
                "System.Net.Http.SocketsHttpHandler.Http2UnencryptedSupport", true);

            var channel = GrpcChannel.ForAddress("http://10.0.4.134:5000");
            var client  = new ShoppingCart.ShoppingCartClient(channel); // Customer.CustomerClient(channel);

            //var customerRequested = new IsProductAddressUpdateAllowedRequest
            //{
            //    StateFrom = "ON",
            //    StateTo = "SC",
            //    Userrelationid = 12345
            //};

            var request = new InsuranceTrialLinkGetRequest
            {
                State  = "SC",
                Server = 1
            };

            var reply = client.InsuranceTrialLinkGet(request);

            Console.WriteLine(reply.TrialURL.ToString());
            Console.ReadLine();
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            // initialization, better done elsewhere
            var channel = new Grpc.Core.Channel("localhost", 5000, ChannelCredentials.Insecure);

            //// create client
            //var customerClient = new Customer.CustomerClient(channel);
            //var customerRequested = new IsProductAddressUpdateAllowedRequest
            //{
            //    StateFrom = "ON",
            //    StateTo = "OW",
            //    Userrelationid = 1234
            //};

            //var response = customerClient.IsProductAddressUpdateAllowed(customerRequested);

            //Console.WriteLine(response.IsAddressUpdatable.ToString());
            //Console.WriteLine(response.ReturnMessage);

            var client = new ShoppingCart.ShoppingCartClient(channel); // Customer.CustomerClient(channel);

            var request = new InsuranceTrialLinkGetRequest
            {
                State  = "SC",
                Server = 1
            };

            var reply = client.InsuranceTrialLinkGet(request);

            Console.WriteLine(reply.TrialURL.ToString());
            Console.ReadLine();

            Console.ReadKey();
        }
Beispiel #3
0
        public IActionResult TrialLink(TrialLinkModel model)
        {
            var channel = GrpcChannel.ForAddress(_configuration.GetSection("ApiAddress").Value.ToString());
            var client  = new ShoppingCart.ShoppingCartClient(channel);

            var request = new InsuranceTrialLinkGetRequest
            {
                State  = model.State,
                Server = model.Server
            };

            try
            {
                var response = client.InsuranceTrialLinkGet(request, deadline: DateTime.UtcNow.AddSeconds(180));
                if (response.IsValid.GetValueOrDefault())
                {
                    model.TrialURL = response.TrialURL;
                }
                else
                {
                    ModelState.AddModelError("", response.ErrorMessage);
                }
            }
            catch (Exception ex)
            {
                ModelState.AddModelError("", ex.Message);
            }

            return(View(model));
        }