trex-model 1.6.14__tar.gz → 1.6.15__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.6.14 → trex_model-1.6.15}/PKG-INFO +1 -1
- {trex_model-1.6.14 → trex_model-1.6.15}/setup.py +1 -1
- {trex_model-1.6.14 → trex_model-1.6.15}/trex_model.egg-info/PKG-INFO +1 -1
- {trex_model-1.6.14 → trex_model-1.6.15}/trexmodel/models/merchant_helpers.py +85 -1
- {trex_model-1.6.14 → trex_model-1.6.15}/LICENSE +0 -0
- {trex_model-1.6.14 → trex_model-1.6.15}/MANIFEST.in +0 -0
- {trex_model-1.6.14 → trex_model-1.6.15}/README.md +0 -0
- {trex_model-1.6.14 → trex_model-1.6.15}/setup.cfg +0 -0
- {trex_model-1.6.14 → trex_model-1.6.15}/trex_model.egg-info/SOURCES.txt +0 -0
- {trex_model-1.6.14 → trex_model-1.6.15}/trex_model.egg-info/dependency_links.txt +0 -0
- {trex_model-1.6.14 → trex_model-1.6.15}/trex_model.egg-info/requires.txt +0 -0
- {trex_model-1.6.14 → trex_model-1.6.15}/trex_model.egg-info/top_level.txt +0 -0
- {trex_model-1.6.14 → trex_model-1.6.15}/trexmodel/__init__.py +0 -0
- {trex_model-1.6.14 → trex_model-1.6.15}/trexmodel/conf.py +0 -0
- {trex_model-1.6.14 → trex_model-1.6.15}/trexmodel/models/__init__.py +0 -0
- {trex_model-1.6.14 → trex_model-1.6.15}/trexmodel/models/datastore/__init__.py +0 -0
- {trex_model-1.6.14 → trex_model-1.6.15}/trexmodel/models/datastore/admin_models.py +0 -0
- {trex_model-1.6.14 → trex_model-1.6.15}/trexmodel/models/datastore/analytic_models.py +0 -0
- {trex_model-1.6.14 → trex_model-1.6.15}/trexmodel/models/datastore/app_models.py +0 -0
- {trex_model-1.6.14 → trex_model-1.6.15}/trexmodel/models/datastore/coporate_models.py +0 -0
- {trex_model-1.6.14 → trex_model-1.6.15}/trexmodel/models/datastore/customer_model_helpers.py +0 -0
- {trex_model-1.6.14 → trex_model-1.6.15}/trexmodel/models/datastore/customer_models.py +0 -0
- {trex_model-1.6.14 → trex_model-1.6.15}/trexmodel/models/datastore/fb_subsriber_models.py +0 -0
- {trex_model-1.6.14 → trex_model-1.6.15}/trexmodel/models/datastore/helper/__init__.py +0 -0
- {trex_model-1.6.14 → trex_model-1.6.15}/trexmodel/models/datastore/helper/reward_model_helpers.py +0 -0
- {trex_model-1.6.14 → trex_model-1.6.15}/trexmodel/models/datastore/helper/reward_transaction_helper.py +0 -0
- {trex_model-1.6.14 → trex_model-1.6.15}/trexmodel/models/datastore/helper/sales_transaction_helpers.py +0 -0
- {trex_model-1.6.14 → trex_model-1.6.15}/trexmodel/models/datastore/import_models.py +0 -0
- {trex_model-1.6.14 → trex_model-1.6.15}/trexmodel/models/datastore/inventory_model.py +0 -0
- {trex_model-1.6.14 → trex_model-1.6.15}/trexmodel/models/datastore/loyalty_models.py +0 -0
- {trex_model-1.6.14 → trex_model-1.6.15}/trexmodel/models/datastore/lucky_draw_models.py +0 -0
- {trex_model-1.6.14 → trex_model-1.6.15}/trexmodel/models/datastore/marketing_models.py +0 -0
- {trex_model-1.6.14 → trex_model-1.6.15}/trexmodel/models/datastore/membership_models.py +0 -0
- {trex_model-1.6.14 → trex_model-1.6.15}/trexmodel/models/datastore/merchant_models.py +0 -0
- {trex_model-1.6.14 → trex_model-1.6.15}/trexmodel/models/datastore/merchant_promotion_models.py +0 -0
- {trex_model-1.6.14 → trex_model-1.6.15}/trexmodel/models/datastore/message_model_helper.py +0 -0
- {trex_model-1.6.14 → trex_model-1.6.15}/trexmodel/models/datastore/message_models.py +0 -0
- {trex_model-1.6.14 → trex_model-1.6.15}/trexmodel/models/datastore/model_decorators.py +0 -0
- {trex_model-1.6.14 → trex_model-1.6.15}/trexmodel/models/datastore/ndb_models.py +0 -0
- {trex_model-1.6.14 → trex_model-1.6.15}/trexmodel/models/datastore/partnership_models.py +0 -0
- {trex_model-1.6.14 → trex_model-1.6.15}/trexmodel/models/datastore/pos_models.py +0 -0
- {trex_model-1.6.14 → trex_model-1.6.15}/trexmodel/models/datastore/prepaid_models.py +0 -0
- {trex_model-1.6.14 → trex_model-1.6.15}/trexmodel/models/datastore/product_models.py +0 -0
- {trex_model-1.6.14 → trex_model-1.6.15}/trexmodel/models/datastore/program_models.py +0 -0
- {trex_model-1.6.14 → trex_model-1.6.15}/trexmodel/models/datastore/rating_models.py +0 -0
- {trex_model-1.6.14 → trex_model-1.6.15}/trexmodel/models/datastore/recruit_models.py +0 -0
- {trex_model-1.6.14 → trex_model-1.6.15}/trexmodel/models/datastore/redeem_models.py +0 -0
- {trex_model-1.6.14 → trex_model-1.6.15}/trexmodel/models/datastore/redemption_catalogue_models.py +0 -0
- {trex_model-1.6.14 → trex_model-1.6.15}/trexmodel/models/datastore/referral_program_model.py +0 -0
- {trex_model-1.6.14 → trex_model-1.6.15}/trexmodel/models/datastore/reward_models.py +0 -0
- {trex_model-1.6.14 → trex_model-1.6.15}/trexmodel/models/datastore/spending_base_program_model.py +0 -0
- {trex_model-1.6.14 → trex_model-1.6.15}/trexmodel/models/datastore/support_models.py +0 -0
- {trex_model-1.6.14 → trex_model-1.6.15}/trexmodel/models/datastore/system_models.py +0 -0
- {trex_model-1.6.14 → trex_model-1.6.15}/trexmodel/models/datastore/task_models.py +0 -0
- {trex_model-1.6.14 → trex_model-1.6.15}/trexmodel/models/datastore/test_models.py +0 -0
- {trex_model-1.6.14 → trex_model-1.6.15}/trexmodel/models/datastore/transaction_models.py +0 -0
- {trex_model-1.6.14 → trex_model-1.6.15}/trexmodel/models/datastore/user_models.py +0 -0
- {trex_model-1.6.14 → trex_model-1.6.15}/trexmodel/models/datastore/voucher_models.py +0 -0
- {trex_model-1.6.14 → trex_model-1.6.15}/trexmodel/models/model_decorator.py +0 -0
- {trex_model-1.6.14 → trex_model-1.6.15}/trexmodel/models/prepaid_helpers.py +0 -0
- {trex_model-1.6.14 → trex_model-1.6.15}/trexmodel/pos_conf.py +0 -0
- {trex_model-1.6.14 → trex_model-1.6.15}/trexmodel/program_conf.py +0 -0
- {trex_model-1.6.14 → trex_model-1.6.15}/trexmodel/utils/__init__.py +0 -0
- {trex_model-1.6.14 → trex_model-1.6.15}/trexmodel/utils/gcloud/__init__.py +0 -0
- {trex_model-1.6.14 → trex_model-1.6.15}/trexmodel/utils/gcloud/datastore_util.py +0 -0
- {trex_model-1.6.14 → trex_model-1.6.15}/trexmodel/utils/model/__init__.py +0 -0
- {trex_model-1.6.14 → trex_model-1.6.15}/trexmodel/utils/model/model_util.py +0 -0
|
@@ -7,6 +7,9 @@ from trexconf import conf
|
|
|
7
7
|
from datetime import datetime
|
|
8
8
|
import logging
|
|
9
9
|
from trexlib.utils.crypto_util import aes_encrypt_json
|
|
10
|
+
from trexmodel.models.datastore.customer_models import CustomerTierMembership,\
|
|
11
|
+
CustomerMembership
|
|
12
|
+
from trexmodel.models.datastore.membership_models import MerchantMembership
|
|
10
13
|
|
|
11
14
|
logger = logging.getLogger('helper')
|
|
12
15
|
|
|
@@ -169,6 +172,7 @@ def construct_merchant_acct_info(merchant_acct, referrer_code=None, read_minimum
|
|
|
169
172
|
'refer_a_friend_message' : refer_a_friend_message,
|
|
170
173
|
'refer_a_friend_deep_link' : refer_a_friend_deep_link,
|
|
171
174
|
'referrer_merchant_and_friend_code' : referrer_merchant_and_friend_code,
|
|
175
|
+
'referrer_code' : referrer_code,
|
|
172
176
|
}
|
|
173
177
|
|
|
174
178
|
|
|
@@ -368,4 +372,84 @@ def convert_points_between_merchants(
|
|
|
368
372
|
# Convert monetary value to Merchant B points
|
|
369
373
|
required_points_b = monetary_value / merchant_b_point_value
|
|
370
374
|
|
|
371
|
-
return round(required_points_b, 2)
|
|
375
|
+
return round(required_points_b, 2)
|
|
376
|
+
|
|
377
|
+
def return_customer_details(customer):
|
|
378
|
+
customer_details_dict = customer.to_dict(
|
|
379
|
+
date_format="%d-%m-%Y",
|
|
380
|
+
datetime_format="%d-%m-%Y %H:%M:%S",
|
|
381
|
+
excluded_dict_properties = [
|
|
382
|
+
'registered_merchant_acct',
|
|
383
|
+
'memberships_list',
|
|
384
|
+
'tier_membership_key',
|
|
385
|
+
'registered_user_acct',
|
|
386
|
+
|
|
387
|
+
],
|
|
388
|
+
)
|
|
389
|
+
customer_details_dict['customer_key'] = customer.key_in_str
|
|
390
|
+
|
|
391
|
+
|
|
392
|
+
customer_basic_memberships_list = _list_customer_basic_memberships(customer)
|
|
393
|
+
if customer_basic_memberships_list:
|
|
394
|
+
customer_details_dict['basic_memberships'] = customer_basic_memberships_list
|
|
395
|
+
|
|
396
|
+
customer_tier_membership = _get_tier_membership(customer)
|
|
397
|
+
if customer_tier_membership:
|
|
398
|
+
customer_details_dict['tier_membership'] = customer_tier_membership
|
|
399
|
+
|
|
400
|
+
if 'entitled_voucher_summary' in customer_details_dict:
|
|
401
|
+
customer_details_dict['voucher_summary'] = customer.entitled_voucher_summary
|
|
402
|
+
del customer_details_dict['entitled_voucher_summary']
|
|
403
|
+
|
|
404
|
+
return customer_details_dict
|
|
405
|
+
|
|
406
|
+
def _list_customer_basic_memberships(customer):
|
|
407
|
+
customer_membership_final_list = []
|
|
408
|
+
|
|
409
|
+
if is_not_empty(customer.memberships_list):
|
|
410
|
+
customer_memberships_list = CustomerMembership.list_all_by_customer(customer)
|
|
411
|
+
if is_not_empty(customer_memberships_list):
|
|
412
|
+
merchant_acct = customer.registered_merchant_acct
|
|
413
|
+
merchant_memberships_list = MerchantMembership.list_by_merchant_acct(merchant_acct)
|
|
414
|
+
|
|
415
|
+
for cm in customer_memberships_list:
|
|
416
|
+
for mm in merchant_memberships_list:
|
|
417
|
+
logger.debug('cm=%s', cm)
|
|
418
|
+
if mm.key_in_str == cm.merchant_membership_key:
|
|
419
|
+
membership_data = {
|
|
420
|
+
'key' : mm.key_in_str,
|
|
421
|
+
'label' : mm.label,
|
|
422
|
+
'card_image' : mm.membership_card_image,
|
|
423
|
+
'desc' : mm.desc if is_not_empty(mm.desc) else '',
|
|
424
|
+
'terms_and_conditions' : mm.terms_and_conditions if is_not_empty(mm.terms_and_conditions) else '',
|
|
425
|
+
'is_tier' : False,
|
|
426
|
+
'entitled_date' : cm.entitled_date.strftime('%d-%m-%Y'),
|
|
427
|
+
'expiry_date' : cm.expiry_date.strftime('%d-%m-%Y'),
|
|
428
|
+
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
if cm.renewed_date is not None:
|
|
432
|
+
membership_data['renewed_date'] = cm.renewed_date.strftime('%d-%m-%Y'),
|
|
433
|
+
|
|
434
|
+
customer_membership_final_list.append(membership_data)
|
|
435
|
+
break
|
|
436
|
+
return customer_membership_final_list
|
|
437
|
+
|
|
438
|
+
def _get_tier_membership(customer):
|
|
439
|
+
|
|
440
|
+
if is_not_empty(customer.tier_membership):
|
|
441
|
+
merchant_tier_membership = customer.tier_membership_entity
|
|
442
|
+
customer_tier_membership = CustomerTierMembership.get_by_customer_and_merchant_tier_membership(customer, merchant_tier_membership)
|
|
443
|
+
|
|
444
|
+
membership_data = {
|
|
445
|
+
'key' : customer_tier_membership.merchant_tier_membership_key,
|
|
446
|
+
'label' : merchant_tier_membership.label,
|
|
447
|
+
'card_image' : merchant_tier_membership.membership_card_image,
|
|
448
|
+
'desc' : merchant_tier_membership.desc if is_not_empty(merchant_tier_membership.desc) else '',
|
|
449
|
+
'terms_and_conditions' : merchant_tier_membership.terms_and_conditions if is_not_empty(merchant_tier_membership.terms_and_conditions) else '',
|
|
450
|
+
'entitled_date' : customer_tier_membership.entitled_date.strftime('%d-%m-%Y'),
|
|
451
|
+
'expiry_date' : customer_tier_membership.expiry_date.strftime('%d-%m-%Y'),
|
|
452
|
+
'is_tier' : True,
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
return membership_data
|
|
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.6.14 → trex_model-1.6.15}/trexmodel/models/datastore/customer_model_helpers.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{trex_model-1.6.14 → trex_model-1.6.15}/trexmodel/models/datastore/helper/reward_model_helpers.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
|
{trex_model-1.6.14 → trex_model-1.6.15}/trexmodel/models/datastore/merchant_promotion_models.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
|
{trex_model-1.6.14 → trex_model-1.6.15}/trexmodel/models/datastore/redemption_catalogue_models.py
RENAMED
|
File without changes
|
{trex_model-1.6.14 → trex_model-1.6.15}/trexmodel/models/datastore/referral_program_model.py
RENAMED
|
File without changes
|
|
File without changes
|
{trex_model-1.6.14 → trex_model-1.6.15}/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
|
|
File without changes
|