From 7640f5d74d7e4f4ee53b3f1be9e46e51a40cd4f4 Mon Sep 17 00:00:00 2001 From: nobswebdev Date: Sun, 6 Sep 2026 16:07:44 +0200 Subject: [PATCH] generalize CMS order invoice payment panel for multi-crypto invoices. --- ...Panel.vue => OrderInvoicePaymentPanel.vue} | 32 ++++++++++++------- .../OrderManualShippingQuotePanel.vue | 3 +- cms/src/components/OrderPaymentPanel.vue | 2 +- cms/src/types/payment/InvoiceExtended.ts | 1 + cms/src/types/payment/PaymentMethod.ts | 5 --- 5 files changed, 23 insertions(+), 20 deletions(-) rename cms/src/components/{OrderMoneroPaymentPanel.vue => OrderInvoicePaymentPanel.vue} (78%) diff --git a/cms/src/components/OrderMoneroPaymentPanel.vue b/cms/src/components/OrderInvoicePaymentPanel.vue similarity index 78% rename from cms/src/components/OrderMoneroPaymentPanel.vue rename to cms/src/components/OrderInvoicePaymentPanel.vue index ab3241d..ac27640 100644 --- a/cms/src/components/OrderMoneroPaymentPanel.vue +++ b/cms/src/components/OrderInvoicePaymentPanel.vue @@ -8,14 +8,12 @@ - {{ invoice.expectedTotalCrypto }} {{ paymentMethodCryptoCurrency[invoice.paymentMethod] }} + {{ invoice.expectedTotalCrypto }} {{ invoice.paymentLabel }} - - {{ formatFiatPrice(fiatPerXmrAtCreation, config.shopFiatCurrency) }} / - {{ paymentMethodCryptoCurrency[invoice.paymentMethod] }} + + {{ formatFiatPrice(fiatPerCryptoAtCreation, config.shopFiatCurrency) }} / + {{ invoice.paymentLabel }} @@ -37,9 +35,7 @@ @@ -69,7 +65,7 @@ import { computed, type PropType } from 'vue'; import { config } from '@/config'; import type { InvoiceExtended } from '@/types/payment/InvoiceExtended'; -import { paymentMethodCryptoCurrency } from '@/types/payment/PaymentMethod'; +import { PaymentMethod } from '@/types/payment/PaymentMethod'; import { formatDate } from '@/utils/formatDate'; import { formatFiatPrice } from '@/utils/formatFiatPrice'; import { resolveInvoiceStatusTagType } from '@/utils/order/resolveInvoiceStatusTagType'; @@ -85,13 +81,25 @@ const props = defineProps({ }, emptyText: { type: String, - default: 'No Monero payment session.' + default: 'No payment session.' } }); const payments = computed(() => props.invoice?.payments ?? []); -const fiatPerXmrAtCreation = computed(() => props.invoice?.moneroDetails?.fiatPerXmrAtCreation); +const fiatPerCryptoAtCreation = computed(() => { + const invoice = props.invoice; + + if (!invoice) { + return undefined; + } + + if (invoice.paymentMethod === PaymentMethod.Btc) { + return invoice.btcDetails?.fiatPerBtcAtCreation; + } + + return invoice.moneroDetails?.fiatPerXmrAtCreation; +});