Credit subscriptions (#4575)

* Implement subscription crediting

* chore: query cache, clippy, fmt

* Improve code, improve query for next open charge

* chore: query cache, clippy, fmt

* Move server ID copy button up

* Node + region crediting

* Make it less ugly

* chore: query cache, clippy, fmt

* Bugfixes

* Fix lint

* Adjust migration

* Adjust migration

* Remove billing change

* Move DEFAULT_CREDIT_EMAIL_MESSAGE to utils.ts

* Lint

* Merge

* bump clickhouse, disable validation

* tombi fmt

* Update cargo lock
This commit is contained in:
François-Xavier Talbot
2025-10-20 18:35:44 +01:00
committed by GitHub
parent 79502a19d6
commit eeed4e572d
22 changed files with 1052 additions and 8 deletions

View File

@@ -109,6 +109,13 @@ pub enum LegacyNotificationBody {
amount: String,
service: String,
},
SubscriptionCredited {
subscription_id: UserSubscriptionId,
days: i32,
previous_due: DateTime<Utc>,
next_due: DateTime<Utc>,
header_message: Option<String>,
},
PatCreated {
token_name: String,
},
@@ -219,6 +226,9 @@ impl LegacyNotification {
NotificationBody::TaxNotification { .. } => {
Some("tax_notification".to_string())
}
NotificationBody::SubscriptionCredited { .. } => {
Some("subscription_credited".to_string())
}
NotificationBody::PayoutAvailable { .. } => {
Some("payout_available".to_string())
}
@@ -396,6 +406,19 @@ impl LegacyNotification {
NotificationBody::PaymentFailed { amount, service } => {
LegacyNotificationBody::PaymentFailed { amount, service }
}
NotificationBody::SubscriptionCredited {
subscription_id,
days,
previous_due,
next_due,
header_message,
} => LegacyNotificationBody::SubscriptionCredited {
subscription_id,
days,
previous_due,
next_due,
header_message,
},
NotificationBody::Unknown => LegacyNotificationBody::Unknown,
};