{"record":{"id":"4d94a5359ebf0861","repo":"juspay/hyperswitch","slug":"invalid-parameters-provided-to-createpaymentintent","errorCode":null,"errorMessage":"Invalid parameters provided to createPaymentIntentTest command","messagePattern":"Invalid parameters provided to createPaymentIntentTest command","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"cypress-tests/cypress/support/commands.js","lineNumber":2796,"sourceCode":"      Request: reqData,\n      Response: resData,\n    } = data || {};\n\n    const validatedConfigs = validateConfig(configs);\n    if (validatedConfigs?.TRIGGER_SKIP) {\n      cy.task(\n        \"cli_log\",\n        \"TRIGGER_SKIP enabled, skipping createPaymentIntentTest\"\n      );\n      return;\n    }\n\n    if (\n      !createPaymentBody ||\n      typeof createPaymentBody !== \"object\" ||\n      !reqData.currency\n    ) {\n      throw new Error(\n        \"Invalid parameters provided to createPaymentIntentTest command\"\n      );\n    }\n\n    const configInfo = execConfig(validatedConfigs);\n    const profile_id = globalState.get(`${configInfo.profilePrefix}Id`);\n\n    const body = JSON.parse(JSON.stringify(createPaymentBody));\n    for (const key in reqData) {\n      body[key] = reqData[key];\n    }\n    body.authentication_type = authentication_type;\n    body.capture_method = capture_method;\n    body.customer_id = globalState.get(\"customerId\");\n    body.profile_id = profile_id;\n\n    const headers = {\n      \"Content-Type\": \"application/json\",","sourceCodeStart":2778,"sourceCodeEnd":2814,"githubUrl":"https://github.com/juspay/hyperswitch/blob/9b8b89dc378b62c9a6feda647bad4719d2de7699/cypress-tests/cypress/support/commands.js#L2778-L2814","documentation":"Thrown synchronously by the createPaymentIntentTest command (cypress-tests/cypress/support/commands.js:2796) when its inputs fail a shape check: createPaymentBody is null/undefined/non-object, or data.Request.currency is missing. This is pure client-side validation — no HTTP call has been made — and always indicates a broken fixture or wrong call-site arguments.","triggerScenarios":"The test-data JSON lacks currency in its Request block; the spec passes arguments in the wrong order (data before body); the destructured data.Request is undefined because the fixture shape changed; the body fixture accidentally set to null.","commonSituations":"Fixture-schema refactors dropping currency; copying a spec and swapping the first two parameters; JSON typos like 'Currency' vs 'currency'; shared data files drifting from the command's expected shape.","solutions":["Check the two preconditions in order: createPaymentBody must be an object, and data.Request.currency must be a non-empty currency code","Fix the fixture: add \"currency\": \"USD\" (or the intended ISO-4217 code) to the Request block","Verify argument order at the call site: (createPaymentBody, data, authentication_type, capture_method, globalState, connectedMerchantId)","Print the data object before the call to spot shape drift"],"exampleFix":"// before — fixture without currency, throws synchronously\n{ \"Request\": { \"amount\": 100 } }\n// after\n{ \"Request\": { \"amount\": 100, \"currency\": \"USD\" } }","handlingStrategy":"validation","validationCode":"const hasIntentParams = (body, data) =>\n  Boolean(body) && typeof body === 'object' && Boolean(data && data.Request && data.Request.currency);\nif (!hasIntentParams(createPaymentBody, data)) {\n  throw new Error('Fixture invalid: need a createPaymentBody object and Request.currency');\n}","typeGuard":"const isCreateIntentInput = (b, d) =>\n  typeof b === 'object' && b !== null &&\n  typeof d?.Request?.currency === 'string' && d.Request.currency.length === 3;","tryCatchPattern":null,"preventionTips":["Schema-check fixture files in CI (e.g. a smoke spec or ajv validation)","Name fixtures after the command they feed","Fail fast on malformed data at the spec boundary, not deep inside commands"],"tags":["cypress","validation","fixtures","payment-intent"],"backgroundTag":null,"analyzedSha":"9b8b89dc378b62c9a6feda647bad4719d2de7699","analyzedAt":"2026-08-16T09:01:53.433Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}