mirror of
				https://github.com/juspay/hyperswitch.git
				synced 2025-11-01 02:57:02 +08:00 
			
		
		
		
	test(postman): update postman collection files
This commit is contained in:
		| @ -4,7 +4,33 @@ | ||||
|       "listen": "prerequest", | ||||
|       "script": { | ||||
|         "exec": [ | ||||
|           "" | ||||
|           "const path = pm.request.url.toString();", | ||||
|           "const isPostRequest = pm.request.method.toString() === \"POST\";", | ||||
|           "const isPaymentCreation = path.match(/\\/payments$/) && isPostRequest;", | ||||
|           "", | ||||
|           "if (isPaymentCreation) {", | ||||
|           "  try {", | ||||
|           "    const request = JSON.parse(pm.request.body.toJSON().raw);", | ||||
|           "", | ||||
|           "    // Attach routing", | ||||
|           "    const routing = { type: \"single\", data: \"paypal\" };", | ||||
|           "    request[\"routing\"] = routing;", | ||||
|           "", | ||||
|           "    let updatedRequest = {", | ||||
|           "      mode: \"raw\",", | ||||
|           "      raw: JSON.stringify(request),", | ||||
|           "      options: {", | ||||
|           "        raw: {", | ||||
|           "          language: \"json\",", | ||||
|           "        },", | ||||
|           "      },", | ||||
|           "    };", | ||||
|           "    pm.request.body.update(updatedRequest);", | ||||
|           "  } catch (error) {", | ||||
|           "    console.error(\"Failed to inject routing in the request\");", | ||||
|           "    console.error(error);", | ||||
|           "  }", | ||||
|           "}" | ||||
|         ], | ||||
|         "type": "text/javascript" | ||||
|       } | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	![41898282+github-actions[bot]@users.noreply.github.com](/assets/img/avatar_default.png) github-actions
					github-actions