You've already forked AstralRinth
forked from didirus/AstralRinth
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:
committed by
GitHub
parent
79502a19d6
commit
eeed4e572d
@@ -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,
|
||||
};
|
||||
|
||||
|
||||
@@ -46,6 +46,7 @@ pub enum NotificationType {
|
||||
PasswordChanged,
|
||||
PasswordRemoved,
|
||||
EmailChanged,
|
||||
SubscriptionCredited,
|
||||
PaymentFailed,
|
||||
TaxNotification,
|
||||
PatCreated,
|
||||
@@ -78,6 +79,7 @@ impl NotificationType {
|
||||
NotificationType::PasswordChanged => "password_changed",
|
||||
NotificationType::PasswordRemoved => "password_removed",
|
||||
NotificationType::EmailChanged => "email_changed",
|
||||
NotificationType::SubscriptionCredited => "subscription_credited",
|
||||
NotificationType::PaymentFailed => "payment_failed",
|
||||
NotificationType::TaxNotification => "tax_notification",
|
||||
NotificationType::PatCreated => "pat_created",
|
||||
@@ -114,6 +116,7 @@ impl NotificationType {
|
||||
"password_changed" => NotificationType::PasswordChanged,
|
||||
"password_removed" => NotificationType::PasswordRemoved,
|
||||
"email_changed" => NotificationType::EmailChanged,
|
||||
"subscription_credited" => NotificationType::SubscriptionCredited,
|
||||
"payment_failed" => NotificationType::PaymentFailed,
|
||||
"tax_notification" => NotificationType::TaxNotification,
|
||||
"payout_available" => NotificationType::PayoutAvailable,
|
||||
@@ -220,6 +223,13 @@ pub enum NotificationBody {
|
||||
new_email: String,
|
||||
to_email: String,
|
||||
},
|
||||
SubscriptionCredited {
|
||||
subscription_id: UserSubscriptionId,
|
||||
days: i32,
|
||||
previous_due: DateTime<Utc>,
|
||||
next_due: DateTime<Utc>,
|
||||
header_message: Option<String>,
|
||||
},
|
||||
PaymentFailed {
|
||||
amount: String,
|
||||
service: String,
|
||||
@@ -312,6 +322,9 @@ impl NotificationBody {
|
||||
NotificationBody::EmailChanged { .. } => {
|
||||
NotificationType::EmailChanged
|
||||
}
|
||||
NotificationBody::SubscriptionCredited { .. } => {
|
||||
NotificationType::SubscriptionCredited
|
||||
}
|
||||
NotificationBody::PaymentFailed { .. } => {
|
||||
NotificationType::PaymentFailed
|
||||
}
|
||||
@@ -554,6 +567,12 @@ impl From<DBNotification> for Notification {
|
||||
"#".to_string(),
|
||||
vec![],
|
||||
),
|
||||
NotificationBody::SubscriptionCredited { .. } => (
|
||||
"Subscription credited".to_string(),
|
||||
"Your subscription has been credited with additional service time.".to_string(),
|
||||
"#".to_string(),
|
||||
vec![],
|
||||
),
|
||||
NotificationBody::PayoutAvailable { .. } => (
|
||||
"Payout available".to_string(),
|
||||
"A payout is available!".to_string(),
|
||||
|
||||
Reference in New Issue
Block a user