diff --git a/src/main/java/br/com/pjbank/sdk/recebimento/BoletosManager.java b/src/main/java/br/com/pjbank/sdk/recebimento/BoletosManager.java index 253023d..32223b5 100644 --- a/src/main/java/br/com/pjbank/sdk/recebimento/BoletosManager.java +++ b/src/main/java/br/com/pjbank/sdk/recebimento/BoletosManager.java @@ -111,11 +111,11 @@ public String getByIds(Set pedidos) throws IOException, PJBankException return responseObject.getString("linkBoleto"); } - public List get(Date inicio, Date fim, StatusPagamentoBoleto pago) throws URISyntaxException, IOException, PJBankException, java.text.ParseException { + public List get(Date inicio, Date fim, StatusPagamentoBoleto pago, Integer pagina) throws URISyntaxException, IOException, PJBankException, java.text.ParseException { PJBankClient client = new PJBankClient(this.endPoint.concat("/transacoes")); HttpGet httpGet = client.getHttpGetClient(); httpGet.addHeader("x-chave", this.getChave()); - this.adicionarFiltros(httpGet, inicio, fim, pago); + this.adicionarFiltros(httpGet, inicio, fim, pago, pagina); String response = EntityUtils.toString(client.doRequest(httpGet).getEntity()); JSONArray extratoObject = new JSONArray(response); @@ -152,7 +152,7 @@ public List get(Date inicio, Date fim, StatusPagamentoBoleto pago return extratos; } - private void adicionarFiltros(HttpRequestBase httpRequestClient, Date inicio, Date fim, StatusPagamentoBoleto pago) + private void adicionarFiltros(HttpRequestBase httpRequestClient, Date inicio, Date fim, StatusPagamentoBoleto pago, Integer pagina) throws URISyntaxException { SimpleDateFormat formatter = new SimpleDateFormat("MM/dd/yyyy"); URIBuilder uriBuilder = new URIBuilder(httpRequestClient.getURI()); @@ -160,6 +160,7 @@ private void adicionarFiltros(HttpRequestBase httpRequestClient, Date inicio, Da uriBuilder.addParameter("data_inicio", formatter.format(inicio)); uriBuilder.addParameter("data_fim", formatter.format(fim)); uriBuilder.addParameter("pago", pago.getName()); + uriBuilder.addParameter("pagina", pagina.toString()); httpRequestClient.setURI(uriBuilder.build()); } diff --git a/src/test/java/br/com/pjbank/sdk/recebimento/BoletosManagerTest.java b/src/test/java/br/com/pjbank/sdk/recebimento/BoletosManagerTest.java index 2a66e9d..e7b152c 100644 --- a/src/test/java/br/com/pjbank/sdk/recebimento/BoletosManagerTest.java +++ b/src/test/java/br/com/pjbank/sdk/recebimento/BoletosManagerTest.java @@ -130,12 +130,12 @@ public void get() throws IOException, JSONException, PJBankException, ParseExcep BoletosManager manager = new BoletosManager(this.credencial, this.chave); LocalDate inicio = LocalDate.of(2001, 1, 29); LocalDate fim = LocalDate.now(); - List extratos = manager.get(Date.from(inicio.atStartOfDay(ZoneId.systemDefault()).toInstant()), Date.from(fim.atStartOfDay(ZoneId.systemDefault()).toInstant()), StatusPagamentoBoleto.ABERTO); + List extratos = manager.get(Date.from(inicio.atStartOfDay(ZoneId.systemDefault()).toInstant()), Date.from(fim.atStartOfDay(ZoneId.systemDefault()).toInstant()), StatusPagamentoBoleto.ABERTO, 1); for (ExtratoBoleto extrato : extratos) { Assert.assertThat(extrato.getDataPagamento(), nullValue(Date.class)); } - extratos = manager.get(Date.from(inicio.atStartOfDay(ZoneId.systemDefault()).toInstant()), Date.from(fim.atStartOfDay(ZoneId.systemDefault()).toInstant()), StatusPagamentoBoleto.PAGO); + extratos = manager.get(Date.from(inicio.atStartOfDay(ZoneId.systemDefault()).toInstant()), Date.from(fim.atStartOfDay(ZoneId.systemDefault()).toInstant()), StatusPagamentoBoleto.PAGO, 1); for (ExtratoBoleto extrato : extratos) { Assert.assertThat(extrato.getDataPagamento(), not(nullValue(Date.class))); }