Steve L. Nyemba 7 years ago
parent 0368d78496
commit 4c1e326b51

BIN
.DS_Store vendored

Binary file not shown.

BIN
src/.DS_Store vendored

Binary file not shown.

BIN
src/api/.DS_Store vendored

Binary file not shown.

@ -1,6 +1,11 @@
"""
Steve L. Nyemba <steve@the-phi.com>
The Phi Technology, LLC - Store
This file handles customer & plans associated with a given product/app
The subscription works as follows:
We understand that a product will have multiple plans under it and we make sure that we always have a free version:
- Having a free product insures there is no excuse not to signup users
- If a product doesn't fall under this model we will find a way to fix it.
-
"""
from __future__ import division
@ -34,49 +39,71 @@ COUCHDB = Server(uri=CONFIG['couchdb']['uri']) ;
This function will set the user information to the session and update the information
@header uid user email address
"""
@app.route("/init/<app_name>",methods=['POST'])
def init(app_name):
plans = []
handler = None
uid = request.headers['uid']
plan = request.headers['pid']
auid = None
if 'uid' in request.headers and 'auid' not in request.headers:
id = uid
#couchdb = Couchdb(uri=CONFIG['couchdb']['uri'],dbname=app_name,uid=uid,create=False)
#DB = couchdb.dbase
@app.route("/init/<product>",methods=['POST'])
def init(product):
"""
This function initializes a product to a given user,
if the user has provided a user identifier it will be used as her primary email. The understanding is that a product may have multiple plans under it but always a free one
@param uid user's email (primary)
@param pid plan identifier
"""
email = request.headers['uid']
plan_id = request.headers['pid']
user = User(stripe=stripe,store=CONFIG['couchdb'],product=product)
user.susbscribe(uid,plan_id)
if 'auid' in request.headers :
auid = request.headers['auid']
auid = json.loads(auid)if auid.startswith('[') else auid
if isinstance(auid,list) :
auid = list(set(auid) - set([uid]))
if len(auid) == 0:
auid = None
id = uid
else:
auid = auid[0]
id = auid
couchdb = Couchdb(uri=CONFIG['couchdb']['uri'],dbname=app_name,uid=id,create=False)
DB = couchdb.dbase
#handler.update_user(id=handler.getId(auid),uid=uid)
handler = Domain.User(DB,stripe) ;
if auid is None :
handler.init(uid,plan) ;
auid = request.header['auid']
user.update(emails=auid)
user.post()
features = json.loads(users.me['subscriptions'][pid][0]['metadata'])
else:
if couchdb.isready() == False:
handler.init(auid,plan)
id = handler.getId(uid)
features = user.get(uid,key)
user.refresh()
return json.dumps(features),200
# @app.route("/init/<app_name>",methods=['POST'])
# def init(app_name):
# plans = []
# handler = None
# uid = request.headers['uid']
# plan = request.headers['pid']
# auid = None
# if 'uid' in request.headers and 'auid' not in request.headers:
# id = uid
# #couchdb = Couchdb(uri=CONFIG['couchdb']['uri'],dbname=app_name,uid=uid,create=False)
# #DB = couchdb.dbase
# if 'auid' in request.headers :
# auid = request.headers['auid']
# auid = json.loads(auid)if auid.startswith('[') else auid
# if isinstance(auid,list) :
# auid = list(set(auid) - set([uid]))
handler.initialize(auid)
id = handler.getId(auid)
handler.update_user(id=id,uid=uid) ;
# if len(auid) == 0:
# auid = None
# id = uid
# else:
# auid = auid[0]
# id = auid
# couchdb = Couchdb(uri=CONFIG['couchdb']['uri'],dbname=app_name,uid=id,create=False)
# DB = couchdb.dbase
# #handler.update_user(id=handler.getId(auid),uid=uid)
plans = handler.plans()
#return json.dumps(plans)
_features = features(app_name)
return _features
# handler = Domain.User(DB,stripe) ;
# if auid is None :
# handler.init(uid,plan) ;
# else:
# if couchdb.isready() == False:
# handler.init(auid,plan)
# id = handler.getId(uid)
# handler.initialize(auid)
# id = handler.getId(auid)
# handler.update_user(id=id,uid=uid) ;
# plans = handler.plans()
# #return json.dumps(plans)
# _features = features(app_name)
# return _features
"""
This function will update the user's email
"""

Binary file not shown.

Before

Width:  |  Height:  |  Size: 357 KiB

After

Width:  |  Height:  |  Size: 357 KiB

Before

Width:  |  Height:  |  Size: 9.6 KiB

After

Width:  |  Height:  |  Size: 9.6 KiB

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Binary file not shown.

@ -1,46 +1,46 @@
(function(jsGrid) {
jsGrid.locales.ja = {
grid: {
noDataContent: "データが見つかりません。",
deleteConfirm: "削除しますよろしですか。",
pagerFormat: "頁: {first} {prev} {pages} {next} {last} &nbsp;&nbsp; 【{pageIndex}{pageCount}】",
pagePrevText: "前",
pageNextText: "次",
pageFirstText: "最初",
pageLastText: "最後",
loadMessage: "しばらくお待ちください…",
invalidMessage: "入力されたデータが不正です。"
},
loadIndicator: {
message: "処理中…"
},
fields: {
control: {
searchModeButtonTooltip: "検索モードへ",
insertModeButtonTooltip: "登録モードへ",
editButtonTooltip: "編集",
deleteButtonTooltip: "削除",
searchButtonTooltip: "フィルター",
clearFilterButtonTooltip: "クリア",
insertButtonTooltip: "登録",
updateButtonTooltip: "更新",
cancelEditButtonTooltip: "編集戻す"
}
},
validators: {
required: { message: "項目が必要です。" },
rangeLength: { message: "項目の桁数が範囲外です。" },
minLength: { message: "項目の桁数が超過しています。" },
maxLength: { message: "項目の桁数が不足しています。" },
pattern: { message: "項目の値がパターンに一致しません。" },
range: { message: "項目の値が範囲外です。" },
min: { message: "項目の値が超過しています。" },
max: { message: "項目の値が不足しています。" }
}
};
(function(jsGrid) {
jsGrid.locales.ja = {
grid: {
noDataContent: "データが見つかりません。",
deleteConfirm: "削除しますよろしですか。",
pagerFormat: "頁: {first} {prev} {pages} {next} {last} &nbsp;&nbsp; 【{pageIndex}{pageCount}】",
pagePrevText: "前",
pageNextText: "次",
pageFirstText: "最初",
pageLastText: "最後",
loadMessage: "しばらくお待ちください…",
invalidMessage: "入力されたデータが不正です。"
},
loadIndicator: {
message: "処理中…"
},
fields: {
control: {
searchModeButtonTooltip: "検索モードへ",
insertModeButtonTooltip: "登録モードへ",
editButtonTooltip: "編集",
deleteButtonTooltip: "削除",
searchButtonTooltip: "フィルター",
clearFilterButtonTooltip: "クリア",
insertButtonTooltip: "登録",
updateButtonTooltip: "更新",
cancelEditButtonTooltip: "編集戻す"
}
},
validators: {
required: { message: "項目が必要です。" },
rangeLength: { message: "項目の桁数が範囲外です。" },
minLength: { message: "項目の桁数が超過しています。" },
maxLength: { message: "項目の桁数が不足しています。" },
pattern: { message: "項目の値がパターンに一致しません。" },
range: { message: "項目の値が範囲外です。" },
min: { message: "項目の値が超過しています。" },
max: { message: "項目の値が不足しています。" }
}
};
}(jsGrid, jQuery));

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save