2025-06-03 09:20:53 -07:00
|
|
|
<script setup lang="ts">
|
2025-08-14 21:48:38 +01:00
|
|
|
import type Stripe from 'stripe'
|
|
|
|
|
|
2025-12-27 13:37:37 -08:00
|
|
|
import { useVIntl } from '../../composables/i18n'
|
2025-12-20 11:43:04 +00:00
|
|
|
import { commonMessages, getPaymentMethodIcon, paymentMethodMessages } from '../../utils'
|
2025-06-03 09:20:53 -07:00
|
|
|
|
|
|
|
|
const { formatMessage } = useVIntl()
|
|
|
|
|
defineProps<{
|
2025-08-14 21:48:38 +01:00
|
|
|
method: Stripe.PaymentMethod
|
2025-06-03 09:20:53 -07:00
|
|
|
}>()
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<template>
|
2025-08-14 21:48:38 +01:00
|
|
|
<template v-if="'type' in method">
|
2025-12-20 11:43:04 +00:00
|
|
|
<component :is="getPaymentMethodIcon(method.type)" class="size-[1.5em]" />
|
2025-08-14 21:48:38 +01:00
|
|
|
<span v-if="method.type === 'card' && 'card' in method && method.card">
|
|
|
|
|
{{
|
|
|
|
|
formatMessage(commonMessages.paymentMethodCardDisplay, {
|
|
|
|
|
card_brand:
|
|
|
|
|
formatMessage(paymentMethodMessages[method.card.brand]) ??
|
|
|
|
|
formatMessage(paymentMethodMessages.unknown),
|
|
|
|
|
last_four: method.card.last4,
|
|
|
|
|
})
|
|
|
|
|
}}
|
|
|
|
|
</span>
|
|
|
|
|
<template v-else>
|
|
|
|
|
{{
|
|
|
|
|
formatMessage(paymentMethodMessages[method.type]) ??
|
|
|
|
|
formatMessage(paymentMethodMessages.unknown)
|
|
|
|
|
}}
|
|
|
|
|
</template>
|
2025-06-03 09:20:53 -07:00
|
|
|
|
2025-08-14 21:48:38 +01:00
|
|
|
<span v-if="method.type === 'cashapp' && 'cashapp' in method && method.cashapp">
|
|
|
|
|
({{ method.cashapp.cashtag }})
|
|
|
|
|
</span>
|
|
|
|
|
<span v-else-if="method.type === 'paypal' && 'paypal' in method && method.paypal">
|
|
|
|
|
({{ method.paypal.payer_email }})
|
|
|
|
|
</span>
|
|
|
|
|
</template>
|
2025-06-03 09:20:53 -07:00
|
|
|
</template>
|