Skip to content

Commit 1be530c

Browse files
authored
Merge branch 'dev' into fix/mcp-orphan-process-cleanup
2 parents 8d1f1c8 + 1571d51 commit 1be530c

File tree

9 files changed

+2486
-7
lines changed

9 files changed

+2486
-7
lines changed

packages/console/app/src/routes/workspace/[id]/billing/payment-section.tsx

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Billing } from "@opencode-ai/console-core/billing.js"
22
import { query, action, useParams, createAsync, useAction } from "@solidjs/router"
3-
import { For, Show } from "solid-js"
3+
import { For, Match, Show, Switch } from "solid-js"
44
import { withActor } from "~/context/auth.withActor"
55
import { formatDateUTC, formatDateForTable } from "../../common"
66
import styles from "./payment-section.module.css"
@@ -77,21 +77,23 @@ export function PaymentSection() {
7777
<For each={payments()!}>
7878
{(payment) => {
7979
const date = new Date(payment.timeCreated)
80-
const isCredit = !payment.paymentID
80+
const amount =
81+
payment.enrichment?.type === "subscription" && payment.enrichment.couponID ? 0 : payment.amount
8182
return (
8283
<tr>
8384
<td data-slot="payment-date" title={formatDateUTC(date)}>
8485
{formatDateForTable(date)}
8586
</td>
8687
<td data-slot="payment-id">{payment.id}</td>
8788
<td data-slot="payment-amount" data-refunded={!!payment.timeRefunded}>
88-
${((payment.amount ?? 0) / 100000000).toFixed(2)}
89-
{isCredit ? " (credit)" : ""}
89+
${((amount ?? 0) / 100000000).toFixed(2)}
90+
<Switch>
91+
<Match when={payment.enrichment?.type === "credit"}> (credit)</Match>
92+
<Match when={payment.enrichment?.type === "subscription"}> (subscription)</Match>
93+
</Switch>
9094
</td>
9195
<td data-slot="payment-receipt">
92-
{isCredit ? (
93-
<span>-</span>
94-
) : (
96+
{payment.paymentID ? (
9597
<button
9698
onClick={async () => {
9799
const receiptUrl = await downloadReceiptAction(params.id!, payment.paymentID!)
@@ -103,6 +105,8 @@ export function PaymentSection() {
103105
>
104106
View
105107
</button>
108+
) : (
109+
<span>-</span>
106110
)}
107111
</td>
108112
</tr>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ALTER TABLE `billing` ADD `subscription_coupon_id` varchar(28);
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ALTER TABLE `payment` ADD `enrichment` json;

0 commit comments

Comments
 (0)