Handle the Centinel Lookup Response and SDK handle the Challenge UI - iOS
- Bharadwaj Reddy Sama (Unlicensed)
- Kayleigh LaSalle
After the completion of the cmpi_lookup request, check the CMPI_Lookup_Response for the following fields :
- ThreeDSVersion = 2.X ( 2.0, 2.1, etc)
- Enrolled = Y
- PAResStatus = C
Upon validating the above fields, you will call [session continueWithTransactionId.. ] to hand control to SDK for performing the challenge between the user and the issuing bank. Use the code snippet below for completing the session's continue.
cardinal session continue is updated without the hardcoded directoryServerID.
[session continueWithTransactionId: @"[TRANSACTION_ID]" payload: @"[PAYLOAD]"
directoryServerID: CCADirectoryServerIDVisa didValidateDelegate: self];
In continue for Quick Integration, a class conforming to a protocol CardinalValidationDelegate (and implement a method stepUpDidValidate) should be passed as a parameter. Following is the example of class conforming to CardinalValidationDelegate protocol.
@interface YourViewController()<CardinalValidationDelegate>{ //Conform your ViewController or any other class to CardinalValidationDelegate protocol } @end @implementation YourViewController /** * This method is triggered when the transaction has been terminated.This is how SDK hands back * control to the merchant's application. This method will * include data on how the transaction attempt ended and * you should have your logic for reviewing the results of * the transaction and making decisions regarding next steps. * JWT will be empty if validate was not successful * * @param session * @param validateResponse * @param serverJWT */ -(void)cardinalSession:(CardinalSession *)session stepUpDidValidateWithResponse:(CardinalResponse *)validateResponse serverJWT:(NSString *)serverJWT{ } @end
If continue is being called in the same class then the following method is called to start StepUpFlow:
[session continueWithTransactionId: @"[TRANSACTION_ID]" payload: @"[PAYLOAD]" didValidateDelegate: self];
class YourViewController:CardinalValidationDelegate { /** * This method is triggered when the transaction has been terminated.This is how SDK hands back * control to the merchant's application. This method will * include data on how the transaction attempt ended and * you should have your logic for reviewing the results of * the transaction and making decisions regarding next steps. * JWT will be empty if validate was not successful * * @param session * @param validateResponse * @param serverJWT */ func cardinalSession(cardinalSession session: CardinalSession!, stepUpValidated validateResponse: CardinalResponse!, serverJWT: String!) { } }
If continue is being called in the same class then the following method is called to start StepUpFlow:
session.continueWith(transactionId: "[TRANSACTION_ID]", payload: "[PAYLOAD]", validationDelegate: self)
stepUpDidValidate is triggered when the transaction has been terminated. This is how the Cardinal Mobile SDK hands back control to the merchant's application. This event will include data on how the transaction attempt ended and should be where you review the results of the transaction and make decisions regarding the next steps. The field ActionCode should be used to determine the overall state of the transaction. On the first pass, we recommend that on an ActionCode of 'SUCCESS' or 'NOACTION' you send the response JWT to your backend for verification. There is more information on verifying JWT's in the next section.
-(void)cardinalSession:(CardinalSession *)session stepUpDidValidateWithResponse:(CardinalResponse *)validateResponse serverJWT:(NSString *)serverJWT{ switch (validateResponse.actionCode) { case CardinalResponseActionCodeSuccess: // Handle successful transaction, send JWT to backend to verify break; case CardinalResponseActionCodeNoAction: // Handle no actionable outcome break; case CardinalResponseActionCodeFailure: // Handle failed transaction attempt break; case CardinalResponseActionCodeError: // Handle service level error break; case CardinalResponseActionCodeCancel: // Handle transaction canceled by user break; case CardinalResponseActionCodeTimeout: // Handle transaction timeout. break; } }
func cardinalSession(cardinalSession session: CardinalSession!, stepUpValidated validateResponse: CardinalResponse!, serverJWT: String!) { switch validateResponse.actionCode { case .success: // Handle successful transaction, send JWT to backend to verify break case .noAction: // Handle no actionable outcome break case .failure: // Handle failed transaction attempt break case .error: // Handle service level error break case .cancel: // Handle transaction canceled by user break case .timeout: // Handle transaction timedout break } }
ValidateResponse Object
Properties | Type | Description |
---|---|---|
isValidated | BOOL | This value represents whether the transaction was successful or not. |
errorNumber | NSInteger | Application error number. A non-zero value represents the error encountered while attempting the process the message request. |
errorDescription | NSString | Application error description for the associated error number. |
payment | CardinalPayment | Check CardinalPayment object for detailed information. |
actionCode | CardinalResponseActionCode | The resulting state of the transaction. ENUM with the following possible values: CardinalResponseActionCodeSuccess, CardinalResponseActionCodeNoAction, CardinalResponseActionCodeFailure, CardinalResponseActionCodeError, CardinalResponseActionCodeCancel, CardinalResponseActionCodeTimeout |