-
Notifications
You must be signed in to change notification settings - Fork 139
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #535 from recurly/3d-secure-wirecard
Adds Wirecard 3D Secure support
- Loading branch information
Showing
22 changed files
with
389 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import Promise from 'promise'; | ||
import ThreeDSecureStrategy from './strategy'; | ||
|
||
const debug = require('debug')('recurly:risk:three-d-secure:wirecard'); | ||
|
||
export default class WirecardStrategy extends ThreeDSecureStrategy { | ||
static strategyName = 'wirecard'; | ||
|
||
constructor (...args) { | ||
super(...args); | ||
this.markReady(); | ||
} | ||
|
||
get redirectParams () { | ||
return this.actionToken.three_d_secure.params; | ||
} | ||
|
||
/** | ||
* Provides the target DOM element for which we will apply | ||
* fingerprint detection, challenge flows, and results | ||
* | ||
* @param {HTMLElement} element | ||
*/ | ||
attach (element) { | ||
super.attach(element); | ||
debug('Initiating 3D Secure frame'); | ||
|
||
const { redirectParams, container, threeDSecure } = this; | ||
const { recurly } = threeDSecure.risk; | ||
const payload = { | ||
redirect_url: redirectParams.acsUrl, | ||
pa_req: redirectParams.pareq | ||
}; | ||
|
||
this.frame = recurly.Frame({ path: '/three_d_secure/start', payload, container }) | ||
.on('error', cause => threeDSecure.error('3ds-auth-error', { cause })) | ||
.on('done', results => this.emit('done', results)); | ||
} | ||
|
||
/** | ||
* Removes DOM elements | ||
*/ | ||
remove () { | ||
const { frame } = this; | ||
if (frame) frame.destroy(); | ||
super.remove(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.