-
Notifications
You must be signed in to change notification settings - Fork 67
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add regex for UnionPay and allow card number checking if cardbrand not detected #882
base: main
Are you sure you want to change the base?
Conversation
383f810
to
2998850
Compare
src/Payments/CardPayment.res
Outdated
if cardBrand != "" { | ||
[("card_network", cardBrand->JSON.Encode.string)] | ||
} else { | ||
[] | ||
[("card_network", JSON.Encode.null)] | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let cardNetwork = [
("card_network", cardBrand != "" ? cardBrand->JSON.Encode.string : JSON.Encode.null),
]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
src/Payment.res
Outdated
if cardBrand != "" { | ||
[("card_network", cardBrand->JSON.Encode.string)] | ||
} else { | ||
[] | ||
[("card_network", JSON.Encode.null)] | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let cardNetwork = [
("card_network", cardBrand != "" ? cardBrand->JSON.Encode.string : JSON.Encode.null),
]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
d4a45b9
to
97744f2
Compare
97744f2
to
e6c9a84
Compare
Type of Change
Description
This update enhances our card validation logic by adding regex support for UnionPay and allow card number checking if cardbrand not detected.
The UnionPay regex pattern and pin was derived from the following sources:
How did you test it?
I have checked it by running the local React demo app.
If the card brand is not detected but the card number is valid (passes the Luhn test and falls within the valid card number length range), we allow the user to make a payment. We send
card_network
asnull
.I have also changed the default pattern, as many card brands have different CVC and card number lengths.
I have removed
checkIsTestCardWildcard
, as it is passing luhn test.Checklist
npm run re:build