From e4bb4c23be46991d212c732908cb6d0ec33f80bb Mon Sep 17 00:00:00 2001 From: Maria Chin Date: Thu, 31 Oct 2024 13:53:05 -0700 Subject: [PATCH] [DTPPCPSDK-2627] [DTPRP-1650] Set up new subscriptions callbacks (#2449) * Add component support for a new createSubscription callback to the CardFields component * Add unit test * Latest UT * Latest UT * Removing Unit test for now --- src/zoid/card-fields/component.jsx | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/zoid/card-fields/component.jsx b/src/zoid/card-fields/component.jsx index 349107a29..40a33828e 100644 --- a/src/zoid/card-fields/component.jsx +++ b/src/zoid/card-fields/component.jsx @@ -25,6 +25,7 @@ import { getUserIDToken, getSDKToken, getClientMetadataID, + isPayPalDomain, } from "@paypal/sdk-client/src"; import { getRefinedFundingEligibility } from "@paypal/funding-components/src"; import { @@ -90,6 +91,7 @@ type CardFieldsProps = {| onInputSubmitRequest?: () => ZalgoPromise | Object, |}, createOrder: () => ZalgoPromise | string, + createSubscription?: () => ZalgoPromise | string, createVaultSetupToken: () => ZalgoPromise, onApprove: ( {| returnUrl?: string, vaultSetupToken?: string |}, @@ -245,6 +247,14 @@ export const getCardFieldsComponent: () => CardFieldsComponent = memoize( value: ({ props }) => props.parent.props.createOrder, }, + ...(isPayPalDomain() && { + createSubscription: { + type: "function", + required: false, + value: ({ props }) => props.parent.props.createSubscription, + }, + }), + createVaultSetupToken: { type: "function", required: false, @@ -573,6 +583,13 @@ export const getCardFieldsComponent: () => CardFieldsComponent = memoize( required: false, }, + ...(isPayPalDomain() && { + createSubscription: { + type: "function", + required: false, + }, + }), + createVaultSetupToken: { type: "function", required: false,