| Line 5... |
Line 5... |
| 5 |
from dtr.storage import DataService
|
5 |
from dtr.storage import DataService
|
| 6 |
from dtr.storage.DataService import price_preferences, brand_preferences, \
|
6 |
from dtr.storage.DataService import price_preferences, brand_preferences, \
|
| 7 |
user_actions, Brands, app_offers, approved_app_transactions, user_app_cashbacks, \
|
7 |
user_actions, Brands, app_offers, approved_app_transactions, user_app_cashbacks, \
|
| 8 |
user_app_installs, appmasters
|
8 |
user_app_installs, appmasters
|
| 9 |
from dtr.storage.MemCache import MemCache
|
9 |
from dtr.storage.MemCache import MemCache
|
| 10 |
from dtr.utils.FetchLivePrices import returnLatestPrice
|
- |
|
| 11 |
from dtr.utils.MailSender import Email
|
10 |
from dtr.utils.MailSender import Email
|
| 12 |
from dtr.utils.utils import to_java_date, CB_PENDING, CB_APPROVED, CB_INIT, \
|
11 |
from dtr.utils.utils import to_java_date, CB_PENDING, CB_APPROVED, CB_INIT, \
|
| 13 |
to_py_date, CB_REJECTED
|
12 |
to_py_date, CB_REJECTED
|
| 14 |
from sqlalchemy.sql.expression import func, func, or_, desc, asc, case
|
13 |
from sqlalchemy.sql.expression import func, func, or_, desc, asc, case
|
| 15 |
from elixir import *
|
14 |
from elixir import *
|
| Line 487... |
Line 486... |
| 487 |
cashBack = getCashBack(item[0]['_id'], item[0]['source_id'], item[0]['category_id'])
|
486 |
cashBack = getCashBack(item[0]['_id'], item[0]['source_id'], item[0]['category_id'])
|
| 488 |
if not cashBack or cashBack.get('cash_back_status')!=1:
|
487 |
if not cashBack or cashBack.get('cash_back_status')!=1:
|
| 489 |
item[0]['cash_back_type'] = 0
|
488 |
item[0]['cash_back_type'] = 0
|
| 490 |
item[0]['cash_back'] = 0
|
489 |
item[0]['cash_back'] = 0
|
| 491 |
else:
|
490 |
else:
|
| - |
|
491 |
if cashBack.get('maxCashBack') is not None:
|
| - |
|
492 |
|
| - |
|
493 |
if cashBack.get('cash_back_type') ==1 and (float(cashBack.get('cash_back'))*item[0]['available_price'])/100 > cashBack.get('maxCashBack'):
|
| - |
|
494 |
cashBack['cash_back_type'] = 2
|
| - |
|
495 |
cashBack['cash_back'] = cashBack['maxCashBack']
|
| - |
|
496 |
elif cashBack.get('cash_back_type') ==2 and cashBack.get('cash_back') > cashBack.get('maxCashBack'):
|
| - |
|
497 |
cashBack['cash_back'] = cashBack['maxCashBack']
|
| - |
|
498 |
|
| 492 |
item[0]['cash_back_type'] = int(cashBack['cash_back_type'])
|
499 |
item[0]['cash_back_type'] = int(cashBack['cash_back_type'])
|
| 493 |
item[0]['cash_back'] = cashBack['cash_back']
|
500 |
item[0]['cash_back'] = cashBack['cash_back']
|
| 494 |
except:
|
501 |
except:
|
| 495 |
print "Error in adding cashback to deals"
|
502 |
print "Error in adding cashback to deals"
|
| 496 |
item[0]['cash_back_type'] = 0
|
503 |
item[0]['cash_back_type'] = 0
|
| Line 1656... |
Line 1663... |
| 1656 |
mc.set("cached_app_offers_"+str(retailerId), {}, 10)
|
1663 |
mc.set("cached_app_offers_"+str(retailerId), {}, 10)
|
| 1657 |
|
1664 |
|
| 1658 |
|
1665 |
|
| 1659 |
def main():
|
1666 |
def main():
|
| 1660 |
#generateRedirectUrl(101,1)
|
1667 |
#generateRedirectUrl(101,1)
|
| 1661 |
print getCashBackDetails('1351153', 3)
|
1668 |
print (getCashBackDetails('1351153', 3))
|
| 1662 |
#print addPayout("10", "55db82c0bcabd7fc59e0a71")
|
1669 |
#print addPayout("10", "55db82c0bcabd7fc59e0a71")
|
| 1663 |
|
1670 |
|
| 1664 |
|
1671 |
|
| 1665 |
|
1672 |
|
| 1666 |
if __name__=='__main__':
|
1673 |
if __name__=='__main__':
|
| 1667 |
main()
|
1674 |
main()
|
| 1668 |
|
- |
|