Skip to content

Commit

Permalink
Merge pull request #874 from recurly/co-badge
Browse files Browse the repository at this point in the history
Co-badge card support
  • Loading branch information
isaacvance1027 authored Feb 28, 2024
2 parents 84c6faf + 465e5a9 commit 4b83a28
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/recurly/element/element.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ export default class Element extends Emitter {
this.on(this.messageName('tab:previous'), () => this.onTab('previous'));
this.on(this.messageName('tab:next'), () => this.onTab('next'));
this.on(this.messageName('submit'), () => this.onSubmit());
this.on(this.messageName('coBadge:ready'), (...args) => this.notifyCoBadgeResult(...args));
this.on('destroy', (...args) => this.destroy(...args));
debug('create', this.id);
}
Expand Down Expand Up @@ -167,6 +168,7 @@ export default class Element extends Emitter {
*/
get url () {
const config = encodeURIComponent(JSON.stringify(this.config));

return this.recurly.url(`/field.html#config=${config}`);
}

Expand Down Expand Up @@ -345,6 +347,7 @@ export default class Element extends Emitter {
*/
messageName (name) {
return `element:${this.id}:${name}`;
// element:21940812094ankfjankfawfwa:name
}

/**
Expand Down Expand Up @@ -405,6 +408,10 @@ export default class Element extends Emitter {
debug('submit', this.id);
this.emit('submit', this);
}

notifyCoBadgeResult (body) {
this.emit('coBadge', { coBadgeSupport: body.coBadgeSupport, supportedBrands: body.supportedBrands });
}
}

/**
Expand Down
1 change: 1 addition & 0 deletions lib/recurly/token.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export const NON_ADDRESS_FIELDS = [
'tax_identifier_type',
'fraud_session_id',
'token',
'card_network_preference',
];

/**
Expand Down

0 comments on commit 4b83a28

Please sign in to comment.