Skip to content

Commit 9f80280

Browse files
committed
send email instead of user id in notification
1 parent 2abf588 commit 9f80280

File tree

1 file changed

+54
-54
lines changed

1 file changed

+54
-54
lines changed

services/providers/DiscordNotificationProvider.ts

Lines changed: 54 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -251,8 +251,8 @@ export class DiscordNotificationProvider implements NotificationProvider {
251251
color: 0x00C851, // Success green color
252252
fields: [
253253
{
254-
name: '👤 User ID',
255-
value: payload.user.id,
254+
name: '👤 User',
255+
value: payload.user.email,
256256
inline: true
257257
},
258258
{
@@ -304,65 +304,65 @@ export class DiscordNotificationProvider implements NotificationProvider {
304304
}
305305
}
306306

307-
private formatSubscriptionCancelledNotification(payload: NotificationPayload): DiscordWebhookPayload {
308-
const embed: DiscordEmbed = {
309-
title: '❌ Subscription Cancelled',
310-
description: `A user's subscription has been cancelled`,
311-
color: 0xFF4444, // Warning red color
312-
fields: [
313-
{
314-
name: '👤 User ID',
315-
value: payload.user.id,
316-
inline: true
317-
},
318-
{
319-
name: '🗓️ Cancelled At',
320-
value: payload.data?.cancelled_at ? `<t:${Math.floor(new Date(payload.data.cancelled_at).getTime() / 1000)}:R>` : 'Just now',
321-
inline: true
322-
},
323-
{
324-
name: '📋 Subscription ID',
325-
value: payload.data?.subscription_id || 'Unknown',
326-
inline: false
327-
}
328-
],
329-
footer: {
330-
text: 'Ebb Platform Notifications'
307+
private formatSubscriptionCancelledNotification(payload: NotificationPayload): DiscordWebhookPayload {
308+
const embed: DiscordEmbed = {
309+
title: '❌ Subscription Cancelled',
310+
description: `A user's subscription has been cancelled`,
311+
color: 0xFF4444, // Warning red color
312+
fields: [
313+
{
314+
name: '👤 User ID',
315+
value: payload.user.id,
316+
inline: true
331317
},
332-
timestamp: new Date().toISOString()
333-
}
334-
335-
// Add optional fields if available
336-
if (payload.data?.license_id) {
337-
embed.fields?.push({
338-
name: '🎫 License ID',
339-
value: payload.data.license_id,
318+
{
319+
name: '🗓️ Cancelled At',
320+
value: payload.data?.cancelled_at ? `<t:${Math.floor(new Date(payload.data.cancelled_at).getTime() / 1000)}:R>` : 'Just now',
340321
inline: true
341-
})
342-
}
322+
},
323+
{
324+
name: '📋 Subscription ID',
325+
value: payload.data?.subscription_id || 'Unknown',
326+
inline: false
327+
}
328+
],
329+
footer: {
330+
text: 'Ebb Platform Notifications'
331+
},
332+
timestamp: new Date().toISOString()
333+
}
343334

344-
if (payload.data?.customer_id) {
345-
embed.fields?.push({
346-
name: '🏪 Customer ID',
347-
value: payload.data.customer_id,
348-
inline: true
349-
})
350-
}
335+
// Add optional fields if available
336+
if (payload.data?.license_id) {
337+
embed.fields?.push({
338+
name: '🎫 License ID',
339+
value: payload.data.license_id,
340+
inline: true
341+
})
342+
}
351343

352-
if (payload.data?.status) {
353-
embed.fields?.push({
354-
name: '📊 Status',
355-
value: payload.data.status,
356-
inline: true
357-
})
358-
}
344+
if (payload.data?.customer_id) {
345+
embed.fields?.push({
346+
name: '🏪 Customer ID',
347+
value: payload.data.customer_id,
348+
inline: true
349+
})
350+
}
359351

360-
return {
361-
embeds: [embed],
362-
username: 'Ebb Notifications',
363-
}
352+
if (payload.data?.status) {
353+
embed.fields?.push({
354+
name: '📊 Status',
355+
value: payload.data.status,
356+
inline: true
357+
})
364358
}
365359

360+
return {
361+
embeds: [embed],
362+
username: 'Ebb Notifications',
363+
}
364+
}
365+
366366
private formatSubscriptionExpiredNotification(payload: NotificationPayload): DiscordWebhookPayload {
367367
const embed: DiscordEmbed = {
368368
title: '❌ Subscription Expired',

0 commit comments

Comments
 (0)