Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Co-badge card support #874

Merged
merged 1 commit into from
Feb 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading