Deleting Account Flow for iOS

casan221saas
A user can delete an account from the app at any point of time.
The user’s on-boarded record with the CA solution remains intact even after the user deletes all the accounts from the app.
This section covers the following topics:
For information about the APIs mentioned in these topics, see API Reference for iOS.
Steps in the Deleting Account Flow
The following steps take place when the user deletes an account:
  1. The user opens the app.
  2. The user left-swipes the account that she wants to delete.
  3. The app displays the Generate OTP and Delete options.
    Deleting_Account_01_Open_Menu.png
  4. The user taps the Delete option.
  5. The app displays a message prompting the user to confirm that she wants to delete the account.
    Deleting_Account_02_Delete_Prompt.png
  6. When the user taps Yes, the account is deleted. A message stating that the account has been deleted is displayed.
Sequence Diagrams for the Deleting Account Flow
For sequence diagrams that summarize the API flow during various Deleting Account flow scenarios, see Sequence Diagrams for Unenrollment Flows.
Deleting Account Flow Diagram
The following flow diagram shows the sequence of API calls that take place when an account for which CA Strong Authentication has been activated is deleted from the app.
iOS - Deleting Account
iOS - Deleting Account
Deleting Multiple Accounts Flow Diagram
The following flow diagram shows the sequence of API calls that take place when the user deletes multiple accounts for which CA Strong Authentication has been activated.
iOS - Deleting Multiiple Accounts
iOS - Deleting Multiiple Accounts
Sample Code for the Deleting Account Flow
The following is sample code for deleting an account for which CA Strong Authentication has been activated:
//Code snippet for the Deleting Account flow
//Get the AccountDetails object selected by the user
AccountDetails *deleteAccount=[
a
ccountDetails objectAtIndex:indexPathToBeDeleted.row];
//Call Delete Account API here
AuthenticationHandler * m3dsHandler = [[AuthenticationHandler alloc] init];
AccountDeletionResponse * accountDeletionResponse = [m3dsHandler deleteAccount:deleteAccount];
if(accountDeletionResponse != nil && [[accountDeletionResponse status] isEqualToString:@"SUCCESS"]) {
//Handle Success Scenario
} else {
//Handle Failure Scenario
}
Sample Code for the Deleting Multiple Accounts Flow
The following is sample code for the Deleting Multiple Accounts flow:
//Code snippet for the Deleting Multiple Accounts flow
AuthenticationHandler * authenticationHandler = [[AuthenticationHandler alloc] init];
//If user selects all existing accounts to be deleted
//If removePinSetup = true, then remove all the accounts and also the PIN that the user had set up
//Else removePinSetup = false, then remove all the accounts but retain the PIN
//If removeFromServer = true, then remove the accounts from the CA Strong Authentication server.
// If user selects some existing accounts to be deleted
UnenrollmentResponse *unEnrollmentResponse = [authenticationHandler unenrollAccounts:accountsSelectedByUser removeFromRemote:true];
if ([unEnrollmentResponse.status isEqualToString:@""SUCCESS""]) {
for(UnenrollmentResponse *successAccounts in unEnrollmentResponse.successStatusArray)
{
NSLog(@""Successfully deleted accountId : %@"", successAccounts.accountId);
//Prepare a success message or process the specified accounts have been deleted.
}
}
if ([unEnrollmentResponse.status isEqualToString:@""FAILURE""]) {
for(UnenrollmentResponse *failureAccounts in unEnrollmentResponse.failureStatusArray)
{
NSLog(@""Failed to delete accountId : %@"", failureAccounts.accountId);
NSLog(@""Error code : %@"", failureAccounts.errorCode);
//Prepare a failure message or process the specified accounts have not been deleted.
}
}"