trex-model 1.4.1__tar.gz → 1.4.3__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.1 → trex-model-1.4.3}/PKG-INFO +1 -1
- {trex-model-1.4.1 → trex-model-1.4.3}/setup.py +1 -1
- {trex-model-1.4.1 → trex-model-1.4.3}/trex_model.egg-info/PKG-INFO +1 -1
- {trex-model-1.4.1 → trex-model-1.4.3}/trexmodel/models/datastore/customer_models.py +7 -1
- {trex-model-1.4.1 → trex-model-1.4.3}/trexmodel/models/datastore/merchant_models.py +82 -9
- {trex-model-1.4.1 → trex-model-1.4.3}/trexmodel/models/merchant_helpers.py +21 -2
- {trex-model-1.4.1 → trex-model-1.4.3}/LICENSE +0 -0
- {trex-model-1.4.1 → trex-model-1.4.3}/MANIFEST.in +0 -0
- {trex-model-1.4.1 → trex-model-1.4.3}/README.md +0 -0
- {trex-model-1.4.1 → trex-model-1.4.3}/setup.cfg +0 -0
- {trex-model-1.4.1 → trex-model-1.4.3}/trex_model.egg-info/SOURCES.txt +0 -0
- {trex-model-1.4.1 → trex-model-1.4.3}/trex_model.egg-info/dependency_links.txt +0 -0
- {trex-model-1.4.1 → trex-model-1.4.3}/trex_model.egg-info/requires.txt +0 -0
- {trex-model-1.4.1 → trex-model-1.4.3}/trex_model.egg-info/top_level.txt +0 -0
- {trex-model-1.4.1 → trex-model-1.4.3}/trexmodel/__init__.py +0 -0
- {trex-model-1.4.1 → trex-model-1.4.3}/trexmodel/conf.py +0 -0
- {trex-model-1.4.1 → trex-model-1.4.3}/trexmodel/models/__init__.py +0 -0
- {trex-model-1.4.1 → trex-model-1.4.3}/trexmodel/models/datastore/__init__.py +0 -0
- {trex-model-1.4.1 → trex-model-1.4.3}/trexmodel/models/datastore/admin_models.py +0 -0
- {trex-model-1.4.1 → trex-model-1.4.3}/trexmodel/models/datastore/analytic_models.py +0 -0
- {trex-model-1.4.1 → trex-model-1.4.3}/trexmodel/models/datastore/app_models.py +0 -0
- {trex-model-1.4.1 → trex-model-1.4.3}/trexmodel/models/datastore/coporate_models.py +0 -0
- {trex-model-1.4.1 → trex-model-1.4.3}/trexmodel/models/datastore/customer_model_helpers.py +0 -0
- {trex-model-1.4.1 → trex-model-1.4.3}/trexmodel/models/datastore/fb_subsriber_models.py +0 -0
- {trex-model-1.4.1 → trex-model-1.4.3}/trexmodel/models/datastore/import_models.py +0 -0
- {trex-model-1.4.1 → trex-model-1.4.3}/trexmodel/models/datastore/inventory_model.py +0 -0
- {trex-model-1.4.1 → trex-model-1.4.3}/trexmodel/models/datastore/loyalty_models.py +0 -0
- {trex-model-1.4.1 → trex-model-1.4.3}/trexmodel/models/datastore/lucky_draw_models.py +0 -0
- {trex-model-1.4.1 → trex-model-1.4.3}/trexmodel/models/datastore/marketing_models.py +0 -0
- {trex-model-1.4.1 → trex-model-1.4.3}/trexmodel/models/datastore/membership_models.py +0 -0
- {trex-model-1.4.1 → trex-model-1.4.3}/trexmodel/models/datastore/message_model_helper.py +0 -0
- {trex-model-1.4.1 → trex-model-1.4.3}/trexmodel/models/datastore/message_models.py +0 -0
- {trex-model-1.4.1 → trex-model-1.4.3}/trexmodel/models/datastore/model_decorators.py +0 -0
- {trex-model-1.4.1 → trex-model-1.4.3}/trexmodel/models/datastore/ndb_models.py +0 -0
- {trex-model-1.4.1 → trex-model-1.4.3}/trexmodel/models/datastore/pos_models.py +0 -0
- {trex-model-1.4.1 → trex-model-1.4.3}/trexmodel/models/datastore/prepaid_models.py +0 -0
- {trex-model-1.4.1 → trex-model-1.4.3}/trexmodel/models/datastore/product_models.py +0 -0
- {trex-model-1.4.1 → trex-model-1.4.3}/trexmodel/models/datastore/program_models.py +0 -0
- {trex-model-1.4.1 → trex-model-1.4.3}/trexmodel/models/datastore/rating_models.py +0 -0
- {trex-model-1.4.1 → trex-model-1.4.3}/trexmodel/models/datastore/recruit_models.py +0 -0
- {trex-model-1.4.1 → trex-model-1.4.3}/trexmodel/models/datastore/redeem_models.py +0 -0
- {trex-model-1.4.1 → trex-model-1.4.3}/trexmodel/models/datastore/redemption_catalogue_models.py +0 -0
- {trex-model-1.4.1 → trex-model-1.4.3}/trexmodel/models/datastore/referral_program_model.py +0 -0
- {trex-model-1.4.1 → trex-model-1.4.3}/trexmodel/models/datastore/reward_model_helpers.py +0 -0
- {trex-model-1.4.1 → trex-model-1.4.3}/trexmodel/models/datastore/reward_models.py +0 -0
- {trex-model-1.4.1 → trex-model-1.4.3}/trexmodel/models/datastore/spending_base_program_model.py +0 -0
- {trex-model-1.4.1 → trex-model-1.4.3}/trexmodel/models/datastore/system_models.py +0 -0
- {trex-model-1.4.1 → trex-model-1.4.3}/trexmodel/models/datastore/task_models.py +0 -0
- {trex-model-1.4.1 → trex-model-1.4.3}/trexmodel/models/datastore/test_models.py +0 -0
- {trex-model-1.4.1 → trex-model-1.4.3}/trexmodel/models/datastore/transaction_models.py +0 -0
- {trex-model-1.4.1 → trex-model-1.4.3}/trexmodel/models/datastore/user_models.py +0 -0
- {trex-model-1.4.1 → trex-model-1.4.3}/trexmodel/models/datastore/voucher_models.py +0 -0
- {trex-model-1.4.1 → trex-model-1.4.3}/trexmodel/models/model_decorator.py +0 -0
- {trex-model-1.4.1 → trex-model-1.4.3}/trexmodel/models/prepaid_helpers.py +0 -0
- {trex-model-1.4.1 → trex-model-1.4.3}/trexmodel/pos_conf.py +0 -0
- {trex-model-1.4.1 → trex-model-1.4.3}/trexmodel/program_conf.py +0 -0
- {trex-model-1.4.1 → trex-model-1.4.3}/trexmodel/utils/__init__.py +0 -0
- {trex-model-1.4.1 → trex-model-1.4.3}/trexmodel/utils/gcloud/__init__.py +0 -0
- {trex-model-1.4.1 → trex-model-1.4.3}/trexmodel/utils/gcloud/datastore_util.py +0 -0
- {trex-model-1.4.1 → trex-model-1.4.3}/trexmodel/utils/model/__init__.py +0 -0
- {trex-model-1.4.1 → trex-model-1.4.3}/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):
|
|
@@ -1219,14 +1219,15 @@ class MerchantAcct(MerchantMin):
|
|
|
1219
1219
|
|
|
1220
1220
|
for program in published_program_configuration.get('programs'):
|
|
1221
1221
|
if program.get('giveaway_method') == program_conf.PROGRAM_REWARD_GIVEAWAY_METHOD_SYSTEM:
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1222
|
+
if program.get('program_settings').get('giveaway_system_settings') and program.get('program_settings').get('giveaway_system_settings').get('giveaway_system_condition'):
|
|
1223
|
+
logger.debug('giveaway system condition=%s', program.get('program_settings').get('giveaway_system_settings').get('giveaway_system_condition'))
|
|
1224
|
+
if program.get('program_settings').get('giveaway_system_settings').get('giveaway_system_condition') == program_conf.GIVEAWAY_SYSTEM_CONDITION_DATA_IMPORT:
|
|
1225
|
+
logger.debug('giveaway reward_format=%s', program.get('reward_format'))
|
|
1226
|
+
if program.get('reward_format') == target_reward_format:
|
|
1227
|
+
data_import_giveaway_programs.append({
|
|
1228
|
+
'program_key' : program.get('program_key'),
|
|
1229
|
+
'label' : program.get('label'),
|
|
1230
|
+
})
|
|
1230
1231
|
|
|
1231
1232
|
return data_import_giveaway_programs
|
|
1232
1233
|
|
|
@@ -1892,4 +1893,76 @@ class BannerFile(BaseNModel, DictModel):
|
|
|
1892
1893
|
old_logo_blob = bucket.get_blob(banner_file.banner_file_storage_filename)
|
|
1893
1894
|
if old_logo_blob:
|
|
1894
1895
|
old_logo_blob.delete()
|
|
1895
|
-
banner_file.delete()
|
|
1896
|
+
banner_file.delete()
|
|
1897
|
+
|
|
1898
|
+
class MerchantNewsFile(BaseNModel, DictModel):
|
|
1899
|
+
'''
|
|
1900
|
+
Merchant Account as ancestor
|
|
1901
|
+
'''
|
|
1902
|
+
label = ndb.StringProperty(required=False)
|
|
1903
|
+
desc = ndb.StringProperty(required=False)
|
|
1904
|
+
news_text = ndb.StringProperty(required=False)
|
|
1905
|
+
|
|
1906
|
+
news_file_type = ndb.StringProperty(required=True)
|
|
1907
|
+
news_file_public_url = ndb.StringProperty(required=True)
|
|
1908
|
+
news_file_storage_filename = ndb.StringProperty(required=True)
|
|
1909
|
+
start_date = ndb.DateProperty(required=True)
|
|
1910
|
+
end_date = ndb.DateProperty(required=True)
|
|
1911
|
+
|
|
1912
|
+
|
|
1913
|
+
dict_properties = ['news_file_public_url', 'news_file_storage_filename', 'news_file_type', 'label', 'desc', 'news_text', 'start_date', 'end_date']
|
|
1914
|
+
|
|
1915
|
+
@staticmethod
|
|
1916
|
+
def list_by_merchant_acct(merchant_acct):
|
|
1917
|
+
result = MerchantNewsFile.query(ancestor=merchant_acct.create_ndb_key()).fetch(limit=conf.MAX_FETCH_RECORD)
|
|
1918
|
+
return result
|
|
1919
|
+
|
|
1920
|
+
@staticmethod
|
|
1921
|
+
def create(merchant_acct, label=None, desc=None, news_text=None):
|
|
1922
|
+
news_file = MerchantNewsFile(
|
|
1923
|
+
parent = merchant_acct.create_ndb_key(),
|
|
1924
|
+
label = label,
|
|
1925
|
+
desc = desc,
|
|
1926
|
+
news_text = news_text,
|
|
1927
|
+
)
|
|
1928
|
+
|
|
1929
|
+
news_file.put()
|
|
1930
|
+
|
|
1931
|
+
@staticmethod
|
|
1932
|
+
def upload_file(merchant_news, uploading_file, merchant_acct, bucket, news_file_type=None):
|
|
1933
|
+
file_prefix = random_string(8)
|
|
1934
|
+
news_file_storage_filename = 'merchant/'+merchant_acct.key_in_str+'/news/'+file_prefix+'-'+uploading_file.filename
|
|
1935
|
+
blob = bucket.blob(news_file_storage_filename)
|
|
1936
|
+
|
|
1937
|
+
logger.debug('news_file_storage_filename=%s', news_file_storage_filename)
|
|
1938
|
+
|
|
1939
|
+
blob.upload_from_string(
|
|
1940
|
+
uploading_file.read(),
|
|
1941
|
+
content_type=uploading_file.content_type
|
|
1942
|
+
)
|
|
1943
|
+
|
|
1944
|
+
uploaded_url = blob.public_url
|
|
1945
|
+
|
|
1946
|
+
logger.debug('uploaded_url=%s', uploaded_url)
|
|
1947
|
+
logger.debug('news_file_type=%s', news_file_type)
|
|
1948
|
+
|
|
1949
|
+
if is_not_empty(merchant_news.news_file_storage_filename):
|
|
1950
|
+
old_logo_blob = bucket.get_blob(merchant_news.news_file_storage_filename)
|
|
1951
|
+
if old_logo_blob:
|
|
1952
|
+
old_logo_blob.delete()
|
|
1953
|
+
|
|
1954
|
+
|
|
1955
|
+
merchant_news.news_file_public_url = uploaded_url
|
|
1956
|
+
merchant_news.news_file_storage_filename = news_file_storage_filename
|
|
1957
|
+
merchant_news.news_file_type = news_file_type
|
|
1958
|
+
|
|
1959
|
+
|
|
1960
|
+
merchant_news.put()
|
|
1961
|
+
|
|
1962
|
+
@staticmethod
|
|
1963
|
+
def remove_file(news_file, bucket):
|
|
1964
|
+
|
|
1965
|
+
old_logo_blob = bucket.get_blob(news_file.news_file_storage_filename)
|
|
1966
|
+
if old_logo_blob:
|
|
1967
|
+
old_logo_blob.delete()
|
|
1968
|
+
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.1 → trex-model-1.4.3}/trexmodel/models/datastore/redemption_catalogue_models.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{trex-model-1.4.1 → trex-model-1.4.3}/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
|