Skip to content

Commit

Permalink
[DTPPCPSDK-2627] [DTPRP-1650] Set up new subscriptions callbacks (#2449)
Browse files Browse the repository at this point in the history
* Add component support for a new createSubscription callback to the CardFields component

* Add unit test

* Latest UT

* Latest UT

* Removing Unit test for now
  • Loading branch information
9zees authored Oct 31, 2024
1 parent be30a3b commit e4bb4c2
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/zoid/card-fields/component.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import {
getUserIDToken,
getSDKToken,
getClientMetadataID,
isPayPalDomain,
} from "@paypal/sdk-client/src";
import { getRefinedFundingEligibility } from "@paypal/funding-components/src";
import {
Expand Down Expand Up @@ -90,6 +91,7 @@ type CardFieldsProps = {|
onInputSubmitRequest?: () => ZalgoPromise<Object> | Object,
|},
createOrder: () => ZalgoPromise<string> | string,
createSubscription?: () => ZalgoPromise<string> | string,
createVaultSetupToken: () => ZalgoPromise<string>,
onApprove: (
{| returnUrl?: string, vaultSetupToken?: string |},
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -573,6 +583,13 @@ export const getCardFieldsComponent: () => CardFieldsComponent = memoize(
required: false,
},

...(isPayPalDomain() && {
createSubscription: {
type: "function",
required: false,
},
}),

createVaultSetupToken: {
type: "function",
required: false,
Expand Down

0 comments on commit e4bb4c2

Please sign in to comment.