Skip to content

Instantly share code, notes, and snippets.

@plagelao
Created November 17, 2010 19:04
Show Gist options
  • Save plagelao/703843 to your computer and use it in GitHub Desktop.
Save plagelao/703843 to your computer and use it in GitHub Desktop.
Banco que viola la D de S.O.L.I.D.
public class Banco {
private final Conector conector;
private final GeneradorToken generadorToken;
public Banco(Conector conector, GeneradorToken generadorToken) {
this.conector = conector;
this.generadorToken = generadorToken;
}
public Cuenta obtenerCuenta(String usuario, Pin pin) {
String json = conector.obtenerJsonDeRespuesta("debit_card/challenge?" +
"card=" +
usuario +
"&pin=" +
pin.digitos());
return Cuenta.crear(crearToken(json), conectorHttp);
}
private String crearToken(String json) {
return generadorToken.crear(json);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment