Refactor PaymentService and related components for improved state management

- Reset payment state on initialization in PaymentService to prevent stuck states.
- Introduce forceResetPaymentState method for debugging purposes.
- Update useTicketPurchase and useLightningPayment composables to reflect changes in computed properties for better state handling.
- Ensure OrderHistory component resets payment state on mount to enhance user experience.
This commit is contained in:
padreug 2025-09-05 16:18:13 +02:00
parent ef7333e68e
commit e8b9f04494
4 changed files with 28 additions and 8 deletions

View file

@ -46,7 +46,9 @@ export class PaymentService extends BaseService {
* Service-specific initialization (called by BaseService)
*/
protected async onInitialize(): Promise<void> {
this.debug('PaymentService initialized')
// Reset payment state on initialization to prevent stuck states
this.resetPaymentState()
this.debug('PaymentService initialized with clean state')
}
/**
@ -265,6 +267,17 @@ export class PaymentService extends BaseService {
resetPaymentState(): void {
this._isProcessingPayment.value = false
this._paymentError.value = null
this.debug('Payment state reset to clean state')
}
/**
* Force reset payment state (public method for debugging)
*/
forceResetPaymentState(): void {
console.log('Force resetting payment state from:', this._isProcessingPayment.value)
this._isProcessingPayment.value = false
this._paymentError.value = null
console.log('Payment state after force reset:', this._isProcessingPayment.value)
}
/**