public void Approve(string customerCPF)
        {
            var customerRepository = new CustomerApiRepository(SettingsService.GetApiSettings());

            var aproveInput = new CustomerRegistrationInput
            {
                CPF = customerCPF
            };

            customerRepository.ApproveRegistrationAgain(aproveInput)
            .GetAwaiter()
            .GetResult();
        }
        private void ApproveDefaultRegistration(string cpfCliente, CustomerApiSettings apiSettings)
        {
            var customerRepository = new CustomerApiRepository(apiSettings);

            var aproveInput = new CustomerRegistrationInput
            {
                CPF = cpfCliente
            };

            customerRepository.ApproveRegistrationAgain(aproveInput)
            .GetAwaiter()
            .GetResult();
        }
Exemple #3
0
        public async Task ApproveRegistrationAgain(CustomerRegistrationInput input)
        {
            var auth = await this.Authenticate();

            var _client = new HttpClient();

            _client.BaseAddress = new Uri(_customerApiSettings.BaseUrl);
            _client.DefaultRequestHeaders.Accept.Clear();
            _client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
            _client.DefaultRequestHeaders.Add("Authorization", auth.Token);

            var content = new StringContent(JsonConvert.SerializeObject(input), Encoding.UTF8, "application/json");

            var responseMessage = _client.PostAsync(_customerApiSettings.ApproveRegistrationAgainResource, content)
                                  .GetAwaiter()
                                  .GetResult();

            responseMessage.EnsureSuccessStatusCode();
        }