mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-07 18:42:10 +00:00
prevent proration
This commit is contained in:
1 parent
8dba5d1d46
commit
0c359d55d3
1 file changed
+12
-1
+12
-1
@@ -11,7 +11,7 @@ use crate::utils::metadata::get_metadata_user_token::get_metadata_user_token;
|
||||
use log::{error, info, warn};
|
||||
use reusable_types::server_environment::ServerEnvironment;
|
||||
use stripe::Client;
|
||||
use stripe_shared::{Invoice, InvoiceStatus};
|
||||
use stripe_shared::{Invoice, InvoiceBillingReason, InvoiceStatus};
|
||||
use crate::utils::stripe_event_descriptor::StripeEventDescriptor;
|
||||
|
||||
// Handle event type: 'invoice.paid'
|
||||
@@ -80,6 +80,17 @@ pub async fn invoice_paid_extractor(
|
||||
return Ok(EnrichedWebhookEvent::from_actionless_log(event_log_summary));
|
||||
}
|
||||
|
||||
match invoice.billing_reason {
|
||||
Some(InvoiceBillingReason::SubscriptionCycle) => {}, // Typical renewal invoice
|
||||
Some(InvoiceBillingReason::SubscriptionUpdate) => {
|
||||
// NB: The logic for handling prorations will be a little bit involved. We can do this later.
|
||||
// For now, let's stick to "at end of billing cycle" updates.
|
||||
warn!("Skipping likely invoice proration.");
|
||||
return Ok(EnrichedWebhookEvent::from_actionless_log(event_log_summary));
|
||||
},
|
||||
_ => {},
|
||||
}
|
||||
|
||||
let subscription_id = match maybe_stripe_subscription_id {
|
||||
Some(subscription_id) => subscription_id,
|
||||
None => {
|
||||
|
||||
Reference in new issue
Block a user