Skip to content

Commit

Permalink
fix: HS-132: Removing Dynamic Fields from rendering on SDK (#58)
Browse files Browse the repository at this point in the history
  • Loading branch information
ArushKapoorJuspay authored Dec 5, 2023
1 parent 769574c commit b9eee72
Showing 1 changed file with 19 additions and 5 deletions.
24 changes: 19 additions & 5 deletions src/Payments/PaymentMethodsRecord.res
Original file line number Diff line number Diff line change
Expand Up @@ -528,17 +528,31 @@ let getRequiredFieldsFromJson = dict => {

let dynamicFieldsEnabledPaymentMethods = ["crypto_currency", "debit", "credit", "blik"]

let getPaymentMethodFields = (paymentMethod, requiredFields, ~isSavedCardFlow=false, ~isAllStoredCardsHaveName=false, ()) => {
let getPaymentMethodFields = (
paymentMethod,
requiredFields,
~isSavedCardFlow=false,
~isAllStoredCardsHaveName=false,
(),
) => {
let requiredFieldsArr =
requiredFields
->Utils.getDictFromJson
->Js.Dict.values
->Js.Array2.map(item => {
let val = item->Utils.getDictFromJson->getRequiredFieldsFromJson
if isSavedCardFlow && val.display_name === "card_holder_name" && isAllStoredCardsHaveName {
None
let requiredField = item->Utils.getDictFromJson->getRequiredFieldsFromJson
if requiredField.value === "" {
if (
isSavedCardFlow &&
requiredField.display_name === "card_holder_name" &&
isAllStoredCardsHaveName
) {
None
} else {
requiredField.field_type
}
} else {
val.field_type
None
}
})
requiredFieldsArr->Js.Array2.concat(
Expand Down

0 comments on commit b9eee72

Please sign in to comment.