public void ExecuteIntegrations() { CustomerApiSettings apiSettings = new CustomerApiSettings { BaseUrl = "https://dev-gapi.simpaul.com.br/", IncompletedResource = "dev/backoffice/client/incomplete", ApproveResource = "dev/backoffice/client/sinacor", ReproveResource = "dev/backoffice/client/{id}/status", CustomerResource = "dev/backoffice/client/onboarding", LoginResource = "dev/backoffice/authentication", SuitabilityResource = "dev/backoffice/client/{id}/suitability", RegisterAginResource = "dev/backoffice/client/reregister", UserLogin = "******", PasswordLogin = "******" }; var customerRepository = new SimPaulOnbase.Infraestructure.ApiDataAccess.CustomerApiRepository(apiSettings); var customers = customerRepository.GetIncompleted() .GetAwaiter() .GetResult(); var customersData = customerRepository .GetCustomer() .GetAwaiter() .GetResult(); var customer = customersData .FirstOrDefault(cm => cm.SinacorAccounts == null || cm.SinacorAccounts.Length == 0); var aproveInput = new CustomerApproveInput { Id = customer.Id, CPF = customer.Cpf }; customerRepository.ApproveRegistration(aproveInput) .GetAwaiter() .GetResult(); var reproveInput = new CustomerReproveInput { Id = customer.Id, Status = "REPROVADO" }; customerRepository.ReproveRegistration(reproveInput) .GetAwaiter() .GetResult(); }
public void Reprove(string customerDocument) { var customerRepository = new SimPaulOnbase.Infraestructure.ApiDataAccess.CustomerApiRepository(this.GetApiSettings()); var output = customerRepository .GetCustomer(customerDocument) .GetAwaiter() .GetResult(); var customer = output.FirstOrDefault(); var reproveInput = new CustomerReproveInput { Id = customer.Id, Status = "BACKOFFICEDENIED" }; customerRepository.ReproveRegistration(reproveInput) .GetAwaiter() .GetResult(); }
public void ExecuteIntegrations() { var customerRepository = new SimPaulOnbase.Infraestructure.ApiDataAccess.CustomerApiRepository(this.GetApiSettings()); var customers = customerRepository.GetIncompleted() .GetAwaiter() .GetResult(); var customersData = customerRepository .GetCustomer() .GetAwaiter() .GetResult(); var customer = customersData .FirstOrDefault(cm => cm.SinacorAccounts == null || cm.SinacorAccounts.Length == 0); var aproveInput = new CustomerApproveInput { Id = customer.Id, CPF = customer.Cpf }; customerRepository.ApproveRegistration(aproveInput) .GetAwaiter() .GetResult(); var reproveInput = new CustomerReproveInput { Id = customer.Id, Status = "REPROVADO" }; customerRepository.ReproveRegistration(reproveInput) .GetAwaiter() .GetResult(); }
public async Task ReproveRegistration(CustomerReproveInput 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 payload = JsonConvert.SerializeObject(new { status = input.Status }); var content = new StringContent(payload, Encoding.UTF8, "application/json"); var url = _customerApiSettings.ReproveResource.Replace("{id}", input.Id.ToString()); var responseMessage = _client.PutAsync(url, content) .GetAwaiter() .GetResult(); var contentResponse = await responseMessage.Content .ReadAsStringAsync(); responseMessage.EnsureSuccessStatusCode(); }
public Task ReproveRegistration(CustomerReproveInput input) { throw new NotImplementedException(); }