{"record":{"id":"45913b9b747b3d07","repo":"juspay/hyperswitch","slug":"invalid-authentication-type-response-body-authen","errorCode":null,"errorMessage":"Invalid authentication type ${response.body.authentication_type}","messagePattern":"Invalid authentication type (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"cypress-tests/cypress/support/commands.js","lineNumber":3346,"sourceCode":"                );\n              }\n              for (const key in resData.body) {\n                expect(resData.body[key], [key]).to.deep.equal(\n                  response.body[key]\n                );\n                if (\n                  response.body.setup_future_usage === \"off_session\" &&\n                  response.body.status === \"succeeded\" &&\n                  globalState.get(\"connectorId\") !== \"tsys_transit\"\n                ) {\n                  expect(\n                    response.body.connector_mandate_id,\n                    \"connector_mandate_id\"\n                  ).to.not.be.null;\n                }\n              }\n            } else {\n              throw new Error(\n                `Invalid authentication type ${response.body.authentication_type}`\n              );\n            }\n          } else if (\n            response.body.capture_method === \"manual\" ||\n            response.body.capture_method === \"manual_multiple\"\n          ) {\n            if (response.body.authentication_type === \"three_ds\") {\n              if (response.body.next_action) {\n                if (response.body.next_action.type === \"invoke_ddc\") {\n                  expect(response.body.next_action)\n                    .to.have.property(\"type\")\n                    .to.equal(\"invoke_ddc\");\n                  globalState.set(\n                    \"nextActionUrl\",\n                    response.body.next_action.ddc_data.iframe_url\n                  );\n                } else if (","sourceCodeStart":3328,"sourceCodeEnd":3364,"githubUrl":"https://github.com/juspay/hyperswitch/blob/9b8b89dc378b62c9a6feda647bad4719d2de7699/cypress-tests/cypress/support/commands.js#L3328-L3364","documentation":"Thrown by the confirmCallTest command (cypress-tests/cypress/support/commands.js:3346) on the success path of POST /payments/{id}/confirm when capture_method is 'automatic' but response.body.authentication_type is neither 'three_ds' nor 'no_three_ds'. The command's if/else only models those two auth types; anything else — including undefined or a newly added enum value — is treated as a protocol violation and thrown.","triggerScenarios":"The confirmed payment returns an authentication_type the command doesn't model: an API version adding a new enum; the response body shape drifting so authentication_type is missing/undefined; the server overriding the requested auth type for the chosen payment method or connector.","commonSituations":"A Hyperswitch upgrade introduces a third authentication_type; the fixture requests three_ds but the connector forces a different flow; response schema changes dropping the field.","solutions":["Log response.body.authentication_type and compare with what the request fixture asked for","Align the fixture's authentication_type with a modeled value ('three_ds' or 'no_three_ds')","If the API legitimately added a new type, extend the command's if/else chain to cover it","Confirm the payment method/connector actually supports the requested authentication flow"],"exampleFix":"// before — any unmodeled value throws with no context\n} else {\n  throw new Error(`Invalid authentication type ${response.body.authentication_type}`);\n}\n// after — fail with request context so the mismatch is obvious\n} else {\n  throw new Error(\n    `Expected authentication_type 'three_ds'|'no_three_ds' for automatic capture, got '${response.body.authentication_type}' (request asked for '${body.authentication_type}')`\n  );\n}","handlingStrategy":"type-guard","validationCode":"const AUTH_TYPES = ['three_ds', 'no_three_ds'];\nif (!AUTH_TYPES.includes(data.Request.authentication_type)) {\n  throw new Error(`Fixture uses unsupported authentication_type '${data.Request.authentication_type}'`);\n}","typeGuard":"const isKnownAuthType = (v) =>\n  typeof v === 'string' && ['three_ds', 'no_three_ds'].includes(v);\n// usage: if (!isKnownAuthType(response.body.authentication_type)) fail with an explicit assertion","tryCatchPattern":null,"preventionTips":["Pin fixture auth types to the enums the command models","When adopting a new Hyperswitch version, diff enum sets (authentication_type, capture_method) first","Assert the response echoes the requested auth type before deep-diving the flow tree"],"tags":["cypress","hyperswitch","payments","enum-drift","assertion"],"backgroundTag":null,"analyzedSha":"9b8b89dc378b62c9a6feda647bad4719d2de7699","analyzedAt":"2026-08-16T09:01:53.433Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}