collab: Limit customers to one free trial (#29232)
This PR makes it so customers can only subscribe to the trial once. Release Notes: - N/A
This commit is contained in:
parent
abf2b9d7d3
commit
a0eaede13d
5 changed files with 36 additions and 3 deletions
|
@ -11,6 +11,7 @@ pub struct UpdateBillingCustomerParams {
|
|||
pub user_id: ActiveValue<UserId>,
|
||||
pub stripe_customer_id: ActiveValue<String>,
|
||||
pub has_overdue_invoices: ActiveValue<bool>,
|
||||
pub trial_started_at: ActiveValue<Option<DateTime>>,
|
||||
}
|
||||
|
||||
impl Database {
|
||||
|
@ -45,7 +46,8 @@ impl Database {
|
|||
user_id: params.user_id.clone(),
|
||||
stripe_customer_id: params.stripe_customer_id.clone(),
|
||||
has_overdue_invoices: params.has_overdue_invoices.clone(),
|
||||
..Default::default()
|
||||
trial_started_at: params.trial_started_at.clone(),
|
||||
created_at: ActiveValue::not_set(),
|
||||
})
|
||||
.exec(&*tx)
|
||||
.await?;
|
||||
|
|
|
@ -10,6 +10,7 @@ pub struct Model {
|
|||
pub user_id: UserId,
|
||||
pub stripe_customer_id: String,
|
||||
pub has_overdue_invoices: bool,
|
||||
pub trial_started_at: Option<DateTime>,
|
||||
pub created_at: DateTime,
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue