polling
This commit is contained in:
@@ -282,7 +282,11 @@ export class CartComponent implements OnDestroy {
|
|||||||
.pipe(
|
.pipe(
|
||||||
take(this.maxChecks), // maximum 36 checks (3 minutes)
|
take(this.maxChecks), // maximum 36 checks (3 minutes)
|
||||||
exhaustMap(() => {
|
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),
|
timeout(8000),
|
||||||
catchError((err) => {
|
catchError((err) => {
|
||||||
console.error('Error checking payment status:', err);
|
console.error('Error checking payment status:', err);
|
||||||
|
|||||||
@@ -533,6 +533,12 @@ export class ApiService {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
checkCartCardPaymentStatus(orderId: string): Observable<QrDynamicStatusResponse> {
|
||||||
|
return this.http.get<QrDynamicStatusResponse>(
|
||||||
|
`${this.qrBaseUrl}/card/${this.cartPaymentPartnerId}/${encodeURIComponent(orderId)}`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
checkPaymentStatus(partnerQrId: string, qrId: string): Observable<QrDynamicStatusResponse> {
|
checkPaymentStatus(partnerQrId: string, qrId: string): Observable<QrDynamicStatusResponse> {
|
||||||
return this.http.get<QrDynamicStatusResponse>(
|
return this.http.get<QrDynamicStatusResponse>(
|
||||||
`${this.qrBaseUrl}/qr/dynamic/${encodeURIComponent(partnerQrId)}/${encodeURIComponent(qrId)}`
|
`${this.qrBaseUrl}/qr/dynamic/${encodeURIComponent(partnerQrId)}/${encodeURIComponent(qrId)}`
|
||||||
|
|||||||
Reference in New Issue
Block a user