Skip to content

Commit

Permalink
fix: Business & Shipping Details Updated (#245)
Browse files Browse the repository at this point in the history
Co-authored-by: Pritish Budhiraja <[email protected]>
  • Loading branch information
dvenga and Pritish Budhiraja authored Jan 11, 2024
1 parent 15d2e6e commit 8a91072
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 8 deletions.
28 changes: 27 additions & 1 deletion src/screens/HyperSwitch/Order/OrderEntity.res
Original file line number Diff line number Diff line change
Expand Up @@ -796,8 +796,34 @@ let getFRMDetails = dict => {
dict->getJsonObjectFromDict("frm_message")->getDictFromJsonObject->itemToObjMapperForFRMDetails
}

let concatValueOfGivenKeysOfDict = (dict, keys) => {
Array.reduceWithIndex(keys, "", (acc, key, i) => {
let val = dict->getString(key, "")
let delimiter = if val->String.length > 0 {
if key !== "first_name" {
i + 1 == keys->Array.length ? "." : ", "
} else {
" "
}
} else {
""
}
String.concat(acc, `${val}${delimiter}`)
})
}

let itemToObjMapper = dict => {
let addressKeys = ["line1", "line2", "line3", "city", "state", "country", "zip"]
let addressKeys = [
"first_name",
"last_name",
"line1",
"line2",
"line3",
"city",
"state",
"country",
"zip",
]
{
payment_id: dict->getString("payment_id", ""),
merchant_id: dict->getString("merchant_id", ""),
Expand Down
7 changes: 0 additions & 7 deletions src/utils/LogicUtils.res
Original file line number Diff line number Diff line change
Expand Up @@ -642,10 +642,3 @@ let listOfMatchedText = (text, searchText) => {
}
}
}

let concatValueOfGivenKeysOfDict = (dict, keys) => {
Array.reduceWithIndex(keys, "", (acc, key, i) => {
let delimiter = i + 1 == keys->Array.length ? "." : ", "
String.concat(acc, `${dict->getString(key, "")}${delimiter}`)
})
}

0 comments on commit 8a91072

Please sign in to comment.