---
# System prepended metadata

title: 'The Survey of [Saleor](https://getsaleor.com/)'
tags: [work]

---

The Survey of [Saleor](https://getsaleor.com/) 
===

## 功能面

### 有哪些功能模組？
#### 1. [Handling Money Amounts](https://docs.getsaleor.com/docs/architecture/money/)
  * 預設貨幣: USD
  * 系統可依使用者所在區域，顯示以當地貨幣單位所計算的商品價格 
    _(使用[Open Exchange Rate](https://openexchangerates.org)的API )_
  * 實際購買時，以系統設定的貨幣作計算 
  * 更改貨幣單位時，目前只能手動調整每個商品的價格數字

#### 2. [Product Structure](https://docs.getsaleor.com/docs/architecture/products/)
  * 概念：
    * **product types**
      定義產品擁有的特性，可看作是產品範本
    * **products**
      定義產品的基本資料，名稱、價格等
    * **product variants**
      定義產品的版本，容量、尺寸、顏色等
  * 可定義數位商品
    * 透過 URL Link 連結內容
    * 透過存取次數、時間、Token 管控
#### 3. [Thumbnails](https://docs.getsaleor.com/docs/architecture/thumbnails/)
#### 4. [Stock Management](https://docs.getsaleor.com/docs/architecture/stock/)
  * 概念：
    * **quantity**
      標示產品存貨總量
    * **quantity allocated**
      標示已分配(已售出未送達)的產品數量
    * **quantity available**
      標示可販售的產品數量
#### 5. [Order Management](https://docs.getsaleor.com/docs/architecture/orders/)
  * 概念：
    * Order
        * 包含訂單狀態、訂單資訊，付費方式、送貨地址等
        * Status: _DRAFT, UNFULFILLED, PARTIALLY, FULFILLED, FULFILLED, CANCELED_
    * Fulfillment 
        * 表示商品送貨狀態
        * Status: _FULFILLED_ , _CANCELED_
#### 6. [Events](https://docs.getsaleor.com/docs/architecture/events/)
#### 7. Internationalization
#### 8. Model Translations
#### 9. Search
  * 預設使用 PostgreSQL，可整合 Elasticsearch
#### 10. Payments Architecture
#### 11. Shippings
#### 12. Site Settings
#### 13. Pages
#### 14. GDPR Compliance
#### 15. GraphQL API (Beta)

---

### 關於稅務
  * #### 預設支援的線上服務
    * [Avalara](https://www.avalara.com/us/en/index.html) [簡介](https://help.shopify.com/zh-TW/manual/taxes/tax-services)
    * [Vatlayer](https://vatlayer.com/) [簡介](https://www.astralweb.com.tw/introduction-of-eu-vat-and-how-it-works-on-magento/)
  * #### 如何調整
    * [Taxes Guide](https://docs.getsaleor.com/docs/guides/taxes)

---

### 關於金流：
  * ### 預設支援哪些金流？
    * #### [Braintree](https://www.braintreepayments.com/) (supports PayPal and Credit Cards) [簡介](https://transbiz.com.tw/paypal-braintree-stripe-payment-gateways)
    * #### [Stripe](https://stripe.com/) (supports Credit Cards) [簡介](https://transbiz.com.tw/paypal-braintree-stripe-payment-gateways)
    * #### [Razorpay](https://razorpay.com/) (supports only the paisa currency)

  * ### 如何增加金流服務
    * [Payment Guide](https://docs.getsaleor.com/docs/guides/payments/)

---

### Data Schema?
* #### 78 張 Tables
* #### 264 個 Index

![](https://i.imgur.com/WlgUKjN.jpg)

---

## 開發面
1. Django 可能的問題
    * 使用 ORM 存取資料庫須優化
    * 高流量時的 Concurrency 處理
4. #### [Salor Source Code](https://github.com/mirumee/saleor)


## Others
* ### 軟體授權
  * [BSD-3-Clause](https://opensource.org/licenses/BSD-3-Clause) 
    1. 如以原始碼形式發佈，須包含原「BSD-3-Clause」授權內容
    2. 如以 Binary 形式發佈，須包含原「BSD-3-Clause」授權內容
    3. 未獲得允許前，不可使用原作者、組織或產品名稱作為推廣或行銷用途。

* ### Case Study
  * [Patch](https://www.patchplants.com/gb/en/)
  * [RoomLab](https://roomlab.co.uk/)
  * [Pretty Green](https://www.prettygreen.com/)
  * [GGlitch](https://www.gglitch.com/en/)

* ### Install Step:
  1. Install Python 3 (3.6 or 3.7)
  2. Install Node.js
    ```
    curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
    sudo apt-get install -y nodejs 
   ```
  3. Install PostgreSQL (9.4 or later)
    ```
    sudo apt install postgresql
    ```
  4. Install GTK+ (For PDF creation and others)
    ```
    sudo apt-get install build-essential python3-dev python3-pip python3-cffi libcairo2 libpango-1.0-0 libpangocairo-1.0-0 libgdk-pixbuf2.0-0 libffi-dev shared-mime-info
    ```
  5. Install Saleor project
  ```
  git clone https://github.com/mirumee/saleor.git
  ```
  6. Install python dependances
  ```
  cd saleor
  pip install -r requirements.txt
  ```
  7. Set SECRET_KEY environment variable
  ```
  export SECRET_KEY='<mysecretkey>'
  ```
  8. Create a PostgreSQL user and database
  ```
  createuser -P -s -e <username>
  createdb <db_name>
  ```
  9. Set DATABASE_URL environment variable
  ```
  export DATABASE_URL="postgres://<username>:<passwd>@localhost:5432/<db_name>"
  ```
  10. Prepare the database
  ```
  python manage.py migrate
  ```
  11. Install front-end dependencies
  ```
  npm install
  ```
  12. Prepare front-end assets
  ```
  npm run build-assets
  ```
  13. Compile e-mails
  ```
  npm run build-emails
  ```
  14. Start the development server
  ```
  python manage.py runserver
  ```
  
  

###### tags: `work`