Skip to content

Commit

Permalink
Emit/forward 'error' and 'close' events on AmazonPay frame
Browse files Browse the repository at this point in the history
  • Loading branch information
douglaslise committed Sep 26, 2023
1 parent e675bb0 commit 56c3042
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/recurly/amazon/amazon-pay.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ 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
}
}

Expand Down

0 comments on commit 56c3042

Please sign in to comment.