trex-model 1.6.5__tar.gz → 1.6.6__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.5 → trex_model-1.6.6}/PKG-INFO +1 -1
- {trex_model-1.6.5 → trex_model-1.6.6}/setup.py +1 -1
- {trex_model-1.6.5 → trex_model-1.6.6}/trex_model.egg-info/PKG-INFO +1 -1
- {trex_model-1.6.5 → trex_model-1.6.6}/trex_model.egg-info/SOURCES.txt +1 -0
- {trex_model-1.6.5 → trex_model-1.6.6}/trexmodel/models/datastore/helper/reward_transaction_helper.py +11 -17
- trex_model-1.6.6/trexmodel/models/datastore/helper/sales_transaction_helpers.py +33 -0
- {trex_model-1.6.5 → trex_model-1.6.6}/trexmodel/models/datastore/transaction_models.py +1 -1
- {trex_model-1.6.5 → trex_model-1.6.6}/LICENSE +0 -0
- {trex_model-1.6.5 → trex_model-1.6.6}/MANIFEST.in +0 -0
- {trex_model-1.6.5 → trex_model-1.6.6}/README.md +0 -0
- {trex_model-1.6.5 → trex_model-1.6.6}/setup.cfg +0 -0
- {trex_model-1.6.5 → trex_model-1.6.6}/trex_model.egg-info/dependency_links.txt +0 -0
- {trex_model-1.6.5 → trex_model-1.6.6}/trex_model.egg-info/requires.txt +0 -0
- {trex_model-1.6.5 → trex_model-1.6.6}/trex_model.egg-info/top_level.txt +0 -0
- {trex_model-1.6.5 → trex_model-1.6.6}/trexmodel/__init__.py +0 -0
- {trex_model-1.6.5 → trex_model-1.6.6}/trexmodel/conf.py +0 -0
- {trex_model-1.6.5 → trex_model-1.6.6}/trexmodel/models/__init__.py +0 -0
- {trex_model-1.6.5 → trex_model-1.6.6}/trexmodel/models/datastore/__init__.py +0 -0
- {trex_model-1.6.5 → trex_model-1.6.6}/trexmodel/models/datastore/admin_models.py +0 -0
- {trex_model-1.6.5 → trex_model-1.6.6}/trexmodel/models/datastore/analytic_models.py +0 -0
- {trex_model-1.6.5 → trex_model-1.6.6}/trexmodel/models/datastore/app_models.py +0 -0
- {trex_model-1.6.5 → trex_model-1.6.6}/trexmodel/models/datastore/coporate_models.py +0 -0
- {trex_model-1.6.5 → trex_model-1.6.6}/trexmodel/models/datastore/customer_model_helpers.py +0 -0
- {trex_model-1.6.5 → trex_model-1.6.6}/trexmodel/models/datastore/customer_models.py +0 -0
- {trex_model-1.6.5 → trex_model-1.6.6}/trexmodel/models/datastore/fb_subsriber_models.py +0 -0
- {trex_model-1.6.5 → trex_model-1.6.6}/trexmodel/models/datastore/helper/__init__.py +0 -0
- {trex_model-1.6.5 → trex_model-1.6.6}/trexmodel/models/datastore/helper/reward_model_helpers.py +0 -0
- {trex_model-1.6.5 → trex_model-1.6.6}/trexmodel/models/datastore/import_models.py +0 -0
- {trex_model-1.6.5 → trex_model-1.6.6}/trexmodel/models/datastore/inventory_model.py +0 -0
- {trex_model-1.6.5 → trex_model-1.6.6}/trexmodel/models/datastore/loyalty_models.py +0 -0
- {trex_model-1.6.5 → trex_model-1.6.6}/trexmodel/models/datastore/lucky_draw_models.py +0 -0
- {trex_model-1.6.5 → trex_model-1.6.6}/trexmodel/models/datastore/marketing_models.py +0 -0
- {trex_model-1.6.5 → trex_model-1.6.6}/trexmodel/models/datastore/membership_models.py +0 -0
- {trex_model-1.6.5 → trex_model-1.6.6}/trexmodel/models/datastore/merchant_models.py +0 -0
- {trex_model-1.6.5 → trex_model-1.6.6}/trexmodel/models/datastore/merchant_promotion_models.py +0 -0
- {trex_model-1.6.5 → trex_model-1.6.6}/trexmodel/models/datastore/message_model_helper.py +0 -0
- {trex_model-1.6.5 → trex_model-1.6.6}/trexmodel/models/datastore/message_models.py +0 -0
- {trex_model-1.6.5 → trex_model-1.6.6}/trexmodel/models/datastore/model_decorators.py +0 -0
- {trex_model-1.6.5 → trex_model-1.6.6}/trexmodel/models/datastore/ndb_models.py +0 -0
- {trex_model-1.6.5 → trex_model-1.6.6}/trexmodel/models/datastore/partnership_models.py +0 -0
- {trex_model-1.6.5 → trex_model-1.6.6}/trexmodel/models/datastore/pos_models.py +0 -0
- {trex_model-1.6.5 → trex_model-1.6.6}/trexmodel/models/datastore/prepaid_models.py +0 -0
- {trex_model-1.6.5 → trex_model-1.6.6}/trexmodel/models/datastore/product_models.py +0 -0
- {trex_model-1.6.5 → trex_model-1.6.6}/trexmodel/models/datastore/program_models.py +0 -0
- {trex_model-1.6.5 → trex_model-1.6.6}/trexmodel/models/datastore/rating_models.py +0 -0
- {trex_model-1.6.5 → trex_model-1.6.6}/trexmodel/models/datastore/recruit_models.py +0 -0
- {trex_model-1.6.5 → trex_model-1.6.6}/trexmodel/models/datastore/redeem_models.py +0 -0
- {trex_model-1.6.5 → trex_model-1.6.6}/trexmodel/models/datastore/redemption_catalogue_models.py +0 -0
- {trex_model-1.6.5 → trex_model-1.6.6}/trexmodel/models/datastore/referral_program_model.py +0 -0
- {trex_model-1.6.5 → trex_model-1.6.6}/trexmodel/models/datastore/reward_models.py +0 -0
- {trex_model-1.6.5 → trex_model-1.6.6}/trexmodel/models/datastore/spending_base_program_model.py +0 -0
- {trex_model-1.6.5 → trex_model-1.6.6}/trexmodel/models/datastore/system_models.py +0 -0
- {trex_model-1.6.5 → trex_model-1.6.6}/trexmodel/models/datastore/task_models.py +0 -0
- {trex_model-1.6.5 → trex_model-1.6.6}/trexmodel/models/datastore/test_models.py +0 -0
- {trex_model-1.6.5 → trex_model-1.6.6}/trexmodel/models/datastore/user_models.py +0 -0
- {trex_model-1.6.5 → trex_model-1.6.6}/trexmodel/models/datastore/voucher_models.py +0 -0
- {trex_model-1.6.5 → trex_model-1.6.6}/trexmodel/models/merchant_helpers.py +0 -0
- {trex_model-1.6.5 → trex_model-1.6.6}/trexmodel/models/model_decorator.py +0 -0
- {trex_model-1.6.5 → trex_model-1.6.6}/trexmodel/models/prepaid_helpers.py +0 -0
- {trex_model-1.6.5 → trex_model-1.6.6}/trexmodel/pos_conf.py +0 -0
- {trex_model-1.6.5 → trex_model-1.6.6}/trexmodel/program_conf.py +0 -0
- {trex_model-1.6.5 → trex_model-1.6.6}/trexmodel/utils/__init__.py +0 -0
- {trex_model-1.6.5 → trex_model-1.6.6}/trexmodel/utils/gcloud/__init__.py +0 -0
- {trex_model-1.6.5 → trex_model-1.6.6}/trexmodel/utils/gcloud/datastore_util.py +0 -0
- {trex_model-1.6.5 → trex_model-1.6.6}/trexmodel/utils/model/__init__.py +0 -0
- {trex_model-1.6.5 → trex_model-1.6.6}/trexmodel/utils/model/model_util.py +0 -0
|
@@ -57,6 +57,7 @@ trexmodel/models/datastore/voucher_models.py
|
|
|
57
57
|
trexmodel/models/datastore/helper/__init__.py
|
|
58
58
|
trexmodel/models/datastore/helper/reward_model_helpers.py
|
|
59
59
|
trexmodel/models/datastore/helper/reward_transaction_helper.py
|
|
60
|
+
trexmodel/models/datastore/helper/sales_transaction_helpers.py
|
|
60
61
|
trexmodel/utils/__init__.py
|
|
61
62
|
trexmodel/utils/gcloud/__init__.py
|
|
62
63
|
trexmodel/utils/gcloud/datastore_util.py
|
{trex_model-1.6.5 → trex_model-1.6.6}/trexmodel/models/datastore/helper/reward_transaction_helper.py
RENAMED
|
@@ -19,14 +19,14 @@ from trexmodel.models.datastore.customer_model_helpers import update_customer_en
|
|
|
19
19
|
update_customer_entiteld_voucher_summary_with_customer_new_voucher,\
|
|
20
20
|
update_prepaid_summary_with_reverted_prepaid,\
|
|
21
21
|
update_reward_summary_with_reverted_reward
|
|
22
|
-
from trexanalytics.bigquery_upstream_data_config import
|
|
23
|
-
create_merchant_customer_transaction_upstream_for_merchant,\
|
|
22
|
+
from trexanalytics.bigquery_upstream_data_config import create_merchant_customer_transaction_upstream_for_merchant,\
|
|
24
23
|
create_merchant_customer_redemption_upstream_for_merchant,\
|
|
25
24
|
create_merchant_customer_prepaid_upstream_for_merchant,\
|
|
26
25
|
create_merchant_customer_redemption_reverted_upstream_for_merchant,\
|
|
27
26
|
create_revert_entitled_customer_voucher_upstream_for_merchant,\
|
|
28
27
|
create_redeemed_customer_voucher_to_upstream_for_merchant,\
|
|
29
|
-
create_merchant_sales_transaction_upstream_for_merchant
|
|
28
|
+
create_merchant_sales_transaction_upstream_for_merchant,\
|
|
29
|
+
create_merchant_customer_reward_upstream_for_merchant
|
|
30
30
|
from trexmodel.models.datastore.membership_models import MerchantTierMembership
|
|
31
31
|
from trexmodel.models.datastore.transaction_models import CustomerTransaction,\
|
|
32
32
|
SalesTransaction
|
|
@@ -831,7 +831,8 @@ def revert_transaction(transaction_details, reverted_by, reverted_datetime=None,
|
|
|
831
831
|
merchant_acct = transaction_details.transact_merchant_acct
|
|
832
832
|
transaction_id = transaction_details.transaction_id
|
|
833
833
|
customer_acct = transaction_details.transact_customer_acct
|
|
834
|
-
|
|
834
|
+
is_from_instant_transaction = transaction_details.is_from_instant_transaction
|
|
835
|
+
|
|
835
836
|
if transaction_details.is_membership_purchase:
|
|
836
837
|
#remove membership
|
|
837
838
|
|
|
@@ -941,18 +942,12 @@ def revert_transaction(transaction_details, reverted_by, reverted_datetime=None,
|
|
|
941
942
|
|
|
942
943
|
create_merchant_customer_transaction_upstream_for_merchant(transaction_details, Reverted=True)
|
|
943
944
|
|
|
944
|
-
if transaction_details.
|
|
945
|
+
if transaction_details.is_from_instant_transaction:
|
|
945
946
|
sales_transaction = SalesTransaction.get_by_transaction_id(transaction_id)
|
|
946
947
|
|
|
947
948
|
if sales_transaction:
|
|
948
|
-
sales_transaction.
|
|
949
|
-
sales_transaction.reverted_datetime = reverted_datetime
|
|
950
|
-
sales_transaction.reverted_by = reverted_by_key
|
|
951
|
-
sales_transaction.reverted_by_username = reverted_by.username
|
|
949
|
+
sales_transaction.used = False
|
|
952
950
|
sales_transaction.put()
|
|
953
|
-
|
|
954
|
-
create_merchant_sales_transaction_upstream_for_merchant(sales_transaction, Reverted=True)
|
|
955
|
-
|
|
956
951
|
|
|
957
952
|
if is_stamp_entitled_in_transaction or is_point_entitled_in_transaction or is_voucher_entitled_in_transaction or is_prepaid_entitled_in_transaction:
|
|
958
953
|
for p in reverting_point_details_list:
|
|
@@ -965,7 +960,7 @@ def revert_transaction(transaction_details, reverted_by, reverted_datetime=None,
|
|
|
965
960
|
|
|
966
961
|
customer_reward_summary = update_reward_summary_with_reverted_reward(customer_reward_summary, p.to_reward_summary())
|
|
967
962
|
if create_upstream:
|
|
968
|
-
|
|
963
|
+
create_merchant_customer_reward_upstream_for_merchant(transaction_details, p, Reverted=True)
|
|
969
964
|
|
|
970
965
|
|
|
971
966
|
for p in reverting_stamp_details_list:
|
|
@@ -978,7 +973,7 @@ def revert_transaction(transaction_details, reverted_by, reverted_datetime=None,
|
|
|
978
973
|
|
|
979
974
|
customer_reward_summary = update_reward_summary_with_reverted_reward(customer_reward_summary, p.to_reward_summary())
|
|
980
975
|
if create_upstream:
|
|
981
|
-
|
|
976
|
+
create_merchant_customer_reward_upstream_for_merchant(transaction_details, p, Reverted=True)
|
|
982
977
|
|
|
983
978
|
for p in reverting_vouchers_list:
|
|
984
979
|
if p.is_valid:
|
|
@@ -998,7 +993,7 @@ def revert_transaction(transaction_details, reverted_by, reverted_datetime=None,
|
|
|
998
993
|
|
|
999
994
|
voucher_reward_brief = VoucherRewardDetailsForUpstreamData(voucher_key, 1, expiry_date, rewarded_datetime)
|
|
1000
995
|
if create_upstream:
|
|
1001
|
-
|
|
996
|
+
create_merchant_customer_reward_upstream_for_merchant(transaction_details, voucher_reward_brief, Reverted=True)
|
|
1002
997
|
|
|
1003
998
|
for p in reverting_prepaid_list:
|
|
1004
999
|
if p.is_valid:
|
|
@@ -1010,8 +1005,7 @@ def revert_transaction(transaction_details, reverted_by, reverted_datetime=None,
|
|
|
1010
1005
|
|
|
1011
1006
|
customer_prepaid_summary = update_prepaid_summary_with_reverted_prepaid(customer_prepaid_summary, p.to_prepaid_summary())
|
|
1012
1007
|
if create_upstream:
|
|
1013
|
-
|
|
1014
|
-
create_merchant_customer_reward_reverted_upstream_for_merchant(transaction_details, p, reverted_datetime)
|
|
1008
|
+
create_merchant_customer_prepaid_upstream_for_merchant(transaction_details, p, Reverted=True)
|
|
1015
1009
|
|
|
1016
1010
|
|
|
1017
1011
|
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
'''
|
|
2
|
+
Created on 23 Jun 2025
|
|
3
|
+
|
|
4
|
+
@author: jacklok
|
|
5
|
+
'''
|
|
6
|
+
import logging
|
|
7
|
+
from datetime import datetime
|
|
8
|
+
from trexanalytics.bigquery_upstream_data_config import create_merchant_sales_transaction_upstream_for_merchant
|
|
9
|
+
|
|
10
|
+
#logger = logging.getLogger('helper')
|
|
11
|
+
logger = logging.getLogger('target_debug')
|
|
12
|
+
|
|
13
|
+
def revert_sales_transaction(transaction_details, reverted_by, reverted_datetime=None):
|
|
14
|
+
|
|
15
|
+
if transaction_details.is_revert==False and transaction_details.allow_to_revert and transaction_details.used==False:
|
|
16
|
+
logger.info('going to check for sales transaction revert')
|
|
17
|
+
|
|
18
|
+
if reverted_datetime is None:
|
|
19
|
+
reverted_datetime = datetime.utcnow()
|
|
20
|
+
|
|
21
|
+
if reverted_by:
|
|
22
|
+
transaction_details.reverted_by = reverted_by.create_ndb_key()
|
|
23
|
+
transaction_details.reverted_by_username = reverted_by.username
|
|
24
|
+
|
|
25
|
+
transaction_details.reverted_datetime = reverted_datetime
|
|
26
|
+
transaction_details.is_revert = True
|
|
27
|
+
transaction_details.put()
|
|
28
|
+
|
|
29
|
+
create_merchant_sales_transaction_upstream_for_merchant(transaction_details, Reverted=True)
|
|
30
|
+
|
|
31
|
+
else:
|
|
32
|
+
logger.error('Sales transaction is either reverted or not allow to revert or it has been claimed by customer')
|
|
33
|
+
raise Exception('Sales transaction is either reverted or not allow to revert or it has been claimed by customer')
|
|
@@ -348,7 +348,7 @@ class CustomerTransaction(SalesTransaction):
|
|
|
348
348
|
'transact_datetime', 'created_datetime', 'transact_outlet_key', 'is_revert', 'reverted_datetime', 'reverted_by_username',
|
|
349
349
|
'transact_by', 'transact_by_username', 'is_reward_redeemed', 'is_sales_transaction', 'allow_to_revert',
|
|
350
350
|
'is_membership_purchase', 'purchased_merchant_membership_key', 'is_tier_membership_upgraded', 'upgraded_merchant_tier_membership_key',
|
|
351
|
-
'is_rating_review_enabled', 'promotion_code', 'is_partner_transaction',
|
|
351
|
+
'is_rating_review_enabled', 'promotion_code', 'is_partner_transaction', 'is_from_instant_transaction',
|
|
352
352
|
]
|
|
353
353
|
|
|
354
354
|
def to_transaction_details_json(self):
|
|
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.6.5 → trex_model-1.6.6}/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
|
{trex_model-1.6.5 → trex_model-1.6.6}/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.5 → trex_model-1.6.6}/trexmodel/models/datastore/redemption_catalogue_models.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{trex_model-1.6.5 → trex_model-1.6.6}/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
|