Accepted ACS (Please go through ticket description)
Code level changes
Renamed CardTokenTestData to TokenizationRequestTestData
Refactored and added new test cases
Improved API spec for CreateToken for CVVComponentMediator using a sealed class to represent the result of CVV tokenization. This can provide better type safety and make the code more readable. Here's a possible API design using a sealed class, example as below:
cvvComponentMediator.createToken { result ->
when (result) {
is CVVTokenizationResultHandler.Success -> {
val tokenDetails = result.tokenDetails
context.showAlertDialog(
title = context.getString(R.string.token_generated), message = tokenDetails.token
)
}
is CVVTokenizationResultHandler.Failure -> {
val errorMessage = result.errorMessage
context.showAlertDialog(
title = context.getString(R.string.token_generated_failed), message = errorMessage
)
}
}
}
Created CVVTokenizationUseCase from Frames to hit the createToken from Checkout module (reusing the existing implementation)
Injected CardScheme from CVVComponentMediator in tokenization to handle the CVV validation from the SDK side and then call the tokenization endpoint
On failure of CVV Validation, SDK returns a common error message as "Please enter a valid security code"
Functionality details
Updated sample app for tokenisation (part of PIMOB-2182
Added CVV component variants with different schemes and customisation into sample app
Added new endpoint createToken in checkout module
Note: Currently tokenisation error handling is part of the existing implementation and we are returning only an error message with "error_type": "request_invalid" and an error response code. We need to improve this error handling and it is in backlog for us. Reference Github issue
Test Steps
Open the kotlin sample app and navigate to CVVComponent screen
Test all 4 cvv components for tokenisation
What to test:
The first 3 CVV components are handled with pay button validation where the merchant will know whether the entered cvv is valid or not and based on it they can handle the pay button
If the merchant applies a card scheme, the CVV field will have the typing length validation. For instance, if cvv is visa type, the user can type only 3 characters and if it is AMEX, the user can add up to 4 values
For Tokenisation error handling testing, the last CVV component does not have the pay button validation. So,
When the merchant does not handle the pay button, SDK will do the CVV validation first. For instance, Visa scheme. if without entering CVV or entering an invalid CVV results in displaying an error message from the client side.
When a user enters the valid cvv, SDK will call the tokenisation endpoint and return a tokenisation response from the server side to the application layer
Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.
[X] Reviewers assigned
[X] I have performed a self-review of my code and manual testing
[X] Lint and unit tests pass locally with my changes
[X] I have added tests that prove my fix is effective or that my feature works
[X] I have added necessary documentation (if applicable)
Further comments
If this is a relatively large or complex change, kick off the discussion by explaining why you choose the solution you did and what alternatives you considered, etc...
Issue
PIMOB-2138
Proposed changes
Accepted ACS (Please go through ticket description)
Code level changes
CardTokenTestData
toTokenizationRequestTestData
CreateToken
forCVVComponentMediator
using a sealed class to represent the result of CVV tokenization. This can provide better type safety and make the code more readable. Here's a possible API design using a sealed class, example as below:CVVTokenizationUseCase
from Frames to hit thecreateToken
fromCheckout
module (reusing the existing implementation)CardScheme
fromCVVComponentMediator
in tokenization to handle the CVV validation from the SDK side and then call the tokenization endpointcreateToken
incheckout
moduleNote: Currently tokenisation error handling is part of the existing implementation and we are returning only an error message with
"error_type": "request_invalid"
and an error response code. We need to improve this error handling and it is in backlog for us. Reference Github issueTest Steps
What to test:
video.webm
Checklist
Put an
x
in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.Further comments
If this is a relatively large or complex change, kick off the discussion by explaining why you choose the solution you did and what alternatives you considered, etc...