Skip to content

DASH-4251 feat(device-data-collection.ts): add data device iframe to sdk#49

Open
Devlaird wants to merge 19 commits intomainfrom
DASH-4251-device-collection
Open

DASH-4251 feat(device-data-collection.ts): add data device iframe to sdk#49
Devlaird wants to merge 19 commits intomainfrom
DASH-4251-device-collection

Conversation

@Devlaird
Copy link
Contributor

@Devlaird Devlaird commented Aug 29, 2025

📝 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

  • Security of any environment is not reduced by this change.
  • All existing security controls remain in place or have been replaced with equal or stronger controls.

Testing of Changes

  • Testing results have been verified as complete and covering all aspects of the change.
  • Evidence of testing attached
  • Security scans are passing
  • No package vulnerabilities introduced

🔎 Quality assurance

  • Reviewed this PR myself
  • Automated tests are required and included
  • Security controls have been reviewed
  • Changes are Blue-Green friendly

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
pulled main into feature branch
@snyk-io-au
Copy link

snyk-io-au bot commented Sep 24, 2025

⚠️ Snyk checks are incomplete.

Status Scanner Critical High Medium Low 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.

@Devlaird Devlaird marked this pull request as ready for review December 16, 2025 00:05
@Devlaird Devlaird requested a review from a team as a code owner December 16, 2025 00:05

private static getFormOrThrow(): HTMLFormElement {
const el = this.getForm();
if (!el) throw new Error("Form not initialized. Call createIframe() first.");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we be handling these (and on line 148) somewhere?

Copy link

@fz-wtio fz-wtio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

non-blocking comments


export default class DeviceDataCollection {
// Shared IDs so other classes can query the DOM directly too
static IFRAME_ID = "cardinal_collection_iframe";
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

static readonly instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ahh good shout out

private static handleDataCollectionResponse(event: any) {
if (event.origin !== "https://centinelapistag.cardinalcommerce.com") { return; }

const response = JSON.parse(event.data);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants