{
  "info": {
    "name": "Travel Insured API - Annual Plan Quote to Purchase",
    "description": "Public partner collection for the published annual-plan deferred purchase flow: annualPlanQuote, stageAnnualPolicyPurchase, processPayment, and policyBindRequest.",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "item": [
    {
      "name": "00 - Getting Started",
      "item": [
        {
          "name": "Test GraphQL Connectivity",
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('Status code is 200', function () { pm.response.to.have.status(200); });",
                  "pm.test('Response is JSON', function () { pm.response.to.be.json; });",
                  "const json = pm.response.json();",
                  "pm.test('No GraphQL errors', function () { pm.expect(json).to.not.have.property('errors'); });"
                ]
              }
            }
          ],
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              },
              {
                "key": "Authorization",
                "value": "ApiKey {{apiToken}}"
              },
              {
                "key": "x-api-key",
                "value": "{{accessKey}}"
              }
            ],
            "body": {
              "mode": "graphql",
              "graphql": {
                "query": "query PurchaseOptions {\n  purchaseOptions {\n    marketingChannels {\n      marketingChannelId\n      marketingChannelName\n    }\n  }\n}",
                "variables": "{}"
              }
            },
            "url": {
              "raw": "{{graphqlBaseUrl}}",
              "host": [
                "{{graphqlBaseUrl}}"
              ]
            }
          },
          "response": []
        }
      ]
    },
    {
      "name": "01 - Annual Quote to Purchase",
      "item": [
        {
          "name": "1. Annual Plan Quote",
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('Status code is 200', function () { pm.response.to.have.status(200); });",
                  "const json = pm.response.json();",
                  "pm.test('No GraphQL errors', function () { pm.expect(json).to.not.have.property('errors'); });",
                  "pm.test('Annual quote number returned', function () { pm.expect(json.data.annualPlanQuote.quoteNumber).to.be.a('string').that.is.not.empty; });",
                  "pm.test('Products returned', function () { pm.expect(json.data.annualPlanQuote.products).to.be.an('array').that.is.not.empty; });",
                  "pm.environment.set('quoteNumber', json.data.annualPlanQuote.quoteNumber);",
                  "if (json.data.annualPlanQuote.products.length > 0) { pm.environment.set('selectedProductCode', json.data.annualPlanQuote.products[0].productCode); }"
                ]
              }
            }
          ],
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              },
              {
                "key": "Authorization",
                "value": "ApiKey {{apiToken}}"
              },
              {
                "key": "x-api-key",
                "value": "{{accessKey}}"
              }
            ],
            "body": {
              "mode": "graphql",
              "graphql": {
                "query": "mutation AnnualPlanQuote($annualPlanQuoteRequest: AnnualPlanQuoteRequestInput!) {\n  annualPlanQuote(annualPlanQuoteRequest: $annualPlanQuoteRequest) {\n    quoteNumber\n    products {\n      productId\n      productName\n      productCode\n      availablePaymentMethod {\n        paymentMethod\n      }\n      coverages {\n        productCoverageTypeCode\n        coverageLimits {\n          productCoverageLimitId\n          totalPrice\n        }\n      }\n    }\n  }\n}",
                "variables": "{\n  \"annualPlanQuoteRequest\": {\n    \"agencyNumber\": \"{{agencyNumber}}\",\n    \"agentId\": \"{{agentId}}\",\n    \"effectiveDate\": \"2026-08-01\",\n    \"residencyCountryIsoCode\": \"US\",\n    \"residencyStateIsoCode\": \"CT\",\n    \"travelers\": [\n      {\n        \"id\": 1,\n        \"primaryTraveler\": true,\n        \"firstName\": \"Jane\",\n        \"lastName\": \"Smith\",\n        \"dateOfBirth\": \"1985-03-20\",\n        \"email\": \"jane.smith@example.com\"\n      }\n    ],\n    \"tripSegment\": {\n      \"departureDate\": \"2026-08-15\",\n      \"returnDate\": \"2026-08-22\",\n      \"destinations\": [\n        {\n          \"countryIsoCode\": \"GB\",\n          \"destinationName\": \"United Kingdom\"\n        }\n      ],\n      \"travelers\": [\n        {\n          \"id\": 1,\n          \"firstName\": \"Jane\",\n          \"lastName\": \"Smith\",\n          \"dateOfBirth\": \"1985-03-20\",\n          \"tripCost\": 3000\n        }\n      ]\n    }\n  }\n}"
              }
            },
            "url": {
              "raw": "{{graphqlBaseUrl}}",
              "host": [
                "{{graphqlBaseUrl}}"
              ]
            },
            "description": "Generates an annual-plan quote and saves quoteNumber and productCode for staging."
          },
          "response": []
        },
        {
          "name": "2. Stage Annual Policy Purchase",
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('Status code is 200', function () { pm.response.to.have.status(200); });",
                  "const json = pm.response.json();",
                  "pm.test('No GraphQL errors', function () { pm.expect(json).to.not.have.property('errors'); });",
                  "pm.test('planGuid returned', function () { pm.expect(json.data.stageAnnualPolicyPurchase.planGuid).to.be.a('string').that.is.not.empty; });",
                  "pm.environment.set('planGuid', json.data.stageAnnualPolicyPurchase.planGuid);"
                ]
              }
            }
          ],
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              },
              {
                "key": "Authorization",
                "value": "ApiKey {{apiToken}}"
              },
              {
                "key": "x-api-key",
                "value": "{{accessKey}}"
              }
            ],
            "body": {
              "mode": "graphql",
              "graphql": {
                "query": "mutation StageAnnualPolicyPurchase($annualPolicyPurchaseStage: AnnualPolicyPurchaseStageInput!) {\n  stageAnnualPolicyPurchase(annualPolicyPurchaseStage: $annualPolicyPurchaseStage) {\n    planGuid\n  }\n}",
                "variables": "{\n  \"annualPolicyPurchaseStage\": {\n    \"agencyNumber\": \"{{agencyNumber}}\",\n    \"agentId\": \"{{agentId}}\",\n    \"quoteNumber\": \"{{quoteNumber}}\",\n    \"deliveryTypes\": [\n      {\n        \"deliveryType\": \"Email\"\n      }\n    ],\n    \"product\": {\n      \"productCode\": \"{{selectedProductCode}}\"\n    },\n    \"planTravelers\": [\n      {\n        \"id\": 1,\n        \"primaryTraveler\": true,\n        \"firstName\": \"Jane\",\n        \"lastName\": \"Smith\",\n        \"dateOfBirth\": \"1985-03-20\",\n        \"contactInfo\": {\n          \"email\": \"jane.smith@example.com\",\n          \"phoneNumbers\": [\n            \"860-555-0100\"\n          ],\n          \"address\": {\n            \"addressLine1\": \"123 Main Street\",\n            \"city\": \"Hartford\",\n            \"stateIsoCode\": \"CT\",\n            \"zipCode\": \"06101\",\n            \"countryIsoCode\": \"US\"\n          }\n        }\n      }\n    ],\n    \"tripSegment\": {\n      \"departureDate\": \"2026-08-15\",\n      \"returnDate\": \"2026-08-22\",\n      \"destinations\": [\n        {\n          \"countryIsoCode\": \"GB\",\n          \"destinationName\": \"United Kingdom\"\n        }\n      ],\n      \"travelers\": [\n        {\n          \"id\": 1,\n          \"firstName\": \"Jane\",\n          \"lastName\": \"Smith\",\n          \"dateOfBirth\": \"1985-03-20\",\n          \"tripCost\": 3000\n        }\n      ]\n    }\n  }\n}"
              }
            },
            "url": {
              "raw": "{{graphqlBaseUrl}}",
              "host": [
                "{{graphqlBaseUrl}}"
              ]
            },
            "description": "Stages the annual policy purchase using the annual quote and annual traveler model."
          },
          "response": []
        },
        {
          "name": "3. Process Payment",
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('Status code is 200', function () { pm.response.to.have.status(200); });",
                  "const json = pm.response.json();",
                  "pm.test('No GraphQL errors', function () { pm.expect(json).to.not.have.property('errors'); });",
                  "pm.test('processPayment returned', function () { pm.expect(json.data.processPayment.planGuid).to.be.a('string'); });",
                  "if (json.data.processPayment.paymentRequestId) { pm.environment.set('paymentRequestId', json.data.processPayment.paymentRequestId); }"
                ]
              }
            }
          ],
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              },
              {
                "key": "Authorization",
                "value": "ApiKey {{apiToken}}"
              },
              {
                "key": "x-api-key",
                "value": "{{accessKey}}"
              }
            ],
            "body": {
              "mode": "graphql",
              "graphql": {
                "query": "mutation ProcessPayment($paymentProcessingRequest: PaymentProcessingRequestInput!) {\n  processPayment(paymentProcessingRequest: $paymentProcessingRequest) {\n    paymentRequestId\n    planGuid\n  }\n}",
                "variables": "{\n  \"paymentProcessingRequest\": {\n    \"planGuid\": \"{{planGuid}}\",\n    \"paymentMethod\": \"CreditCard\",\n    \"hostedPaymentUrl\": \"{{hostedPaymentUrl}}\"\n  }\n}"
              }
            },
            "url": {
              "raw": "{{graphqlBaseUrl}}",
              "host": [
                "{{graphqlBaseUrl}}"
              ]
            }
          },
          "response": []
        },
        {
          "name": "4. Policy Bind Request",
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('Status code is 200', function () { pm.response.to.have.status(200); });",
                  "const json = pm.response.json();",
                  "pm.test('No GraphQL errors', function () { pm.expect(json).to.not.have.property('errors'); });",
                  "pm.test('planNumber returned', function () { pm.expect(json.data.policyBindRequest.planNumber).to.be.a('string').that.is.not.empty; });",
                  "pm.environment.set('planNumber', json.data.policyBindRequest.planNumber);"
                ]
              }
            }
          ],
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              },
              {
                "key": "Authorization",
                "value": "ApiKey {{apiToken}}"
              },
              {
                "key": "x-api-key",
                "value": "{{accessKey}}"
              }
            ],
            "body": {
              "mode": "graphql",
              "graphql": {
                "query": "mutation PolicyBindRequest($planGuid: UUID!, $transactionId: String) {\n  policyBindRequest(planGuid: $planGuid, transactionId: $transactionId) {\n    planNumber\n    cobDownloadLink\n    eobDownloadLink\n  }\n}",
                "variables": "{\n  \"planGuid\": \"{{planGuid}}\",\n  \"transactionId\": \"{{transactionId}}\"\n}"
              }
            },
            "url": {
              "raw": "{{graphqlBaseUrl}}",
              "host": [
                "{{graphqlBaseUrl}}"
              ]
            },
            "description": "Binds the staged annual policy after payment authorization."
          },
          "response": []
        }
      ]
    }
  ]
}
