Skip to content

Commit

Permalink
fix: blik code hyphen removal (#401)
Browse files Browse the repository at this point in the history
Co-authored-by: Pritish Budhiraja <[email protected]>
  • Loading branch information
PritishBudhiraja and Pritish Budhiraja authored May 27, 2024
1 parent a041c04 commit 4953f7a
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
3 changes: 1 addition & 2 deletions src/Payments/PaymentMethodsWrapper.res
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ let make = (~paymentType: CardThemeType.mode, ~paymentMethodName: string) => {
let (country, _) = Recoil.useRecoilState(userCountry)
let (selectedBank, _) = Recoil.useRecoilState(userBank)
let setFieldComplete = Recoil.useSetRecoilState(fieldsComplete)
let cleanBlik = str => str->String.replaceRegExp(%re("/-/g"), "")
let cleanPhoneNumber = str => str->String.replaceRegExp(%re("/\s/g"), "")

let (requiredFieldsBody, setRequiredFieldsBody) = React.useState(_ => Dict.make())
Expand Down Expand Up @@ -79,7 +78,7 @@ let make = (~paymentType: CardThemeType.mode, ~paymentMethodName: string) => {
~fullName=fullName.value,
~email=email.value,
~bank=bank.hyperSwitch,
~blikCode=blikCode.value->cleanBlik,
~blikCode=blikCode.value->removeHyphen,
~phoneNumber=cleanPhoneNumber(
phoneNumber.countryCode->Option.getOr("") ++ phoneNumber.value,
),
Expand Down
2 changes: 1 addition & 1 deletion src/Utilities/DynamicFieldsUtils.res
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ let useRequiredFieldsBody = (
| AddressCity => city.value
| AddressPincode => postalCode.value
| AddressState => state.value
| BlikCode => blikCode.value
| BlikCode => blikCode.value->Utils.removeHyphen
| PhoneNumber => phone.value
| Currency(_) => currency
| Country => country
Expand Down
2 changes: 2 additions & 0 deletions src/Utilities/Utils.res
Original file line number Diff line number Diff line change
Expand Up @@ -1278,3 +1278,5 @@ let getStateNameFromStateCodeAndCountry = (list: JSON.t, stateCode: string, coun
| None => stateCode
}
}

let removeHyphen = str => str->String.replaceRegExp(%re("/-/g"), "")

0 comments on commit 4953f7a

Please sign in to comment.