{
  "info": {
    "_postman_id": "a466fe2a-ed6b-4ffd-b7c3-6f470900f7ad",
    "name": "🦖 Tictactrip",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
    "_exporter_id": "9082442"
  },
  "item": [
    {
      "name": "1. Get clusters and groups",
      "request": {
        "method": "GET",
        "header": [
          {
            "key": "Authorization",
            "value": "Bearer token"
          },
          {
            "key": "Content-Type",
            "value": "application/json"
          }
        ],
        "url": {
          "raw": "https://api.tictactrip.eu/v2/stopClusters",
          "protocol": "https",
          "host": [
            "api",
            "tictactrip",
            "eu"
          ],
          "path": [
            "v2",
            "stopClusters"
          ]
        }
      },
      "response": []
    },
    {
      "name": "2. Search for trips",
      "request": {
        "method": "POST",
        "header": [
          {
            "warning": "This is a duplicate header and will be overridden by the Authorization header generated by Postman.",
            "key": "Authorization",
            "value": "Bearer token",
            "type": "text"
          },
          {
            "key": "Content-Type",
            "value": "application/json",
            "type": "text"
          }
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n    \"originGpuid\": \"{{group_lyon_part_dieu}}\",\n    \"destinationGpuid\": \"{{group_paris_gare_de_lyon}}\",\n    \"outboundDate\": \"2024-01-08T00:00:00Z\",\n    \"returnDate\": \"2024-01-09T00:00:00Z\",\n    \"passengers\": [\n        {\n            \"age\": 30\n        }\n    ]\n}",
          "options": {
            "raw": {
              "language": "json"
            }
          }
        },
        "url": {
          "raw": "https://api.tictactrip.eu/v2/results",
          "protocol": "https",
          "host": [
            "api",
            "tictactrip",
            "eu"
          ],
          "path": [
            "v2",
            "results"
          ]
        }
      },
      "response": []
    },
    {
      "name": "3. Select a trip and create a cart",
      "request": {
        "method": "POST",
        "header": [
          {
            "key": "Authorization",
            "value": "Bearer token"
          },
          {
            "key": "Content-Type",
            "value": "application/json"
          }
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n  \"outboundTripId\": \"{{trip_id}}\",\n  \"passengers\": [\n    {\n      \"age\": 35,\n      \"discountCards\": []\n    }\n  ]\n}"
        },
        "url": {
          "raw": "https://api.tictactrip.eu/booking/v3/carts",
          "protocol": "https",
          "host": [
            "api",
            "tictactrip",
            "eu"
          ],
          "path": [
            "booking",
            "v3",
            "carts"
          ]
        }
      },
      "response": []
    },
    {
      "name": "4. Provide passengers’ informations, select fare",
      "request": {
        "method": "PATCH",
        "header": [
          {
            "key": "Authorization",
            "value": "Bearer token"
          },
          {
            "key": "Content-Type",
            "value": "application/json"
          }
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n    \"passengers\": [\n        {\n            \"lastName\": \"Potter\",\n            \"discountCards\": [],\n            \"isCustomer\": true,\n            \"birthdate\": \"1979-09-02\",\n            \"title\": \"MR\",\n            \"firstName\": \"Harry\",\n            \"category\": \"adults\",\n            \"age\": 35\n        },\n        {\n            \"lastName\": \"Potter\",\n            \"discountCards\": [],\n            \"isCustomer\": true,\n            \"birthdate\": \"2010-09-02\",\n            \"title\": \"MR\",\n            \"firstName\": \"Henriette\",\n            \"category\": \"adults\",\n            \"age\": 12\n        }\n    ],\n    \"customer\": {\n        \"lastName\": \"Potter\",\n        \"mail\": \"your@mail.com\",\n        \"phoneNumber\": \"+33612345678\",\n        \"isSubscribedToNewsletter\": false,\n        \"title\": \"MR\",\n        \"firstName\": \"Harry\",\n        \"language\": \"fr\",\n        \"birthdate\": \"1999-09-02\"\n    }\n}"
        },
        "url": {
          "raw": "https://api.tictactrip.eu/booking/v3/carts/{{cart_id}}",
          "protocol": "https",
          "host": [
            "api",
            "tictactrip",
            "eu"
          ],
          "path": [
            "booking",
            "v3",
            "carts",
            "{{cart_id}}"
          ]
        }
      },
      "response": []
    },
    {
      "name": "5. Create an order",
      "request": {
        "method": "POST",
        "header": [
          {
            "key": "Authorization",
            "value": "Bearer token"
          },
          {
            "key": "Content-Type",
            "value": "application/json"
          }
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n    \"cartId\": \"{{cart_id}}\"\n}"
        },
        "url": {
          "raw": "https://api.tictactrip.eu/booking/v3/orders",
          "protocol": "https",
          "host": [
            "api",
            "tictactrip",
            "eu"
          ],
          "path": [
            "booking",
            "v3",
            "orders"
          ]
        }
      },
      "response": []
    },
    {
      "name": "6. Book an order",
      "request": {
        "method": "POST",
        "header": [
          {
            "key": "Authorization",
            "value": "Bearer token"
          },
          {
            "key": "Content-Type",
            "value": "application/json"
          }
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n    \"passengers\": [\n        {\n            \"lastName\": \"Potter\",\n            \"discountCards\": [],\n            \"isCustomer\": true,\n            \"birthdate\": \"1999-09-02\",\n            \"title\": \"MR\",\n            \"firstName\": \"Harry\",\n            \"category\": \"adults\",\n            \"age\": 35\n        }\n    ],\n    \"customer\": {\n        \"lastName\": \"Potter\",\n        \"mail\": \"your@mail.com\",\n        \"phoneNumber\": \"+33612345678\",\n        \"isSubscribedToNewsletter\": false,\n        \"title\": \"MR\",\n        \"firstName\": \"Harry\",\n        \"language\": \"fr\",\n        \"birthdate\": \"1999-09-02\"\n    }\n}"
        },
        "url": {
          "raw": "https://api.tictactrip.eu/booking/v3/orders/{{order_id}}/book",
          "protocol": "https",
          "host": [
            "api",
            "tictactrip",
            "eu"
          ],
          "path": [
            "booking",
            "v3",
            "orders",
            "{{order_id}}",
            "book"
          ]
        }
      },
      "response": []
    },
    {
      "name": "7. Get order status",
      "request": {
        "method": "GET",
        "header": [
          {
            "key": "Authorization",
            "value": "Bearer token"
          },
          {
            "key": "Content-Type",
            "value": "application/json"
          }
        ],
        "url": {
          "raw": "https://api.tictactrip.eu/booking/v3/orders/{{order_id}}",
          "protocol": "https",
          "host": [
            "api",
            "tictactrip",
            "eu"
          ],
          "path": [
            "booking",
            "v3",
            "orders",
            "{{order_id}}"
          ]
        }
      },
      "response": []
    },
    {
      "name": "8. Download tickets",
      "protocolProfileBehavior": {
        "disableBodyPruning": true
      },
      "request": {
        "method": "GET",
        "header": [
          {
            "key": "Authorization",
            "value": "Bearer token"
          },
          {
            "key": "Content-Type",
            "value": "application/json"
          }
        ],
        "body": {
          "mode": "raw",
          "raw": ""
        },
        "url": {
          "raw": "https://api.comparatrip.eu/booking/v3/orders/4ff7e4cc89bf4338",
          "protocol": "https",
          "host": [
            "api",
            "comparatrip",
            "eu"
          ],
          "path": [
            "booking",
            "v3",
            "orders",
            "4ff7e4cc89bf4338"
          ]
        }
      },
      "response": []
    },
    {
      "name": "9. Get cancellation conditions",
      "request": {
        "method": "GET",
        "header": [
          {
            "key": "Authorization",
            "value": "Bearer token"
          },
          {
            "key": "Content-Type",
            "value": "application/json"
          }
        ],
        "url": {
          "raw": "https://api.tictactrip.eu/booking/v3/orderTickets/{{ticket_id}}/cancellation/conditions",
          "protocol": "https",
          "host": [
            "api",
            "tictactrip",
            "eu"
          ],
          "path": [
            "booking",
            "v3",
            "orderTickets",
            "{{ticket_id}}",
            "cancellation",
            "conditions"
          ]
        }
      },
      "response": []
    },
    {
      "name": "10. Cancel a booking",
      "request": {
        "method": "PUT",
        "header": [
          {
            "key": "Authorization",
            "value": "Bearer token"
          },
          {
            "key": "Content-Type",
            "value": "application/json"
          }
        ],
        "url": {
          "raw": "https://api.tictactrip.eu/booking/v3/orderTickets/{{ticket_id}}/cancellation",
          "protocol": "https",
          "host": [
            "api",
            "tictactrip",
            "eu"
          ],
          "path": [
            "booking",
            "v3",
            "orderTickets",
            "{{ticket_id}}",
            "cancellation"
          ]
        }
      },
      "response": []
    },
    {
      "name": "11. Autocomplete",
      "request": {
        "auth": {
          "type": "bearer",
          "bearer": [
            {
              "key": "token",
              "value": "",
              "type": "string"
            }
          ]
        },
        "method": "GET",
        "header": [
          {
            "key": "Authorization",
            "value": "Bearer token",
            "type": "text"
          },
          {
            "key": "Content-Type",
            "value": "application/json",
            "type": "text"
          }
        ],
        "url": {
          "raw": "https://api.tictactrip.eu/v2/autocomplete?q=",
          "protocol": "https",
          "host": [
            "api",
            "tictactrip",
            "eu"
          ],
          "path": [
            "v2",
            "autocomplete"
          ],
          "query": [
            {
              "key": "q",
              "value": ""
            }
          ]
        }
      },
      "response": []
    },
    {
      "name": "12. Get popular cities",
      "request": {
        "method": "GET",
        "header": [
          {
            "key": "Content-Type",
            "value": "application/json",
            "type": "text"
          },
          {
            "key": "Authorization",
            "value": "Bearer token",
            "type": "text"
          }
        ],
        "url": {
          "raw": "https://api.tictactrip.eu/v2/cities/popular/10",
          "protocol": "https",
          "host": [
            "api",
            "tictactrip",
            "eu"
          ],
          "path": [
            "v2",
            "cities",
            "popular",
            "10"
          ]
        }
      },
      "response": []
    },
    {
      "name": "13. Get popular cities from other one",
      "request": {
        "method": "GET",
        "header": [
          {
            "key": "Content-Type",
            "value": "application/json",
            "type": "text"
          },
          {
            "key": "Authorization",
            "value": "Bearer token",
            "type": "text"
          }
        ],
        "url": {
          "raw": "https://api.tictactrip.eu/v2/cities/popular/10",
          "protocol": "https",
          "host": [
            "api",
            "tictactrip",
            "eu"
          ],
          "path": [
            "v2",
            "cities",
            "popular",
            "10"
          ]
        }
      },
      "response": []
    }
  ],
  "event": [
    {
      "listen": "prerequest",
      "script": {
        "type": "text/javascript",
        "exec": [
          "// Create a new date object for the current time",
          "let currentDate = new Date();",
          "",
          "// Add 7 days to the current date to get a week from now",
          "currentDate.setDate(currentDate.getDate() + 7);",
          "",
          "// Reset hours, minutes, seconds, and milliseconds",
          "currentDate.setHours(0, 0, 0, 0);",
          "",
          "// Format the date to match the desired format with the T00:00:00Z at the end",
          "let seven_days_from_now = currentDate.toISOString().split('T')[0] + 'T00:00:00Z';",
          "",
          "// Set the calculated date to a Postman variable",
          "pm.environment.set(\"seven_days_from_now\", seven_days_from_now);"
        ]
      }
    },
    {
      "listen": "test",
      "script": {
        "type": "text/javascript",
        "exec": [
          ""
        ]
      }
    }
  ],
  "variable": [
    {
      "key": "token",
      "value": "",
      "type": "string"
    },
    {
      "key": "seven_days_from_now",
      "value": "scripted_variable",
      "type": "string"
    },
    {
      "key": "cluster_paris",
      "value": "c|FRparis___@u09tv",
      "type": "string"
    },
    {
      "key": "cluster_lyon",
      "value": "c|FRlyon____@u05kq",
      "type": "string"
    },
    {
      "key": "group_paris_gare_de_lyon",
      "value": "g|FRpargarly@u09ty5",
      "type": "string"
    },
    {
      "key": "group_paris_bercy",
      "value": "g|FRpariberc@u09ty4",
      "type": "string"
    },
    {
      "key": "group_marne_la_vallee",
      "value": "g|FRmavachpa@u09yp2",
      "type": "string"
    },
    {
      "key": "group_lyon_perrache",
      "value": "g|FRlyonperr@u05kmb",
      "type": "string"
    },
    {
      "key": "group_lyon_part_dieu",
      "value": "g|FRlyopardi@u05kqd",
      "type": "string"
    },
    {
      "key": "group_lyon_saint_exupery",
      "value": "g|FRlysaextg@u05s5e",
      "type": "string"
    },
    {
      "key": "trip_id",
      "value": "fakeuuid-8ab8-405d-b679-54a9edb2a102c52030a1-8ab8-405d-b679-54a9ddb2a302",
      "type": "string"
    },
    {
      "key": "cart_id",
      "value": "fake69c4c7b446b",
      "type": "string"
    },
    {
      "key": "order_id",
      "value": "fake816cb3d84703",
      "type": "string"
    },
    {
      "key": "ticket_id",
      "value": "999999",
      "type": "string"
    }
  ]
}