trex-model 1.4.0__tar.gz → 1.4.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of trex-model might be problematic. Click here for more details.
- {trex-model-1.4.0 → trex-model-1.4.2}/PKG-INFO +1 -1
- {trex-model-1.4.0 → trex-model-1.4.2}/setup.py +1 -1
- {trex-model-1.4.0 → trex-model-1.4.2}/trex_model.egg-info/PKG-INFO +1 -1
- {trex-model-1.4.0 → trex-model-1.4.2}/trexmodel/models/datastore/customer_models.py +7 -1
- {trex-model-1.4.0 → trex-model-1.4.2}/trexmodel/models/datastore/merchant_models.py +73 -1
- {trex-model-1.4.0 → trex-model-1.4.2}/trexmodel/models/merchant_helpers.py +21 -2
- {trex-model-1.4.0 → trex-model-1.4.2}/LICENSE +0 -0
- {trex-model-1.4.0 → trex-model-1.4.2}/MANIFEST.in +0 -0
- {trex-model-1.4.0 → trex-model-1.4.2}/README.md +0 -0
- {trex-model-1.4.0 → trex-model-1.4.2}/setup.cfg +0 -0
- {trex-model-1.4.0 → trex-model-1.4.2}/trex_model.egg-info/SOURCES.txt +0 -0
- {trex-model-1.4.0 → trex-model-1.4.2}/trex_model.egg-info/dependency_links.txt +0 -0
- {trex-model-1.4.0 → trex-model-1.4.2}/trex_model.egg-info/requires.txt +0 -0
- {trex-model-1.4.0 → trex-model-1.4.2}/trex_model.egg-info/top_level.txt +0 -0
- {trex-model-1.4.0 → trex-model-1.4.2}/trexmodel/__init__.py +0 -0
- {trex-model-1.4.0 → trex-model-1.4.2}/trexmodel/conf.py +0 -0
- {trex-model-1.4.0 → trex-model-1.4.2}/trexmodel/models/__init__.py +0 -0
- {trex-model-1.4.0 → trex-model-1.4.2}/trexmodel/models/datastore/__init__.py +0 -0
- {trex-model-1.4.0 → trex-model-1.4.2}/trexmodel/models/datastore/admin_models.py +0 -0
- {trex-model-1.4.0 → trex-model-1.4.2}/trexmodel/models/datastore/analytic_models.py +0 -0
- {trex-model-1.4.0 → trex-model-1.4.2}/trexmodel/models/datastore/app_models.py +0 -0
- {trex-model-1.4.0 → trex-model-1.4.2}/trexmodel/models/datastore/coporate_models.py +0 -0
- {trex-model-1.4.0 → trex-model-1.4.2}/trexmodel/models/datastore/customer_model_helpers.py +0 -0
- {trex-model-1.4.0 → trex-model-1.4.2}/trexmodel/models/datastore/fb_subsriber_models.py +0 -0
- {trex-model-1.4.0 → trex-model-1.4.2}/trexmodel/models/datastore/import_models.py +0 -0
- {trex-model-1.4.0 → trex-model-1.4.2}/trexmodel/models/datastore/inventory_model.py +0 -0
- {trex-model-1.4.0 → trex-model-1.4.2}/trexmodel/models/datastore/loyalty_models.py +0 -0
- {trex-model-1.4.0 → trex-model-1.4.2}/trexmodel/models/datastore/lucky_draw_models.py +0 -0
- {trex-model-1.4.0 → trex-model-1.4.2}/trexmodel/models/datastore/marketing_models.py +0 -0
- {trex-model-1.4.0 → trex-model-1.4.2}/trexmodel/models/datastore/membership_models.py +0 -0
- {trex-model-1.4.0 → trex-model-1.4.2}/trexmodel/models/datastore/message_model_helper.py +0 -0
- {trex-model-1.4.0 → trex-model-1.4.2}/trexmodel/models/datastore/message_models.py +0 -0
- {trex-model-1.4.0 → trex-model-1.4.2}/trexmodel/models/datastore/model_decorators.py +0 -0
- {trex-model-1.4.0 → trex-model-1.4.2}/trexmodel/models/datastore/ndb_models.py +0 -0
- {trex-model-1.4.0 → trex-model-1.4.2}/trexmodel/models/datastore/pos_models.py +0 -0
- {trex-model-1.4.0 → trex-model-1.4.2}/trexmodel/models/datastore/prepaid_models.py +0 -0
- {trex-model-1.4.0 → trex-model-1.4.2}/trexmodel/models/datastore/product_models.py +0 -0
- {trex-model-1.4.0 → trex-model-1.4.2}/trexmodel/models/datastore/program_models.py +0 -0
- {trex-model-1.4.0 → trex-model-1.4.2}/trexmodel/models/datastore/rating_models.py +0 -0
- {trex-model-1.4.0 → trex-model-1.4.2}/trexmodel/models/datastore/recruit_models.py +0 -0
- {trex-model-1.4.0 → trex-model-1.4.2}/trexmodel/models/datastore/redeem_models.py +0 -0
- {trex-model-1.4.0 → trex-model-1.4.2}/trexmodel/models/datastore/redemption_catalogue_models.py +0 -0
- {trex-model-1.4.0 → trex-model-1.4.2}/trexmodel/models/datastore/referral_program_model.py +0 -0
- {trex-model-1.4.0 → trex-model-1.4.2}/trexmodel/models/datastore/reward_model_helpers.py +0 -0
- {trex-model-1.4.0 → trex-model-1.4.2}/trexmodel/models/datastore/reward_models.py +0 -0
- {trex-model-1.4.0 → trex-model-1.4.2}/trexmodel/models/datastore/spending_base_program_model.py +0 -0
- {trex-model-1.4.0 → trex-model-1.4.2}/trexmodel/models/datastore/system_models.py +0 -0
- {trex-model-1.4.0 → trex-model-1.4.2}/trexmodel/models/datastore/task_models.py +0 -0
- {trex-model-1.4.0 → trex-model-1.4.2}/trexmodel/models/datastore/test_models.py +0 -0
- {trex-model-1.4.0 → trex-model-1.4.2}/trexmodel/models/datastore/transaction_models.py +0 -0
- {trex-model-1.4.0 → trex-model-1.4.2}/trexmodel/models/datastore/user_models.py +0 -0
- {trex-model-1.4.0 → trex-model-1.4.2}/trexmodel/models/datastore/voucher_models.py +0 -0
- {trex-model-1.4.0 → trex-model-1.4.2}/trexmodel/models/model_decorator.py +0 -0
- {trex-model-1.4.0 → trex-model-1.4.2}/trexmodel/models/prepaid_helpers.py +0 -0
- {trex-model-1.4.0 → trex-model-1.4.2}/trexmodel/pos_conf.py +0 -0
- {trex-model-1.4.0 → trex-model-1.4.2}/trexmodel/program_conf.py +0 -0
- {trex-model-1.4.0 → trex-model-1.4.2}/trexmodel/utils/__init__.py +0 -0
- {trex-model-1.4.0 → trex-model-1.4.2}/trexmodel/utils/gcloud/__init__.py +0 -0
- {trex-model-1.4.0 → trex-model-1.4.2}/trexmodel/utils/gcloud/datastore_util.py +0 -0
- {trex-model-1.4.0 → trex-model-1.4.2}/trexmodel/utils/model/__init__.py +0 -0
- {trex-model-1.4.0 → trex-model-1.4.2}/trexmodel/utils/model/model_util.py +0 -0
|
@@ -81,7 +81,8 @@ class Customer(BaseNModel, DictModel, FullTextSearchable):
|
|
|
81
81
|
'tags_list', 'memberships_list', 'registered_merchant_acct', 'entitled_membership_reward_summary',
|
|
82
82
|
'reward_summary', 'entitled_voucher_summary', 'prepaid_summary', 'kpi_summary', 'entitled_lucky_draw_ticket_summary',
|
|
83
83
|
'entitled_birthday_reward_summary', 'tier_membership_key',
|
|
84
|
-
'registered_outlet_key', '
|
|
84
|
+
'registered_outlet_key', 'merchant_account_key',
|
|
85
|
+
'registered_datetime', 'modified_datetime',
|
|
85
86
|
'registered_user_acct','referral_code',
|
|
86
87
|
|
|
87
88
|
]
|
|
@@ -116,6 +117,11 @@ class Customer(BaseNModel, DictModel, FullTextSearchable):
|
|
|
116
117
|
def registered_merchant_acct_key(self):
|
|
117
118
|
if self.merchant_acct:
|
|
118
119
|
return self.merchant_acct.urlsafe().decode("utf-8")
|
|
120
|
+
|
|
121
|
+
@property
|
|
122
|
+
def merchant_account_key(self):
|
|
123
|
+
if self.merchant_acct:
|
|
124
|
+
return self.merchant_acct.urlsafe().decode("utf-8")
|
|
119
125
|
|
|
120
126
|
@property
|
|
121
127
|
def registered_outlet(self):
|
|
@@ -1892,4 +1892,76 @@ class BannerFile(BaseNModel, DictModel):
|
|
|
1892
1892
|
old_logo_blob = bucket.get_blob(banner_file.banner_file_storage_filename)
|
|
1893
1893
|
if old_logo_blob:
|
|
1894
1894
|
old_logo_blob.delete()
|
|
1895
|
-
banner_file.delete()
|
|
1895
|
+
banner_file.delete()
|
|
1896
|
+
|
|
1897
|
+
class MerchantNewsFile(BaseNModel, DictModel):
|
|
1898
|
+
'''
|
|
1899
|
+
Merchant Account as ancestor
|
|
1900
|
+
'''
|
|
1901
|
+
label = ndb.StringProperty(required=False)
|
|
1902
|
+
desc = ndb.StringProperty(required=False)
|
|
1903
|
+
news_text = ndb.StringProperty(required=False)
|
|
1904
|
+
|
|
1905
|
+
news_file_type = ndb.StringProperty(required=True)
|
|
1906
|
+
news_file_public_url = ndb.StringProperty(required=True)
|
|
1907
|
+
news_file_storage_filename = ndb.StringProperty(required=True)
|
|
1908
|
+
start_date = ndb.DateProperty(required=True)
|
|
1909
|
+
end_date = ndb.DateProperty(required=True)
|
|
1910
|
+
|
|
1911
|
+
|
|
1912
|
+
dict_properties = ['news_file_public_url', 'news_file_storage_filename', 'news_file_type', 'label', 'desc', 'news_text', 'start_date', 'end_date']
|
|
1913
|
+
|
|
1914
|
+
@staticmethod
|
|
1915
|
+
def list_by_merchant_acct(merchant_acct):
|
|
1916
|
+
result = MerchantNewsFile.query(ancestor=merchant_acct.create_ndb_key()).fetch(limit=conf.MAX_FETCH_RECORD)
|
|
1917
|
+
return result
|
|
1918
|
+
|
|
1919
|
+
@staticmethod
|
|
1920
|
+
def create(merchant_acct, label=None, desc=None, news_text=None):
|
|
1921
|
+
news_file = MerchantNewsFile(
|
|
1922
|
+
parent = merchant_acct.create_ndb_key(),
|
|
1923
|
+
label = label,
|
|
1924
|
+
desc = desc,
|
|
1925
|
+
news_text = news_text,
|
|
1926
|
+
)
|
|
1927
|
+
|
|
1928
|
+
news_file.put()
|
|
1929
|
+
|
|
1930
|
+
@staticmethod
|
|
1931
|
+
def upload_file(merchant_news, uploading_file, merchant_acct, bucket, news_file_type=None):
|
|
1932
|
+
file_prefix = random_string(8)
|
|
1933
|
+
news_file_storage_filename = 'merchant/'+merchant_acct.key_in_str+'/news/'+file_prefix+'-'+uploading_file.filename
|
|
1934
|
+
blob = bucket.blob(news_file_storage_filename)
|
|
1935
|
+
|
|
1936
|
+
logger.debug('news_file_storage_filename=%s', news_file_storage_filename)
|
|
1937
|
+
|
|
1938
|
+
blob.upload_from_string(
|
|
1939
|
+
uploading_file.read(),
|
|
1940
|
+
content_type=uploading_file.content_type
|
|
1941
|
+
)
|
|
1942
|
+
|
|
1943
|
+
uploaded_url = blob.public_url
|
|
1944
|
+
|
|
1945
|
+
logger.debug('uploaded_url=%s', uploaded_url)
|
|
1946
|
+
logger.debug('news_file_type=%s', news_file_type)
|
|
1947
|
+
|
|
1948
|
+
if is_not_empty(merchant_news.news_file_storage_filename):
|
|
1949
|
+
old_logo_blob = bucket.get_blob(merchant_news.news_file_storage_filename)
|
|
1950
|
+
if old_logo_blob:
|
|
1951
|
+
old_logo_blob.delete()
|
|
1952
|
+
|
|
1953
|
+
|
|
1954
|
+
merchant_news.news_file_public_url = uploaded_url
|
|
1955
|
+
merchant_news.news_file_storage_filename = news_file_storage_filename
|
|
1956
|
+
merchant_news.news_file_type = news_file_type
|
|
1957
|
+
|
|
1958
|
+
|
|
1959
|
+
merchant_news.put()
|
|
1960
|
+
|
|
1961
|
+
@staticmethod
|
|
1962
|
+
def remove_file(news_file, bucket):
|
|
1963
|
+
|
|
1964
|
+
old_logo_blob = bucket.get_blob(news_file.news_file_storage_filename)
|
|
1965
|
+
if old_logo_blob:
|
|
1966
|
+
old_logo_blob.delete()
|
|
1967
|
+
news_file.delete()
|
|
@@ -3,6 +3,7 @@ from trexmodel.models.datastore.pos_models import InvoiceNoGeneration,\
|
|
|
3
3
|
from trexmodel.models.datastore.merchant_models import ReceiptSetup, Outlet,\
|
|
4
4
|
BannerFile
|
|
5
5
|
from trexlib.utils.string_util import is_not_empty
|
|
6
|
+
from trexconf import conf
|
|
6
7
|
|
|
7
8
|
def construct_merchant_acct_info(merchant_acct):
|
|
8
9
|
account_settings = {
|
|
@@ -34,6 +35,24 @@ def construct_merchant_acct_info(merchant_acct):
|
|
|
34
35
|
|
|
35
36
|
referral_program_settings = merchant_acct.program_settings.get('referral_program', {})
|
|
36
37
|
|
|
38
|
+
|
|
39
|
+
merchant_news_list = [
|
|
40
|
+
{
|
|
41
|
+
'image_url': 'https://scontent.cdninstagram.com/v/t39.30808-6/395358935_817823987014226_84933362912055577_n.jpg?stp=dst-jpg_e35&efg=eyJ2ZW5jb2RlX3RhZyI6ImltYWdlX3VybGdlbi42NTF4NjUwLnNkci5mMzA4MDgifQ&_nc_ht=scontent.cdninstagram.com&_nc_cat=102&_nc_ohc=v_kSSi1t6JgQ7kNvgERj6Vi&edm=APs17CUAAAAA&ccb=7-5&ig_cache_key=MzIyMjUxMzQ0MzI0ODIyMzYzMg%3D%3D.2-ccb7-5&oh=00_AfAUoP1jFeskadyDc4xrwkZb1PuH9t5JSajL6Q5tKAwCew&oe=663DAE72&_nc_sid=10d13b',
|
|
42
|
+
'text':'',
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
'image_url': 'https://scontent.cdninstagram.com/v/t39.30808-6/422867915_881086610687963_4914358090885890823_n.jpg?stp=dst-jpg_e35&efg=eyJ2ZW5jb2RlX3RhZyI6ImltYWdlX3VybGdlbi4xMDAweDEwMDAuc2RyLmYzMDgwOCJ9&_nc_ht=scontent.cdninstagram.com&_nc_cat=111&_nc_ohc=-26XTqUwW_UQ7kNvgGzfHx3&edm=APs17CUAAAAA&ccb=7-5&ig_cache_key=MzI5MDg0MTIxNDU3MjA1Nzk3OA%3D%3D.2-ccb7-5&oh=00_AfC8Mj_E7VFXjv_lXqKRYZujgLyIzSHCIL7zM4-sVgRl_A&oe=663DC772&_nc_sid=10d13b',
|
|
46
|
+
'text':'',
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
'image_url': 'https://scontent.cdninstagram.com/v/t39.30808-6/429531381_18323200675112934_3919053740927881532_n.jpg?stp=dst-jpg_e35&efg=eyJ2ZW5jb2RlX3RhZyI6ImltYWdlX3VybGdlbi4xMDgweDEwODAuc2RyLmYzMDgwOCJ9&_nc_ht=scontent.cdninstagram.com&_nc_cat=106&_nc_ohc=xNmQi508i6sQ7kNvgEEkOg4&edm=APs17CUAAAAA&ccb=7-5&ig_cache_key=MzMxMzI2NDY1NDg3NDQxNDI1Mw%3D%3D.2-ccb7-5&oh=00_AfApkzmZjDGPJB1Vnf49is-ZpqqYYL5nKgmB9jXmDGpUGQ&oe=663FD578&_nc_sid=10d13b',
|
|
50
|
+
'text':'',
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
]
|
|
54
|
+
|
|
55
|
+
merchant_news_list=[]
|
|
37
56
|
info = {
|
|
38
57
|
'key' : merchant_acct.key_in_str,
|
|
39
58
|
'company_name' : merchant_acct.company_name,
|
|
@@ -46,7 +65,7 @@ def construct_merchant_acct_info(merchant_acct):
|
|
|
46
65
|
'account_settings' : account_settings,
|
|
47
66
|
'outlets' : outlet_json_list,
|
|
48
67
|
'banners' : banner_listing,
|
|
49
|
-
|
|
68
|
+
'merchant_news' : merchant_news_list,
|
|
50
69
|
}
|
|
51
70
|
if is_not_empty(referral_program_settings):
|
|
52
71
|
|
|
@@ -54,7 +73,7 @@ def construct_merchant_acct_info(merchant_acct):
|
|
|
54
73
|
'program_count' : merchant_acct.effective_referral_program_count,
|
|
55
74
|
'referrer_promote_title' : referral_program_settings.get('referrer_promote_title'),
|
|
56
75
|
'referrer_promote_desc' : referral_program_settings.get('referrer_promote_desc'),
|
|
57
|
-
'referrer_promote_image' : referral_program_settings.get('referrer_promote_image'),
|
|
76
|
+
'referrer_promote_image' : referral_program_settings.get('referrer_promote_image', conf.REFERRAL_DEFAULT_PROMOTE_IMAGE),
|
|
58
77
|
'referee_promote_title' : referral_program_settings.get('referee_promote_title'),
|
|
59
78
|
'referee_promote_desc' : referral_program_settings.get('referee_promote_desc'),
|
|
60
79
|
'referee_promote_image' : referral_program_settings.get('referee_promote_image'),
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{trex-model-1.4.0 → trex-model-1.4.2}/trexmodel/models/datastore/redemption_catalogue_models.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{trex-model-1.4.0 → trex-model-1.4.2}/trexmodel/models/datastore/spending_base_program_model.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|