Created
November 19, 2010 16:06
-
-
Save plagelao/706693 to your computer and use it in GitHub Desktop.
Banco capaz de avisar a quien quiera escucharle de los eventos que se generan
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
public class Banco { | |
private final OperacionesBancarias operacionesBancarias; | |
private final InteresadoEnAccesoACuenta suscriptor; | |
public Banco(OperacionesBancarias operacionesBancarias, | |
InteresadoEnAccesoACuenta suscriptor) { | |
this.operacionesBancarias = operacionesBancarias; | |
this.suscriptor = suscriptor; | |
} | |
public void obtenerCuenta(String usuario, Pin pin) { | |
try { | |
Token token = operacionesBancarias.autenticarUsuario(usuario, pin); | |
suscriptor.cuentaObtenida(Cuenta.crear(token)); | |
} catch (AccesoInvalidadoPorMultiplesReintentosFallidos e) { | |
suscriptor.cuentaAnulada() | |
} catch (CredencialesIncorrectas e) { | |
suscriptor.credencialesIncorrectas(); | |
} catch (BancoInaccesible e) { | |
suscriptor.bancoInaccesible(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment