Skip to content

Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation

ci: fix paypal postman tests (#4501)

Shanks4718c174572d
diff --git a/postman/collection-dir/paypal/event.prerequest.js b/postman/collection-dir/paypal/event.prerequest.js
index f4c9a76486..944aebeb6e 100644
--- a/postman/collection-dir/paypal/event.prerequest.js
+++ b/postman/collection-dir/paypal/event.prerequest.js
@@ -3,25 +3,28 @@ 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);
+ try {
+ const request = JSON.parse(pm.request.body.toJSON().raw);
+ const merchantConnectorId = pm.collectionVariables.get("merchant_connector_id");
- // Attach routing
- const routing = { type: "single", data: "paypal" };
- request["routing"] = routing;
+ // Attach routing
+ const routing = {
+ type: "single", data: { connector: "paypal", merchant_connector_id: merchantConnectorId }
+ };
+ 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);
- }
-}
\ No newline at end of file
+ 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);
+ }
+}
diff --git a/postman/collection-json/paypal.postman_collection.json b/postman/collection-json/paypal.postman_collection.json
index dfb52bb4ff..58368b3b85 100644
--- a/postman/collection-json/paypal.postman_collection.json
+++ b/postman/collection-json/paypal.postman_collection.json
@@ -9,28 +9,32 @@
"const isPaymentCreation = path.match(/\\/payments$/) && isPostRequest;",
"",
"if (isPaymentCreation) {",
- " try {",
- " const request = JSON.parse(pm.request.body.toJSON().raw);",
+ " try {",
+ " const request = JSON.parse(pm.request.body.toJSON().raw);",
+ " const merchantConnectorId = pm.collectionVariables.get(\"merchant_connector_id\");",
"",
- " // Attach routing",
- " const routing = { type: \"single\", data: \"paypal\" };",
- " request[\"routing\"] = routing;",
+ " // Attach routing",
+ " const routing = {",
+ " type: \"single\", data: { connector: \"paypal\", merchant_connector_id: merchantConnectorId }",
+ " };",
+ " 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);",
- " }",
- "}"
+ " 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"
}