{
  "info": {
    "_postman_id": "cdd3c48f-cd55-473c-a793-51f659e1e965",
    "name": "BETFLIX API + WINLOSE READY",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
    "_exporter_id": "12870228",
    "_collection_link": "https://go.postman.co/collection/12870228-cdd3c48f-cd55-473c-a793-51f659e1e965?source=collection_link",
    "description": "\n\nWin/Lose ต้องส่ง start และ end แบบ Full datetime: YYYY-MM-DD HH:mm:ss เท่านั้น และ start ต้องไม่มากกว่า end."
  },
  "item": [
    {
      "name": "12 Win/Lose รวมทุกเกม (แนะนำสำหรับคืนยอดเสีย)",
      "request": {
        "method": "POST",
        "header": [
          {
            "key": "Content-Type",
            "value": "application/json"
          }
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n  \"action\": \"winloseall\",\n  \"username\": \"{{username}}\",\n  \"start\": \"{{report_start}}\",\n  \"end\": \"{{report_end}}\"\n}",
          "options": {
            "raw": {
              "language": "json"
            }
          }
        },
        "url": {
          "raw": "{{base_url}}/api.php",
          "host": [
            "{{base_url}}"
          ],
          "path": [
            "api.php"
          ]
        },
        "description": "เรียก upstream /v4/report/summaryNEW เพื่อรวมยอดทุก Provider ของสมาชิกในช่วงเวลาที่เลือก ค่า winloss ติดลบหมายถึงสมาชิกขาดทุน และ loss_amount คือยอดขาดทุนแบบจำนวนบวก"
      },
      "event": [
        {
          "listen": "test",
          "script": {
            "exec": [
              "pm.test('HTTP status is 200', function () { pm.response.to.have.status(200); });",
              "const json = pm.response.json();",
              "pm.test('API ok is true', function () { pm.expect(json.ok).to.eql(true); });"
            ],
            "type": "text/javascript"
          }
        }
      ],
      "response": []
    },
    {
      "name": "13 Win/Lose แยกตามเกม/Provider",
      "request": {
        "method": "POST",
        "header": [
          {
            "key": "Content-Type",
            "value": "application/json"
          }
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n  \"action\": \"winlosegames\",\n  \"username\": \"{{username}}\",\n  \"start\": \"{{report_start}}\",\n  \"end\": \"{{report_end}}\"\n}",
          "options": {
            "raw": {
              "language": "json"
            }
          }
        },
        "url": {
          "raw": "{{base_url}}/api.php",
          "host": [
            "{{base_url}}"
          ],
          "path": [
            "api.php"
          ]
        },
        "description": "เรียก upstream /v4/report/summary2NEW เพื่อแยกยอดตามเกมหรือ Provider เหมาะกับคืนยอดเสียเฉพาะค่ายและวิเคราะห์รายเกม"
      },
      "event": [
        {
          "listen": "test",
          "script": {
            "exec": [
              "pm.test('HTTP status is 200', function () { pm.response.to.have.status(200); });",
              "const json = pm.response.json();",
              "pm.test('API ok is true', function () { pm.expect(json.ok).to.eql(true); });"
            ],
            "type": "text/javascript"
          }
        }
      ],
      "response": []
    },
    {
      "name": "11 Agent Balance เครดิต Agent",
      "request": {
        "method": "POST",
        "header": [
          {
            "key": "Content-Type",
            "value": "application/json"
          }
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n  \"action\": \"agentbalance\",\n  \"username\": \"{{username}}\"\n}"
        },
        "url": {
          "raw": "{{base_url}}/api.php",
          "host": [
            "{{base_url}}"
          ],
          "path": [
            "api.php"
          ]
        }
      },
      "response": []
    },
    {
      "name": "10 Credit History ประวัติเครดิต",
      "request": {
        "method": "POST",
        "header": [
          {
            "key": "Content-Type",
            "value": "application/json"
          }
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n  \"action\": \"credithistory\",\n  \"username\": \"{{username}}\"\n}"
        },
        "url": {
          "raw": "{{base_url}}/api.php",
          "host": [
            "{{base_url}}"
          ],
          "path": [
            "api.php"
          ]
        }
      },
      "response": []
    },
    {
      "name": "9 Summary2 รายงาน 2",
      "request": {
        "method": "POST",
        "header": [
          {
            "key": "Content-Type",
            "value": "application/json"
          }
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n  \"action\": \"summary2\",\n  \"username\": \"{{username}}\",\n  \"start\": \"2026-06-01\",\n  \"end\": \"2026-06-15\"\n}"
        },
        "url": {
          "raw": "{{base_url}}/api.php",
          "host": [
            "{{base_url}}"
          ],
          "path": [
            "api.php"
          ]
        }
      },
      "response": []
    },
    {
      "name": "8 Summary รายงาน",
      "request": {
        "method": "POST",
        "header": [
          {
            "key": "Content-Type",
            "value": "application/json"
          }
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n  \"action\": \"summary\",\n  \"username\": \"{{username}}\",\n  \"start\": \"2026-06-01\",\n  \"end\": \"2026-06-15\"\n}"
        },
        "url": {
          "raw": "{{base_url}}/api.php",
          "host": [
            "{{base_url}}"
          ],
          "path": [
            "api.php"
          ]
        }
      },
      "response": []
    },
    {
      "name": "7 Change Password เปลี่ยนรหัส",
      "request": {
        "method": "POST",
        "header": [
          {
            "key": "Content-Type",
            "value": "application/json"
          }
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n  \"action\": \"changepassword\",\n  \"username\": \"{{username}}\",\n  \"new_password\": \"654321\"\n}"
        },
        "url": {
          "raw": "{{base_url}}/api.php",
          "host": [
            "{{base_url}}"
          ],
          "path": [
            "api.php"
          ]
        }
      },
      "response": []
    },
    {
      "name": "6 Lobby เข้าล็อบบี้",
      "request": {
        "method": "POST",
        "header": [
          {
            "key": "Content-Type",
            "value": "application/json"
          }
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n  \"action\": \"lobby\",\n  \"username\": \"{{username}}\"\n}"
        },
        "url": {
          "raw": "{{base_url}}",
          "host": [
            "{{base_url}}"
          ]
        }
      },
      "response": []
    },
    {
      "name": "5 Play Game เข้าเกม",
      "request": {
        "method": "POST",
        "header": [
          {
            "key": "Content-Type",
            "value": "application/json"
          }
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n  \"action\": \"playgame\",\n  \"username\": \"{{username}}\",\n  \"provider\": \"{{provider}}\",\n  \"gamecode\": \"{{gamecode}}\",\n  \"language\": \"thai\",\n  \"openGame\": \"true\",\n  \"returnUrl\": \"https://www.google.com/\"\n}"
        },
        "url": {
          "raw": "{{base_url}}/api.php",
          "host": [
            "{{base_url}}"
          ],
          "path": [
            "api.php"
          ]
        }
      },
      "response": []
    },
    {
      "name": "4 Transfer Credit เติม/ตัดเครดิต",
      "request": {
        "method": "POST",
        "header": [
          {
            "key": "Content-Type",
            "value": "application/json"
          }
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n  \"action\": \"transfercredit\",\n  \"username\": \"{{username}}\",\n  \"amount\": \"100\",\n  \"ref\": \"postman_ref_001\"\n}"
        },
        "url": {
          "raw": "{{base_url}}/api.php",
          "host": [
            "{{base_url}}"
          ],
          "path": [
            "api.php"
          ]
        }
      },
      "response": []
    },
    {
      "name": "3 Balance เช็คเครดิต",
      "request": {
        "method": "POST",
        "header": [
          {
            "key": "Content-Type",
            "value": "application/json"
          }
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n  \"action\": \"balance\",\n  \"username\": \"{{username}}\"\n}"
        },
        "url": {
          "raw": "{{base_url}}/api.php",
          "host": [
            "{{base_url}}"
          ],
          "path": [
            "api.php"
          ]
        }
      },
      "response": []
    },
    {
      "name": "2 Register สมัครสมาชิก",
      "request": {
        "method": "POST",
        "header": [
          {
            "key": "Content-Type",
            "value": "application/json"
          }
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n  \"action\": \"register\",\n  \"username\": \"{{username}}\",\n  \"password\": \"{{password}}\",\n  \"name\": \"ทดสอบ\",\n  \"tel\": \"0999999999\",\n  \"note\": \"postman\"\n}"
        },
        "url": {
          "raw": "{{base_url}}/api.php",
          "host": [
            "{{base_url}}"
          ],
          "path": [
            "api.php"
          ]
        }
      },
      "response": []
    },
    {
      "name": "1 Health Check",
      "request": {
        "method": "GET",
        "header": [],
        "url": {
          "raw": "{{base_url}}/api.php",
          "host": [
            "{{base_url}}"
          ],
          "path": [
            "api.php"
          ]
        }
      },
      "response": []
    }
  ],
  "event": [
    {
      "listen": "prerequest",
      "script": {
        "type": "text/javascript",
        "packages": {},
        "requests": {},
        "exec": [
          ""
        ]
      }
    },
    {
      "listen": "test",
      "script": {
        "type": "text/javascript",
        "packages": {},
        "requests": {},
        "exec": [
          ""
        ]
      }
    }
  ],
  "variable": [
    {
      "key": "base_url",
      "value": "http://localhost/betflix"
    },
    {
      "key": "username",
      "value": "test"
    },
    {
      "key": "report_start",
      "value": "2026-07-01 00:00:00"
    },
    {
      "key": "report_end",
      "value": "2026-07-11 23:59:59"
    }
  ]
}