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)
masterControllerAdapter.sendEvent2MasterController(
KSMStartChangePinEvent(), withCompletionHandler: nil)
Next, you need to send the SetNewPin Event, this is done by the following snippets:
Triggering SetNewPin Event (Swift)
masterControllerAdapter.sendEvent2MasterController(
KSMProvideSetNewPinEvent(currentPin: oldPin,
andPin: newPin),
withCompletionHandler: nil)
Android/Kotlin
For Kotlin, we have created a dedicated method in the MCHandler class of our example app to trigger this event. Below is the code snippet:
Triggering StartChangePin Event (Kotlin)
fun triggerStartChangePinEvent() {
logDebug(
"triggering StartChangePinEvent",
"triggerStartChangePinEvent",
TAG
)
launchIO {
mcEventHandler?.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) {
logDebug(
"triggering ProvideSetNewPinEvent with currentPin =>$currentPin && newPin => $newPin",
"triggerProvideSetNewPinEvent",
TAG
)
val setNewPinEvent = ProvideSetNewPinEvent(currentPin, newPin)
launchIO {
mcEventHandler?.postEvent(setNewPinEvent)?.then {
// handle result
}
}
}