{
  "info": {
    "name": "Peyeli synthetic evaluation — no real money",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
    "description": "Run node server.mjs first. Selected source-informed simulation, not live API authorization. Attempts stay processing; cancellation after submission must fail. Collection does not send or store credentials."
  },
  "variable": [
    {
      "key": "baseUrl",
      "value": "http://127.0.0.1:3061",
      "type": "string"
    },
    {
      "key": "org",
      "value": "org_synthetic",
      "type": "string"
    },
    {
      "key": "assetId",
      "value": "asset_synthetic_htg",
      "type": "string"
    },
    {
      "key": "connectionId",
      "value": "connection_synthetic",
      "type": "string"
    },
    {
      "key": "intentId",
      "value": "",
      "type": "string"
    },
    {
      "key": "key",
      "value": "",
      "type": "string"
    }
  ],
  "item": [
    {
      "name": "01 Create synthetic intent",
      "event": [
        {
          "listen": "prerequest",
          "script": {
            "type": "text/javascript",
            "exec": [
              "if (pm.variables.get(\"baseUrl\") !== \"http://127.0.0.1:3061\" || pm.variables.get(\"org\") !== \"org_synthetic\" || pm.variables.get(\"assetId\") !== \"asset_synthetic_htg\" || pm.variables.get(\"connectionId\") !== \"connection_synthetic\") { pm.execution.skipRequest(); throw new Error(\"Synthetic loopback fixtures only\"); }",
              "pm.collectionVariables.set(\"key\", \"evaluation-\" + pm.variables.replaceIn(\"{{$guid}}\"));"
            ]
          }
        },
        {
          "listen": "test",
          "script": {
            "type": "text/javascript",
            "exec": [
              "pm.test(\"Expected synthetic HTTP status\", () => pm.response.to.have.status(201));",
              "pm.collectionVariables.set(\"intentId\", pm.response.json().id);"
            ]
          }
        }
      ],
      "request": {
        "method": "POST",
        "auth": {
          "type": "noauth"
        },
        "header": [
          {
            "key": "Content-Type",
            "value": "application/json"
          },
          {
            "key": "Idempotency-Key",
            "value": "{{key}}"
          }
        ],
        "url": "{{baseUrl}}/api/v1/orgs/{{org}}/payment-intents",
        "body": {
          "mode": "raw",
          "raw": "{\n  \"amount\": {\n    \"amountMinor\": \"250000\",\n    \"assetId\": \"{{assetId}}\"\n  },\n  \"orderReference\": \"SYNTHETIC-ORDER-001\"\n}",
          "options": {
            "raw": {
              "language": "json"
            }
          }
        }
      }
    },
    {
      "name": "02 Replay same request and key",
      "event": [
        {
          "listen": "prerequest",
          "script": {
            "type": "text/javascript",
            "exec": [
              "if (pm.variables.get(\"baseUrl\") !== \"http://127.0.0.1:3061\" || pm.variables.get(\"org\") !== \"org_synthetic\" || pm.variables.get(\"assetId\") !== \"asset_synthetic_htg\" || pm.variables.get(\"connectionId\") !== \"connection_synthetic\") { pm.execution.skipRequest(); throw new Error(\"Synthetic loopback fixtures only\"); }"
            ]
          }
        },
        {
          "listen": "test",
          "script": {
            "type": "text/javascript",
            "exec": [
              "pm.test(\"Expected synthetic HTTP status\", () => pm.response.to.have.status(201));",
              "pm.test(\"Same intent\", () => pm.expect(pm.response.json().id).to.eql(pm.collectionVariables.get(\"intentId\")));",
              "pm.test(\"Replay header\", () => pm.expect(pm.response.headers.get(\"idempotent-replayed\")).to.eql(\"true\"));"
            ]
          }
        }
      ],
      "request": {
        "method": "POST",
        "auth": {
          "type": "noauth"
        },
        "header": [
          {
            "key": "Content-Type",
            "value": "application/json"
          },
          {
            "key": "Idempotency-Key",
            "value": "{{key}}"
          }
        ],
        "url": "{{baseUrl}}/api/v1/orgs/{{org}}/payment-intents",
        "body": {
          "mode": "raw",
          "raw": "{\n  \"amount\": {\n    \"amountMinor\": \"250000\",\n    \"assetId\": \"{{assetId}}\"\n  },\n  \"orderReference\": \"SYNTHETIC-ORDER-001\"\n}",
          "options": {
            "raw": {
              "language": "json"
            }
          }
        }
      }
    },
    {
      "name": "03 Read detail",
      "event": [
        {
          "listen": "prerequest",
          "script": {
            "type": "text/javascript",
            "exec": [
              "if (pm.variables.get(\"baseUrl\") !== \"http://127.0.0.1:3061\" || pm.variables.get(\"org\") !== \"org_synthetic\" || pm.variables.get(\"assetId\") !== \"asset_synthetic_htg\" || pm.variables.get(\"connectionId\") !== \"connection_synthetic\") { pm.execution.skipRequest(); throw new Error(\"Synthetic loopback fixtures only\"); }"
            ]
          }
        },
        {
          "listen": "test",
          "script": {
            "type": "text/javascript",
            "exec": [
              "pm.test(\"Expected synthetic HTTP status\", () => pm.response.to.have.status(200));"
            ]
          }
        }
      ],
      "request": {
        "method": "GET",
        "auth": {
          "type": "noauth"
        },
        "header": [],
        "url": "{{baseUrl}}/api/v1/orgs/{{org}}/payment-intents/{{intentId}}"
      }
    },
    {
      "name": "04 Submit unresolved attempt",
      "event": [
        {
          "listen": "prerequest",
          "script": {
            "type": "text/javascript",
            "exec": [
              "if (pm.variables.get(\"baseUrl\") !== \"http://127.0.0.1:3061\" || pm.variables.get(\"org\") !== \"org_synthetic\" || pm.variables.get(\"assetId\") !== \"asset_synthetic_htg\" || pm.variables.get(\"connectionId\") !== \"connection_synthetic\") { pm.execution.skipRequest(); throw new Error(\"Synthetic loopback fixtures only\"); }",
              "pm.collectionVariables.set(\"key\", \"evaluation-\" + pm.variables.replaceIn(\"{{$guid}}\"));"
            ]
          }
        },
        {
          "listen": "test",
          "script": {
            "type": "text/javascript",
            "exec": [
              "pm.test(\"Expected synthetic HTTP status\", () => pm.response.to.have.status(201));"
            ]
          }
        }
      ],
      "request": {
        "method": "POST",
        "auth": {
          "type": "noauth"
        },
        "header": [
          {
            "key": "Content-Type",
            "value": "application/json"
          },
          {
            "key": "Idempotency-Key",
            "value": "{{key}}"
          }
        ],
        "url": "{{baseUrl}}/api/v1/orgs/{{org}}/payment-intents/{{intentId}}/attempts",
        "body": {
          "mode": "raw",
          "raw": "{\n  \"providerConnectionId\": \"{{connectionId}}\"\n}",
          "options": {
            "raw": {
              "language": "json"
            }
          }
        }
      }
    },
    {
      "name": "05 Cancel unresolved attempt is rejected",
      "event": [
        {
          "listen": "prerequest",
          "script": {
            "type": "text/javascript",
            "exec": [
              "if (pm.variables.get(\"baseUrl\") !== \"http://127.0.0.1:3061\" || pm.variables.get(\"org\") !== \"org_synthetic\" || pm.variables.get(\"assetId\") !== \"asset_synthetic_htg\" || pm.variables.get(\"connectionId\") !== \"connection_synthetic\") { pm.execution.skipRequest(); throw new Error(\"Synthetic loopback fixtures only\"); }",
              "pm.collectionVariables.set(\"key\", \"evaluation-\" + pm.variables.replaceIn(\"{{$guid}}\"));"
            ]
          }
        },
        {
          "listen": "test",
          "script": {
            "type": "text/javascript",
            "exec": [
              "pm.test(\"Expected synthetic HTTP status\", () => pm.response.to.have.status(409));",
              "pm.test(\"Unresolved\", () => pm.expect(pm.response.json().error.code).to.eql(\"invalid_transition\"));"
            ]
          }
        }
      ],
      "request": {
        "method": "POST",
        "auth": {
          "type": "noauth"
        },
        "header": [
          {
            "key": "Content-Type",
            "value": "application/json"
          },
          {
            "key": "Idempotency-Key",
            "value": "{{key}}"
          }
        ],
        "url": "{{baseUrl}}/api/v1/orgs/{{org}}/payment-intents/{{intentId}}/cancel",
        "body": {
          "mode": "raw",
          "raw": "{}",
          "options": {
            "raw": {
              "language": "json"
            }
          }
        }
      }
    },
    {
      "name": "06 List synthetic intents",
      "event": [
        {
          "listen": "prerequest",
          "script": {
            "type": "text/javascript",
            "exec": [
              "if (pm.variables.get(\"baseUrl\") !== \"http://127.0.0.1:3061\" || pm.variables.get(\"org\") !== \"org_synthetic\" || pm.variables.get(\"assetId\") !== \"asset_synthetic_htg\" || pm.variables.get(\"connectionId\") !== \"connection_synthetic\") { pm.execution.skipRequest(); throw new Error(\"Synthetic loopback fixtures only\"); }"
            ]
          }
        },
        {
          "listen": "test",
          "script": {
            "type": "text/javascript",
            "exec": [
              "pm.test(\"Expected synthetic HTTP status\", () => pm.response.to.have.status(200));"
            ]
          }
        }
      ],
      "request": {
        "method": "GET",
        "auth": {
          "type": "noauth"
        },
        "header": [],
        "url": "{{baseUrl}}/api/v1/orgs/{{org}}/payment-intents"
      }
    },
    {
      "name": "07 Create another intent",
      "event": [
        {
          "listen": "prerequest",
          "script": {
            "type": "text/javascript",
            "exec": [
              "if (pm.variables.get(\"baseUrl\") !== \"http://127.0.0.1:3061\" || pm.variables.get(\"org\") !== \"org_synthetic\" || pm.variables.get(\"assetId\") !== \"asset_synthetic_htg\" || pm.variables.get(\"connectionId\") !== \"connection_synthetic\") { pm.execution.skipRequest(); throw new Error(\"Synthetic loopback fixtures only\"); }",
              "pm.collectionVariables.set(\"key\", \"evaluation-\" + pm.variables.replaceIn(\"{{$guid}}\"));"
            ]
          }
        },
        {
          "listen": "test",
          "script": {
            "type": "text/javascript",
            "exec": [
              "pm.test(\"Expected synthetic HTTP status\", () => pm.response.to.have.status(201));",
              "pm.collectionVariables.set(\"intentId\", pm.response.json().id);"
            ]
          }
        }
      ],
      "request": {
        "method": "POST",
        "auth": {
          "type": "noauth"
        },
        "header": [
          {
            "key": "Content-Type",
            "value": "application/json"
          },
          {
            "key": "Idempotency-Key",
            "value": "{{key}}"
          }
        ],
        "url": "{{baseUrl}}/api/v1/orgs/{{org}}/payment-intents",
        "body": {
          "mode": "raw",
          "raw": "{\n  \"amount\": {\n    \"amountMinor\": \"250000\",\n    \"assetId\": \"{{assetId}}\"\n  },\n  \"orderReference\": \"SYNTHETIC-ORDER-002\"\n}",
          "options": {
            "raw": {
              "language": "json"
            }
          }
        }
      }
    },
    {
      "name": "08 Cancel untouched intent",
      "event": [
        {
          "listen": "prerequest",
          "script": {
            "type": "text/javascript",
            "exec": [
              "if (pm.variables.get(\"baseUrl\") !== \"http://127.0.0.1:3061\" || pm.variables.get(\"org\") !== \"org_synthetic\" || pm.variables.get(\"assetId\") !== \"asset_synthetic_htg\" || pm.variables.get(\"connectionId\") !== \"connection_synthetic\") { pm.execution.skipRequest(); throw new Error(\"Synthetic loopback fixtures only\"); }",
              "pm.collectionVariables.set(\"key\", \"evaluation-\" + pm.variables.replaceIn(\"{{$guid}}\"));"
            ]
          }
        },
        {
          "listen": "test",
          "script": {
            "type": "text/javascript",
            "exec": [
              "pm.test(\"Expected synthetic HTTP status\", () => pm.response.to.have.status(200));",
              "pm.test(\"Canceled\", () => pm.expect(pm.response.json().status).to.eql(\"canceled\"));"
            ]
          }
        }
      ],
      "request": {
        "method": "POST",
        "auth": {
          "type": "noauth"
        },
        "header": [
          {
            "key": "Content-Type",
            "value": "application/json"
          },
          {
            "key": "Idempotency-Key",
            "value": "{{key}}"
          }
        ],
        "url": "{{baseUrl}}/api/v1/orgs/{{org}}/payment-intents/{{intentId}}/cancel",
        "body": {
          "mode": "raw",
          "raw": "{}",
          "options": {
            "raw": {
              "language": "json"
            }
          }
        }
      }
    }
  ]
}
