/** * Validael campo del número de cuenta * * @return true si no tiene errores */ public boolean validateAccountNumber() { List<String> validationErrors = validateField( "cuenta", false, view.getAccountNumber(), view.getAccountNumberValidationRules()); view.setAccountNumberErrors(validationErrors); return validationErrors.size() == 0; }
/** * Invoca a las clases necesarias para registrar una cuenta via web services * * @param client */ private void callRegisterWebService(final Client client) { view.getWSTokenRequester() .getTokenAsync( new WSTokenReceivedCallback() { @Override public void onWSTokenReceived(WSResponse<WSToken> wsTokenResult) { view.showRegistrationErrors(wsTokenResult.getErrors()); if (wsTokenResult.getResult() != null) { AccountWS accountWebService = new AccountWS(wsTokenResult.getResult()); accountWebService.registerAccount( view.getAccountNumber(), view.getNUS(), client.getGmail(), view.getPhoneNumber(), Build.BRAND, Build.MODEL, view.getIMEI(), view.getPreferences().getGCMToken(), new IWSFinishEvent<Account>() { @Override public void executeOnFinished(WSResponse<Account> result) { view.hideWSWaiting(); if (result.getResult() != null) { ElfecAccountsManager.registerAccount(result.getResult()); view.notifyAccountSuccessfulyRegistered(); } else if (!result.hasErrors()) result.addError(new MobileSideException()); view.showRegistrationErrors(result.getErrors()); } }); } else view.hideWSWaiting(); } }); }
/** * Valida el campo del NUS * * @return true si no tiene errores */ public boolean validateNUS() { List<String> validationErrors = validateField("NUS", true, view.getNUS(), view.getNUSValidationRules()); view.setNUSErrors(validationErrors); return validationErrors.size() == 0; }