{"info":{"_postman_id":"26861908-0b06-4a6c-84c7-4c5e09ad2338","name":"GOMYGO Merchant","schema":"https://schema.getpostman.com/json/collection/v2.0.0/collection.json","toc":[],"description":"<html><head></head><body></body></html>","owner":"25160631","collectionId":"26861908-0b06-4a6c-84c7-4c5e09ad2338","publishedId":"2sAYXBEyta","public":true,"customColor":{"top-bar":"FFFFFF","right-sidebar":"303030","highlight":"6941C6"},"publishDate":"2025-02-11T10:11:46.000Z"},"item":[{"name":"Merchant V1","item":[{"name":"Get Places List","event":[{"listen":"test","script":{"id":"db52128e-fdb3-49c6-9061-808a346017e2","exec":["// Ensure the status code is 200","pm.test(\"Status code is 200\", function () {","    pm.response.to.have.status(200);","});","","// Ensure the message is \"List Place Success.\"","pm.test(\"Message is 'Place Lists'\", function () {","    var jsonData = pm.response.json();","    pm.expect(jsonData.message).to.eql(\"Place Lists\");","});","","// Ensure each object in data contains 'code' and 'name' keys with non-empty values","pm.test(\"Data contains objects with 'code' and 'name' keys having non-empty values\", function () {","    var jsonData = pm.response.json();","    ","    pm.expect(jsonData.data).to.be.an('array').that.is.not.empty;","","    jsonData.data.forEach(function(item) {","        pm.expect(item).to.have.property('code').that.is.a('string').that.is.not.empty;","        pm.expect(item).to.have.property('name').that.is.a('string').that.is.not.empty;","    });","});","","// // Select two random places and set environment variables 'trip-from' and 'trip-to'","// pm.test(\"Set environment variables 'trip-from' and 'trip-to' with random places\", function () {","//     var jsonData = pm.response.json();","//     var data = jsonData.data;","","//     // Ensure there are at least two places in the data","//     pm.expect(data.length).to.be.at.least(2);","","//     // Shuffle the data array to get random places","//     data = _.shuffle(data);","","//     // Select two random places","//     var tripFrom = data[0];","//     var tripTo = data[1];","","//     // Set the environment variables","//     pm.environment.set(\"trip-from\", tripFrom.code);","//     pm.environment.set(\"trip-to\", tripTo.code);","","// });"],"type":"text/javascript","packages":{}}}],"id":"39349066-9166-4740-bdbc-20554cc840e8","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[{"key":"x-api-key","value":"{{API-KEY}}","type":"text"}],"body":{"mode":"raw","raw":"","options":{"raw":{"language":"json"}}},"url":"{{URL}}/api/v1/merchant/place/list","description":"<h3 id=\"get-merchant-places-list\">Get Merchant Places List</h3>\n<p>This endpoint makes an HTTP GET request to retrieve a list of merchant places.</p>\n<h4 id=\"request\">Request</h4>\n<p>The request does not require a request body. It includes the following parameters:</p>\n<ul>\n<li>No request body parameters are required.</li>\n</ul>\n<h4 id=\"response\">Response</h4>\n<p>The response will be a JSON object with the following schema:</p>\n<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code class=\"language-json\">{\n    \"responseCode\": 6001,\n    \"message\": \"Place Lists\",\n    \"data\": [\n        {\n            \"code\": \"66613b743ed1cce090d62364\",\n            \"name\": \"Siraha\"\n        },\n        {\n            \"code\": \"65cdf4e99d5fc0e248e9cdc9\",\n            \"name\": \"radhe radhe\"\n        },\n        {\n            \"code\": \"65b2326a4986172008fb6277\",\n            \"name\": \"test\"\n        },\n        {\n            \"code\": \"65abf891a6c1d05a9301e506\",\n            \"name\": \"Bardibas  chock\"\n        },\n        {\n            \"code\": \"65abf858a6c1d05a9301e501\",\n            \"name\": \"Lahan\"\n        },\n        {\n            \"code\": \"65abf7f6a6c1d05a9301e4fc\",\n            \"name\": \"Biratnagar\"\n        },\n        {\n            \"code\": \"65aa99c72b7cdfec0e26c174\",\n            \"name\": \"Janakpur\"\n        },\n        {\n            \"code\": \"65aa999a2b7cdfec0e26c170\",\n            \"name\": \"Kathmandu Valley\"\n        }\n    ]\n}\n\n</code></pre>\n<p>The response will contain an array of <code>places</code>, where each place object includes code and name properties.</p>\n","urlObject":{"path":["api","v1","merchant","place","list"],"host":["{{URL}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"39349066-9166-4740-bdbc-20554cc840e8"},{"name":"Get Trips From To","event":[{"listen":"test","script":{"id":"db52128e-fdb3-49c6-9061-808a346017e2","exec":["// Ensure the status code is 200","pm.test(\"Status code is 200\", function () {","    pm.response.to.have.status(200);","});","","// Ensure the message is \"List Trip Success\"","pm.test(\"Message is 'Trip Lists'\", function () {","    var jsonData = pm.response.json();","    pm.expect(jsonData.message).to.eql(\"Trip Lists\");","});","","// Ensure the response format is correct and required keys are present","pm.test(\"Response format and required keys validation\", function () {","    var jsonData = pm.response.json();","    var trip = jsonData.data[0];","","    // Check overall structure","    pm.expect(jsonData).to.have.keys(['responseCode', 'message', 'data']);","    pm.expect(jsonData.data).to.be.an('array');","","    // Validate trip object structure","    // to.have.keys will ensure only these keys are present","    pm.expect(trip).to.have.keys([","        'code', 'vehicle', 'startTime', 'reachTime', 'isRefundable', 'duration',","        'availableSeats', 'totalSeats', 'route', 'maxPrice'","    ]);","","    // Validate vehicle object structure","    var vehicle = trip.vehicle;","    pm.expect(vehicle).to.have.keys(['name', 'type', 'categories', 'facilities', 'numberPlate', 'profile']);","    pm.expect(vehicle.type).to.have.property('name').that.is.a('string').that.is.not.empty;","    pm.expect(vehicle.categories).to.be.an('array');","    pm.expect(vehicle.facilities).to.be.an('array');","    pm.expect(vehicle.numberPlate).to.be.a('string');","    pm.expect(vehicle.profile).to.have.property('completedUrl').that.is.a('string');","","    // Validate route array structure","    pm.expect(trip.route).to.be.an('array').that.is.not.empty;","    trip.route.forEach(function(routeItem) {","        pm.expect(routeItem).to.have.keys(['name', 'place']);","        pm.expect(routeItem.name).to.be.a('string').that.is.not.empty;","        pm.expect(routeItem.place).to.have.property('name').that.is.a('string').that.is.not.empty;","    });","","    // Validate data types and values","    pm.expect(trip.code).to.be.a('string').that.is.not.empty;","    pm.expect(trip.startTime).to.be.a('string').that.is.not.empty;","    pm.expect(trip.reachTime).to.be.a('string').that.is.not.empty;","    pm.expect(trip.isRefundable).to.be.a('boolean');","    pm.expect(trip.duration).to.be.a('number');","    pm.expect(trip.availableSeats).to.be.a('number');","    pm.expect(trip.totalSeats).to.be.a('number');","    pm.expect(trip.maxPrice).to.be.a('number');","    ","    // Check that startTime and reachTime are not in the past","    var startTime = new Date(trip.startTime);","    var reachTime = new Date(trip.reachTime);","    var now = new Date();","    pm.expect(startTime).to.be.above(now);","    pm.expect(reachTime).to.be.above(now);","});","","// Additional test to ensure only required fields are present","pm.test(\"Ensure no additional fields are present in the trip object\", function () {","    var jsonData = pm.response.json();","    var trip = jsonData.data[0];","","    var expectedKeys = [","        'code', 'vehicle', 'startTime', 'reachTime', 'isRefundable', 'duration',","        'availableSeats', 'totalSeats', 'route', 'maxPrice'","    ];","","    // Check for extra keys","    var actualKeys = Object.keys(trip);","    var extraKeys = actualKeys.filter(key => !expectedKeys.includes(key));","    pm.expect(extraKeys.length).to.eql(0);","});","","// Select any random trip id and set trip code to selected-trip-code key","pm.test(\"Select any random trip id and set trip code to selected-trip-code key\", function () {","    var jsonData = pm.response.json();","    var data = jsonData.data;","","    // Ensure there are at least two places in the data","    pm.expect(data.length).to.be.at.least(1);","","    // Shuffle the data array to get random places","    data = _.shuffle(data);","","    // Select two random places","    var selectedTrip = data[0];","","    // Set the environment variables","    pm.environment.set(\"selected-trip-code\", selectedTrip.code);","    pm.environment.set(\"maxPrice\", selectedTrip.maxPrice);","});","","","",""],"type":"text/javascript","packages":{}}}],"id":"9d12f0e4-fe51-4c92-a8f8-ab536cda5dc9","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[{"key":"x-api-key","value":"{{API-KEY}}","type":"text"}],"url":"{{URL}}/api/v1/merchant/trip/list?from={{trip-from}}&to={{trip-to}}&date=2025-02-25","description":"<h3 id=\"api-request-description\">API Request Description</h3>\n<p>This API endpoint makes an HTTP GET request to retrieve a list of merchant trips based on the specified parameters.</p>\n<ul>\n<li><p><code>from</code> (query parameter): Specifies the starting location of the trip.</p>\n</li>\n<li><p><code>to</code> (query parameter): Specifies the destination of the trip.</p>\n</li>\n<li><p><code>date</code> (query parameter): Specifies the date for which the trip list is requested.</p>\n</li>\n</ul>\n<h3 id=\"response\">Response</h3>\n<p>The response to the request is in the form of a JSON schema with the following structure:</p>\n<ul>\n<li><p><code>responseCode</code> (number): Indicates the response status code.</p>\n</li>\n<li><p><code>message</code> (string): Provides additional information or error messages.</p>\n</li>\n<li><p><code>data</code> (array): Contains an array of trip objects, each representing a merchant trip.</p>\n<ul>\n<li><p><code>code</code> (string): Represents the code of the trip.</p>\n</li>\n<li><p><code>vehicle</code> (object): Contains information about the vehicle used for the trip.</p>\n<ul>\n<li><p><code>name</code> (string): Specifies the name of the vehicle.</p>\n</li>\n<li><p><code>type</code> (object): Contains details about the type of the vehicle.</p>\n<ul>\n<li><code>name</code> (string): Specifies the name of the vehicle type.</li>\n</ul>\n</li>\n<li><p><code>categories</code> (array): Contains the categories associated with the vehicle.</p>\n<ul>\n<li><code>name</code> (string): Specifies the name of the category.</li>\n</ul>\n</li>\n<li><p><code>facilities</code> (array): Lists the facilities available with the vehicle.</p>\n<ul>\n<li><code>name</code> (string): Specifies the name of the facility.</li>\n</ul>\n</li>\n<li><p><code>numberPlate</code> (string): Represents the number plate of the vehicle.</p>\n</li>\n<li><p><code>profile</code> (object): Contains the profile information of the vehicle.</p>\n<ul>\n<li><code>completedUrl</code> (string): Specifies the URL for the completed profile of the vehicle.</li>\n</ul>\n</li>\n</ul>\n</li>\n<li><p><code>startTime</code> (string): Indicates the start time of the trip.</p>\n</li>\n<li><p><code>reachTime</code> (string): Specifies the estimated time of arrival at the destination.</p>\n</li>\n<li><p><code>isRefundable</code> (boolean): Indicates whether the trip is refundable.</p>\n</li>\n<li><p><code>duration</code> (number): Specifies the duration of the trip.</p>\n</li>\n<li><p><code>availableSeats</code> (number): Indicates the number of available seats for the trip.</p>\n</li>\n<li><p><code>totalSeats</code> (number): Specifies the total number of seats available for the trip.</p>\n</li>\n<li><p><code>maxPrice</code> (number): Represents the maximum price for the trip.</p>\n</li>\n<li><p><code>route</code> (array): Contains the route details for the trip.</p>\n<ul>\n<li><p><code>name</code> (string): Specifies the name of the route.</p>\n</li>\n<li><p><code>place</code> (object): Contains information about the places included in the route.</p>\n<ul>\n<li><code>name</code> (string): Specifies the name of the place.</li>\n</ul>\n</li>\n</ul>\n</li>\n</ul>\n</li>\n</ul>\n<p>The response provides detailed information about the merchant trips, including vehicle details, trip timings, availability, pricing, and route information.</p>\n","urlObject":{"path":["api","v1","merchant","trip","list"],"host":["{{URL}}"],"query":[{"key":"from","value":"{{trip-from}}"},{"key":"to","value":"{{trip-to}}"},{"key":"date","value":"2025-02-25"}],"variable":[]}},"response":[],"_postman_id":"9d12f0e4-fe51-4c92-a8f8-ab536cda5dc9"},{"name":"Fetch Trip. Seat","event":[{"listen":"test","script":{"id":"db52128e-fdb3-49c6-9061-808a346017e2","exec":["// 1. Ensure the status code is 200","pm.test(\"Status code is 200\", function () {","    pm.response.to.have.status(200);","});","","// 2. Ensure the message is \"Trip Seats\"","pm.test(\"Message is 'Trip Seats'\", function () {","    var jsonData = pm.response.json();","    pm.expect(jsonData.message).to.eql(\"Trip Seats\");","});","","","// 3. Ensure the response format is correct and required keys are present","pm.test(\"Response format and required keys validation\", function () {","    var jsonData = pm.response.json();","","    // Check overall structure","    pm.expect(jsonData).to.have.keys(['responseCode', 'message', 'data']);","    pm.expect(jsonData.data).to.have.keys(['seats', 'code']);","    // pm.expect(jsonData.data).to.have.key('seats');","    ","    // Check seats array","    pm.expect(jsonData.data.seats).to.be.an('array').that.is.not.empty;","","    // Check code","    pm.expect(jsonData.data.code).to.be.a('string').that.is.not.empty;","});","","","// 4. Validate each seat object structure and data types","pm.test(\"Seats properties validation\", function () {","    var jsonData = pm.response.json();","    var seats = jsonData.data.seats;","","    seats.forEach(function(seat) {","        pm.expect(seat).to.have.keys(['title', 'status', 'x', 'y', 'height', 'width', 'code']);","        ","        pm.expect(seat.title).to.be.a('string').that.is.not.empty;","        pm.expect(seat.status).to.be.a('string').that.is.not.empty;","        pm.expect(seat.x).to.be.a('string').that.matches(/^\\d+(\\.\\d+)?$/);","        pm.expect(seat.y).to.be.a('string').that.matches(/^\\d+(\\.\\d+)?$/);","        pm.expect(seat.height).to.be.a('string').that.matches(/^\\d+(\\.\\d+)?$/);","        pm.expect(seat.width).to.be.a('string').that.matches(/^\\d+(\\.\\d+)?$/);","        pm.expect(seat.code).to.be.a('string').that.is.not.empty;","    });","});","","// 5. Check for available seats and set environment variables for two seats","pm.test(\"Select two available seats and set environment variables\", function () {","    var jsonData = pm.response.json();","    var seats = jsonData.data.seats;","","    // Filter available seats","    var availableSeats = seats.filter(function(seat) {","        return seat.status === \"AVAILABLE\";","    });","","    // Ensure there are at least two available seats","    pm.expect(availableSeats.length).to.be.at.least(2);","","    // Select the first two available seats","    var seat1Code = availableSeats[0].code;","    var seat2Code = availableSeats[1].code;","","    // Set environment variables","    pm.environment.set(\"seat1Code\", seat1Code);","    pm.environment.set(\"seat2Code\", seat2Code);","","    // Log the selected seats for verification","    console.log(\"Selected Seat 1:\", seat1Code);","    console.log(\"Selected Seat 2:\", seat2Code);","});","","// // 6. Ensure seat numbers are unique","// pm.test(\"Ensure seat numbers are unique\", function () {","//     var jsonData = pm.response.json();","//     var seats = jsonData.data.seats;","","//     var seatNumbers = seats.map(seat => seat.title);","//     var uniqueSeatNumbers = new Set(seatNumbers);","","//     pm.expect(seatNumbers.length).to.eql(uniqueSeatNumbers.size);","// });","var template = `","<style type=\"text/css\">","    .tftable {font-size:14px;color:#333333;width:100%;border-width: 1px;border-color: #87ceeb;border-collapse: collapse;}","    .tftable th {font-size:18px;background-color:#87ceeb;border-width: 1px;padding: 8px;border-style: solid;border-color: #87ceeb;text-align:left;}","    .tftable tr {background-color:#ffffff;}","    .tftable td {font-size:14px;border-width: 1px;padding: 8px;border-style: solid;border-color: #87ceeb;}","    .tftable tr:hover {background-color:#e0ffff;}","</style>","","<table class=\"tftable\" border=\"1\">","    <tr>","        <th>Title</th>","        <th>Status</th>","        <th>X</th>","        <th>Y</th>","        <th>Height</th>","        <th>Width</th>","        <th>Row Span</th>","        <th>Column Span</th>","        <th>Row</th>","        <th>Column</th>","        <th>Layer</th>","        <th>Orientation</th>","        <th>Code</th>","    </tr>","    ","    {{#each response.data.seats}}","        <tr>","            <td>{{title}}</td>","            <td>{{status}}</td>","            <td>{{x}}</td>","            <td>{{y}}</td>","            <td>{{height}}</td>","            <td>{{width}}</td>","            <td>{{rowSpan}}</td>","            <td>{{columnSpan}}</td>","            <td>{{row}}</td>","            <td>{{column}}</td>","            <td>{{layer}}</td>","            <td>{{orientation}}</td>","            <td>{{code}}</td>","        </tr>","    {{/each}}","</table>","`;","","function constructVisualizerPayload() {","    return { response: pm.response.json() }","}","","pm.visualizer.set(template, constructVisualizerPayload());"],"type":"text/javascript","packages":{}}}],"id":"6d25cf9d-6239-41bb-888f-046936c2b5a0","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[{"key":"x-api-key","value":"{{API-KEY}}","type":"text"}],"url":"{{URL}}/api/v1/merchant/trip/seats/{{selected-trip-code}}","urlObject":{"path":["api","v1","merchant","trip","seats","{{selected-trip-code}}"],"host":["{{URL}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"6d25cf9d-6239-41bb-888f-046936c2b5a0"},{"name":"Hold Seat","event":[{"listen":"test","script":{"id":"db52128e-fdb3-49c6-9061-808a346017e2","exec":["// 1. Ensure the status code is 200","pm.test(\"Status code is 201\", function () {","    pm.response.to.have.status(201);","});","","// 2. Ensure the message is \"Seats Hold\"","pm.test(\"Message is 'Seats Hold'\", function () {","    var jsonData = pm.response.json();","    pm.expect(jsonData.message).to.eql(\"Seats Hold\");","});","","// 3. Ensure the response format is correct and required keys are present","pm.test(\"Response format and required keys validation\", function () {","    var jsonData = pm.response.json();","","    // Check overall structure","    pm.expect(jsonData).to.have.keys(['responseCode', 'message', 'data']);","    pm.expect(jsonData.data).to.have.keys(['sessionId', 'boardingPoints']);","    ","    // Check boardingPoints array","    pm.expect(jsonData.data.boardingPoints).to.be.an('array').that.is.not.empty;","});","","// 4. Validate session ID structure and data type","pm.test(\"Session ID validation\", function () {","    var jsonData = pm.response.json();","    var sessionId = jsonData.data.sessionId;","","    pm.expect(sessionId).to.be.a('string').that.is.not.empty;","    pm.expect(sessionId).to.match(/^[0-9a-fA-F\\-]{36}$/);","});","","// 5. Validate each boarding point object structure and data types","pm.test(\"Boarding points properties validation\", function () {","    var jsonData = pm.response.json();","    var boardingPoints = jsonData.data.boardingPoints;","","    boardingPoints.forEach(function(point) {","        pm.expect(point).to.have.keys(['code', 'label']);","        ","        pm.expect(point.code).to.be.a('string').that.is.not.empty;","        pm.expect(point.label).to.be.a('string').that.is.not.empty;","    });","});","","// 6. Ensure boarding points are unique","pm.test(\"Ensure boarding points are unique\", function () {","    var jsonData = pm.response.json();","    var boardingPoints = jsonData.data.boardingPoints;","","    var pointCodes = boardingPoints.map(point => point.code);","    var uniquePointCodes = new Set(pointCodes);","","    pm.expect(pointCodes.length).to.eql(uniquePointCodes.size);","});","","// 7. Select one boarding point and set environment variables","pm.test(\"Select one boarding point and set environment variables\", function () {","    var jsonData = pm.response.json();","    var boardingPoints = jsonData.data.boardingPoints;","","    // Ensure there is at least one boarding point","    pm.expect(boardingPoints.length).to.be.at.least(1);","","    // Select the first boarding point","    var selectedBoardingPoint = boardingPoints[0];","","    // Set environment variables","    pm.environment.set(\"sessionId\", jsonData.data.sessionId);","    pm.environment.set(\"boardingPointCode\", selectedBoardingPoint.code);","    pm.environment.set(\"boardingPointLabel\", selectedBoardingPoint.label);","    // Set Price","    pm.environment.set(\"totalPrice\", pm.environment.get(\"maxPrice\"));","","    // Log the selected boarding point and session ID for verification","    console.log(\"Session ID:\", jsonData.data.sessionId);","    console.log(\"Selected Boarding Point:\", selectedBoardingPoint);","});",""],"type":"text/javascript","packages":{}}},{"listen":"prerequest","script":{"id":"b6b61ee5-a8f1-4647-9fb3-cfcde7c8259e","exec":[""],"type":"text/javascript","packages":{}}}],"id":"69215d74-e671-43fd-bb1e-059e72580e71","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[{"key":"x-api-key","value":"{{API-KEY}}","type":"text"}],"body":{"mode":"raw","raw":"{\n  \"seats\": [\n    \"{{seat1Code}}\"  ],\n  \"tripCode\": \"{{selected-trip-code}}\"\n}","options":{"raw":{"language":"json"}}},"url":"{{URL}}/api/v1/merchant/booking/seat-holds","urlObject":{"path":["api","v1","merchant","booking","seat-holds"],"host":["{{URL}}"],"query":[{"disabled":true,"key":"from","value":"{{trip-from}}"},{"disabled":true,"key":"to","value":"{{trip-to}}"},{"disabled":true,"key":"date","value":"2024-05-28"}],"variable":[]}},"response":[],"_postman_id":"69215d74-e671-43fd-bb1e-059e72580e71"},{"name":"Create Booking","event":[{"listen":"test","script":{"id":"db52128e-fdb3-49c6-9061-808a346017e2","exec":["// 1. Ensure the status code is 201","pm.test(\"Status code is 201\", function () {","    pm.response.to.have.status(201);","});","","// 2. Ensure the message is \"Booking Created\"","pm.test(\"Message is 'Booking Created'\", function () {","    var jsonData = pm.response.json();","    pm.expect(jsonData.message).to.eql(\"Booking Created\");","});","","// 3. Ensure the response format is correct and required keys are present","pm.test(\"Response format and required keys validation\", function () {","    var jsonData = pm.response.json();","","    // Check overall structure","    pm.expect(jsonData).to.have.keys(['responseCode', 'message', 'data']);","    pm.expect(jsonData.data).to.have.keys(['bookingCode']);","    ","    // Check bookingCode","    pm.expect(jsonData.data.bookingCode).to.be.a('string').that.is.not.empty;","});","","// 4. Validate booking code format and data type","pm.test(\"Booking Code validation\", function () {","    var jsonData = pm.response.json();","    var bookingCode = jsonData.data.bookingCode;","","    pm.expect(bookingCode).to.be.a('string').that.is.not.empty;","    // Assuming booking code should be a 24-character hex string","    pm.expect(bookingCode).to.match(/^[0-9a-fA-F]{24}$/);","});","","// 5. Log the booking code for verification","pm.test(\"Save and Log booking code\", function () {","    // Save bookingCode in Env","    var jsonData = pm.response.json();","    pm.environment.set(\"bookingCode\", jsonData.data.bookingCode);","    console.log(\"Booking Code:\", jsonData.data.bookingCode);","});","",""],"type":"text/javascript","packages":{}}},{"listen":"prerequest","script":{"id":"b6b61ee5-a8f1-4647-9fb3-cfcde7c8259e","exec":[""],"type":"text/javascript","packages":{}}}],"id":"997b5e7f-4184-4e21-a539-40ec0b4f96b3","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[{"key":"x-api-key","value":"{{API-KEY}}","type":"text"}],"body":{"mode":"raw","raw":"{\n  \"sessionId\": \"{{sessionId}}\",\n  \"tripCode\": \"{{selected-trip-code}}\",\n  \"boardingPointCode\": \"{{boardingPointCode}}\",\n  \"mobileNumber\": \"{{contactPhoneNumber}}\",\n  \"email\": \"{{contactEmailAddress}}\",\n  \"name\": \"{{contactName}}\",\n  \"seats\": [\n    {\n      \"code\": \"{{seat1Code}}\",\n      \"name\": \"Jim Bode\",\n      \"age\": \"22\"\n    }\n   \n  ]\n}","options":{"raw":{"language":"json"}}},"url":"{{URL}}/api/v1/merchant/booking/create","urlObject":{"path":["api","v1","merchant","booking","create"],"host":["{{URL}}"],"query":[],"variable":[]}},"response":[{"id":"83eb20ad-5ad5-4ad4-8c79-671f2eb7737f","name":"Create Booking","originalRequest":{"method":"POST","header":[{"key":"x-api-key","value":"{{API-KEY}}","type":"text"}],"body":{"mode":"raw","raw":"{\n  \"sessionId\": \"{{sessionId}}\",\n  \"tripCode\": \"{{selected-trip-code}}\",\n  \"boardingPointCode\": \"{{boardingPointCode}}\",\n  \"mobileNumber\": \"{{contactPhoneNumber}}\",\n  \"email\": \"{{contactEmailAddress}}\",\n  \"name\": \"{{contactName}}\",\n  \"seats\": [\n    {\n      \"code\": \"{{seat1Code}}\",\n      \"name\": \"Jim Bode\",\n      \"age\": \"22\"\n    }\n   \n  ]\n}","options":{"raw":{"language":"json"}}},"url":"{{URL}}/api/v1/merchant/booking/create"},"status":"Internal Server Error","code":500,"_postman_previewlanguage":"json","header":[{"key":"Server","value":"nginx"},{"key":"Date","value":"Fri, 14 Feb 2025 09:40:04 GMT"},{"key":"Content-Type","value":"application/json; charset=utf-8"},{"key":"Content-Length","value":"288"},{"key":"Connection","value":"keep-alive"},{"key":"Access-Control-Allow-Origin","value":"*"},{"key":"Content-Security-Policy","value":"default-src 'self';base-uri 'self';font-src 'self' https: data:;form-action 'self';frame-ancestors 'self';img-src 'self' data:;object-src 'none';script-src 'self';script-src-attr 'none';style-src 'self' https: 'unsafe-inline';upgrade-insecure-requests"},{"key":"Cross-Origin-Opener-Policy","value":"same-origin"},{"key":"Cross-Origin-Resource-Policy","value":"same-origin"},{"key":"Origin-Agent-Cluster","value":"?1"},{"key":"Referrer-Policy","value":"no-referrer"},{"key":"Strict-Transport-Security","value":"max-age=15552000; includeSubDomains"},{"key":"X-Content-Type-Options","value":"nosniff"},{"key":"X-DNS-Prefetch-Control","value":"off"},{"key":"X-Download-Options","value":"noopen"},{"key":"X-Frame-Options","value":"SAMEORIGIN"},{"key":"X-Permitted-Cross-Domain-Policies","value":"none"},{"key":"X-XSS-Protection","value":"0"},{"key":"Access-Control-Allow-Credentials","value":"true"},{"key":"X-RateLimit-Limit-short","value":"3"},{"key":"X-RateLimit-Remaining-short","value":"2"},{"key":"X-RateLimit-Reset-short","value":"1"},{"key":"X-RateLimit-Limit-medium","value":"20"},{"key":"X-RateLimit-Remaining-medium","value":"19"},{"key":"X-RateLimit-Reset-medium","value":"10"},{"key":"X-RateLimit-Limit-long","value":"100"},{"key":"X-RateLimit-Remaining-long","value":"98"},{"key":"X-RateLimit-Reset-long","value":"42"},{"key":"x-custom-lang","value":"en"},{"key":"x-timestamp","value":"1739526004355"},{"key":"x-request-id","value":"fc0acb9b-b9b1-4759-9919-e4a851f5f406"},{"key":"x-version","value":"1"},{"key":"x-repo-version","value":"0.0.1"},{"key":"ETag","value":"W/\"120-8ZwgQ6zJedRfCBfOvw7vJIQNNX4\""},{"key":"X-Response-Time","value":"242.898ms"}],"cookie":[],"responseTime":null,"body":"{\n    \"statusCode\": 500,\n    \"message\": \"Cannot read properties of undefined (reading 'index')\",\n    \"_metadata\": {\n        \"languages\": [\n            \"en\"\n        ],\n        \"timestamp\": 1739526004355,\n        \"timezone\": \"UTC\",\n        \"requestId\": \"fc0acb9b-b9b1-4759-9919-e4a851f5f406\",\n        \"path\": \"/api/v1/merchant/booking/create\",\n        \"version\": \"1\",\n        \"repoVersion\": \"0.0.1\"\n    }\n}"}],"_postman_id":"997b5e7f-4184-4e21-a539-40ec0b4f96b3"},{"name":"Confirm Booking","event":[{"listen":"test","script":{"id":"db52128e-fdb3-49c6-9061-808a346017e2","exec":["// 1. Ensure the status code is 201","pm.test(\"Status code is 201\", function () {","    pm.response.to.have.status(201);","});","","// 2. Ensure the message is \"Payment Added\"","pm.test(\"Message is 'Payment Added'\", function () {","    var jsonData = pm.response.json();","    pm.expect(jsonData.message).to.eql(\"Payment Added\");","});","","// 3. Ensure the response format is correct and required keys are present","pm.test(\"Response format and required keys validation\", function () {","    var jsonData = pm.response.json();","","    // Check overall structure","    pm.expect(jsonData).to.have.keys(['responseCode', 'message', 'data']);","    ","    // Check data","    pm.expect(jsonData.data).to.be.a('string').that.is.not.empty;","});","","// 4. Ensure the data contains \"Payment Successful\"","pm.test(\"Data contains 'Payment Successful'\", function () {","    var jsonData = pm.response.json();","    pm.expect(jsonData.data).to.eql(\"Payment Successful\");","});",""],"type":"text/javascript","packages":{}}},{"listen":"prerequest","script":{"id":"b6b61ee5-a8f1-4647-9fb3-cfcde7c8259e","exec":[""],"type":"text/javascript","packages":{}}}],"id":"d92f9172-ad5b-4560-a2a6-de33f30929a6","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[{"key":"x-api-key","value":"{{API-KEY}}","type":"text"}],"body":{"mode":"raw","raw":"{\n  \"bookingCode\": \"{{bookingCode}}\",\n  \"sessionId\": \"{{sessionId}}\",\n  \"paymentAmount\":{{totalPrice}},\n//   \"paymentAmount\":400,\n  \"paymentTransactionNumber\": \"tqbwCwi7Dh\"\n}","options":{"raw":{"language":"json"}}},"url":"{{URL}}/api/v1/merchant/booking/add-payment","urlObject":{"path":["api","v1","merchant","booking","add-payment"],"host":["{{URL}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"d92f9172-ad5b-4560-a2a6-de33f30929a6"},{"name":"Fetch Booking Details","event":[{"listen":"test","script":{"id":"db52128e-fdb3-49c6-9061-808a346017e2","exec":["// 1. Ensure the status code is 200","pm.test(\"Status code is 200\", function () {","    pm.response.to.have.status(200);","});","","// 2. Ensure the message is \"Booking Get\"","pm.test(\"Message is 'Booking Get'\", function () {","    var jsonData = pm.response.json();","    pm.expect(jsonData.message).to.eql(\"Booking Get\");","});","","// 3. Ensure the response format is correct and required keys are present","pm.test(\"Response format and required keys validation\", function () {","    var jsonData = pm.response.json();","","    // Check overall structure","    pm.expect(jsonData).to.have.keys(['responseCode', 'message', 'data']);","    pm.expect(jsonData.data).to.have.keys(['totalFare', 'shortId', 'code']);","    ","    // Check data types","    pm.expect(jsonData.data.totalFare).to.be.a('number');","    pm.expect(jsonData.data.shortId).to.be.a('string').that.is.not.empty;","    pm.expect(jsonData.data.code).to.be.a('string').that.is.not.empty;","});","","// 4. Ensure the total fare is a positive number","pm.test(\"Total fare is a positive number\", function () {","    var jsonData = pm.response.json();","    pm.expect(jsonData.data.totalFare).to.be.above(0);","});","","// 5. Validate short ID format","pm.test(\"Short ID validation\", function () {","    var jsonData = pm.response.json();","    var shortId = jsonData.data.shortId;","","    pm.expect(shortId).to.be.a('string').that.is.not.empty;","    // Assuming shortId should be a 10-character alphanumeric string","    pm.expect(shortId).to.match(/^[A-Z0-9]{10}$/);","});","","// 6. Validate booking code format and data type","pm.test(\"Booking Code validation\", function () {","    var jsonData = pm.response.json();","    var bookingCode = jsonData.data.code;","","    pm.expect(bookingCode).to.be.a('string').that.is.not.empty;","    // Assuming booking code should be a 24-character hex string","    pm.expect(bookingCode).to.match(/^[0-9a-fA-F]{24}$/);","});","","// 7. Log the booking details for verification","pm.test(\"Log booking details\", function () {","    var jsonData = pm.response.json();","    console.log(\"Total Fare:\", jsonData.data.totalFare);","    console.log(\"Short ID:\", jsonData.data.shortId);","    console.log(\"Booking Code:\", jsonData.data.code);","});",""],"type":"text/javascript","packages":{}}},{"listen":"prerequest","script":{"id":"b6b61ee5-a8f1-4647-9fb3-cfcde7c8259e","exec":[""],"type":"text/javascript","packages":{}}}],"id":"58d816dc-4e92-4cce-8795-5ed9a7e04a79","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[{"key":"x-api-key","value":"{{API-KEY}}","type":"text"}],"body":{"mode":"raw","raw":"","options":{"raw":{"language":"json"}}},"url":"{{URL}}/api/v1/merchant/booking/{{bookingCode}}","urlObject":{"path":["api","v1","merchant","booking","{{bookingCode}}"],"host":["{{URL}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"58d816dc-4e92-4cce-8795-5ed9a7e04a79"},{"name":"Download Ticket","event":[{"listen":"test","script":{"id":"db52128e-fdb3-49c6-9061-808a346017e2","exec":["// 1. Ensure the status code is 200","pm.test(\"Status code is 200\", function () {","    pm.response.to.have.status(200);","});",""],"type":"text/javascript","packages":{}}},{"listen":"prerequest","script":{"id":"b6b61ee5-a8f1-4647-9fb3-cfcde7c8259e","exec":[""],"type":"text/javascript","packages":{}}}],"id":"88a87aee-b593-452d-a973-325a97ce33ec","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[{"key":"x-api-key","value":"{{API-KEY}}","type":"text"}],"body":{"mode":"raw","raw":"{\n  \"bookingCode\": \"{{bookingCode}}\",\n  \"sessionId\": \"{{sessionId}}\",\n  \"paymentAmount\":{{totalPrice}},\n  \"paymentTransactionNumber\": \"tqbwCwi7Dh\"\n}","options":{"raw":{"language":"json"}}},"url":"{{URL}}/api/v1/merchant/ticket/download/{{bookingCode}}","urlObject":{"path":["api","v1","merchant","ticket","download","{{bookingCode}}"],"host":["{{URL}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"88a87aee-b593-452d-a973-325a97ce33ec"},{"name":"Destroy Session","event":[{"listen":"test","script":{"id":"db52128e-fdb3-49c6-9061-808a346017e2","exec":["// 1. Ensure the status code is 200","pm.test(\"Status code is 200\", function () {","    pm.response.to.have.status(200);","});","","// 2. Ensure the message is \"Seats Hold\"","pm.test(\"Message is 'Seats Hold'\", function () {","    var jsonData = pm.response.json();","    pm.expect(jsonData.message).to.eql(\"Seats Hold\");","});","","// 3. Ensure the response format is correct and required keys are present","pm.test(\"Response format and required keys validation\", function () {","    var jsonData = pm.response.json();","","    // Check overall structure","    pm.expect(jsonData).to.have.keys(['responseCode', 'message', 'data']);","    pm.expect(jsonData.data).to.have.keys(['sessionId', 'boardingPoints']);","    ","    // Check boardingPoints array","    pm.expect(jsonData.data.boardingPoints).to.be.an('array').that.is.not.empty;","});","","// 4. Validate session ID structure and data type","pm.test(\"Session ID validation\", function () {","    var jsonData = pm.response.json();","    var sessionId = jsonData.data.sessionId;","","    pm.expect(sessionId).to.be.a('string').that.is.not.empty;","    pm.expect(sessionId).to.match(/^[0-9a-fA-F\\-]{36}$/);","});","","// 5. Validate each boarding point object structure and data types","pm.test(\"Boarding points properties validation\", function () {","    var jsonData = pm.response.json();","    var boardingPoints = jsonData.data.boardingPoints;","","    boardingPoints.forEach(function(point) {","        pm.expect(point).to.have.keys(['code', 'label']);","        ","        pm.expect(point.code).to.be.a('string').that.is.not.empty;","        pm.expect(point.label).to.be.a('string').that.is.not.empty;","    });","});","","// 6. Ensure boarding points are unique","pm.test(\"Ensure boarding points are unique\", function () {","    var jsonData = pm.response.json();","    var boardingPoints = jsonData.data.boardingPoints;","","    var pointCodes = boardingPoints.map(point => point.code);","    var uniquePointCodes = new Set(pointCodes);","","    pm.expect(pointCodes.length).to.eql(uniquePointCodes.size);","});",""],"type":"text/javascript","packages":{}}},{"listen":"prerequest","script":{"id":"b6b61ee5-a8f1-4647-9fb3-cfcde7c8259e","exec":[""],"type":"text/javascript","packages":{}}}],"id":"89ecebbe-db99-4546-990e-8d787926566b","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[{"key":"x-api-key","value":"{{API-KEY}}","type":"text"}],"body":{"mode":"raw","raw":"{\n  \"sessionId\": \"{{sessionId}}\"\n}","options":{"raw":{"language":"json"}}},"url":"{{URL}}/api/v1/merchant/booking/destroy-session","urlObject":{"path":["api","v1","merchant","booking","destroy-session"],"host":["{{URL}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"89ecebbe-db99-4546-990e-8d787926566b"}],"id":"d449452c-b4a4-408a-b710-5d56c9795551","_postman_id":"d449452c-b4a4-408a-b710-5d56c9795551","description":""}]}