Update and refactor billing services and types

Several updates and refactorings have been made to the billing services and types. The "onInvoicePaid" method and some types related to line items have been removed. The comments and arguments for the "verifyWebhookSignature" and "handleWebhookEvent" methods in service classes have been updated for clarity. The "onEvent" method's arguments have also been adjusted in multiple places to improve consistency.
This commit is contained in:
gbuomprisco
2024-06-11 23:35:32 +08:00
parent ce18a342ba
commit bb6f26f240
5 changed files with 29 additions and 52 deletions

View File

@@ -97,8 +97,7 @@ export class LemonSqueezyWebhookHandlerService
onSubscriptionDeleted: (subscriptionId: string) => Promise<unknown>;
onPaymentSucceeded: (sessionId: string) => Promise<unknown>;
onPaymentFailed: (sessionId: string) => Promise<unknown>;
onInvoicePaid: (data: UpsertSubscriptionParams) => Promise<unknown>;
onEvent?: (event: string) => Promise<unknown>;
onEvent?: (event: OrderWebhook | SubscriptionWebhook) => Promise<unknown>;
},
) {
const eventName = event.meta.event_name;
@@ -133,6 +132,10 @@ export class LemonSqueezyWebhookHandlerService
}
default: {
if (params.onEvent) {
return params.onEvent(event);
}
const logger = await getLogger();
logger.info(