Skip to content

Commit

Permalink
fix: make PaymentRequest.abort actually return Promise<void> (#282)
Browse files Browse the repository at this point in the history
* fix: make abort method on PaymentRequest actually return a Promise<void>, thereby properly cancelling event listeners

* chore: use single quotes

* chore: fix accidental removal of get shippingAddress getter
  • Loading branch information
wkoutre authored Apr 13, 2021
1 parent 99feafd commit 68cadfd
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions js/PaymentRequest/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -485,16 +485,13 @@ export default class PaymentRequest {
}

// Try to dismiss the UI
NativePayments.abort(err => {
if (err) {
return reject(new Error('InvalidStateError'));
}

this._closePaymentRequest();

// Return `undefined` as proposed in the spec.
return resolve(undefined);
});
NativePayments.abort()
.then((_bool) => {
this._closePaymentRequest();
// Return `undefined` as proposed in the spec.
return resolve(undefined);
})
.catch((_err) => reject(new Error('InvalidStateError')));
});
}

Expand Down

0 comments on commit 68cadfd

Please sign in to comment.