feat(checkout): enhance countdown synchronization and cleanup logic

This commit is contained in:
2026-08-27 09:03:38 -03:00
parent 51d051733c
commit b6a52ceb8c
3 changed files with 32 additions and 6 deletions

View File

@@ -177,7 +177,6 @@ export class CheckoutPageComponent implements OnInit, OnDestroy {
ngOnDestroy(): void {
this.stopQrPolling();
this.stopTransferPolling();
this.checkoutCountdownService.clear();
}
private mapPurchaseItemToMock(item: PurchaseDetailItemResponse): CartItemMock {
@@ -287,6 +286,7 @@ export class CheckoutPageComponent implements OnInit, OnDestroy {
const tenant = this.tenantService.tenant();
const purchaseId = this.createdPurchaseId();
if (!tenant || !purchaseId) {
this.checkoutCountdownService.clear();
return true;
}
@@ -297,6 +297,7 @@ export class CheckoutPageComponent implements OnInit, OnDestroy {
await firstValueFrom(this.cartService.loadCart());
this.createdPurchaseId.set(null);
this.createdPurchase.set(null);
this.checkoutCountdownService.clear();
this.navigationStarted = true;
return true;
@@ -310,6 +311,7 @@ export class CheckoutPageComponent implements OnInit, OnDestroy {
});
this.createdPurchaseId.set(null);
this.createdPurchase.set(null);
this.checkoutCountdownService.clear();
this.navigationStarted = true;
return true;
}
@@ -671,6 +673,7 @@ export class CheckoutPageComponent implements OnInit, OnDestroy {
this.navigationStarted = true;
this.stopQrPolling();
this.stopTransferPolling();
this.checkoutCountdownService.clear();
void this.router.navigate(['/checkout/status', purchaseId]);
}
@@ -792,6 +795,7 @@ export class CheckoutPageComponent implements OnInit, OnDestroy {
this.navigationStarted = true;
this.stopQrPolling();
this.stopTransferPolling();
this.checkoutCountdownService.clear();
void this.router.navigate(['/checkout/status', purchaseId], {
queryParams: { status: 'expired' },
});