-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
909eb62
commit f196146
Showing
21 changed files
with
480 additions
and
222 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 0 additions & 5 deletions
5
src/main/java/br/com/correios/api/postagem/plp/DestinatarioPlp.java
This file was deleted.
Oops, something went wrong.
5 changes: 0 additions & 5 deletions
5
src/main/java/br/com/correios/api/postagem/plp/DimensoesObjetoPlp.java
This file was deleted.
Oops, something went wrong.
37 changes: 0 additions & 37 deletions
37
src/main/java/br/com/correios/api/postagem/plp/DocumentoPlpToCorreiosLogConverter.java
This file was deleted.
Oops, something went wrong.
23 changes: 23 additions & 0 deletions
23
src/main/java/br/com/correios/api/postagem/plp/NovaPlp.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package br.com.correios.api.postagem.plp; | ||
|
||
import java.util.Set; | ||
|
||
public class NovaPlp { | ||
|
||
private final RemetentePlp remetente; | ||
private final Set<ObjetoPlp> objetosPlp; | ||
|
||
public NovaPlp(RemetentePlp remetente, Set<ObjetoPlp> objetosPlp) { | ||
this.remetente = remetente; | ||
this.objetosPlp = objetosPlp; | ||
} | ||
|
||
public RemetentePlp getRemetente() { | ||
return remetente; | ||
} | ||
|
||
public Set<ObjetoPlp> getObjetosPlp() { | ||
return objetosPlp; | ||
} | ||
|
||
} |
81 changes: 81 additions & 0 deletions
81
src/main/java/br/com/correios/api/postagem/plp/NovaPlpBuilder.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
package br.com.correios.api.postagem.plp; | ||
|
||
import static com.google.common.collect.Sets.newHashSet; | ||
|
||
import java.util.Set; | ||
|
||
import br.com.correios.api.postagem.CorreiosServicoPostagemAPI; | ||
|
||
public class NovaPlpBuilder { | ||
|
||
private String cartaoDePostagem; | ||
private RemetentePlp remetente; | ||
private Set<ObjetoPlp> objetosPlp; | ||
private Long codigoPlpCliente = 0l; | ||
private CorreiosServicoPostagemAPI correiosServicoPostagemAPI; | ||
|
||
public NovaPlpBuilder(CorreiosServicoPostagemAPI correiosServicoPostagemAPI) { | ||
this.correiosServicoPostagemAPI = correiosServicoPostagemAPI; | ||
} | ||
|
||
public NovaPlpComCartaoDePostagemBuilder comCartaoDePostagem(String cartaoDePostagem) { | ||
this.cartaoDePostagem = cartaoDePostagem; | ||
return new NovaPlpComCartaoDePostagemBuilder(this); | ||
} | ||
|
||
public class NovaPlpComCartaoDePostagemBuilder { | ||
|
||
private NovaPlpBuilder builder; | ||
|
||
public NovaPlpComCartaoDePostagemBuilder(NovaPlpBuilder builder) { | ||
this.builder = builder; | ||
} | ||
|
||
public NovaPlpComRemetenteBuilder deRemetente(RemetentePlp remetente) { | ||
builder.remetente = remetente; | ||
return new NovaPlpComRemetenteBuilder(builder); | ||
} | ||
|
||
} | ||
|
||
public class NovaPlpComRemetenteBuilder { | ||
|
||
private NovaPlpBuilder builder; | ||
|
||
private NovaPlpComRemetenteBuilder(NovaPlpBuilder builder) { | ||
this.builder = builder; | ||
} | ||
|
||
public NovaPlpComObjetoAdicionadoBuilder adicionandoObjeto(ObjetoPlp objetoPlp) { | ||
builder.objetosPlp = newHashSet(objetoPlp); | ||
return new NovaPlpComObjetoAdicionadoBuilder(builder); | ||
} | ||
|
||
} | ||
|
||
public class NovaPlpComObjetoAdicionadoBuilder { | ||
|
||
private NovaPlpBuilder builder; | ||
|
||
private NovaPlpComObjetoAdicionadoBuilder(NovaPlpBuilder builder) { | ||
this.builder = builder; | ||
} | ||
|
||
public NovaPlpComObjetoAdicionadoBuilder adicionandoObjeto(ObjetoPlp objetoPlp) { | ||
builder.objetosPlp.add(objetoPlp); | ||
return new NovaPlpComObjetoAdicionadoBuilder(builder); | ||
} | ||
|
||
public NovaPlpComObjetoAdicionadoBuilder comCodigoPlpCliente(Long codigoPlpCliente) { | ||
builder.codigoPlpCliente = codigoPlpCliente; | ||
return this; | ||
} | ||
|
||
public Plp fechaPlp() { | ||
return correiosServicoPostagemAPI.fechaPlp(cartaoDePostagem, codigoPlpCliente, new NovaPlp(builder.remetente, builder.objetosPlp)); | ||
} | ||
|
||
} | ||
|
||
|
||
} |
Oops, something went wrong.