> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cog888.net/llms.txt
> Use this file to discover all available pages before exploring further.

# 同步注單異動額度

> 注單狀態相關異動所需同步的玩家餘額變動（由 vendor 實作）

此 api 將不停重試直到成功，實作方需做好判斷，避免重複加款

實作方需做好同帳號多條 api 併發請求的處理

若已處理過，回傳成功，於 response message 內說明已處理過該派彩



## OpenAPI

````yaml /seamless-openapi.json POST /dt/callback/sync_credit
openapi: 3.1.0
info:
  title: 單一錢包 API
  description: 單一錢包（Seamless Wallet）API 文檔，包含 Game-API 和 Wallet-API
  version: 1.0.0
servers:
  - url: https://api.example.com
    description: API Server
security: []
tags:
  - name: Game-API User
    description: 遊戲 API - 用戶相關操作
  - name: Game-API Report
    description: 遊戲 API - 報表查詢
  - name: Game-API Internal
    description: 遊戲 API - 內部專用（隱藏）
  - name: Wallet-API
    description: 錢包 API - 由 vendor 實作
paths:
  /dt/callback/sync_credit:
    post:
      tags:
        - Wallet-API
      summary: 同步注單異動額度
      description: |-
        注單狀態相關異動所需同步的玩家餘額變動（由 vendor 實作）

        此 api 將不停重試直到成功，實作方需做好判斷，避免重複加款

        實作方需做好同帳號多條 api 併發請求的處理

        若已處理過，回傳成功，於 response message 內說明已處理過該派彩
      operationId: syncCredit
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - platform_id
                - token
                - uuid
                - account
                - info
              properties:
                platform_id:
                  type: string
                  description: 平台方產品ID
                token:
                  type: string
                  description: 驗證碼，md5(platform_id + uuid + account + 平台密鑰)
                uuid:
                  type: string
                  description: 各平台自定義的唯一性請求序號
                account:
                  type: string
                  description: 玩家帳號
                info:
                  type: array
                  description: 注單資訊
                  items:
                    type: object
                    properties:
                      credit:
                        type: number
                        description: 本次操作須同步的金額異動
                      ip:
                        type: string
                        description: 玩家下注時的ip位置
                      target_wallet:
                        type: integer
                        description: 本次操作須同步的金額異動的目標錢包
                      proposal_id:
                        type: string
                        description: 本次操作玩家的提案號
                      type:
                        type: integer
                        description: >-
                          本次異動類型 (8. 派彩 10. 重算局 11. 取消局 12. 添增注單 13. 取消注單 23.
                          下注失敗還款 26. 修改注單 29. 額度回沖)
                      transaction_id:
                        type: string
                        description: >-
                          本次同步唯一序號 (長度 1~128 字元，僅允許 ASCII 32-126 可列印字元，禁止使用 ` 和
                          ~)
                      canceled_id:
                        type: string
                        description: 本次異動所想要取消的交易的同步序號
                      order_id:
                        type: string
                        description: 注單號
                      order_detail:
                        type: object
                        description: 注單詳情
                        properties:
                          amount:
                            type: number
                            description: 投注金額
                          flag:
                            type: integer
                            description: 本次操作所更新的注單狀態
                          room_account:
                            type: string
                            description: 本次操作所在的廳帳號
                          room_name:
                            type: string
                            description: 本次操作所在的廳名稱
                          play_type:
                            type: integer
                            description: 玩法
                          game_type:
                            type: string
                            description: 遊戲類型
                          win:
                            type: number
                            description: 輸贏金額 (不含本金，贏為正、輸為負)
                          gmcode:
                            type: string
                            description: 局號
                          table_id:
                            type: string
                            description: 桌台編號
                          round_detail:
                            type: string
                            description: 該局結果
                          valid_amount:
                            type: number
                            description: 有效投注金額
                          in_proposal:
                            type: integer
                            description: 玩家當下是否在傳統開工中
                          create_time:
                            type: integer
                            description: 注單創建時間 (UNIX timestamp，秒)
                          reckon_time:
                            type: integer
                            description: 該局結算時間 (UNIX timestamp，秒)
                          update_time:
                            type: integer
                            description: 此操作修改注單狀態時間 (UNIX timestamp，秒)
                      rolling_unit:
                        type: number
                        description: 轉碼單位
                      ratio:
                        type: number
                        description: 變比
            example:
              platform_id: H88
              token: E47A56947DF6DA25B6F95C3BFE5748E7
              uuid: lobby1-82818443591811
              account: bentest
              info:
                - transaction_id: 005-200926080808-0000005RB
                  order_id: A003220118145511020000005
                  type: 23
                  canceled_id: 005-200926080808-0000005
                  credit: 2000
                  target_wallet: 0
                  proposal_id: '954531'
                  ip: 127.0.0.1
                  order_detail:
                    room_account: aad144
                    room_name: TRP01
                    table_id: A003
                    gmcode: A003220118
                    in_proposal: 1
                    game_type: BAC
                    play_type: 1
                    amount: 2000
                    valid_amount: 0
                    win: 0
                    flag: 1
                    round_detail: 8 3 23 ; 45 26 17 | 4 | 1 | 8 | 0
                    create_time: 1668580007
                    reckon_time: 1668580007
                    last_update_time: 1668580007
                  rolling_unit: 1000
                  ratio: 1
      responses:
        '200':
          description: 成功
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WalletApiSyncCreditResponse'
              example:
                code: 0
                message: success
                uuid: lobby1-82818443591811
                timestamp: 1668580007001
                data:
                  account: c001
                  credit: 115
                  reserved: 100
                  balance: 215
                  platform_id: H88
                  success_id:
                    - 005-200926080808-0000005
                    - 005-200926080808-0000006
                  fail_id:
                    - 005-200926080808-0000007
components:
  schemas:
    WalletApiSyncCreditResponse:
      description: sync-credit 回應
      allOf:
        - $ref: '#/components/schemas/WalletApiResponseBase'
        - type: object
          properties:
            data:
              type: object
              properties:
                success_id:
                  type: array
                  items:
                    type: string
                  description: 成功的交易序號列表
                fail_id:
                  type: array
                  items:
                    type: string
                  description: 失敗的交易序號列表
    WalletApiResponseBase:
      type: object
      description: 錢包 API 回應的基礎結構
      properties:
        code:
          type: integer
          description: 錯誤代碼
        message:
          type: string
          description: 錯誤訊息
        uuid:
          type: string
          description: 自定義的唯一性請求序號
        timestamp:
          type: integer
          description: UNIX time，毫秒
        data:
          type: object
          properties:
            account:
              type: string
              description: 玩家帳號
            credit:
              type: number
              description: 一般錢包額度
            reserved:
              type: number
              description: 專用錢包額度
            balance:
              type: number
              description: 玩家總額度
            platform_id:
              type: string
              description: 平台方產品ID

````