From 960901d2b24c3849dea027cb3e85bc24b72451de Mon Sep 17 00:00:00 2001 From: sdarbinyan Date: Mon, 29 Jun 2026 22:15:19 +0400 Subject: [PATCH] polling --- src/app/pages/cart/cart.component.ts | 6 +++++- src/app/services/api.service.ts | 6 ++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/app/pages/cart/cart.component.ts b/src/app/pages/cart/cart.component.ts index ff9af5a..b1cb789 100644 --- a/src/app/pages/cart/cart.component.ts +++ b/src/app/pages/cart/cart.component.ts @@ -282,7 +282,11 @@ export class CartComponent implements OnDestroy { .pipe( take(this.maxChecks), // maximum 36 checks (3 minutes) exhaustMap(() => { - return this.apiService.checkCartPaymentStatus(this.paymentId()).pipe( + const statusRequest = this.selectedPaymentMethod() === 'card' + ? this.apiService.checkCartCardPaymentStatus(this.paymentId()) + : this.apiService.checkCartPaymentStatus(this.paymentId()); + + return statusRequest.pipe( timeout(8000), catchError((err) => { console.error('Error checking payment status:', err); diff --git a/src/app/services/api.service.ts b/src/app/services/api.service.ts index 31308d1..986ee07 100644 --- a/src/app/services/api.service.ts +++ b/src/app/services/api.service.ts @@ -533,6 +533,12 @@ export class ApiService { ); } + checkCartCardPaymentStatus(orderId: string): Observable { + return this.http.get( + `${this.qrBaseUrl}/card/${this.cartPaymentPartnerId}/${encodeURIComponent(orderId)}` + ); + } + checkPaymentStatus(partnerQrId: string, qrId: string): Observable { return this.http.get( `${this.qrBaseUrl}/qr/dynamic/${encodeURIComponent(partnerQrId)}/${encodeURIComponent(qrId)}`