diff --git a/src/dbp-mono-processpayment.js b/src/dbp-mono-processpayment.js index 12f1e29..a096cb2 100644 --- a/src/dbp-mono-processpayment.js +++ b/src/dbp-mono-processpayment.js @@ -80,6 +80,8 @@ class DbpMonoProcessPayment extends ScopedElementsMixin(DBPMonoLitElement) { this.popUp = null; + this._paymentPollingTimerID = null; + // view let view = this.getView(); switch (view) { @@ -103,6 +105,27 @@ class DbpMonoProcessPayment extends ScopedElementsMixin(DBPMonoLitElement) { } } + pollPayment() { + if (this.showPending) { + this.getPayment(); + } + } + + connectedCallback() { + super.connectedCallback(); + + this._paymentPollingTimerID = setInterval(() => { + this.pollPayment(); + }, 1000 * 5); + } + + disconnectedCallback() { + clearInterval(this._paymentPollingTimerID); + this._paymentPollingTimerID = null; + + super.disconnectedCallback(); + } + updated(changedProperties) { if (changedProperties.has('lang')) { if (this._loginStatus === 'logged-in' && this.view === VIEW_SELECT) {