Skip to content

Commit e56a91f

Browse files
committed
fix: ensure cardfield flow rejects only when err is not null
1 parent 061c3e1 commit e56a91f

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/three-domain-secure/component.jsx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,17 @@ export function getThreeDomainSecureComponent(): TDSComponent {
115115
onSuccess: {
116116
type: "function",
117117
alias: "onContingencyResult",
118-
decorate: ({ value, onError }) => {
118+
decorate: ({ props, value, onError }) => {
119119
return (err, result) => {
120-
if (err) {
120+
const isCardFieldFlow = props.userType === "UNBRANDED_GUEST";
121+
122+
// HostedFields ONLY rejects when the err object is not null. The below implementation ensures that CardFields follows the same pattern.
123+
124+
const hasError = isCardFieldFlow
125+
? err
126+
: err || result?.success === false;
127+
128+
if (hasError) {
121129
return onError(err);
122130
}
123131

0 commit comments

Comments
 (0)