{"collection":{"info":{"_postman_id":"696260ec-70ee-4934-b39a-2d72c21a2f38","name":"TESTCASE","schema":"https://schema.getpostman.com/json/collection/v2.1.0/collection.json","updatedAt":"2023-12-20T06:42:36.000Z","uid":"14729559-696260ec-70ee-4934-b39a-2d72c21a2f38","createdAt":"2023-12-19T04:21:41.000Z","lastUpdatedBy":"14729559"},"item":[{"name":"API_001: Get Trade Order","item":[{"name":"TC_1+2+3+4+5+9","event":[{"listen":"test","script":{"id":"a485c508-a94c-4a90-8b3c-d0aed0bd1197","exec":["//TC_1: Check status code\r","pm.test(\"status code is 200\", function(){\r"," pm.response.to.have.status(200)\r","});\r","//TC_2:Check message\r","let jsondata=pm.response.json();\r","pm.test(\"Check mesage response: success\",function(){\r"," pm.response.to.have.status(200);\r","})\r","//TC_3: Check data response is an object\r","pm.test(\"data response is an object\",function(){\r"," pm.expect(jsondata).to.be.an('object');\r","});\r","//TC_5:Check duplicate data\r","const content = pm.response.json().content; // Fixed variable name to avoid redeclaration\r","\r","let orderId = content.map(obj => obj.orderId); // create a new flat array of just the orderId\r","\r","function hasDuplicates(array) {\r"," return (new Set(array)).size !== array.length;\r","}\r","\r","pm.test(\"Check orderId are unique\", () => {\r"," pm.expect(hasDuplicates(orderId)).to.equal(false);\r"," \r","});\r","//TC_4:Count total record\r","var body = pm.response.json();\r","tests[\"Count: \" + body.content.length] = true;\r","\r","//TC_9: Check định dạng dữ liệu trả về\r","var responseData = pm.response.json(); // Changed variable name to avoid redeclaration\r","pm.test(\"Test data type of the response\", () => \r","{\r"," pm.expect(responseData.content[0].id).to.be.a('number');\r"," pm.expect(responseData.content[0].tradeId).to.be.a('number');\r"," pm.expect(responseData.content[0].tan).to.be.a('string');\r"," pm.expect(responseData.content[0].orderId).to.be.a('string');\r"," pm.expect(responseData.content[0].originalOrderId).to.be.a('string');\r"," pm.expect(responseData.content[0].orderType).to.eql(\"LIMIT_ORDER\");\r"," pm.expect(responseData.content[0].lot).to.eql(\"BOARD\");\r"," pm.expect(responseData.content[0].matchedQuantity).to.be.a('number');\r"," pm.expect(responseData.content[0].earmarkedQuantity).to.be.a('number');\r"," pm.expect(responseData.content[0].amendingQuantity).to.be.a('number');\r"," pm.expect(responseData.content[0].earmarkedTotalPrice).to.be.a('number');\r"," pm.expect(responseData.content[0].matchedTotalPrice).to.be.a('number');\r"," pm.expect(responseData.content[0].amendingTotalPrice).to.be.a('number');\r"," pm.expect(responseData.content[0].earmarkedMiscCharged).to.be.a('number');\r"," pm.expect(responseData.content[0].matchedMiscCharged).to.be.a('number');\r"," pm.expect(responseData.content[0].amendingMiscCharged).to.be.a('number');\r"," pm.expect(responseData.content[0].orderAction).to.be.a('string');\r"," pm.expect(responseData.content[0].marketCode).to.be.a('string');\r"," pm.expect(responseData.content[0].stockCode).to.be.a('string');\r"," pm.expect(responseData.content[0].status).to.be.a('string');\r"," pm.expect(responseData.content[0].tradingDate).to.be.a('string');\r"," pm.expect(responseData.content[0].version).to.be.a('number');\r"," pm.expect(responseData.content[0].rewardCode).to.be.a('string');\r","})"],"type":"text/javascript"}}],"id":"a88a960c-aff7-4110-9aba-11902139db73","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[],"body":{"mode":"raw","raw":""},"url":{"raw":"{{GetTradeOrder}}","host":["{{GetTradeOrder}}"]}},"response":[],"uid":"14729559-a88a960c-aff7-4110-9aba-11902139db73"},{"name":"TC_6+7","event":[{"listen":"test","script":{"id":"78381ad4-e0ad-4c7c-ac68-297fdc3cedfc","exec":["//TC_6: Check status\r","pm.test(\"status code is 200\", function(){\r"," pm.response.to.have.status(200)\r","});\r","//TC_7: Check mesage\r","let jsondata = pm.response.json();\r","pm.test(\"List is empty\",function(){\r"," pm.expect(jsondata.content).to.eql([]);\r","})"],"type":"text/javascript"}}],"id":"9fa42615-ae9a-4159-b696-8802e8b39b92","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[],"url":{"raw":"{{baseUrl}}/internal/trade/orders?tan=CA-0000007hẻhehehe3&pageNumber=0&pageSize=20","host":["{{baseUrl}}"],"path":["internal","trade","orders"],"query":[{"key":"tan","value":"CA-0000007hẻhehehe3"},{"key":"pageNumber","value":"0"},{"key":"pageSize","value":"20"}]}},"response":[],"uid":"14729559-9fa42615-ae9a-4159-b696-8802e8b39b92"},{"name":"TC_8","event":[{"listen":"test","script":{"id":"5b050ee5-7d7a-4286-9f06-4630ad18908c","exec":["pm.test(\"status code is 500\", function(){\r"," pm.response.to.have.status(500);\r","});\r","//Check message\r","let jsondata=pm.response.json();\r","pm.test(\"Check message response: 405 METHOD_NOT_ALLOWED\",function(){\r"," pm.expect(jsondata.messages[0]).to.eql(\"405 METHOD_NOT_ALLOWED \\\"Request method 'PUT' is not supported.\\\"\");\r","});"],"type":"text/javascript"}}],"id":"34d33e4b-f4b1-4524-9d1f-4abc19bddb16","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"PUT","header":[],"url":{"raw":"{{baseUrl}}/internal/trade/orders?tan=CA-00000073&pageNumber=0&pageSize=20","host":["{{baseUrl}}"],"path":["internal","trade","orders"],"query":[{"key":"tan","value":"CA-00000073"},{"key":"pageNumber","value":"0"},{"key":"pageSize","value":"20"}]}},"response":[],"uid":"14729559-34d33e4b-f4b1-4524-9d1f-4abc19bddb16"}],"id":"14f4f21d-f220-4d4c-8160-a8a0436e04bd","uid":"14729559-14f4f21d-f220-4d4c-8160-a8a0436e04bd"},{"name":"API_002: Create order","item":[{"name":"TC_10+11","event":[{"listen":"test","script":{"id":"bbf065a2-7816-4981-8544-efa41da8654b","exec":["//TC_1: Check status code\r","pm.test(\"status code is 200\", function(){\r"," pm.response.to.have.status(200);\r","});\r","//TC_2:Check message\r","let jsondata=pm.response.json();\r","pm.test(\"Check message response: success\",function(){\r"," pm.expect(jsondata.result).to.eql(\"Success\");\r","});\r",""],"type":"text/javascript"}}],"id":"fa02b99e-53c2-4e0c-9334-b5ed68286bb8","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[],"body":{"mode":"raw","raw":"{\r\n \"accountNo\": \"CA-00000073\",\r\n \"cif\": \"thaohtt_001\",\r\n \"clordId\": \"122\",\r\n \"orderSide\": \"BUY\",\r\n \"orderQty\": 10,\r\n \"exchangeCode\": \"SGX\",\r\n \"stockCode\": \"STO\",\r\n \"currencyCode\": \"SGD\",\r\n \"orderValidity\": \"DAY\",\r\n \"orderLot\": \"BOARD\",\r\n \"orderType\": \"LIMIT_ORDER\",\r\n \"rewardCode\": \"null\",\r\n \"estimatedNetAmount\": \"10\",\r\n \"fees\": \"1\",\r\n \"orderDatetime\": \"2023-12-18T16:55:41.864275200\"\r\n}","options":{"raw":{"language":"json"}}},"url":{"raw":"{{baseUrl}}/internal/order-creation","host":["{{baseUrl}}"],"path":["internal","order-creation"]}},"response":[],"uid":"14729559-fa02b99e-53c2-4e0c-9334-b5ed68286bb8"},{"name":"TC_21+22","event":[{"listen":"test","script":{"id":"11f3e989-f340-42cf-b15b-c68bb9381f8c","exec":["//TC_21: Check status code\r","pm.test(\"status code is 400\", function(){\r"," pm.response.to.have.status(400);\r","});\r","\r","//TC_22:Check message\r","let jsondata=pm.response.json();\r","pm.test(\"Check result response: Failure \",function(){\r"," pm.expect(jsondata.result).to.eql(\"Failure\");\r","});\r","pm.test(\"Check reason response: Insufficient amount of cash\",function(){\r"," pm.expect(jsondata.reason).to.eql(\"Insufficient amount of cash\");\r","});"],"type":"text/javascript"}}],"id":"dae97db6-a8e2-4ada-8313-d330d3af625a","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[],"body":{"mode":"raw","raw":"{\r\n \"accountNo\": \"CA-00000078\",\r\n \"cif\": \"thaohtt_002\",\r\n \"clordId\": \"125\",\r\n \"orderSide\": \"BUY\",\r\n \"orderQty\": 10,\r\n \"exchangeCode\": \"SGX\",\r\n \"stockCode\": \"STO\",\r\n \"currencyCode\": \"SGD\",\r\n \"orderValidity\": \"DAY\",\r\n \"orderLot\": \"BOARD\",\r\n \"orderType\": \"LIMIT_ORDER\",\r\n \"rewardCode\": \"null\",\r\n \"estimatedNetAmount\": \"10\",\r\n \"fees\": \"1\",\r\n \"orderDatetime\": \"2023-12-18T16:55:41.864275200\"\r\n}","options":{"raw":{"language":"json"}}},"url":{"raw":"{{baseUrl}}/internal/order-creation","host":["{{baseUrl}}"],"path":["internal","order-creation"]}},"response":[],"uid":"14729559-dae97db6-a8e2-4ada-8313-d330d3af625a"},{"name":"TC_23+24","event":[{"listen":"test","script":{"id":"bbf065a2-7816-4981-8544-efa41da8654b","exec":["//TC_23: Check status code\r","pm.test(\"status code is 400\", function(){\r"," pm.response.to.have.status(400);\r","});\r","\r","//TC_24:Check message\r","let jsondata=pm.response.json();\r","pm.test(\"Check result response: Failure \",function(){\r"," pm.expect(jsondata.result).to.eql(\"Failure\");\r","});\r","pm.test(\"Check reason response: Stock Account COS not found \",function(){\r"," pm.expect(jsondata.reason).to.eql(\"Stock Account COS not found: Cash:Asset:SGX:STO:Stock\");\r","});"],"type":"text/javascript"}}],"id":"57eb39a0-9711-4a12-a300-72ca1ce7ac5d","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[],"body":{"mode":"raw","raw":"{\r\n \"accountNo\": \"CA-00000078\",\r\n \"cif\": \"thaohtt_002\",\r\n \"clordId\": \"121\",\r\n \"orderSide\": \"SELL\",\r\n \"orderQty\": 10,\r\n \"exchangeCode\": \"SGX\",\r\n \"stockCode\": \"STO\",\r\n \"currencyCode\": \"SGD\",\r\n \"orderValidity\": \"DAY\",\r\n \"orderLot\": \"BOARD\",\r\n \"orderType\": \"LIMIT_ORDER\",\r\n \"rewardCode\": \"null\",\r\n \"estimatedNetAmount\": \"10\",\r\n \"fees\": \"1\",\r\n \"orderDatetime\": \"2023-12-18T16:55:41.864275200\"\r\n}","options":{"raw":{"language":"json"}}},"url":{"raw":"{{baseUrl}}/internal/order-creation","host":["{{baseUrl}}"],"path":["internal","order-creation"]}},"response":[],"uid":"14729559-57eb39a0-9711-4a12-a300-72ca1ce7ac5d"},{"name":"TC_26+27","event":[{"listen":"test","script":{"id":"bbf065a2-7816-4981-8544-efa41da8654b","exec":["//TC_23: Check status code\r","pm.test(\"status code is 400\", function(){\r"," pm.response.to.have.status(400);\r","});\r","\r","//TC_24:Check message\r","let jsondata=pm.response.json();\r","pm.test(\"Check result response: Failure \",function(){\r"," pm.expect(jsondata.result).to.eql(\"Failure\");\r","});\r","pm.test(\"Check reason response:value\",function(){\r"," pm.expect(jsondata.reason).to.eql(\"value\");\r","});"],"type":"text/javascript"}}],"id":"d79d2ff8-f6d6-445f-8a76-f255fec8eb7f","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[],"body":{"mode":"raw","raw":"{\r\n \"accountNo\": \"CA-00000078453543535543\",\r\n \"cif\": \"thaohtt_002\",\r\n \"clordId\": \"155\",\r\n \"orderSide\": \"SELL\",\r\n \"orderQty\": 10,\r\n \"exchangeCode\": \"SGX\",\r\n \"stockCode\": \"STO\",\r\n \"currencyCode\": \"SGD\",\r\n \"orderValidity\": \"DAY\",\r\n \"orderLot\": \"BOARD\",\r\n \"orderType\": \"LIMIT_ORDER\",\r\n \"rewardCode\": \"null\",\r\n \"estimatedNetAmount\": \"10\",\r\n \"fees\": \"1\",\r\n \"orderDatetime\": \"2023-12-18T16:55:41.864275200\"\r\n}","options":{"raw":{"language":"json"}}},"url":{"raw":"{{baseUrl}}/internal/order-creation","host":["{{baseUrl}}"],"path":["internal","order-creation"]}},"response":[],"uid":"14729559-d79d2ff8-f6d6-445f-8a76-f255fec8eb7f"},{"name":"TC_28+29","event":[{"listen":"test","script":{"id":"bbf065a2-7816-4981-8544-efa41da8654b","exec":["//TC_23: Check status code\r","pm.test(\"status code is 500\", function(){\r"," pm.response.to.have.status(500);\r","});\r","\r","//TC_24:Check message\r","let jsondata=pm.response.json();\r","pm.test(\"Check messages response: Sai orderAction\",function(){\r"," pm.expect(jsondata.messages[0]).to.eql(\"No enum constant rt.domain.enums.OrderType.Action.SELLrtyeryer\");\r","});"],"type":"text/javascript"}}],"id":"2b7f5135-925c-4df4-bc65-b09995a4b201","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[],"body":{"mode":"raw","raw":"{\r\n \"accountNo\": \"CA-00000078\",\r\n \"cif\": \"thaohtt_002\",\r\n \"clordId\": \"156\",\r\n \"orderSide\": \"SELLrtyeryer\",\r\n \"orderQty\": 10,\r\n \"exchangeCode\": \"SGX\",\r\n \"stockCode\": \"STO\",\r\n \"currencyCode\": \"SGD\",\r\n \"orderValidity\": \"DAY\",\r\n \"orderLot\": \"BOARD\",\r\n \"orderType\": \"LIMIT_ORDER\",\r\n \"rewardCode\": \"null\",\r\n \"estimatedNetAmount\": \"10\",\r\n \"fees\": \"1\",\r\n \"orderDatetime\": \"2023-12-18T16:55:41.864275200\"\r\n}","options":{"raw":{"language":"json"}}},"url":{"raw":"{{baseUrl}}/internal/order-creation","host":["{{baseUrl}}"],"path":["internal","order-creation"]}},"response":[],"uid":"14729559-2b7f5135-925c-4df4-bc65-b09995a4b201"}],"id":"85003ea3-7f15-41a1-b0fb-edcc4f331239","uid":"14729559-85003ea3-7f15-41a1-b0fb-edcc4f331239"}]}}