trex-model 1.5.11__tar.gz → 1.5.12__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.

Files changed (63) hide show
  1. {trex-model-1.5.11 → trex-model-1.5.12}/PKG-INFO +1 -1
  2. {trex-model-1.5.11 → trex-model-1.5.12}/setup.py +1 -1
  3. {trex-model-1.5.11 → trex-model-1.5.12}/trex_model.egg-info/PKG-INFO +1 -1
  4. {trex-model-1.5.11 → trex-model-1.5.12}/trexmodel/conf.py +2 -0
  5. {trex-model-1.5.11 → trex-model-1.5.12}/trexmodel/models/datastore/helper/reward_transaction_helper.py +36 -2
  6. {trex-model-1.5.11 → trex-model-1.5.12}/trexmodel/models/datastore/message_model_helper.py +26 -1
  7. {trex-model-1.5.11 → trex-model-1.5.12}/trexmodel/models/datastore/message_models.py +1 -1
  8. {trex-model-1.5.11 → trex-model-1.5.12}/LICENSE +0 -0
  9. {trex-model-1.5.11 → trex-model-1.5.12}/MANIFEST.in +0 -0
  10. {trex-model-1.5.11 → trex-model-1.5.12}/README.md +0 -0
  11. {trex-model-1.5.11 → trex-model-1.5.12}/setup.cfg +0 -0
  12. {trex-model-1.5.11 → trex-model-1.5.12}/trex_model.egg-info/SOURCES.txt +0 -0
  13. {trex-model-1.5.11 → trex-model-1.5.12}/trex_model.egg-info/dependency_links.txt +0 -0
  14. {trex-model-1.5.11 → trex-model-1.5.12}/trex_model.egg-info/requires.txt +0 -0
  15. {trex-model-1.5.11 → trex-model-1.5.12}/trex_model.egg-info/top_level.txt +0 -0
  16. {trex-model-1.5.11 → trex-model-1.5.12}/trexmodel/__init__.py +0 -0
  17. {trex-model-1.5.11 → trex-model-1.5.12}/trexmodel/models/__init__.py +0 -0
  18. {trex-model-1.5.11 → trex-model-1.5.12}/trexmodel/models/datastore/__init__.py +0 -0
  19. {trex-model-1.5.11 → trex-model-1.5.12}/trexmodel/models/datastore/admin_models.py +0 -0
  20. {trex-model-1.5.11 → trex-model-1.5.12}/trexmodel/models/datastore/analytic_models.py +0 -0
  21. {trex-model-1.5.11 → trex-model-1.5.12}/trexmodel/models/datastore/app_models.py +0 -0
  22. {trex-model-1.5.11 → trex-model-1.5.12}/trexmodel/models/datastore/coporate_models.py +0 -0
  23. {trex-model-1.5.11 → trex-model-1.5.12}/trexmodel/models/datastore/customer_model_helpers.py +0 -0
  24. {trex-model-1.5.11 → trex-model-1.5.12}/trexmodel/models/datastore/customer_models.py +0 -0
  25. {trex-model-1.5.11 → trex-model-1.5.12}/trexmodel/models/datastore/fb_subsriber_models.py +0 -0
  26. {trex-model-1.5.11 → trex-model-1.5.12}/trexmodel/models/datastore/helper/__init__.py +0 -0
  27. {trex-model-1.5.11 → trex-model-1.5.12}/trexmodel/models/datastore/helper/reward_model_helpers.py +0 -0
  28. {trex-model-1.5.11 → trex-model-1.5.12}/trexmodel/models/datastore/import_models.py +0 -0
  29. {trex-model-1.5.11 → trex-model-1.5.12}/trexmodel/models/datastore/inventory_model.py +0 -0
  30. {trex-model-1.5.11 → trex-model-1.5.12}/trexmodel/models/datastore/loyalty_models.py +0 -0
  31. {trex-model-1.5.11 → trex-model-1.5.12}/trexmodel/models/datastore/lucky_draw_models.py +0 -0
  32. {trex-model-1.5.11 → trex-model-1.5.12}/trexmodel/models/datastore/marketing_models.py +0 -0
  33. {trex-model-1.5.11 → trex-model-1.5.12}/trexmodel/models/datastore/membership_models.py +0 -0
  34. {trex-model-1.5.11 → trex-model-1.5.12}/trexmodel/models/datastore/merchant_models.py +0 -0
  35. {trex-model-1.5.11 → trex-model-1.5.12}/trexmodel/models/datastore/model_decorators.py +0 -0
  36. {trex-model-1.5.11 → trex-model-1.5.12}/trexmodel/models/datastore/ndb_models.py +0 -0
  37. {trex-model-1.5.11 → trex-model-1.5.12}/trexmodel/models/datastore/pos_models.py +0 -0
  38. {trex-model-1.5.11 → trex-model-1.5.12}/trexmodel/models/datastore/prepaid_models.py +0 -0
  39. {trex-model-1.5.11 → trex-model-1.5.12}/trexmodel/models/datastore/product_models.py +0 -0
  40. {trex-model-1.5.11 → trex-model-1.5.12}/trexmodel/models/datastore/program_models.py +0 -0
  41. {trex-model-1.5.11 → trex-model-1.5.12}/trexmodel/models/datastore/rating_models.py +0 -0
  42. {trex-model-1.5.11 → trex-model-1.5.12}/trexmodel/models/datastore/recruit_models.py +0 -0
  43. {trex-model-1.5.11 → trex-model-1.5.12}/trexmodel/models/datastore/redeem_models.py +0 -0
  44. {trex-model-1.5.11 → trex-model-1.5.12}/trexmodel/models/datastore/redemption_catalogue_models.py +0 -0
  45. {trex-model-1.5.11 → trex-model-1.5.12}/trexmodel/models/datastore/referral_program_model.py +0 -0
  46. {trex-model-1.5.11 → trex-model-1.5.12}/trexmodel/models/datastore/reward_models.py +0 -0
  47. {trex-model-1.5.11 → trex-model-1.5.12}/trexmodel/models/datastore/spending_base_program_model.py +0 -0
  48. {trex-model-1.5.11 → trex-model-1.5.12}/trexmodel/models/datastore/system_models.py +0 -0
  49. {trex-model-1.5.11 → trex-model-1.5.12}/trexmodel/models/datastore/task_models.py +0 -0
  50. {trex-model-1.5.11 → trex-model-1.5.12}/trexmodel/models/datastore/test_models.py +0 -0
  51. {trex-model-1.5.11 → trex-model-1.5.12}/trexmodel/models/datastore/transaction_models.py +0 -0
  52. {trex-model-1.5.11 → trex-model-1.5.12}/trexmodel/models/datastore/user_models.py +0 -0
  53. {trex-model-1.5.11 → trex-model-1.5.12}/trexmodel/models/datastore/voucher_models.py +0 -0
  54. {trex-model-1.5.11 → trex-model-1.5.12}/trexmodel/models/merchant_helpers.py +0 -0
  55. {trex-model-1.5.11 → trex-model-1.5.12}/trexmodel/models/model_decorator.py +0 -0
  56. {trex-model-1.5.11 → trex-model-1.5.12}/trexmodel/models/prepaid_helpers.py +0 -0
  57. {trex-model-1.5.11 → trex-model-1.5.12}/trexmodel/pos_conf.py +0 -0
  58. {trex-model-1.5.11 → trex-model-1.5.12}/trexmodel/program_conf.py +0 -0
  59. {trex-model-1.5.11 → trex-model-1.5.12}/trexmodel/utils/__init__.py +0 -0
  60. {trex-model-1.5.11 → trex-model-1.5.12}/trexmodel/utils/gcloud/__init__.py +0 -0
  61. {trex-model-1.5.11 → trex-model-1.5.12}/trexmodel/utils/gcloud/datastore_util.py +0 -0
  62. {trex-model-1.5.11 → trex-model-1.5.12}/trexmodel/utils/model/__init__.py +0 -0
  63. {trex-model-1.5.11 → trex-model-1.5.12}/trexmodel/utils/model/model_util.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: trex-model
3
- Version: 1.5.11
3
+ Version: 1.5.12
4
4
  Summary: TRex database module package
5
5
  Home-page: https://bitbucket.org/lokjac/trex-model
6
6
  Author: Jack Lok
@@ -3,7 +3,7 @@ with open("README.md", "r") as fh:
3
3
  long_description = fh.read()
4
4
  setuptools.setup(
5
5
  name='trex-model',
6
- version='1.5.11',
6
+ version='1.5.12',
7
7
  author="Jack Lok",
8
8
  author_email="sglok77@gmail.com",
9
9
  description="TRex database module package",
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: trex-model
3
- Version: 1.5.11
3
+ Version: 1.5.12
4
4
  Summary: TRex database module package
5
5
  Home-page: https://bitbucket.org/lokjac/trex-model
6
6
  Author: Jack Lok
@@ -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)
@@ -6,7 +6,8 @@ Created on 9 Nov 2023
6
6
  from trexmodel.program_conf import REWARD_FORMAT_MAP, REWARD_FORMAT_PREPAID
7
7
  from trexmodel.models.datastore.message_models import Message
8
8
  from trexmodel.conf import MESSAGE_CATEGORY_REWARD, MESSAGE_STATUS_NEW,\
9
- MESSAGE_CATEGORY_REDEEM, MESSAGE_CATEGORY_REDEMPTION_CATALOGUE
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
@@ -81,7 +81,7 @@ class Message(BaseNModel, DictModel):
81
81
  title = title,
82
82
  message_type = message_type,
83
83
  message_content = message_content,
84
- #created_datetime= datetime.utcnow(),
84
+ created_datetime= datetime.utcnow(),
85
85
  ).put()
86
86
 
87
87
  @staticmethod
File without changes
File without changes
File without changes
File without changes