Skip to content

Commit

Permalink
Merge branch 'main' into feature/three_ds_partB
Browse files Browse the repository at this point in the history
  • Loading branch information
PritishBudhiraja authored May 27, 2024
2 parents baeafe1 + 66b13f5 commit 3e88021
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 6 deletions.
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
## [0.55.2](https://github.com/juspay/hyperswitch-web/compare/v0.55.1...v0.55.2) (2024-05-27)


### Bug Fixes

* blik code hyphen removal ([#401](https://github.com/juspay/hyperswitch-web/issues/401)) ([4953f7a](https://github.com/juspay/hyperswitch-web/commit/4953f7a861ed40ebe2c59b139aa06f9b822f8e67))

## [0.55.1](https://github.com/juspay/hyperswitch-web/compare/v0.55.0...v0.55.1) (2024-05-27)


### Bug Fixes

* sdk button loader issue ([#400](https://github.com/juspay/hyperswitch-web/issues/400)) ([e012642](https://github.com/juspay/hyperswitch-web/commit/e012642865231e6c2787b828730cfc1c41ebbe36))

# [0.55.0](https://github.com/juspay/hyperswitch-web/compare/v0.54.2...v0.55.0) (2024-05-23)


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.55.0",
"version": "0.55.2",
"main": "index.js",
"private": true,
"dependencies": {
Expand Down
14 changes: 14 additions & 0 deletions src/Components/PayNowButton.res
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,23 @@ let make = () => {
let confirmPayload = sdkHandleConfirmPayment->PaymentBody.confirmPayloadForSDKButton
let buttonText = sdkHandleConfirmPayment.buttonText->Option.getOr(localeString.payNowButton)

let handleMessage = (event: Types.event) => {
let json = event.data->Identity.anyTypeToJson->getStringFromJson("")->safeParse
let dict = json->getDictFromJson
switch dict->Dict.get("submitSuccessful") {
| Some(submitSuccessfulVal) =>
if !(submitSuccessfulVal->JSON.Decode.bool->Option.getOr(false)) {
setIsPayNowButtonDisable(_ => false)
setShowLoader(_ => false)
}
| None => ()
}
}

let handleOnClick = _ => {
setIsPayNowButtonDisable(_ => true)
setShowLoader(_ => true)
EventListenerManager.addSmartEventListener("message", handleMessage, "onSubmitSuccessful")
handlePostMessage([("handleSdkConfirm", confirmPayload)])
}

Expand Down
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 3e88021

Please sign in to comment.