Change PIN
Once a user has logged in to the application, they can change their pin. The Change Pin flow involves these events.
ChangePin event flow-diagram.
The following diagram shows the working of the change pin process.
iOS/Swift
The user needs to trigger a StartChangePin Event, so for Swift you can trigger that by this snippet:
Triggering StartChangePin Event (Swift)
func changePin(request: ChangePinRequest, completion: @escaping (ActionResult) -> Void) {
let validation = validateChangePinRequest(request: request)
if validation.success {
self.completion = completion
changePinRequest = request
let event = KSMStartChangePinEvent()
timer = CallTimer(event: event)
MasterControllerAdapter.sharedInstance.sendEvent2MasterController(event: event)
} else {
completion(validation)
}
}
Next, you need to send the SetNewPin Event, this is done by the following snippets:
Triggering SetNewPin Event (Swift)
func startChangePin(event: KSMStartSetNewPinEvent) {
let changePinEvent = KSMProvideSetNewPinEvent(currentPin: changePinRequest.pin, andPin: changePinRequest.newPin)
MasterControllerAdapter.sharedInstance.sendEvent2MasterController(event: changePinEvent)
}
Android/Kotlin
Triggering StartChangePin Event (Kotlin)
fun triggerStartChangePinEvent() {
synchronousEventHandler.postEvent(StartChangePinEvent())
}
Next, you need to send the ProvideSetNewPinEvent, this is done by the following snippets:
Triggering SetNewPin Event (Kotlin)
fun triggerProvideSetNewPinEvent(currentPin: String, newPin: String) {
val setNewPinEvent = ProvideSetNewPinEvent(currentPin, newPin)
synchronousEventHandler.postEvent(setNewPinEvent)?.then {
// handle result
}
}