diff --git a/src/Payments/PaymentMethodsRecord.res b/src/Payments/PaymentMethodsRecord.res index c982aefa6..84aee17c9 100644 --- a/src/Payments/PaymentMethodsRecord.res +++ b/src/Payments/PaymentMethodsRecord.res @@ -452,6 +452,13 @@ let paymentMethodsFields = [ fields: [Country, InfoElement], miniIcon: Some(icon("open_banking", ~size=19)), }, + { + paymentMethodName: "evoucher", + icon: Some(icon("cashtocode", ~size=50)), + displayName: "E-Voucher", + fields: [InfoElement], + miniIcon: Some(icon("cashtocode", ~size=19)), + }, ] type required_fields = { diff --git a/src/Utilities/PaymentBody.res b/src/Utilities/PaymentBody.res index 2a873f0ac..fee55f32a 100644 --- a/src/Utilities/PaymentBody.res +++ b/src/Utilities/PaymentBody.res @@ -1332,9 +1332,9 @@ let bizumBody = () => [ ), ] -let rewardBody = () => [ +let rewardBody = (~paymentMethodType) => [ ("payment_method", "reward"->Js.Json.string), - ("payment_method_type", "classic"->Js.Json.string), + ("payment_method_type", paymentMethodType->Js.Json.string), ("payment_method_data", "reward"->Js.Json.string), ] @@ -1545,9 +1545,10 @@ let getPaymentBody = ( | "alma" => almaBody() | "atome" => atomeBody() | "multibanco" => multibancoBody(~email) - | "classic" => rewardBody() + | "classic" => rewardBody(~paymentMethodType=paymentMethod) | "card_redirect" => cardRedirectBody() | "open_banking_uk" => openBankingUKBody(~country) + | "evoucher" => rewardBody(~paymentMethodType=paymentMethod) | _ => [] } } diff --git a/src/Utilities/PaymentUtils.res b/src/Utilities/PaymentUtils.res index 145a44f1a..b14e2acce 100644 --- a/src/Utilities/PaymentUtils.res +++ b/src/Utilities/PaymentUtils.res @@ -196,18 +196,22 @@ let getDisplayNameAndIcon = ( ->Belt.Array.get(0) switch customNameObj { | Some(val) => - val.paymentMethodName === "classic" + val.paymentMethodName === "classic" || val.paymentMethodName === "evoucher" ? { - let id = val.aliasName->Js.String2.split(" ") - ( - val.aliasName, - Some( - PaymentMethodsRecord.icon( - id->Belt.Array.get(0)->Belt.Option.getWithDefault(""), - ~size=19, + switch val.aliasName { + | "" => (defaultName, defaultIcon) + | aliasName => + let id = aliasName->Js.String2.split(" ") + ( + aliasName, + Some( + PaymentMethodsRecord.icon( + id->Belt.Array.get(0)->Belt.Option.getWithDefault(""), + ~size=19, + ), ), - ), - ) + ) + } } : (defaultName, defaultIcon) | None => (defaultName, defaultIcon)