nanibank
      • 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
    • Make a copy
    • 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 Make a copy 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
    # Nanibank ## Convention The params that needed for the request will be provided in `querystring` and `body` if the method is `GET` or `other` perspective. All requests are required `timestamp` header that specified the time when request sent. Request always return two field `Status` and `Message` for describing the state of the request, the information in **Return** only describe the extra information when the request was successfully. ## Middleware Most of information for satifying the middleware is placed in the header ### Time validation For determining if the request is deprecated. Time validation required unix timestamp. **Note that time validation is applied to all request** **Header** <pre> - timestamp: request's sending time </pre> ### User validation Required access-token **Header** <pre> - access-token: access token that could be obtained via login </pre> ### Otp validation Otp validation for transaction or important request. Each otp has 30 seconds time expire. **Header** <pre> - access-token: access-token obtained via login or specified request - key: key obtained via create otp - otp: otp obtained via create otp </pre> ## Customer ### Get customer information Return the information of a specified customer id or username, only one param is needed. If both are filled, customer id will be used instead **Prerequisite**: `User validation` **Path**: `users/customer/info` **Method**: `GET` **Param**: <pre> - customer_id (1): id of the customer - username (1) : username of the customer </pre> **Return**: <pre> - Info </pre> ### Login **Path**:`/users/customer/login` **Method**: `POST` **Param**: <pre> - username - password </pre> **Return**: <pre> - Token::string : access-token (expired after 15mins) - Customer::Data: information of the customer </pre> ### Refresh Refresh a specified access token. Both access token and refresh token is needed due to security. **Path**: `/users/customer/refresh` **Method**: `POST` **Param**: <pre> - access_token - refresh_token </pre> **Return**: <pre> - Token: new access token </pre> ### Register **Path**:`/users/customer/` **Method**: `POST` **Param**: <pre> - username::string: login name of the account - password::string : password of the account - name - email - phone </pre> **Return**: <pre> - Status::bool : status of the request - Message::string : description for the request - User::Data : result of the registration </pre> ### Forgot Password Forgot password need a chains of action for resetting the current password. Due to user does not have access token thus `s-create` is needed for creating access token. **Prerequisite**: OTP **Path**: `/users/password/reset` **Method**: `POST` **Param**: <pre> - username - email - new_password </pre> ### Change Password Change password require old, new password and username of the account **Prerequisite**: `User validation` **Path**: `/users/password/change` **Method**: `POST` **Param**: <pre> - old_password - new_password - username </pre> ## Receiver Receiver provides 3 methods: `GET`, `POST`, `DELETE` perspective with the usage **Prerequisite**: `User Validation` **Path**: `/users/customer/receiver` **Method**: `POST`, `GET`, `DELETE` **Param**: <pre> POST: - customer_id: id of the customer - receiver: account number of the receiver - remind_name: remind name GET: - customer_id: id of the customer DELETE: - customer_id: id of the customer - receiver: account number of the receiver </pre> **Return**: <pre> - Receiver (GET and POST): information of the receiver </pre> ## Debt Debt provides 3 methods: `GET`, `POST`, `DELETE` perspective with the usage. A debt is distinguished by the creditor and the debt's name thus a creditor cannot have 2 debt with the same name. **Prerequisite**: `User Validation` **Path**: `/debt/` **Method**: `POST`, `GET`, `DELETE` **Param**: <pre> POST: - creditor::int64: customer id of the creditor - debtor::int64: customer id of the debtor - name::string: debt's name - amount::float: amount of money - issue_date::unix-timestamp: time when the debt expired. GET: - customer_id::int64: id of the customer that related to any debt DELETE: - id: id of the debt </pre> **Return**: <pre> - Debt (POST AND GET): debt information </pre> ### Pay Debt Order to pay a debt, debtor must have enough money in the debit account to pay. **Prerequisite**: `User Validation`, `OTP` **Path**: `/debt/pay` **Method**: `POST` **Param**: <pre> POST: - id::int64: id of the debt need to be paid. GET: - customer_id::int64: id of the customer that related to any debt DELETE: - id: id of the debt </pre> **Return**: <pre> - Debt (POST AND GET): debt information </pre> ## Transaction Transaction include charge, draw and transfer for debit account ### Charge **Prerequisite**: `User Validation`, `OTP` **Path**: `/transaction/charge` **Method**: `POST` **Param**: <pre> - id: account id of the debit account that need to be charged. - amount: amount of money for charging to the account </pre> **Return**: <pre> - Account: account information after charge </pre> ### Draw **Prerequisite**: `User Validation`, `OTP` **Path**: `/transaction/draw` **Method**: `POST` **Param**: <pre> - id: account id of the debit account that need to be drawed. - amount: amount of money for drawing from the account </pre> **Return**: <pre> - Account: account information after draw </pre> ### Transfer **Prerequisite**: `User Validation`, `OTP` **Path**: `/transaction/transfer` **Method**: `POST` **Param**: <pre> - from: debit account id of the sender - to: debit account id of the receiver - amount: amount of money need to be transfered - message: message to the receiver </pre> ### History **Path**: `/transaction/history` **Method**: `GET` **Param**: <pre> - id: account id - filter (optional) (default by "both"): filter type, include "both", "receiver", "sender". </pre> **Return**: <pre> - Histories: list of related histories </pre> ## Employee ### Login **Path**: `/users/employee/login` **Method**: `POST` **Param**: same as Customer [Login](#1-login) ### Create **Path**: `/users/employee/create` **Method**: `POST` **Param**: same as Customer [Register](#register) ## Admin ### Login **Path**: `/users/admin/login` **Method**: `POST` **Param**: same as Customer [Login](#1-login) ## Common User ### Login Login to a specified account in any role, the priority is customer -> admin -> employee **Path**: `/users/login` **Method**: `POST` **Param**: sae as Customer [Login](#1-login) **Return**: <pre> - type: type of account, 1, 6, 9 for customer, admin, employee perspective </pre> ### Create **Path**: `/users/admin/create` **Method**: `POST` **Param**: same as Customer [Register](#register) ## Otp ### Create Create an OTP and send the OTP to the email of the user **Prerequisite**: `User Validation` **Path**: `/otp/create` **Method**: `GET` **Param**: <pre> - customer_id: id of the customer </pre> **Return**: <pre> - Otp - Key </pre> ### Specified Create Create an OTP in emergency case, only need the username **Path**: `/otp/s-create` **Method**: `GET` **Param**: <pre> - username: username of the customer </pre> **Return**: <pre> - Otp - Key - Access Token </pre> ## Partner ### Transfer Transfer money to specified account of Nanibank **Prerequisite**: `Hash validation`, `Partner Validation`, `Signature Validation` **Path**: `/partner/transfer` **Method**: `POST` **Param**: <pre> - id: id of the debit account in Nanibank - amount: amount of money need to be transfered </pre> **Return**: <pre> - signature </pre> ### Get Partner Key Get key of a specified partner **Prerequisite**: `User Validation` **Path**: `/partner/key` **Method**: `GET` **Param**: <pre> - partner_name: name of the partner </pre> **Return**: <pre> - Key </pre> ### Get User information from Debit Account id Get information of a specified user by providing the debit account id. **Prerequisite**: `Partner Validation` **Path**: `/partner/` **Method**: `POST` **Return**: <pre> - Info: include public information of the user </pre> ## Debit ### Get debit account Return a debit account by provide debit account id or id of the owner, only one param is needed, if both are filled debit_id will be used. **Path**: `/debit/` **Method**: `GET` **Param**: <pre> - debit_id: id of the debit account - owner: id of the owner </pre> ## Saving account ### Get a specified saving account Return a specified account by name and owner **Prerequisite**: `User validation` **Path**: `/saving/` **Method**: `GET` **Param**: <pre> - name: name of the saving account - owner: customer id of the owner </pre> **Return**: <pre> - Saving </pre> ### Get saving accounts of a specified user Return saving accounts of a specified user **Prerequisite**: `User validation` **Path**: `/saving/s` **Method**: `GET` **Param**: <pre> - owner: customer id of the owner </pre> **Return**: <pre> - Saving </pre>

    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