DASH-4251 feat(device-data-collection.ts): add data device iframe to sdk#49
Open
DASH-4251 feat(device-data-collection.ts): add data device iframe to sdk#49
Conversation
this is a wip for building up the data device iframe, the next step is to implement the setIframeUrl method which is the result of calling sca/setup on gateway
…m fields collect device data for cybersource antifraud.
after tokenizing a card pass the card token to the new gateway client to run sca setup
… happy and sad path add spec for new-api-gateway-client to handle setup shape - paymentIntent and card token
threeds setup is on /threed_ds/setup path not on /sca/setup
setup params were not being passed through: cardToken & paymentIntent
pass correct shape of data for gateway to handle
after tokenizing the card, hit three_ds/setup endpoint, use the result to populate iframe with url, jwt value, submit iframe form.
the device data collection iframe returns a result through postmessage
remove console log
Devlaird
commented
Sep 9, 2025
pulled main into feature branch
|
| Status | Scanner | Total (0) | ||||
|---|---|---|---|---|---|---|
| Open Source Security | 0 | 0 | 0 | 0 | See details | |
| Licenses | 0 | 0 | 0 | 0 | See details | |
| ✅ | Code Security | 0 | 0 | 0 | 0 | 0 issues |
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.
fz-anvu
reviewed
Dec 16, 2025
fz-anvu
reviewed
Dec 16, 2025
fz-brentchuang
approved these changes
Dec 17, 2025
fz-anvu
reviewed
Dec 18, 2025
|
|
||
| private static getFormOrThrow(): HTMLFormElement { | ||
| const el = this.getForm(); | ||
| if (!el) throw new Error("Form not initialized. Call createIframe() first."); |
Contributor
There was a problem hiding this comment.
Should we be handling these (and on line 148) somewhere?
fz-wtio
approved these changes
Dec 18, 2025
src/device-data-collection.ts
Outdated
|
|
||
| export default class DeviceDataCollection { | ||
| // Shared IDs so other classes can query the DOM directly too | ||
| static IFRAME_ID = "cardinal_collection_iframe"; |
| private static handleDataCollectionResponse(event: any) { | ||
| if (event.origin !== "https://centinelapistag.cardinalcommerce.com") { return; } | ||
|
|
||
| const response = JSON.parse(event.data); |
There was a problem hiding this comment.
Is this guaranteed (all event data from that origin is always parseable to JSON)? Or better if we err on the safe side (surround with try/catch)?
| ): HTMLElementTagNameMap[T] { | ||
| const id = props?.id?.toString(); | ||
| if (id) { | ||
| const existing = doc.getElementById(id) as HTMLElementTagNameMap[T] | null; |
There was a problem hiding this comment.
I assume it's intentional the props are not applied again here? I guess the assumption being made here is that if an element with a props.id already exists then all the props it needs has already been applied by a previous operation.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📝 Description
Jira ticket: https://fatzebra.atlassian.net/browse/DASH-4251
Details of change
Here is the sequence diagram
https://fatzebra.atlassian.net/wiki/spaces/~61e4f3f95fcc3700685404f6/pages/edit-v2/2754445322?draftShareId=ee1f53cd-33b8-461b-9885-1ed31ecca060
New3DSFlow (updated) (2).pdf
this was integration tested in staging against Brents PR: https://github.com/fatzebra/gateway/pull/147
Change Rollback Plan
Change Checklist
The following must be reviewed and signed off by the creator of the PR. To sign off review and check each
🔑 Security
Testing of Changes
🔎 Quality assurance