Ray Lee пре 6 година
родитељ
комит
3252de17ea
2 измењених фајлова са 133 додато и 9 уклоњено
  1. 124 0
      Omniauth_API_Document.md
  2. 9 9
      Sendy_Spec.md

+ 124 - 0
Omniauth_API_Document.md

@@ -0,0 +1,124 @@
+#Member Center API Document
+##Hosts
+ - preparing: https://preparing.kdanmobile.com:3002/
+ - staging: https://staging.kdanmobile.com:3002/
+ - production: https://cloud.kdanmobile.com/
+
+##APIs
+###Request Url
+> **POST** api/v3/verification/through\_omniauth
+
+###Request Parameters
+####Required
+ - client_id, string
+ - client_secret, string
+ - provider, string [facebook, google\_oauth2, twitter, linkedin, qq\_connect, wechat]
+ - omniauth_token, string
+ - omniauth_secret **(only for twitter)**, string
+ - bundle_id **(only for twitter)**, string
+ - open_id **(only for qq\_connect, wechat)**, string
+
+####Optional
+ - email, string
+ - password, string
+
+###Response
+####Successful
+
+    {
+      "code":200,
+      "message":"ok",
+      "data": {
+        "current_time":"2017-07-14T08:15:46.120Z",
+        "account":"don.shieh@gmail.com",
+        "name":"謝東霖",
+        "email":"don.shieh@gmail.com",
+        "uuid":"cdff9f73-5ad0-4a32-b640-156c65bc9311",
+        "unconfirmed_email":null,
+        "is_developer":false,
+        "confirmed":true,
+        "bounced":false,
+        "complainted":false,
+        "created_at":"2017-07-13T08:35:04.558Z",
+        "version_email_log_release_time":"2015-05-15T00:00:00.000Z",
+        "profile_data":{
+          "icon_info":{
+            "icon_url":{
+              "100":"https://s3.amazonaws.com/kdanfile-dev/user-icon/defaults/user_icon_1_100.png",
+              "280":"https://s3.amazonaws.com/kdanfile-dev/user-icon/defaults/user_icon_1_280.png"
+            },
+            "icon_default_id":"icon1"
+          },
+          "display_name":null
+        },
+        "access_token": "9ce94b94044b01dba423c7746f1cbb369b344735ff69e01dfc8574246ddc6fc4",
+        "token_type": "bearer",
+        "expires_in": 172800,
+        "refresh_token": "9147a9fd7ecee6c8cada39805429d81f95fda40a9232dd5267b432fb5a3cb581"
+      }
+    }
+
+####Fail
+
+當第三方社群未提供email
+
+    {
+      "code":4025,
+      "message":"Email not available"
+    }
+
+當提供的email與password不匹配
+
+    {
+      "code":4026,
+      "message":"Invalid password"
+    }
+
+當用戶建立失敗導致無法產生token
+
+	{
+      "code":400,
+      "message":"Token generation failed"
+    }  
+    
+當第三方社群驗證失敗,或提供格式有誤
+
+    {
+      "code":403,
+      "message":"Authorication failed"
+    }
+當client\_id或client\_secret不正確
+
+    {
+      "code":403,
+      "message":"Not authorized client"
+    }
+    
+###Request Url
+> **POST** api/v3/verification/email\_existed
+###Request Parameters
+####Required
+ - client_id, string
+ - client_secret, string
+ - email, string
+###Response
+####Successful
+    {
+      "code":200,
+      "message":"ok",
+      "data": true
+    }
+or
+
+    {
+      "code":200,
+      "message":"ok",
+      "data": false
+    }
+####Fail
+當伺服器無法回應
+
+    null
+<!--stackedit_data:
+eyJoaXN0b3J5IjpbMTQ4NzA2NTA3OV19
+-->

+ 9 - 9
Sendy_Spec.md

@@ -22,8 +22,8 @@
       * language (member.identity.language)   
   * iap_service
       * app\_series (receipt.product.app.app_series)
-      * pack (receipt.product.pack)
-      * platform (receipt.product.app.device)
+      * subscription (receipt.product.subscription)
+      * receipt_type (receipt.class)
       * subscription\_status (kdan.subscriptions)
   * A/B Testing
       * Main version %, default 100%
@@ -46,13 +46,13 @@ add_column :members, :sendy_sub_status, enum: [:active, :unsubscribed, :bounced,
 ## IAP Service
 ### Kdan
 ~~~ruby
-has_many :subscriptions, class: 'KdanPackSubscription'
+has_many :subscription_status, class: 'KdanSubscriptionStatus'
 ~~~
-### KdanProduct
+### Subscription
 ~~~ruby
-has_many :subscriptions, class: 'KdanPackSubscription'
+has_many :status, class: 'KdanSubscriptionStatus'
 ~~~
-### KdanPackSubscription
+### KdanSubscriptionStatus
 * only apply to following packs
   * Creativity 365
   * ~~Creativity 365 Teacher & Student~~
@@ -63,13 +63,13 @@ has_many :subscriptions, class: 'KdanPackSubscription'
 
 ~~~ruby
 belongs_to :kdan
-belongs_to :kdan_product
+belongs_to :subscription
 ~~~
 ~~~ruby
 {
   kdan_id:integer,
-  kdan_product_id:integer,
-  stauts:[free_trial, subscribed, expired, refund, cancel]
+  subscription_id:integer,
+  stauts:[outsider, free_trial, subscribed, expired, refund, cancel]
 }
 ~~~
 * outsider: Not subscribed yet on pack