Files
myeasycms-v2/packages/billing/gateway/src/server/services/billing-webhooks/billing-webhooks.service.ts
2024-04-01 21:43:18 +08:00

16 lines
492 B
TypeScript

import { Database } from '@kit/supabase/database';
import { BillingGatewayService } from '../billing-gateway/billing-gateway.service';
type Subscription = Database['public']['Tables']['subscriptions']['Row'];
export class BillingWebhooksService {
async handleSubscriptionDeletedWebhook(subscription: Subscription) {
const gateway = new BillingGatewayService(subscription.billing_provider);
await gateway.cancelSubscription({
subscriptionId: subscription.id,
});
}
}