trex-model 1.5.11__tar.gz → 1.5.13__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.5.11 → trex-model-1.5.13}/PKG-INFO +1 -1
- {trex-model-1.5.11 → trex-model-1.5.13}/setup.py +1 -1
- {trex-model-1.5.11 → trex-model-1.5.13}/trex_model.egg-info/PKG-INFO +1 -1
- {trex-model-1.5.11 → trex-model-1.5.13}/trexmodel/conf.py +2 -0
- {trex-model-1.5.11 → trex-model-1.5.13}/trexmodel/models/datastore/helper/reward_transaction_helper.py +36 -2
- {trex-model-1.5.11 → trex-model-1.5.13}/trexmodel/models/datastore/message_model_helper.py +27 -2
- {trex-model-1.5.11 → trex-model-1.5.13}/trexmodel/models/datastore/message_models.py +1 -1
- {trex-model-1.5.11 → trex-model-1.5.13}/LICENSE +0 -0
- {trex-model-1.5.11 → trex-model-1.5.13}/MANIFEST.in +0 -0
- {trex-model-1.5.11 → trex-model-1.5.13}/README.md +0 -0
- {trex-model-1.5.11 → trex-model-1.5.13}/setup.cfg +0 -0
- {trex-model-1.5.11 → trex-model-1.5.13}/trex_model.egg-info/SOURCES.txt +0 -0
- {trex-model-1.5.11 → trex-model-1.5.13}/trex_model.egg-info/dependency_links.txt +0 -0
- {trex-model-1.5.11 → trex-model-1.5.13}/trex_model.egg-info/requires.txt +0 -0
- {trex-model-1.5.11 → trex-model-1.5.13}/trex_model.egg-info/top_level.txt +0 -0
- {trex-model-1.5.11 → trex-model-1.5.13}/trexmodel/__init__.py +0 -0
- {trex-model-1.5.11 → trex-model-1.5.13}/trexmodel/models/__init__.py +0 -0
- {trex-model-1.5.11 → trex-model-1.5.13}/trexmodel/models/datastore/__init__.py +0 -0
- {trex-model-1.5.11 → trex-model-1.5.13}/trexmodel/models/datastore/admin_models.py +0 -0
- {trex-model-1.5.11 → trex-model-1.5.13}/trexmodel/models/datastore/analytic_models.py +0 -0
- {trex-model-1.5.11 → trex-model-1.5.13}/trexmodel/models/datastore/app_models.py +0 -0
- {trex-model-1.5.11 → trex-model-1.5.13}/trexmodel/models/datastore/coporate_models.py +0 -0
- {trex-model-1.5.11 → trex-model-1.5.13}/trexmodel/models/datastore/customer_model_helpers.py +0 -0
- {trex-model-1.5.11 → trex-model-1.5.13}/trexmodel/models/datastore/customer_models.py +0 -0
- {trex-model-1.5.11 → trex-model-1.5.13}/trexmodel/models/datastore/fb_subsriber_models.py +0 -0
- {trex-model-1.5.11 → trex-model-1.5.13}/trexmodel/models/datastore/helper/__init__.py +0 -0
- {trex-model-1.5.11 → trex-model-1.5.13}/trexmodel/models/datastore/helper/reward_model_helpers.py +0 -0
- {trex-model-1.5.11 → trex-model-1.5.13}/trexmodel/models/datastore/import_models.py +0 -0
- {trex-model-1.5.11 → trex-model-1.5.13}/trexmodel/models/datastore/inventory_model.py +0 -0
- {trex-model-1.5.11 → trex-model-1.5.13}/trexmodel/models/datastore/loyalty_models.py +0 -0
- {trex-model-1.5.11 → trex-model-1.5.13}/trexmodel/models/datastore/lucky_draw_models.py +0 -0
- {trex-model-1.5.11 → trex-model-1.5.13}/trexmodel/models/datastore/marketing_models.py +0 -0
- {trex-model-1.5.11 → trex-model-1.5.13}/trexmodel/models/datastore/membership_models.py +0 -0
- {trex-model-1.5.11 → trex-model-1.5.13}/trexmodel/models/datastore/merchant_models.py +0 -0
- {trex-model-1.5.11 → trex-model-1.5.13}/trexmodel/models/datastore/model_decorators.py +0 -0
- {trex-model-1.5.11 → trex-model-1.5.13}/trexmodel/models/datastore/ndb_models.py +0 -0
- {trex-model-1.5.11 → trex-model-1.5.13}/trexmodel/models/datastore/pos_models.py +0 -0
- {trex-model-1.5.11 → trex-model-1.5.13}/trexmodel/models/datastore/prepaid_models.py +0 -0
- {trex-model-1.5.11 → trex-model-1.5.13}/trexmodel/models/datastore/product_models.py +0 -0
- {trex-model-1.5.11 → trex-model-1.5.13}/trexmodel/models/datastore/program_models.py +0 -0
- {trex-model-1.5.11 → trex-model-1.5.13}/trexmodel/models/datastore/rating_models.py +0 -0
- {trex-model-1.5.11 → trex-model-1.5.13}/trexmodel/models/datastore/recruit_models.py +0 -0
- {trex-model-1.5.11 → trex-model-1.5.13}/trexmodel/models/datastore/redeem_models.py +0 -0
- {trex-model-1.5.11 → trex-model-1.5.13}/trexmodel/models/datastore/redemption_catalogue_models.py +0 -0
- {trex-model-1.5.11 → trex-model-1.5.13}/trexmodel/models/datastore/referral_program_model.py +0 -0
- {trex-model-1.5.11 → trex-model-1.5.13}/trexmodel/models/datastore/reward_models.py +0 -0
- {trex-model-1.5.11 → trex-model-1.5.13}/trexmodel/models/datastore/spending_base_program_model.py +0 -0
- {trex-model-1.5.11 → trex-model-1.5.13}/trexmodel/models/datastore/system_models.py +0 -0
- {trex-model-1.5.11 → trex-model-1.5.13}/trexmodel/models/datastore/task_models.py +0 -0
- {trex-model-1.5.11 → trex-model-1.5.13}/trexmodel/models/datastore/test_models.py +0 -0
- {trex-model-1.5.11 → trex-model-1.5.13}/trexmodel/models/datastore/transaction_models.py +0 -0
- {trex-model-1.5.11 → trex-model-1.5.13}/trexmodel/models/datastore/user_models.py +0 -0
- {trex-model-1.5.11 → trex-model-1.5.13}/trexmodel/models/datastore/voucher_models.py +0 -0
- {trex-model-1.5.11 → trex-model-1.5.13}/trexmodel/models/merchant_helpers.py +0 -0
- {trex-model-1.5.11 → trex-model-1.5.13}/trexmodel/models/model_decorator.py +0 -0
- {trex-model-1.5.11 → trex-model-1.5.13}/trexmodel/models/prepaid_helpers.py +0 -0
- {trex-model-1.5.11 → trex-model-1.5.13}/trexmodel/pos_conf.py +0 -0
- {trex-model-1.5.11 → trex-model-1.5.13}/trexmodel/program_conf.py +0 -0
- {trex-model-1.5.11 → trex-model-1.5.13}/trexmodel/utils/__init__.py +0 -0
- {trex-model-1.5.11 → trex-model-1.5.13}/trexmodel/utils/gcloud/__init__.py +0 -0
- {trex-model-1.5.11 → trex-model-1.5.13}/trexmodel/utils/gcloud/datastore_util.py +0 -0
- {trex-model-1.5.11 → trex-model-1.5.13}/trexmodel/utils/model/__init__.py +0 -0
- {trex-model-1.5.11 → trex-model-1.5.13}/trexmodel/utils/model/model_util.py +0 -0
|
@@ -37,6 +37,7 @@ MESSAGE_CATEGORY_REWARD = 'reward'
|
|
|
37
37
|
MESSAGE_CATEGORY_REFERRAL = 'referral'
|
|
38
38
|
MESSAGE_CATEGORY_BIRTHDAY = 'birthday'
|
|
39
39
|
MESSAGE_CATEGORY_REDEEM = 'redeem'
|
|
40
|
+
MESSAGE_CATEGORY_PAYMENT = 'payment'
|
|
40
41
|
MESSAGE_CATEGORY_REDEMPTION_CATALOGUE = 'redemption_catalogue'
|
|
41
42
|
|
|
42
43
|
MESSAGE_CATEGORIES = (
|
|
@@ -48,6 +49,7 @@ MESSAGE_CATEGORIES = (
|
|
|
48
49
|
MESSAGE_CATEGORY_REWARD,
|
|
49
50
|
MESSAGE_CATEGORY_REDEEM,
|
|
50
51
|
MESSAGE_CATEGORY_REDEMPTION_CATALOGUE,
|
|
52
|
+
MESSAGE_CATEGORY_PAYMENT,
|
|
51
53
|
)
|
|
52
54
|
|
|
53
55
|
MESSAGE_STATUS_NEW = 'n'
|
|
@@ -37,7 +37,7 @@ from trexlib.utils.string_util import is_not_empty
|
|
|
37
37
|
from trexlib.utils.log_util import get_tracelog
|
|
38
38
|
from trexmodel.models.datastore.lucky_draw_models import LuckyDrawTicket
|
|
39
39
|
from trexmodel.models.datastore.message_model_helper import create_transaction_message,\
|
|
40
|
-
create_redemption_message
|
|
40
|
+
create_redemption_message, create_payment_message
|
|
41
41
|
from trexmodel.models.datastore.helper.reward_model_helpers import list_merchant_birthday_program_configuration
|
|
42
42
|
from dateutil.relativedelta import relativedelta
|
|
43
43
|
|
|
@@ -668,7 +668,7 @@ def check_giveaway_reward_for_membership_purchase_transaction(customer_acct, tra
|
|
|
668
668
|
|
|
669
669
|
def redeem_reward_transaction(customer, redeem_outlet=None, reward_format=None, reward_amount=.0, invoice_id=None, remarks=None,
|
|
670
670
|
redeemed_by=None, redeemed_datetime=None, transaction_id=None, prepaid_redeem_code=None,
|
|
671
|
-
redeemed_voucher_keys_list=None
|
|
671
|
+
redeemed_voucher_keys_list=None,
|
|
672
672
|
):
|
|
673
673
|
logger.debug('---redeem_reward_transaction---')
|
|
674
674
|
|
|
@@ -701,6 +701,40 @@ def redeem_reward_transaction(customer, redeem_outlet=None, reward_format=None,
|
|
|
701
701
|
else:
|
|
702
702
|
raise Exception("Invalid reward format")
|
|
703
703
|
|
|
704
|
+
def prepaid_payment_transaction(customer, redeem_outlet=None, reward_format=None, reward_amount=.0, invoice_id=None, remarks=None,
|
|
705
|
+
redeemed_by=None, redeemed_datetime=None, transaction_id=None, prepaid_redeem_code=None,
|
|
706
|
+
|
|
707
|
+
):
|
|
708
|
+
logger.debug('---prepaid_payment_transaction---')
|
|
709
|
+
|
|
710
|
+
if reward_format in program_conf.REWARD_FORMAT_SET:
|
|
711
|
+
|
|
712
|
+
@model_transactional(desc='redeem_reward_transaction')
|
|
713
|
+
def __start_transaction_for_customer_transaction():
|
|
714
|
+
|
|
715
|
+
logger.debug('reward_format=%s', reward_format)
|
|
716
|
+
|
|
717
|
+
customer_redemption = CustomerRedemption.create(customer, reward_format,
|
|
718
|
+
redeemed_outlet = redeem_outlet,
|
|
719
|
+
redeemed_amount = reward_amount,
|
|
720
|
+
prepaid_redeem_code = prepaid_redeem_code,
|
|
721
|
+
invoice_id = invoice_id,
|
|
722
|
+
transaction_id = transaction_id,
|
|
723
|
+
remarks = remarks,
|
|
724
|
+
redeemed_by = redeemed_by,
|
|
725
|
+
redeemed_datetime = redeemed_datetime,
|
|
726
|
+
)
|
|
727
|
+
|
|
728
|
+
if customer_redemption:
|
|
729
|
+
create_payment_message(customer_redemption)
|
|
730
|
+
create_merchant_customer_redemption_upstream_for_merchant(customer_redemption, streamed_datetime=redeemed_datetime)
|
|
731
|
+
|
|
732
|
+
return customer_redemption
|
|
733
|
+
|
|
734
|
+
return __start_transaction_for_customer_transaction()
|
|
735
|
+
else:
|
|
736
|
+
raise Exception("Invalid reward format")
|
|
737
|
+
|
|
704
738
|
def update_customer_reward_summary(customer):
|
|
705
739
|
entitled_point_details_list = CustomerPointReward.list_by_customer(customer)
|
|
706
740
|
entitled_stamp_details_list = CustomerStampReward.list_by_customer(customer)
|
|
@@ -5,8 +5,9 @@ Created on 9 Nov 2023
|
|
|
5
5
|
'''
|
|
6
6
|
from trexmodel.program_conf import REWARD_FORMAT_MAP, REWARD_FORMAT_PREPAID
|
|
7
7
|
from trexmodel.models.datastore.message_models import Message
|
|
8
|
-
from
|
|
9
|
-
MESSAGE_CATEGORY_REDEEM, MESSAGE_CATEGORY_REDEMPTION_CATALOGUE
|
|
8
|
+
from trexconf.conf import MESSAGE_CATEGORY_REWARD, MESSAGE_STATUS_NEW,\
|
|
9
|
+
MESSAGE_CATEGORY_REDEEM, MESSAGE_CATEGORY_REDEMPTION_CATALOGUE,\
|
|
10
|
+
MESSAGE_CATEGORY_PAYMENT
|
|
10
11
|
from trexconf import program_conf
|
|
11
12
|
from babel.numbers import format_currency
|
|
12
13
|
import logging
|
|
@@ -189,6 +190,30 @@ def create_redemption_message(customer_redemption):
|
|
|
189
190
|
|
|
190
191
|
return message
|
|
191
192
|
|
|
193
|
+
def create_payment_message(customer_redemption):
|
|
194
|
+
user_acct = customer_redemption.redeemed_user_acct
|
|
195
|
+
merchant_acct = customer_redemption.redeemed_merchant_acct
|
|
196
|
+
source_key = customer_redemption.key_in_str
|
|
197
|
+
message = Message.get_by_source_key(source_key)
|
|
198
|
+
|
|
199
|
+
if message is None:
|
|
200
|
+
message = Message(
|
|
201
|
+
parent = user_acct.create_ndb_key(),
|
|
202
|
+
source_key = source_key,
|
|
203
|
+
message_to = user_acct.create_ndb_key(),
|
|
204
|
+
title = 'Payment',
|
|
205
|
+
message_category = MESSAGE_CATEGORY_PAYMENT,
|
|
206
|
+
message_content = __create_message_from_redeem_transaction(merchant_acct, customer_redemption),
|
|
207
|
+
message_data = __create_message_data_from_redemption(customer_redemption),
|
|
208
|
+
status = MESSAGE_STATUS_NEW,
|
|
209
|
+
message_from = merchant_acct.brand_name,
|
|
210
|
+
)
|
|
211
|
+
message.put()
|
|
212
|
+
#user_acct.new_message_count+=1
|
|
213
|
+
#user_acct.put()
|
|
214
|
+
|
|
215
|
+
return message
|
|
216
|
+
|
|
192
217
|
|
|
193
218
|
def create_redeem_catalogue_item_message(customer, entitled_vouchers_summary, redemption_catalogue_transaction):
|
|
194
219
|
user_acct = customer.registered_user_acct
|
|
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.5.11 → trex-model-1.5.13}/trexmodel/models/datastore/customer_model_helpers.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{trex-model-1.5.11 → trex-model-1.5.13}/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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{trex-model-1.5.11 → trex-model-1.5.13}/trexmodel/models/datastore/redemption_catalogue_models.py
RENAMED
|
File without changes
|
{trex-model-1.5.11 → trex-model-1.5.13}/trexmodel/models/datastore/referral_program_model.py
RENAMED
|
File without changes
|
|
File without changes
|
{trex-model-1.5.11 → trex-model-1.5.13}/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
|