Steve L. Nyemba 6 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 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 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 This function will set the user information to the session and update the information
@header uid user email address @header uid user email address
""" """
@app.route("/init/<app_name>",methods=['POST']) @app.route("/init/<product>",methods=['POST'])
def init(app_name): def init(product):
plans = [] """
handler = None This function initializes a product to a given user,
uid = request.headers['uid'] 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
plan = request.headers['pid'] @param uid user's email (primary)
auid = None @param pid plan identifier
if 'uid' in request.headers and 'auid' not in request.headers: """
id = uid email = request.headers['uid']
#couchdb = Couchdb(uri=CONFIG['couchdb']['uri'],dbname=app_name,uid=uid,create=False) plan_id = request.headers['pid']
#DB = couchdb.dbase user = User(stripe=stripe,store=CONFIG['couchdb'],product=product)
user.susbscribe(uid,plan_id)
if 'auid' in request.headers : if 'auid' in request.headers :
auid = request.headers['auid'] auid = request.header['auid']
auid = json.loads(auid)if auid.startswith('[') else auid user.update(emails=auid)
if isinstance(auid,list) : user.post()
auid = list(set(auid) - set([uid])) features = json.loads(users.me['subscriptions'][pid][0]['metadata'])
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) ;
else: else:
if couchdb.isready() == False: features = user.get(uid,key)
handler.init(auid,plan) user.refresh()
id = handler.getId(uid) 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) # if len(auid) == 0:
id = handler.getId(auid) # auid = None
handler.update_user(id=id,uid=uid) ; # 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() # handler = Domain.User(DB,stripe) ;
#return json.dumps(plans) # if auid is None :
_features = features(app_name) # handler.init(uid,plan) ;
return _features # 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 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) { (function(jsGrid) {
jsGrid.locales.ja = { jsGrid.locales.ja = {
grid: { grid: {
noDataContent: "データが見つかりません。", noDataContent: "データが見つかりません。",
deleteConfirm: "削除しますよろしですか。", deleteConfirm: "削除しますよろしですか。",
pagerFormat: "頁: {first} {prev} {pages} {next} {last} &nbsp;&nbsp; 【{pageIndex}{pageCount}】", pagerFormat: "頁: {first} {prev} {pages} {next} {last} &nbsp;&nbsp; 【{pageIndex}{pageCount}】",
pagePrevText: "前", pagePrevText: "前",
pageNextText: "次", pageNextText: "次",
pageFirstText: "最初", pageFirstText: "最初",
pageLastText: "最後", pageLastText: "最後",
loadMessage: "しばらくお待ちください…", loadMessage: "しばらくお待ちください…",
invalidMessage: "入力されたデータが不正です。" invalidMessage: "入力されたデータが不正です。"
}, },
loadIndicator: { loadIndicator: {
message: "処理中…" message: "処理中…"
}, },
fields: { fields: {
control: { control: {
searchModeButtonTooltip: "検索モードへ", searchModeButtonTooltip: "検索モードへ",
insertModeButtonTooltip: "登録モードへ", insertModeButtonTooltip: "登録モードへ",
editButtonTooltip: "編集", editButtonTooltip: "編集",
deleteButtonTooltip: "削除", deleteButtonTooltip: "削除",
searchButtonTooltip: "フィルター", searchButtonTooltip: "フィルター",
clearFilterButtonTooltip: "クリア", clearFilterButtonTooltip: "クリア",
insertButtonTooltip: "登録", insertButtonTooltip: "登録",
updateButtonTooltip: "更新", updateButtonTooltip: "更新",
cancelEditButtonTooltip: "編集戻す" cancelEditButtonTooltip: "編集戻す"
} }
}, },
validators: { validators: {
required: { message: "項目が必要です。" }, required: { message: "項目が必要です。" },
rangeLength: { message: "項目の桁数が範囲外です。" }, rangeLength: { message: "項目の桁数が範囲外です。" },
minLength: { message: "項目の桁数が超過しています。" }, minLength: { message: "項目の桁数が超過しています。" },
maxLength: { message: "項目の桁数が不足しています。" }, maxLength: { message: "項目の桁数が不足しています。" },
pattern: { message: "項目の値がパターンに一致しません。" }, pattern: { message: "項目の値がパターンに一致しません。" },
range: { message: "項目の値が範囲外です。" }, range: { message: "項目の値が範囲外です。" },
min: { message: "項目の値が超過しています。" }, min: { message: "項目の値が超過しています。" },
max: { message: "項目の値が不足しています。" } max: { message: "項目の値が不足しています。" }
} }
}; };
}(jsGrid, jQuery)); }(jsGrid, jQuery));

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