Skip to content

Commit 04d29ce

Browse files
committed
fix: use campaign name as product_name for donation invoices
When creating a donation invoice, set product_name to the campaign name (e.g. "A Wave for Saleh") instead of generic "Donation to X". Falls back to the old format if no campaign name is configured.
1 parent 2a2913e commit 04d29ce

1 file changed

Lines changed: 11 additions & 6 deletions

File tree

src/api/payment_links.rs

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -355,12 +355,17 @@ async fn resolve_donation(
355355
};
356356

357357
let amount_fiat = amount_cents as f64 / 100.0;
358-
let org_label = if merchant.name.is_empty() {
359-
link.name.as_deref().unwrap_or("Organization")
360-
} else {
361-
&merchant.name
362-
};
363-
let display_name = format!("Donation to {}", org_label);
358+
let display_name = donation_config.campaign_name.as_deref()
359+
.filter(|n| !n.is_empty())
360+
.map(|n| n.to_string())
361+
.unwrap_or_else(|| {
362+
let org = if merchant.name.is_empty() {
363+
link.name.as_deref().unwrap_or("Organization")
364+
} else {
365+
&merchant.name
366+
};
367+
format!("Donation to {}", org)
368+
});
364369

365370
let invoice_req = crate::invoices::CreateInvoiceRequest {
366371
product_id: None,

0 commit comments

Comments
 (0)