-
Reintentá en unos segundos. Si el problema sigue, comunicate con nosotros.
+
Volvé a ingresar más tarde. Si el problema sigue, comunicate con nosotros.
-
- Reintentar
-
-
| null = null;
protected readonly isLoading = signal(true);
- protected readonly isRefreshing = signal(false);
protected readonly status = signal('pending');
ngOnInit(): void {
@@ -42,45 +39,22 @@ export class PurchaseStatusPageComponent implements OnInit, OnDestroy {
this.purchaseId = purchaseId;
this.tenantCode = tenant.codigo;
- void this.refreshStatus(true);
+ void this.loadStatus();
}
- ngOnDestroy(): void {
- this.clearScheduledPoll();
- }
-
- protected retryStatusCheck(): void {
- void this.refreshStatus(false);
- }
-
- private async refreshStatus(showLoader: boolean): Promise {
+ private async loadStatus(): Promise {
if (!this.purchaseId || !this.tenantCode) {
return;
}
- this.clearScheduledPoll();
-
- if (showLoader) {
- this.isLoading.set(true);
- } else {
- this.isRefreshing.set(true);
- }
-
try {
const purchase = await this.checkoutService.getPurchase(this.tenantCode, this.purchaseId);
- const resolvedStatus = this.resolveStatus(purchase);
-
- this.status.set(resolvedStatus);
-
- if (resolvedStatus === 'pending') {
- this.scheduleNextPoll();
- }
+ this.status.set(this.resolveStatus(purchase));
} catch (error) {
console.error('Failed to fetch purchase status:', error);
this.status.set('error');
} finally {
this.isLoading.set(false);
- this.isRefreshing.set(false);
}
}
@@ -100,26 +74,6 @@ export class PurchaseStatusPageComponent implements OnInit, OnDestroy {
return 'pending';
}
- private scheduleNextPoll(): void {
- if (this.pollTimeoutId !== null) {
- return;
- }
-
- this.pollTimeoutId = setTimeout(() => {
- this.pollTimeoutId = null;
- void this.refreshStatus(false);
- }, this.pollIntervalMs);
- }
-
- private clearScheduledPoll(): void {
- if (this.pollTimeoutId === null) {
- return;
- }
-
- clearTimeout(this.pollTimeoutId);
- this.pollTimeoutId = null;
- }
-
protected getWhatsAppLink(): string {
const phone = '5493416658247';
const message = encodeURIComponent('Hola! Mi compra fue realizada con \u00E9xito.');