@@ -163,6 +174,7 @@
Cancelled
Processing
Upcoming
+ Expiring
{{ charge.status }}
⋅
@@ -274,7 +286,6 @@ import { formatCategory, formatPrice } from '@modrinth/utils'
import dayjs from 'dayjs'
import ModrinthServersIcon from '~/components/ui/servers/ModrinthServersIcon.vue'
-import { products } from '~/generated/state.json'
const { addNotification } = injectNotificationManager()
@@ -333,9 +344,6 @@ const subscriptionCharges = computed(() => {
.filter((charge) => charge.subscription_id === subscription.id)
.slice()
.sort((a, b) => dayjs(b.due).diff(dayjs(a.due))),
- product: products.find((product) =>
- product.prices.some((price) => price.id === subscription.price_id),
- ),
}
})
})
@@ -369,13 +377,17 @@ function showModifyModal(charge) {
async function refundCharge() {
refunding.value = true
try {
+ const amountParsed = Math.max(0, Math.floor(Number(refundAmount.value) || 0))
+ const payload =
+ refundType.value === 'partial'
+ ? { type: 'partial', amount: amountParsed, unprovision: unprovision.value }
+ : refundType.value === 'none'
+ ? { type: 'none', unprovision: unprovision.value }
+ : { type: 'full', unprovision: unprovision.value }
+
await useBaseFetch(`billing/charge/${selectedCharge.value.id}/refund`, {
method: 'POST',
- body: JSON.stringify({
- type: refundType.value,
- amount: refundAmount.value,
- unprovision: unprovision.value,
- }),
+ body: JSON.stringify(payload),
internal: true,
})
await refreshCharges()
@@ -432,6 +444,9 @@ const chargeStatuses = {
cancelled: {
color: 'bg-red',
},
+ expiring: {
+ color: 'bg-orange',
+ },
}