Add PaymentService integration to enhance ticket purchasing and lightning payment functionality

- Introduce PAYMENT_SERVICE token in di-container for dependency injection.
- Update base module to register and initialize PaymentService, ensuring it is available for use.
- Refactor useTicketPurchase and useLightningPayment composables to utilize PaymentService for wallet management, payment processing, and QR code generation.
- Delegate payment handling and error management to PaymentService, streamlining the payment workflow and improving user experience.
This commit is contained in:
padreug 2025-09-05 15:17:51 +02:00
parent adf32c0dca
commit 0bced11623
5 changed files with 372 additions and 137 deletions

View file

@ -10,6 +10,9 @@ import { auth } from './auth/auth-service'
// Import PWA services
import { pwaService } from './pwa/pwa-service'
// Import payment service
import { paymentService } from '@/core/services/PaymentService'
/**
* Base Module Plugin
* Provides core infrastructure: Nostr, Auth, PWA, and UI components
@ -28,6 +31,9 @@ export const baseModule: ModulePlugin = {
// Register auth service
container.provide(SERVICE_TOKENS.AUTH_SERVICE, auth)
// Register payment service
container.provide(SERVICE_TOKENS.PAYMENT_SERVICE, paymentService)
// Register PWA service
container.provide('pwaService', pwaService)
@ -37,6 +43,10 @@ export const baseModule: ModulePlugin = {
waitForDependencies: false, // Auth has no dependencies
maxRetries: 1
})
await paymentService.initialize({
waitForDependencies: true, // PaymentService depends on AuthService
maxRetries: 3
})
console.log('✅ Base module installed successfully')
},
@ -55,6 +65,7 @@ export const baseModule: ModulePlugin = {
relayHub,
nostrclientHub,
auth,
paymentService,
pwaService
},