From d06131086021983dc4ff412a9f87832cc4266c23 Mon Sep 17 00:00:00 2001 From: Andi Zitney Date: Mon, 2 Oct 2023 09:05:40 -0700 Subject: [PATCH] Added Douglas Cancel PR --- lib/recurly/amazon/amazon-pay.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/recurly/amazon/amazon-pay.js b/lib/recurly/amazon/amazon-pay.js index dc66921c2..98ea8a120 100644 --- a/lib/recurly/amazon/amazon-pay.js +++ b/lib/recurly/amazon/amazon-pay.js @@ -72,10 +72,9 @@ class AmazonPay extends Emitter { path: `/amazon_pay/start?region=${this.region}`, type: Frame.TYPES.WINDOW, defaultEventName - }).on('error', cause => console.log(cause)) - .on('done', results => { - this.emit('token', results); - }); + }).on('error', cause => this.emit('error', cause)) // Emitted by js/v1/amazon_pay/cancel + .on('close', () => this.emit('error', 'closed')) // Emitted by RJS Frame when the window is manually closed + .on('done', results => this.emit('token', results)); // Emitted by js/v1/amazon_pay/finish } setLocaleAndCurrency () {