public async Task <BoletoDetalhamento> obterPorNossoNumero(String nossoNumero) { try { BoletoDetalhamento response = new BoletoDetalhamento(); var handler = new HttpClientHandler(); handler.ClientCertificateOptions = ClientCertificateOption.Manual; handler.SslProtocols = SslProtocols.Tls12; handler.ClientCertificates.Add(new X509Certificate2("/opt/mck2.com.br.pfx", "<senha_certificado>")); var client = new HttpClient(handler); client.DefaultRequestHeaders.Add("accept", "application/json"); client.DefaultRequestHeaders.Add("x-inter-conta-corrente", "<conta_bancaria>"); var result = await client.GetAsync($"https://apis.bancointer.com.br/openbanking/v1/certificado/boletos/{nossoNumero}"); response = JsonConvert.DeserializeObject <BoletoDetalhamento>(result.Content.ReadAsStringAsync().Result); return(response); } catch (Exception ex) { throw new Exception(ex.Message); } }
public async Task <dynamic> pesquisaPaginada(BoletoPesquisaRequest dados) { try { BoletoDetalhamento response = new BoletoDetalhamento(); var handler = new HttpClientHandler(); handler.ClientCertificateOptions = ClientCertificateOption.Manual; handler.SslProtocols = SslProtocols.Tls12; handler.ClientCertificates.Add(new X509Certificate2("/opt/mck2.com.br.pfx", "<senha_certificado>")); var client = new HttpClient(handler); // client.DefaultRequestHeaders.Add("accept", "application/json"); client.DefaultRequestHeaders.Add("x-inter-conta-corrente", "<conta_bancaria>"); string queryString = ObjectToQueryString.GetQueryString(dados); var result = await client.GetAsync($"https://apis.bancointer.com.br/openbanking/v1/certificado/boletos?{queryString}"); return(JsonConvert.DeserializeObject <BoletoPesquisaResponse>(result.Content.ReadAsStringAsync().Result)); } catch (Exception ex) { throw new Exception(ex.Message); } }