{"record":{"id":"b64a7467d34b8741","repo":"juspay/hyperswitch","slug":"unsupported-payment-method-type-payment-method","errorCode":null,"errorMessage":"Unsupported payment method type: ${payment_method_type}","messagePattern":"Unsupported payment method type: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"cypress-tests-v2/cypress/support/redirectionHandler.js","lineNumber":377,"sourceCode":"      case \"upi_collect\":\n        cy.visit(redirection_url.href);\n        cy.wait(WAIT_TIME_IATAPAY).then(() => {\n          verifyUrl = true;\n        });\n        break;\n      case \"upi_intent\":\n        cy.request(redirection_url.href).then((response) => {\n          expect(response.status).to.eq(200);\n          expect(response.body).to.have.property(\"iataPaymentId\");\n          expect(response.body).to.have.property(\"status\", \"INITIATED\");\n          expect(response.body.qrInfoData).to.be.an(\"object\");\n          expect(response.body.qrInfoData).to.have.property(\"qr\");\n          expect(response.body.qrInfoData).to.have.property(\"qrLink\");\n        });\n        verifyUrl = false;\n        break;\n      default:\n        throw new Error(\n          `Unsupported payment method type: ${payment_method_type}`\n        );\n    }\n  } else {\n    // If connectorId is not iatapay, wait for 10 seconds\n    cy.wait(WAIT_TIME);\n  }\n\n  cy.then(() => {\n    verifyReturnUrl(redirection_url, expected_url, verifyUrl);\n  });\n}\n\nfunction verifyReturnUrl(redirection_url, expected_url, forward_flow) {\n  if (forward_flow) {\n    // Handling redirection\n    if (redirection_url.host.endsWith(expected_url.host)) {\n      // No CORS workaround needed","sourceCodeStart":359,"sourceCodeEnd":395,"githubUrl":"https://github.com/juspay/hyperswitch/blob/9b8b89dc378b62c9a6feda647bad4719d2de7699/cypress-tests-v2/cypress/support/redirectionHandler.js#L359-L395","documentation":"Thrown by the default branch of an inner switch over payment_method_type in redirectionHandler.js (cypress-tests-v2). The surrounding block is connector-specific (the else-branch at line ~381 waits 10s when the connector is NOT iatapay), so this switch handles a specific connector's payment method types — only types like 'upi_intent' have cases — and any other payment_method_type aborts.","triggerScenarios":"Running a redirection test for the connector handled by this block (the iatapay-style branch) with a payment_method_type that has no case here — e.g. 'upi_collect', 'netbanking', or a typo like 'upi-intent' — so execution falls to default and throws.","commonSituations":"Enabling a new payment method for a connector in the test matrix without adding its redirect-handling case; renaming payment method types in the app while the handler keeps old labels; specs passing payment_method_type with different casing or separators than the switch expects.","solutions":["Log the exact payment_method_type reaching the switch and match it against the case labels (it must equal a supported literal like 'upi_intent')","Add a case for the new payment method type describing how its redirect/QR response is verified, falling through to verifyReturnUrl appropriately","If the type needs no special verification, add a case that just sets verifyUrl = false and breaks instead of throwing","Skip the spec for payment method types this handler intentionally does not support yet"],"exampleFix":"// before\ndefault:\n  throw new Error(\n    `Unsupported payment method type: ${payment_method_type}`\n  );\n\n// after\ncase 'upi_collect':\n  // deeplink-based flow: nothing to assert on the redirect itself\n  verifyUrl = false;\n  break;\ndefault:\n  throw new Error(\n    `Unsupported payment method type: ${payment_method_type}`\n  );","handlingStrategy":"validation","validationCode":"// Before the connector-specific branch\nconst PM_TYPES_WITH_REDIRECT_CASE = new Set(['upi_intent' /* keep in sync with the switch */]);\nif (\n  connectorId === 'iatapay' &&\n  !PM_TYPES_WITH_REDIRECT_CASE.has(payment_method_type)\n) {\n  cy.log(`No redirect case for ${payment_method_type} on iatapay - skipping verification`);\n  return;\n}","typeGuard":null,"tryCatchPattern":"cy.on('fail', (err) => {\n  if (err.message.includes('Unsupported payment method type:')) {\n    /* record the gap and skip instead of failing the run */\n  }\n});","preventionTips":["When enabling a new payment method type for a connector, add its redirect case the same commit","Assert on exact payment_method_type literals — separators like 'upi-intent' vs 'upi_intent' will not match","Keep the handled-types set exported next to the switch so callers can pre-check"],"tags":["cypress","e2e","payment-method-type","redirection","test-infrastructure"],"backgroundTag":null,"analyzedSha":"9b8b89dc378b62c9a6feda647bad4719d2de7699","analyzedAt":"2026-08-16T09:01:53.433Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}