Skip to content

refactor: update component name, match success state response #2466

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

Merged
merged 1 commit into from
Jan 29, 2025
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
6 changes: 3 additions & 3 deletions src/three-domain-secure/component.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import type {
ThreeDSResponse,
TDSProps,
} from "./types";
import { getFastlaneThreeDS } from "./utils";
import { getThreeDS } from "./utils";
import type { GraphQLClient, RestClient } from "./api";

const parseSdkConfig = ({ sdkConfig, logger }): SdkConfig => {
Expand Down Expand Up @@ -110,7 +110,7 @@ export class ThreeDomainSecureComponent {
(link) => link.rel === "payer-action"
).href;
responseStatus = true;
this.threeDSIframe = getFastlaneThreeDS();
this.threeDSIframe = getThreeDS();
}
return responseStatus;
} catch (error) {
Expand Down Expand Up @@ -151,7 +151,7 @@ export class ThreeDomainSecureComponent {
// Helios returns a boolen parameter: "success"
// It will be true for all cases where liability is shifted to merchant
// and false for downstream failures and errors
authenticationState = success ? "success" : "errored";
authenticationState = success ? "succeeded" : "errored";
liabilityShift = liability_shift ? liability_shift : "false";

// call BT mutation to update fastlaneNonce with 3ds data
Expand Down
2 changes: 1 addition & 1 deletion src/three-domain-secure/component.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const defaultSdkConfig = {
authenticationToken: "sdk-client-token",
};
vi.mock("./utils", () => ({
getFastlaneThreeDS: vi.fn(() => {
getThreeDS: vi.fn(() => {
return vi.fn(() => ({
render: vi.fn().mockResolvedValue({}),
close: vi.fn(),
Expand Down
4 changes: 2 additions & 2 deletions src/three-domain-secure/interface.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ import {
type ThreeDomainSecureComponentInterface,
} from "./component";
import { GraphQLClient, RestClient } from "./api";
import { getFastlaneThreeDS } from "./utils";
import { getThreeDS } from "./utils";

const BRAINTREE_PROD = "https://payments.braintree-api.com";
const BRAINTREE_SANDBOX = "https://payments.sandbox.braintree-api.com";

export function setup() {
getFastlaneThreeDS();
getThreeDS();
}
export function destroy(err?: mixed) {
zoidDestroy(err);
Expand Down
4 changes: 2 additions & 2 deletions src/three-domain-secure/interface.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { destroy as zoidDestroy } from "@krakenjs/zoid/src";

import { ThreeDomainSecureComponent } from "./component";
import { GraphQLClient, RestClient } from "./api";
import { getFastlaneThreeDS } from "./utils";
import { getThreeDS } from "./utils";
import { setup, destroy, ThreeDomainSecureClient } from "./interface";

vi.mock("@paypal/sdk-client/src");
Expand All @@ -23,7 +23,7 @@ vi.mock("./utils");
describe("ThreeDomainSecure interface", () => {
it("should setup and destroy", () => {
setup();
expect(getFastlaneThreeDS).toHaveBeenCalledTimes(1);
expect(getThreeDS).toHaveBeenCalledTimes(1);

const err = new Error("test error");
destroy(err);
Expand Down
4 changes: 2 additions & 2 deletions src/three-domain-secure/utils.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ import type { TDSProps } from "./types";

export type TDSComponent = ZoidComponent<TDSProps>;

export function getFastlaneThreeDS(): TDSComponent {
return inlineMemoize(getFastlaneThreeDS, () => {
export function getThreeDS(): TDSComponent {
return inlineMemoize(getThreeDS, () => {
const component = create({
tag: "fastlane-threeds",
url: ({ props }) => props.payerActionUrl,
Expand Down
6 changes: 3 additions & 3 deletions src/three-domain-secure/utils.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { noop } from "@krakenjs/belter/src";
import { describe, expect, vi } from "vitest";
import { getEnv } from "@paypal/sdk-client/src";

import { getFastlaneThreeDS } from "./utils";
import { getThreeDS } from "./utils";

vi.mock("@paypal/sdk-client/src");

Expand All @@ -27,7 +27,7 @@ describe("Three Domain Secure Utils", () => {
type: "zoidComponent",
}));

const fastlaneComponent = getFastlaneThreeDS();
const fastlaneComponent = getThreeDS();
expect(fastlaneComponent).toBeDefined();
// expect(createMock).toHaveBeenCalledTimes(1);
});
Expand All @@ -43,7 +43,7 @@ describe("Three Domain Secure Utils", () => {
type: "zoidComponent",
}));

getFastlaneThreeDS();
getThreeDS();

expect(window.xchild).toBeDefined();
expect(window.xchild).toEqual({
Expand Down