Skip to content

Restfull Micro-Service to support general commerce above TODAQ block-chain.

License

Notifications You must be signed in to change notification settings

lemoncloud-io/lemon-todaq-doc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

lemon-todaq-doc

Restfull Micro-Service to support general commerce above TodaQ block-chain technology.

Objective

  • Support general commerce payment based on TodaQ API
  • Ready to deploy in AWS Cloud in 3 minutes.
  • Provide a web based admin console for payment management.
  • Agent module in nodejs, python for developer.

Requirements

TodaQ for commerce

유저 (User)

  • TYPE: ACCOUNT
  • Master information about user(or company), which is copied via RDB.
  • Encrypt TODAQ's Account Information like <account-id>. (Only super user can see).
  • Can be synchronized with TODAQ Accounts.
  • total has total amount of value of conins belonged to user.
  1. 연결(link): Connect current user with TODAQ's Account (or create new one)

    • Account Type: BIZ/INV
    • Account ID: save the encrypted todaq's account-id into KMS.
  2. 활성(activate): Change active state in TODAQ.

    • Active State: ...
  3. 동기화(sync): Synchronize information, and aggregate total value of coins.

    • Balance: total balance of coins.
    • Sync Date: timestamp of synchronization (including webhook callback).
  4. 패스코드(passcode): Confirm the transaction per account/enterprise.

    • Digit Code: 4~6 digits number.
    • save in encrypted string by KMS

동전 (Coin)

  • TYPE: COIN
  • Like coins in real-world, it has value estimation as 10 KRW, 100 KRW
  • Can be matched with TODAQ's <file-type-id> attribute => only possible to have hash-key.
  • Only define the specifications (like 10KRW) about each coin.
  1. 정의(define): define root/child type of coin. (role: admin)

    • file-type-id: for root. for childs.
    • file-type: COIN
    • initial-owner: enterprise id (or bank of coin).
    • coin-code: code like USD/SOM/KRW/... (inherit from root)
    • coin-name: readable name. (inherit from root)
    • coin-note: like 10/100/500/1000. (only for child)
    • hash-code: = hash(code + intial-owner + name + note)
  2. 발행(issue): Generate coins like exchange-bank in real world (but, enterprisor has ownership)

    • id: same as <file-id>
    • file-type-id: id of COIN.
    • file-type: COIN
    • initial-owner: enterprise id (or bank of coin).
    • coin-code: code like USD/SOM/... (inherit from file-type-id)
    • coin-note: note value (inherit from file-type-id)
    • issue-date:
    • issue-reason: ...
    • hash-code: = hash(type-id + intial-owner + type + code + node + date)
  3. 폐기(trash): Trash coins only by Owner.

    • Trash Account: ...
  4. 교환(exchange): Exchange between different conins with same value. (Use transaction api internally)

    • Exchange Rate: 10 SOM = 10 KRW.
    • Exchange Cost: as tax per exchange (or zero) to enterprise.
  5. 전달(transfer): Transfer coins to other account w/ transaction.

    • Transfer Rate: Y := X + a
    • Transfer Cost: as tax per transfer. (or zero) to enterprise.

결제 (Payment)

  • TYPE: PAYMENT
  • Use coins to buy something. (and get some changes)
  • Make transaction, and make sure settlement in seconds. (TBD)
  1. 결제(pay): Transfer coins in total cost of product to seller, then get the changes.

    • meta: save product's id.
    • transaction-id: keep track of transaction-id in database (will be synced with todaq-api)
  2. 취소(cancel): Cancel payment, then returns back product/coins.

    • transaction-id: keep the original transaction-id.
  3. 충전(charge): Buying coins with PG payment from enterprise.

    • Payment Code: ...
  4. 환불(refund): Refund to credit.

쿠폰 (Coupon)

  • TYPE: COUPON
  • Like coins in real-world, it has the benefit like 10% discount if total > 1000.
  • Rule based definitions.
  1. 발행(issue): Provider could generate.

    • Serial Code: ...
  2. 수락(accept): Provider could generate.

    • ``: ...

CHECK THIS

  • search files by <file-type-id>? or scan all files per acount in order to aggregate?
    • 'Accounts - Get File Types' -> 'Accounts - Get Files by Type'
  • define each state of file(coin), transaction.
  • size of meta data in file. purpose of meta history? -> 4MB limit of payload, or use payload-hash.
    • every transation, each meta data will be appended to file's meta.
  • use-case of 'Files Proofs'
  • implementing of TodaQ app -> cupcake
  • search maximum limit/page number -> see total-results.
  • common error handling
    • duplicated-file: fileid = Hash(payload-hash, merckle-root, first owner)
  • de-nomination will come in soon.git
  • synchronization concern in queue order.
    • how many of available files?
  • open-source and magic-key -> no way.

CALLBACK/WEBHOOK

{ type: "transaction-update", transaction-id: ..., }

STATUS description state
PENDING after 0~30s -> SUBMITTED in-flight
SUBMITTED in 30s -> SENDER_COMPLETE in-flight
SENDER-COMPLETE in 1s -> RECEPIENT-COMPLETE gone
RECIPIENT-COMPLETE completed tx spendable
INCOMPLETE need to re-submit transaction with same tid? -
  • possible to add webhook in future upon request.

About

Restfull Micro-Service to support general commerce above TODAQ block-chain.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published