Files
web/packages/design-system/lib/components/Payment/PaymentMethodIcon.tsx
Anton Gunnarsson 7faa9933a2 Merged in feat/sw-3642-inject-sas-eb-payment (pull request #3243)
feat(SW-3642): Enable SAS EB payments

* Wip add SAS eb payment

* Add validate payment call

* Check booking status payment method to determine validation

* Clean up getPaymentData

* Fix PartnerPoints casing

* Add comment for validatePartnerPayment error handling

* Remove comment


Approved-by: Joakim Jäderberg
2025-12-11 13:23:12 +00:00

63 lines
2.3 KiB
TypeScript

import { PaymentMethodEnum } from '@scandic-hotels/common/constants/paymentMethod'
import { GenericCardIcon } from './Icons/GenericCardIcon'
import { SwishIcon } from './Icons/SwishIcon'
import { VippsIcon } from './Icons/VippsIcon'
import { MobilePayIcon } from './Icons/MobilePayIcon'
import { ApplePayIcon } from './Icons/ApplePayIcon'
import { GooglePayIcon } from './Icons/GooglePayIcon'
import { PayPalIcon } from './Icons/PayPalIcon'
import { KlarnaIcon } from './Icons/KlarnaIcon'
import { AmericanExpressIcon } from './Icons/AmericanExpressIcon'
import { DanKortIcon } from './Icons/DanKortIcon'
import { DinersClubIcon } from './Icons/DinersClubIcon'
import { JcbIcon } from './Icons/JcbIcon'
import { MasterCardIcon } from './Icons/MasterCardIcon'
import { VisaIcon } from './Icons/VisaIcon'
import { MaestroIcon } from './Icons/MaestroIcon'
import { ChinaUnionPayIcon } from './Icons/ChinaUnionPayIcon'
import { DiscoverIcon } from './Icons/DiscoverIcon'
import { PaymentIconProps } from './Icons/IconProps'
const paymentMethods: Partial<
Record<
keyof typeof PaymentMethodEnum,
(props: PaymentIconProps) => React.ReactNode
>
> = {
swish: (props) => <SwishIcon {...props} />,
vipps: (props) => <VippsIcon {...props} />,
mobilePay: (props) => <MobilePayIcon {...props} />,
applePay: (props) => <ApplePayIcon {...props} />,
googlePay: (props) => <GooglePayIcon {...props} />,
payPal: (props) => <PayPalIcon {...props} />,
klarna: (props) => <KlarnaIcon {...props} />,
americanExpress: (props) => <AmericanExpressIcon {...props} />,
dankort: (props) => <DanKortIcon {...props} />,
dinersClub: (props) => <DinersClubIcon {...props} />,
jcb: (props) => <JcbIcon {...props} />,
masterCard: (props) => <MasterCardIcon {...props} />,
visa: (props) => <VisaIcon {...props} />,
maestro: (props) => <MaestroIcon {...props} />,
chinaUnionPay: (props) => <ChinaUnionPayIcon {...props} />,
discover: (props) => <DiscoverIcon {...props} />,
PartnerPoints: () => null,
}
type PaymentMethodIconProps = {
paymentMethod: PaymentMethodEnum
className?: string
alt?: string
}
export const PaymentMethodIcon = ({
paymentMethod,
...props
}: PaymentMethodIconProps) => {
const Icon = paymentMethods[paymentMethod]
if (!Icon) {
return <GenericCardIcon {...props} role="img" />
}
return <Icon {...props} role="img" />
}