Skip to content

Commit

Permalink
Merge branch 'main' into fastlane-3ds-e2e
Browse files Browse the repository at this point in the history
  • Loading branch information
siddy2181 authored Nov 15, 2024
2 parents 62ead51 + b7545fa commit 5cf3f99
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 4 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
## <small>5.0.346 (2024-11-13)</small>

* chore(release): 5.0.345 🎉 ([7d12516](https://github.com/paypal/paypal-checkout-components/commit/7d12516))



## <small>5.0.345 (2024-11-13)</small>

* Add validation for SDK token when createSubscription is being passed (#2450) ([f0483a1](https://github.com/paypal/paypal-checkout-components/commit/f0483a1)), closes [#2450](https://github.com/paypal/paypal-checkout-components/issues/2450)



## <small>5.0.344 (2024-10-23)</small>

* Defining ThreeDomainSecureClient component interface (#2447) ([4857dc7](https://github.com/paypal/paypal-checkout-components/commit/4857dc7)), closes [#2447](https://github.com/paypal/paypal-checkout-components/issues/2447)
Expand Down
4 changes: 3 additions & 1 deletion dist/button.js

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion dist/test/button.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@paypal/checkout-components",
"version": "5.0.344",
"version": "5.0.346",
"description": "PayPal Checkout components, for integrating checkout products.",
"main": "index.js",
"scripts": {
Expand Down
38 changes: 37 additions & 1 deletion 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 All @@ -34,7 +35,7 @@ import {
type FundingEligibilityType,
} from "@paypal/sdk-constants/src";

import { getSessionID } from "../../lib";
import { getSessionID, ValidationError } from "../../lib";

import { CardPrerender } from "./prerender";

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 All @@ -109,6 +111,7 @@ type CardFieldsProps = {|
hcfSessionID: string,
partnerAttributionID: string,
merchantID: $ReadOnlyArray<string>,
sdkToken?: string,
installments?: {|
onInstallmentsRequested: () =>
| InstallmentsConfiguration
Expand Down Expand Up @@ -245,6 +248,24 @@ export const getCardFieldsComponent: () => CardFieldsComponent = memoize(
value: ({ props }) => props.parent.props.createOrder,
},

...(isPayPalDomain() && {
createSubscription: {
type: "function",
required: false,
value: ({ props }) => {
if (
props.parent.props.createSubscription &&
!props.parent.props.sdkToken
) {
throw new ValidationError(
`SDK Token must be passed in for createSubscription`
);
}
return props.parent.props.createSubscription;
},
},
}),

createVaultSetupToken: {
type: "function",
required: false,
Expand Down Expand Up @@ -573,6 +594,21 @@ export const getCardFieldsComponent: () => CardFieldsComponent = memoize(
required: false,
},

...(isPayPalDomain() && {
createSubscription: {
type: "function",
required: false,
value: ({ props }) => {
if (props.createSubscription && !props.sdkToken) {
throw new ValidationError(
`SDK Token must be passed in for createSubscription`
);
}
return props.createSubscription;
},
},
}),

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

0 comments on commit 5cf3f99

Please sign in to comment.