verygoodsecurity / vgs-collect-ios

VGS Collect iOS SDK
https://www.verygoodsecurity.com/
MIT License
22 stars 15 forks source link

Issue with SSN validation #173

Closed siddharthsuneel-Deserve closed 4 years ago

siddharthsuneel-Deserve commented 4 years ago

Describe the bug VGS Collect SDK is not passing the SSN validation even for a valid input.

To Reproduce Steps to reproduce the behavior:

  1. Create textfield with Configuration

configuration.type = .ssn configuration.type.isRequired = true configuration.type.isRequiredValidOnly = true

  1. Try to call the vgsCollect.sendData
  2. VGS will not pass the validation for a valid user input.

Expected behavior It should pass the validation for valid user input.

Screenshots If applicable, add screenshots to help explain your problem.

Additional context while debugging the SDK found that the regex that is getting used in not appropriate.

For Eg. Suppose user enters "123456789" So VGS shows this input on VGSTextField in pattern "###-##-####" i.e. "123-45-6789"

Now while validating it the text which is passed is "123456789" which is right but on the other hand the regex is expecting the SSN text in "123-45-6789" format which is causing the issue.

Possible Solution Update the regex & remove the requirement of "-" from it.

siddharthsuneel-Deserve commented 4 years ago

Fixed