Skip to content

Commit

Permalink
Merge branch 'main' into test/cards
Browse files Browse the repository at this point in the history
  • Loading branch information
PritishBudhiraja authored Dec 9, 2024
2 parents 40690dd + c49f278 commit 1d935c0
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 18 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# [0.106.0](https://github.com/juspay/hyperswitch-web/compare/v0.105.3...v0.106.0) (2024-12-09)


### Features

* added cb regex and typo fix ([#811](https://github.com/juspay/hyperswitch-web/issues/811)) ([e925e33](https://github.com/juspay/hyperswitch-web/commit/e925e33556531eb7142ee0a7b26cdbcacc920b15))

## [0.105.3](https://github.com/juspay/hyperswitch-web/compare/v0.105.2...v0.105.3) (2024-12-09)

## [0.105.2](https://github.com/juspay/hyperswitch-web/compare/v0.105.1...v0.105.2) (2024-12-05)
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "orca-payment-page",
"version": "0.105.3",
"version": "0.106.0",
"main": "index.js",
"private": true,
"dependencies": {
Expand Down
34 changes: 22 additions & 12 deletions src/CardPattern.res
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ type patterns = {
pattern: Re.t,
cvcLength: array<int>,
length: array<int>,
maxCVCLenth: int,
maxCVCLength: int,
pincodeRequired: bool,
}
type card = {details: array<patterns>}
let defaultCardPattern = {
issuer: "",
pattern: %re("/^[0-9]/"),
cvcLength: [3],
maxCVCLenth: 3,
maxCVCLength: 3,
length: [16],
pincodeRequired: false,
}
Expand All @@ -23,7 +23,7 @@ let cardPatterns = [
),
cvcLength: [3, 4],
length: [12, 13, 14, 15, 16, 17, 18, 19],
maxCVCLenth: 4,
maxCVCLength: 4,
pincodeRequired: true,
},
{
Expand All @@ -33,14 +33,14 @@ let cardPatterns = [
),
cvcLength: [3],
length: [16],
maxCVCLenth: 3,
maxCVCLength: 3,
pincodeRequired: false,
},
{
issuer: "DinersClub",
pattern: %re("/^(36|38|39|30[0-5])/"),
cvcLength: [3],
maxCVCLenth: 3,
maxCVCLength: 3,
length: [14, 15, 16, 17, 18, 19],
pincodeRequired: false,
},
Expand All @@ -49,14 +49,14 @@ let cardPatterns = [
pattern: %re("/^(6011|64[4-9]|65|622126|622[1-9][0-9][0-9]|6229[0-1][0-9]|622925)/"),
cvcLength: [3],
length: [16],
maxCVCLenth: 3,
maxCVCLength: 3,
pincodeRequired: true,
},
{
issuer: "Mastercard",
pattern: %re("/^(222[1-9]|22[3-9][0-9]|2[3-6][0-9]{2}|27[0-1][0-9]|2720|5[1-5])/"),
cvcLength: [3],
maxCVCLenth: 3,
maxCVCLength: 3,
length: [16],
pincodeRequired: true,
},
Expand All @@ -65,38 +65,48 @@ let cardPatterns = [
pattern: %re("/^3[47]/"),
cvcLength: [3, 4],
length: [14, 15],
maxCVCLenth: 4,
maxCVCLength: 4,
pincodeRequired: true,
},
{
issuer: "Visa",
pattern: %re("/^4/"),
cvcLength: [3],
length: [13, 14, 15, 16, 19],
maxCVCLenth: 3,
maxCVCLength: 3,
pincodeRequired: true,
},
{
issuer: "CartesBancaires",
pattern: %re(
"/^(401(005|006|581)|4021(01|02)|403550|405936|406572|41(3849|4819|50(56|59|62|71|74)|6286|65(37|79)|71[7])|420110|423460|43(47(21|22)|50(48|49|50|51|52)|7875|95(09|11|15|39|98)|96(03|18|19|20|22|72))|4424(48|49|50|51|52|57)|448412|4505(19|60)|45(33|56[6-8]|61|62[^3]|6955|7452|7717|93[02379])|46(099|54(76|77)|6258|6575|98[023])|47(4107|71(73|74|86)|72(65|93)|9619)|48(1091|3622|6519)|49(7|83[5-9]|90(0[1-6]|1[0-6]|2[0-3]|3[0-3]|4[0-3]|5[0-2]|68|9[256789]))|5075(89|90|93|94|97)|51(0726|3([0-7]|8[56]|9(00|38))|5214|62(07|36)|72(22|43)|73(65|66)|7502|7647|8101|9920)|52(0993|1662|3718|7429|9227|93(13|14|31)|94(14|21|30|40|47|55|56|[6-9])|9542)|53(0901|10(28|30)|1195|23(4[4-7])|2459|25(09|34|54|56)|3801|41(02|05|11)|50(29|66)|5324|61(07|15)|71(06|12)|8011)|54(2848|5157|9538|98(5[89]))|55(39(79|93)|42(05|60)|4965|7008|88(67|82)|89(29|4[23])|9618|98(09|10))|56(0408|12(0[2-6]|4[134]|5[04678]))|58(17(0[0-7]|15|2[14]|3[16789]|4[0-9]|5[016]|6[269]|7[3789]|8[0-7]|9[017])|55(0[2-5]|7[7-9]|8[0-2])))/"
),
cvcLength: [3],
length: [16, 17, 18, 19],
maxCVCLength: 3,
pincodeRequired: true,
},
{
issuer: "SODEXO",
pattern: %re("/^(637513)/"),
cvcLength: [3],
length: [16],
maxCVCLenth: 3,
maxCVCLength: 3,
pincodeRequired: false,
},
{
issuer: "BAJAJ",
pattern: %re("/^(203040)/"),
cvcLength: [3],
maxCVCLenth: 3,
maxCVCLength: 3,
length: [16],
pincodeRequired: true,
},
{
issuer: "JCB",
pattern: %re("/^35(2[89]|[3-8][0-9])/"),
cvcLength: [3],
maxCVCLenth: 3,
maxCVCLength: 3,
length: [16],
pincodeRequired: false,
},
Expand Down
2 changes: 1 addition & 1 deletion src/CardSchemeComponent.res
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ let make = (~cardNumber, ~paymentType, ~cardBrand, ~setCardBrand) => {
let enabledCardSchemes =
paymentMethodListValue->PaymentUtils.getSupportedCardBrands->Option.getOr([])

let matchedCardSchemes = cardNumber->CardUtils.getAllMatchedCardSchemes
let matchedCardSchemes = cardNumber->CardUtils.clearSpaces->CardUtils.getAllMatchedCardSchemes

let eligibleCardSchemes = CardUtils.getEligibleCoBadgedCardSchemes(
~matchedCardSchemes,
Expand Down
2 changes: 1 addition & 1 deletion src/CardUtils.res
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ let getStrFromIndex = (arr: array<string>, index) => {
let formatCVCNumber = (val, cardType) => {
let clearValue = val->clearSpaces
let obj = getobjFromCardPattern(cardType)
clearValue->slice(0, obj.maxCVCLenth)
clearValue->slice(0, obj.maxCVCLength)
}

let getCurrentMonthAndYear = (dateTimeIsoString: string) => {
Expand Down
2 changes: 1 addition & 1 deletion src/Payment.res
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ let make = (~paymentMode, ~integrateError, ~logger) => {

React.useEffect(() => {
let obj = getobjFromCardPattern(cardBrand)
let cvcLength = obj.maxCVCLenth
let cvcLength = obj.maxCVCLength
if (
cvcNumberInRange(cvcNumber, cardBrand)->Array.includes(true) &&
cvcNumber->String.length == cvcLength
Expand Down

0 comments on commit 1d935c0

Please sign in to comment.