Skip to content

Commit

Permalink
feat: HS-182: Added Evoucher Payment Method Type Redirection flow (#73)
Browse files Browse the repository at this point in the history
  • Loading branch information
ArushKapoorJuspay authored Dec 19, 2023
1 parent d91a4cb commit 414ee37
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 13 deletions.
7 changes: 7 additions & 0 deletions src/Payments/PaymentMethodsRecord.res
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
7 changes: 4 additions & 3 deletions src/Utilities/PaymentBody.res
Original file line number Diff line number Diff line change
Expand Up @@ -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),
]

Expand Down Expand Up @@ -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)
| _ => []
}
}
24 changes: 14 additions & 10 deletions src/Utilities/PaymentUtils.res
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 414ee37

Please sign in to comment.