Skip to content

Commit 5a1a095

Browse files
committed
feat(billing): add STATUS and MARKETPLACE columns to payments table
Without the status column, failed or pending payments were indistinguishable from successful ones outside --format json. Also surface the marketplace portion of each payment.
1 parent 90f07b6 commit 5a1a095

3 files changed

Lines changed: 50 additions & 1 deletion

File tree

src/commands/billing.rs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,13 +100,26 @@ impl Render for PaymentsView {
100100
}
101101
};
102102
let mut t = new_table(ctx);
103-
set_header_bold(&mut t, ctx, vec!["CREATED", "AMOUNT", "CURRENCY", "CARD"]);
103+
set_header_bold(
104+
&mut t,
105+
ctx,
106+
vec![
107+
"CREATED",
108+
"AMOUNT",
109+
"CURRENCY",
110+
"STATUS",
111+
"CARD",
112+
"MARKETPLACE",
113+
],
114+
);
104115
for p in &data.payments {
105116
t.add_row(vec![
106117
Cell::new(&p.created_at),
107118
Cell::new(&p.amount),
108119
Cell::new(&p.currency),
120+
Cell::new(&p.status),
109121
opt_cell(&p.card_last_4),
122+
opt_cell(&p.marketplace_amount),
110123
]);
111124
}
112125
write_table(w, &t)
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
source: tests/table_snapshots.rs
3+
expression: out
4+
---
5+
CREATED AMOUNT CURRENCY STATUS CARD MARKETPLACE
6+
2026-01-01T00:00:00Z 49.00 usd succeeded 4242 9.00
7+
2026-02-01T00:00:00Z 49.00 usd failed — —

tests/table_snapshots.rs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,35 @@ async fn team_show_without_members_renders_fields_only() {
259259
insta::assert_snapshot!(out);
260260
}
261261

262+
#[tokio::test]
263+
async fn billing_payments_table_includes_status_and_marketplace() {
264+
let body = serde_json::json!({
265+
"data": {
266+
"payments": [
267+
{
268+
"amount": "49.00",
269+
"card_last_4": "4242",
270+
"created_at": "2026-01-01T00:00:00Z",
271+
"currency": "usd",
272+
"status": "succeeded",
273+
"marketplace_amount": "9.00"
274+
},
275+
{
276+
"amount": "49.00",
277+
"card_last_4": null,
278+
"created_at": "2026-02-01T00:00:00Z",
279+
"currency": "usd",
280+
"status": "failed",
281+
"marketplace_amount": null
282+
}
283+
]
284+
},
285+
"error": null
286+
});
287+
let out = table_stdout("/v0/billing/payments", body, &["billing", "payments"]).await;
288+
insta::assert_snapshot!(out);
289+
}
290+
262291
#[tokio::test]
263292
async fn endpoint_show_minimal_table_omits_security_and_rate_limit_rows() {
264293
let body = serde_json::json!({

0 commit comments

Comments
 (0)