tk3c-mpos
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Write
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Help
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Write
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    --- tags: NewPOS --- # EDC :::info EDC交易 要補寫入TDL PAY (付款別) ::: [TOC] ## 卡機連接 :::info EDC卡機使用ATEN USB 轉RS-232轉換器(UC232A),lsusb只能辨識到RS-232轉換器,因此無法使用VID + PID做EDC裝置辨識。 ![](https://i.imgur.com/oxcPR2o.png) ``` <1> <2> <3> <4> | | | | Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub <1> 裝置所在的 USB bus 編號;一個 USB bus 可以連接多個裝置,每個裝置有不同的編號。(裝置編號從 002 開始,001 代表 USB bus 自己) <2> 裝置在該 USB bus 下的編號 (device number)。 <3> 冒號前後分別是裝置的 vendor ID (製造商) 與 product ID (產品)。 <4> Vendor ID 與 product ID 對應的名稱。例如這裡的 1d6b 代表的是 Linux Foundation,而 0002 則代表 2.0 root hub。 ``` Ref: [The USB ID Repository](https://usb-ids.gowdy.us/read/UD/) [lsusb](https://imsardine.github.io/2016/11/06/lsusb-command/) ::: - 裝置辨識 :::success 目前辨識ATEN USB 轉RS-232轉換器()"vid": 0x0557,"pid": 0x2008) 為EDC ::: ``` if plugin device is EDC then send 卡機確認訊息(tk3c特規) object EDC_Bank switch(response msg.CardNumber) case "2" // 富邦 EDC_Bank.name = "fubon" break; case "" // NCCC EDC_Bank.name = "nccc" break; case "" // 台新 EDC_Bank.name = "tspg" break; EDC_Bank.UID = vendor ID + product ID + serial port end if ``` ## 流程圖 ### 刷卡流程 ``` mermaid graph TD; 既有流程至選付款別-->選取連線信用卡 既有流程至選付款別-->選取離線信用卡 選取離線信用卡-->輸入信用卡卡號 輸入信用卡卡號-->POS完成交易結束流程 POS完成交易結束流程-->人工操作卡機授權 選取連線信用卡-->MPOS發送MQTT訊息詢問DOCK卡機是否存活 MPOS發送MQTT訊息詢問DOCK卡機是否存活-->DOCK回傳卡機狀態及訊息 DOCK回傳卡機狀態及訊息-->列出可使用卡機 列出可使用卡機-->選擇刷卡機 選擇刷卡機-->台新; 選擇刷卡機-->富邦; 選擇刷卡機-->NCCC; 台新-->透過MQTT往DOCK發送訊息; 透過MQTT往DOCK發送訊息-->DOCK往卡機發送刷卡訊息; DOCK往卡機發送刷卡訊息-->DOCK等待回傳訊息; DOCK等待回傳訊息-->卡機選擇刷卡類型; 卡機選擇刷卡類型-->一般; 卡機選擇刷卡類型-->分期; 卡機選擇刷卡類型-->紅利折抵; 一般-->回傳結果; 分期-->回傳結果; 紅利折抵-->回傳結果; 回傳結果-->授權成功; 回傳結果-->授權失敗; DOCK等待回傳訊息-->逾時; 授權成功-->DOCK接收回傳訊息; 授權失敗-->DOCK接收回傳訊息; 逾時-->DOCK接收回傳訊息; DOCK接收回傳訊息-->往MPOS發送訊息; ``` #### 注意 1. 各家銀行規格前端處理(因為目前交易規格都一樣)DOCK保持邏輯乾淨 2. 連線信用卡回填資料以卡機回覆為準,離線信用卡則以操作者選擇為準 ### 銷退流程 ``` mermaid graph TD; 查詢退貨訂單-->輸入交易序號; 輸入交易序號-->查閱明細; 查閱明細-->退貨; 退貨-->檢查是刷卡機還是PR; 檢查是刷卡機還是PR-->PR; PR-->走自動退授權流程; 檢查是刷卡機還是PR-->刷卡機; 刷卡機-->跳出提示到刷卡機人工退授權; 走自動退授權流程-->回壓訂單狀態; 跳出提示到刷卡機人工退授權-->回壓訂單狀態; ``` #### 欲解決問題 1. 訂單明細格式<font color="#f00">(是否需要因應卡機新增資訊)</font> 2. 目前刷卡退授權與否控制在前端 ## 離線信用卡交易要求 ```plantuml @startuml |mPOS/POS| start :信用卡付款; :輸入信用卡號碼; :提示使用者至卡機操作; split :訂單完成; stop split again |卡機| :操作人員到卡機操作授權; stop @enduml ``` ## 離線信用卡取消交易要求 ```plantuml @startuml |mPOS/POS| start :信用卡取消授權; :提示使用者至卡機操作; split :修改訂單狀態; stop split again |卡機| :操作人員到卡機操作退授權; stop @enduml ``` # EDC TSB 台新刷卡機 ## 信用卡交易要求 (多元: 一般/分期/紅利) ![](https://i.imgur.com/1NfDRMH.png) ### Request ```json { "Trans_Type": "01" "Trans_Amount": 1 "Store_Id": "705" "CUP_Indicator": "C"/*CUP*/ "N"/*Default*/ } ``` :::spoiler schema ```json { "$schema": "http://json-schema.org/draft-04/schema#", "type": "object", "properties": { "Trans_Type": { "type": "string" }, "Trans_Amount": { "type": "integer", "minimum": 1, "maximum": 999999999999 }, "Store_Id": { "type": "string", "minLength": 1, "maxLength": 10 }, "CUP_Indicator": { "type": "string", "pattern": "^[CN]$" } }, "required": [ "Trans_Type", "Trans_Amount", "Store_Id", ] } ``` ::: ### Response - [一般交易](#信用卡交易要求-一般交易) - [分期](#信用卡交易要求-分期) - [紅利](#信用卡交易要求-紅利) ```plantuml @startuml |mPOS/POS| start :信用卡結帳; :輸入金額; :發送 Dock info Message; |DOCK Service| :publish dock service info + subservice info; |mPOS/POS| :選擇 台新(一般/分期); :發送卡機Message; split :等待超過1min; :交易失敗 / 交易結果未知; end split again |DOCK Service| repeat :發送卡機電文; |台新 EDC| switch (選擇交易類別) case () :一般交易; case () :分期交易; :輸入分期期數; case () :紅利交易; endswitch |DOCK Service| :等待/接收卡機回復電文; repeat while (卡機回復結果) is (電文格式錯誤, 重試最多三次) -> 電文格式OK 或 已等待超過1Min; :發送卡機交易結果Message; |mPOS/POS| :接收Dock卡機回復Message; if (交易結果) then (ECR_Response_Code == "0000") :交易結果; else (else) :交易失敗; endif stop @enduml ``` ## 信用卡交易要求 (一般交易) ### Request ```json { "Trans_Type": "01" / "11" "Trans_Amount": 1 "Store_Id": "705" "CUP_Indicator": "C"/*CUP*/ "N"/*Default*/ } ``` ### Response ```json { "Trans_Type":"11", "Host_ID":"03", "Receipt_No":"000015", "Card_No":"XXXXXXXXXXXXXXXX ", "Trans_Amount":"000000000100", "Trans_Date":"210803", "Trans_Time":"114201", "Approval_No":"TT4201 ", "ECR_Response_Code":"0000", "EDC_Terminal_ID":"64604484", "Card_type":"04", "CUP_Indicator":"0", "_edcresp_raw":"\u00021103000015XXXXXXXXXXXXXXXX 000000000100210803114201TT4201 000000000000000064604484000000000000000000000000000000000000000000000400000000\u0003\u0002" } ``` <!-- ```plantuml @startuml |mPOS/POS| start :信用卡結帳; :輸入金額; :選擇 台新(一般/分期); :發送卡機Message; split :等待超過1min; end split again |DOCK Service| repeat :發送卡機電文; |台新 EDC| :一般交易; |DOCK Service| :接收卡機回復電文; repeat while (卡機回復結果) is (電文格式錯誤, 重試最多三次) -> 電文格式OK 或 已等待超過1Min; :發送卡機交易結果Message; |mPOS/POS| :接收Dock卡機回復Message; if (交易結果) then (ECR_Response_Code == "0000") :交易結果; else (else) :交易失敗; endif stop @enduml ``` --> ## 信用卡交易要求 (分期) ### Request ```json { "Trans_Type": "01" / "04" "Trans_Amount": 交易金額: int "Store_Id": 櫃號/發票號碼 "CUP_Indicator": "C"/*CUP*/ "N"/*Default*/ } ``` ### Response ```json { "Trans_Type":"04", "Host_ID":"04", "Receipt_No":"000018", "Card_No":"XXXXXXXXXXXXXXXX ", "Trans_Amount":"000000000100", "Trans_Date":"210803", "Trans_Time":"133947", "Approval_No":"TT3947 ", "Installment_Period":"03", "ECR_Response_Code":"0000", "EDC_Terminal_ID":"64604484", "Installment_Total_Amount":"000000000100", "Downpayment_Amount":"000000000100", "Eachpayment_Amount":"000000000000", "Order_No":"210803133947000000", "Card_type":"04", "_edcresp_raw":"\u00020404000018XXXXXXXXXXXXXXXX 000000000100210803133947TT3947 000000000100000064604484000000000100000000000000210803133947000000030400000000\u0003\u000e", } ``` <!-- ```plantuml @startuml |mPOS/POS| start :信用卡結帳; :輸入金額; :選擇 台新(一般/分期); :發送卡機Message; split :等待超過1min; end split again |DOCK Service| repeat :發送卡機電文; |台新 EDC| :分期交易; :輸入分期期數; |DOCK Service| :接收卡機回復電文; repeat while (卡機回復結果) is (電文格式錯誤, 重試最多三次) -> 電文格式OK 或 已等待超過1Min; :發送卡機交易結果Message; |mPOS/POS| :接收Dock卡機回復Message; if (交易結果) then (ECR_Response_Code == "0000") :交易結果; else (else) :交易失敗; endif stop @enduml ``` --> ## 信用卡交易要求 (紅利) ### Request ```json { "Trans_Type": "01" / "05" "Trans_Amount": 交易金額: int "Store_Id": 櫃號/發票號碼 "CUP_Indicator": "C"/*CUP*/ "N"/*Default*/ } ``` ### Response ```json { "Trans_Type":"05", "Host_ID":"05", "Receipt_No":"000017", "Card_No":"XXXXXXXXXXXXXXXX ", "Trans_Amount":"000000000100", "Trans_Date":"210803", "Trans_Time":"125755", "Approval_No":"TT5755 ", "Rebate_Point":"000000000000", "ECR_Response_Code":"0000", "EDC_Terminal_ID":"64604484", "Real_Amount":"000000000100", "Rebate_Amount":"000000000000", "Order_No":"123456789012000000", "Card_type":"04", "_edcresp_raw":"\u00020505000017XXXXXXXXXXXXXXXX 000000000100210803125755TT5755 000000000000000064604484000000000100000000000000123456789012000000000400000000\u0003\u0003", } ``` <!-- ```plantuml @startuml |mPOS/POS| start :信用卡結帳; :輸入金額; :選擇 台新(一般/分期); :發送卡機Message; split :等待超過1min; end split again |DOCK Service| repeat :發送卡機電文; |台新 EDC| :紅利交易; |DOCK Service| :接收卡機回復電文; repeat while (卡機回復結果) is (電文格式錯誤, 重試最多三次) -> 電文格式OK 或 已等待超過1Min; :發送卡機交易結果Message; |mPOS/POS| :接收Dock卡機回復Message; if (交易結果) then (ECR_Response_Code == "0000") :交易結果; else (else) :交易失敗; endif stop @enduml ``` --> ## 信用卡取消交易要求 ### Request ```json { "Trans_Type": "30" "Host_ID": 銀行別/授權中心編碼 "Receipt_No": EDC 簽單序號 } ``` :::spoiler schema ```json { "$schema": "http://json-schema.org/draft-04/schema#", "type": "object", "properties": { "Host_ID": { "type": "string", "minimum": 1, "maximum": 999999999999 }, "Receipt_No": { "type": "string", "minLength": 1, "maxLength": 10 } }, "required": [ "Host_ID", "Receipt_No", ] } ``` ::: ### Response ```json { "Trans_Type":"30", "Host_ID":"03", "Receipt_No":"000015", "Card_No":"XXXXXXXXXXXXXXXX ", "Trans_Amount":"000000000100", "Trans_Date":"210803", "Trans_Time":"125206", "Approval_No":"TT4201 ", "ECR_Response_Code":"0000", "EDC_Terminal_ID":"64604484", "Card_type":"04", "_edcresp_raw":"\u00023003000015XXXXXXXXXXXXXXXX 000000000100210803125206TT4201 000000000000000064604484000000000000000000000000000000000000000000000400000000\u0003\u0004", } ``` ```plantuml @startuml |mPOS/POS| start :信用卡取消授權; :發送卡機Message; split :等待超過1min; :交易失敗 / 交易結果未知; end split again |DOCK Service| repeat :發送卡機電文; |台新 EDC| :輸入卡機密碼; :確認取消交易; |DOCK Service| :等待/接收卡機回復電文; repeat while (卡機回復結果) is (電文格式錯誤, 重試最多三次) -> 電文格式OK 或 已等待超過1Min; :發送卡機交易結果Message; |mPOS/POS| :接收Dock卡機回復Message; if (交易結果) then (ECR_Response_Code == "0000") :交易結果; else (else) :交易失敗; endif stop @enduml ```

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully