// SPDX-License-Identifier: AGPL-3.0-or-later import type {DonationCurrency} from '@fluxer/schema/src/domains/donation/DonationSchemas'; import type {IDonationService} from './IDonationService'; import type {DonationCheckoutService} from './services/DonationCheckoutService'; import type {DonationMagicLinkService} from './services/DonationMagicLinkService'; export class DonationService implements IDonationService { constructor( private magicLinkService: DonationMagicLinkService, private checkoutService: DonationCheckoutService, ) {} async requestMagicLink(email: string): Promise { return this.magicLinkService.sendMagicLink(email); } async validateMagicLinkToken(token: string): Promise<{ email: string; stripeCustomerId: string | null; }> { return this.magicLinkService.validateToken(token); } async createDonationCheckout(params: { email: string; amountCents: number; currency: DonationCurrency; interval: 'month' | 'year' | null; isBusiness?: boolean; }): Promise { return this.checkoutService.createCheckout(params); } async createDonorPortalSession(stripeCustomerId: string): Promise { return this.checkoutService.createPortalSession(stripeCustomerId); } }