Exemplo n.º 1
0
        public void Cambio_Tarjeta()
        {
            string controlador = "/api/account/CambioTarjeta";
            string endpoint    = urlbase + controlador;

            TarjetaLealtadM tarjetaLealtadM = new TarjetaLealtadM()
            {
                LoyaltyAccount = "3086812845384691"
            };

            var client = new RestClient(endpoint);

            client.Timeout = -1;
            var request = new RestRequest(Method.POST);

            request.AddHeader("bearertoken", token.AccessToken);
            request.AddParameter("application/json", tarjetaLealtadM.ToJson(), ParameterType.RequestBody);

            IRestResponse response = client.Execute(request);

            if (response.StatusCode != System.Net.HttpStatusCode.OK)
            {
                throw new Exception("Status Code:" + response.StatusCode + " | Contenido respuesta: " + response.Content);
            }
        }
Exemplo n.º 2
0
        public void Crear_Tarjeta_Virtual()
        {
            Cliente1    clienteTarjeta = RegistrarCliente(clienteTester16);
            BearerToken token2         = ObtenerToken(clienteTester17);

            string controlador = "/api/account/CrearTarjetaVirtual";
            string endpoint    = urlbase + controlador;

            TarjetaLealtadM tarjetaLealtadM = new TarjetaLealtadM()
            {
                Mail = clienteTarjeta.Mail
            };

            var client = new RestClient(endpoint);

            client.Timeout = -1;
            var request = new RestRequest(Method.POST);

            request.AddHeader("bearertoken", token2.AccessToken);
            request.AddParameter("application/json", tarjetaLealtadM.ToJson(), ParameterType.RequestBody);

            IRestResponse response = client.Execute(request);

            if (response.StatusCode != System.Net.HttpStatusCode.OK)
            {
                throw new Exception("Status Code:" + response.StatusCode + " | Contenido respuesta: " + response.Content);
            }
        }