Fix closing payment popup

This commit is contained in:
Eduard Kuzmenko 2022-07-19 16:05:35 +02:00
parent 11fbc0fe07
commit 4daa3dd321
2 changed files with 9 additions and 7 deletions

4
.env
View File

@ -1,5 +1,5 @@
API_ID=1025907 API_ID=1025907
API_HASH=452b0359b988148995f22ff0f4229750 API_HASH=452b0359b988148995f22ff0f4229750
VERSION=1.5.0 VERSION=1.5.0
VERSION_FULL=1.5.0 (198) VERSION_FULL=1.5.0 (199)
BUILD=198 BUILD=199

View File

@ -761,6 +761,13 @@ export default class PopupPayment extends PopupElement {
onConfirmed(); onConfirmed();
} else { } else {
popupPaymentVerification = new PopupPaymentVerification(paymentResult.url); popupPaymentVerification = new PopupPaymentVerification(paymentResult.url);
popupPaymentVerification.addEventListener('finish', () => {
popupPaymentVerification = undefined;
// setTimeout(() => {
onConfirmed();
// }, 0);
});
await new Promise<void>((resolve, reject) => { await new Promise<void>((resolve, reject) => {
popupPaymentVerification.addEventListener('close', () => { popupPaymentVerification.addEventListener('close', () => {
popupPaymentVerification = undefined; popupPaymentVerification = undefined;
@ -773,11 +780,6 @@ export default class PopupPayment extends PopupElement {
} }
}); });
}); });
popupPaymentVerification.addEventListener('finish', () => {
popupPaymentVerification = undefined;
onConfirmed();
});
} }
} catch(err) { } catch(err) {
if((err as ApiError).type === 'BOT_PRECHECKOUT_TIMEOUT') { if((err as ApiError).type === 'BOT_PRECHECKOUT_TIMEOUT') {