mirror of
https://github.com/vernu/textbee.git
synced 2026-05-06 22:53:45 -04:00
chore(api): improve logging for polar webhook notifications
This commit is contained in:
@@ -430,8 +430,10 @@ export class BillingService {
|
||||
async storePolarWebhookPayload(payload: any) {
|
||||
const userId = payload.data?.metadata?.userId || payload.data?.userId
|
||||
const eventType = payload.type
|
||||
const name = payload.data?.customer?.name
|
||||
const email = payload.data?.customer?.email
|
||||
const name = payload.data?.customer?.name || payload.data?.customerName
|
||||
const email = payload.data?.customer?.email || payload.data?.customerEmail
|
||||
const productId = payload.data?.product?.id || payload.data?.productId
|
||||
const productName = payload.data?.product?.name || payload.data?.productName
|
||||
|
||||
await this.polarWebhookPayloadModel.create({
|
||||
userId,
|
||||
@@ -439,6 +441,8 @@ export class BillingService {
|
||||
name,
|
||||
email,
|
||||
payload,
|
||||
productId,
|
||||
productName,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,12 @@ export class PolarWebhookPayload {
|
||||
|
||||
@Prop({ type: Object })
|
||||
payload: Record<string, any>
|
||||
|
||||
@Prop()
|
||||
productId: string
|
||||
|
||||
@Prop()
|
||||
productName: string
|
||||
}
|
||||
|
||||
export const PolarWebhookPayloadSchema = SchemaFactory.createForClass(PolarWebhookPayload)
|
||||
|
||||
Reference in New Issue
Block a user