*
* @param actEvent contains information about the event that triggers the execution of this operation
*/
public void ChangePin(ActionEvent actEvent) {
RequestContext ctx = RequestContext.getCurrentInstance();
FacesMessage msg = null;
boolean bChangedPin = false;
try {
if (!getLoggedOnUser().getChangePin().getNewPin().equals(getLoggedOnUser().getChangePin().getRetryPin())) {
bChangedPin = false;
msg = new FacesMessage(FacesMessage.SEVERITY_ERROR, "Password mismatch",
"Please make sure that your re-type your pin correctly!");
} else {
BaseDTO result = _customerWebService.getCustomerServiceImplPort().changeCustomer(
getLoggedOnUser().getProfileData().getUserName(),
getLoggedOnUser().getChangePin().getCurrentPin(),
getLoggedOnUser().getChangePin().getNewPin());
if (result.getReturncode() == 0) {
bChangedPin = true;
msg = new FacesMessage(FacesMessage.SEVERITY_INFO, "Pin changed", "Your pin has been changed successfully!");
} else {
bChangedPin = false;
msg = new FacesMessage(FacesMessage.SEVERITY_ERROR, "Pin not changed", result.getMessage());
}
}
} catch (Exception ex) {
bChangedPin = false;
msg = new FacesMessage(FacesMessage.SEVERITY_FATAL, "Error communicating with customer web service!",
String.format("Unable to access customer web service at %s: %s",
_customerWebService.getWSDLDocumentLocation(),
ex.getMessage()));
}
if (msg != null)
FacesContext.getCurrentInstance().addMessage(null, msg);
ctx.addCallbackParam("changedPin", bChangedPin);
}