Skip to content

Commit

Permalink
Torna a PixOrder.notification_url opcional
Browse files Browse the repository at this point in the history
Ao gerar um pedido PIX a partir de um servidor
rodando localmente, a URL localhost do servidor
não pode ser acessada pelo serviço do PagBank
para notificar a aplicação quando o PIX for pago.

Neste casos, a notification_url pode ser omitida.

Signed-off-by: Manoel Campos <[email protected]>
  • Loading branch information
manoelcampos committed Oct 10, 2023
1 parent fc3dc4b commit 233f258
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>br.com.competeaqui</groupId>
<artifactId>pagseguro-api</artifactId>
<version>0.0.4-snapshot</version>
<version>0.0.5-snapshot</version>

<name>PagSeguro Java API</name>
<description>
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/br/com/competeaqui/pagseguro/service/PixOrder.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,14 @@ public PixOrder(@NonNull String reference_id, @NonNull Customer customer) {
}

public PixOrder(@NonNull String reference_id, @NonNull Customer customer, QrCode qrcode, @NonNull String notification_url) {
this(null, reference_id, null, customer, null, List.of(qrcode), null, emptyList(), List.of(validateUrl(notification_url)), null);
this(null, reference_id, null, customer, null, List.of(qrcode), null, emptyList(), getSingleList(notification_url), null);
}

private static String validateUrl(final String notification_url) {
if(notification_url.isBlank())
throw new IllegalArgumentException("notification_url é obrigatória");
private static List<String> getSingleList(final String value) {
if(value == null || value.isBlank())
return List.of();

return notification_url;
return List.of(value);
}

}

0 comments on commit 233f258

Please sign in to comment.