diff --git a/src/three-domain-secure/component.jsx b/src/three-domain-secure/component.jsx index 32d517376..031bad986 100644 --- a/src/three-domain-secure/component.jsx +++ b/src/three-domain-secure/component.jsx @@ -154,6 +154,8 @@ export class ThreeDomainSecureComponent { }; // $FlowFixMe const instance = this.threeDSIframe({ + payerActionUrl: + "https://te-fastlane-3ds.qa.paypal.com/webapps/helios?action=authenticate&token=30S05532XC756423E&go_to=next", onSuccess: async (data) => { // const { threeDSRefID, authentication_status, liability_shift } = data; const { threeDSRefID } = data; diff --git a/src/three-domain-secure/interface.js b/src/three-domain-secure/interface.js index 8d2b449af..563f1cc3a 100644 --- a/src/three-domain-secure/interface.js +++ b/src/three-domain-secure/interface.js @@ -5,7 +5,7 @@ import { getPayPalAPIDomain, getSDKToken, } from "@paypal/sdk-client/src"; - +import { destroy as zoidDestroy, destroyComponents } from "@krakenjs/zoid/src"; import type { LazyExport } from "../types"; import { @@ -13,10 +13,18 @@ import { type ThreeDomainSecureComponentInterface, } from "./component"; import { GraphQLClient, RestClient } from "./api"; +import { getFastlaneThreeDS } from "./utils"; const BRAINTREE_PROD = "https://payments.braintree-api.com"; const BRAINTREE_SANDBOX = "https://payments.sandbox.braintree-api.com"; +export function setup() { + return getFastlaneThreeDS(); +} +export function destroy(err?: mixed) { + zoidDestroy(err); +} + export const ThreeDomainSecureClient: LazyExport = { __get__: () => { diff --git a/src/three-domain-secure/utils.jsx b/src/three-domain-secure/utils.jsx index 6ef4d425e..cf2adb926 100644 --- a/src/three-domain-secure/utils.jsx +++ b/src/three-domain-secure/utils.jsx @@ -28,11 +28,11 @@ export type TDSProps = {| export type TDSComponent = ZoidComponent; -export function getFastlaneThreeDS(payerActionUrl: string): TDSComponent { +export function getFastlaneThreeDS(): TDSComponent { return inlineMemoize(getFastlaneThreeDS, () => { const component = create({ tag: "fastlane-threeds", - url: payerActionUrl, + url: ({ props }) => props.payerActionUrl, attributes: { iframe: { @@ -67,6 +67,9 @@ export function getFastlaneThreeDS(payerActionUrl: string): TDSComponent { // $FlowIssue allowedParentDomains: /^https?:\/\/[a-zA-Z0-9.-]+(:[0-9]+)?(\/.*)?$/, // eslint-disable-line security/detect-unsafe-regex props: { + payerActionUrl: { + type: "string", + }, clientID: { type: "string", value: getClientID,