feat(licenses): enhance Stripe webhook handling for license creation

- Added support for the "invoice.paid" event to create licenses upon successful payment.
- Refactored the handling of subscription updates to improve license deactivation logic.
- Removed the expiration date from the LicenseEmail component to simplify email content.
- Improved error handling for customer retrieval and subscription status checks.
This commit is contained in:
Mauricio Siu
2025-03-23 12:58:40 -06:00
parent c8e6df4c29
commit 5180c785b4
2 changed files with 50 additions and 68 deletions

View File

@@ -18,7 +18,6 @@ interface LicenseEmailProps {
customerName: string;
licenseKey: string;
productName: string;
expirationDate: Date;
features: string[];
}
@@ -28,15 +27,8 @@ export const LicenseEmail = ({
customerName = "John Doe",
licenseKey = "1234567890",
productName = "Dokploy",
expirationDate = new Date(),
features = ["Feature 1", "Feature 2", "Feature 3"],
}: LicenseEmailProps): React.ReactElement => {
const formattedDate = expirationDate.toLocaleDateString("en-US", {
year: "numeric",
month: "long",
day: "numeric",
});
return (
<Html>
<Head />
@@ -69,12 +61,6 @@ export const LicenseEmail = ({
<Text style={licenseKeyStyle}>{licenseKey}</Text>
</Section>
<Section style={validitySection}>
<Text style={validityText}>
🗓️ Next billing date: <strong>{formattedDate}</strong>
</Text>
</Section>
<Section style={featuresContainer}>
<Heading as="h2" style={h2}>
🎉 Your Premium Features