| Line 21... |
Line 21... |
| 21 |
PageViewEvents, CartEvents, EbayItem, BannerUriMapping, Campaign, SnapdealItem, \
|
21 |
PageViewEvents, CartEvents, EbayItem, BannerUriMapping, Campaign, SnapdealItem, \
|
| 22 |
SnapdealItemUpdateHistory
|
22 |
SnapdealItemUpdateHistory
|
| 23 |
from shop2020.thriftpy.model.v1.catalog.ttypes import status, ItemShippingInfo, \
|
23 |
from shop2020.thriftpy.model.v1.catalog.ttypes import status, ItemShippingInfo, \
|
| 24 |
ItemType, PremiumType, FreebieItem as t_FreebieItem, \
|
24 |
ItemType, PremiumType, FreebieItem as t_FreebieItem, \
|
| 25 |
StorePricing as tStorePricing, CatalogServiceException, \
|
25 |
StorePricing as tStorePricing, CatalogServiceException, \
|
| 26 |
BannerType
|
26 |
BannerType, InsurerType
|
| 27 |
from shop2020.thriftpy.model.v1.inventory.ttypes import \
|
27 |
from shop2020.thriftpy.model.v1.inventory.ttypes import \
|
| 28 |
InventoryServiceException, IgnoredInventoryUpdateItems
|
28 |
InventoryServiceException, IgnoredInventoryUpdateItems
|
| 29 |
from shop2020.utils import EmailAttachmentSender
|
29 |
from shop2020.utils import EmailAttachmentSender
|
| 30 |
from shop2020.utils.EmailAttachmentSender import mail
|
30 |
from shop2020.utils.EmailAttachmentSender import mail
|
| 31 |
from shop2020.utils.Utils import to_py_date, log_risky_flag
|
31 |
from shop2020.utils.Utils import to_py_date, log_risky_flag
|
| Line 173... |
Line 173... |
| 173 |
ds_item.model_number = item.modelNumber
|
173 |
ds_item.model_number = item.modelNumber
|
| 174 |
ds_item.color = item.color
|
174 |
ds_item.color = item.color
|
| 175 |
ds_item.model_name = item.modelName
|
175 |
ds_item.model_name = item.modelName
|
| 176 |
ds_item.category = item.category
|
176 |
ds_item.category = item.category
|
| 177 |
if item.category == 10006:
|
177 |
if item.category == 10006:
|
| - |
|
178 |
itemInsurerMapping = ItemInsurerMapping.query.filter(ItemInsurerMapping.itemId == item.id).filter(ItemInsurerMapping.insurerType == InsurerType._NAMES_TO_VALUES.get("DEVICE")).first()
|
| - |
|
179 |
if itemInsurerMapping is None:
|
| - |
|
180 |
itemInsurerMapping = ItemInsurerMapping()
|
| - |
|
181 |
itemInsurerMapping.itemId = item.id
|
| 178 |
ds_item.preferredInsurer = 1
|
182 |
itemInsurerMapping.insurerId = 1
|
| - |
|
183 |
itemInsurerMapping.insurerType = 1
|
| 179 |
|
184 |
|
| 180 |
ds_item.comments = item.comments
|
185 |
ds_item.comments = item.comments
|
| 181 |
|
186 |
|
| 182 |
ds_item.catalog_item_id = item.catalogItemId
|
187 |
ds_item.catalog_item_id = item.catalogItemId
|
| 183 |
|
188 |
|
| Line 541... |
Line 546... |
| 541 |
item_change_log = ItemChangeLog()
|
546 |
item_change_log = ItemChangeLog()
|
| 542 |
item_change_log.old_status = item.status
|
547 |
item_change_log.old_status = item.status
|
| 543 |
item_change_log.new_status = content_complete_status
|
548 |
item_change_log.new_status = content_complete_status
|
| 544 |
item_change_log.timestamp = current_timestamp
|
549 |
item_change_log.timestamp = current_timestamp
|
| 545 |
item_change_log.item = item
|
550 |
item_change_log.item = item
|
| - |
|
551 |
if isAndroid:
|
| - |
|
552 |
itemInsurerMapping = ItemInsurerMapping.query.filter(ItemInsurerMapping.itemId == item.id).filter(ItemInsurerMapping.insurerType == InsurerType._NAMES_TO_VALUES.get("DATA")).first()
|
| - |
|
553 |
if itemInsurerMapping is None:
|
| - |
|
554 |
itemInsurerMapping = ItemInsurerMapping()
|
| - |
|
555 |
itemInsurerMapping.itemId = item.id
|
| - |
|
556 |
itemInsurerMapping.insurerId = 2
|
| - |
|
557 |
itemInsurerMapping.insurerType = 2
|
| 546 |
|
558 |
|
| 547 |
category_object = get_category(category)
|
559 |
category_object = get_category(category)
|
| 548 |
if category_object is not None:
|
560 |
if category_object is not None:
|
| 549 |
item.category = category
|
561 |
item.category = category
|
| 550 |
item.product_group = category_object.display_name
|
562 |
item.product_group = category_object.display_name
|
| Line 1578... |
Line 1590... |
| 1578 |
session.query(EntityTag.tag).filter_by(tag=displayName,entityId=catalogId).delete()
|
1590 |
session.query(EntityTag.tag).filter_by(tag=displayName,entityId=catalogId).delete()
|
| 1579 |
session.commit()
|
1591 |
session.commit()
|
| 1580 |
return True
|
1592 |
return True
|
| 1581 |
|
1593 |
|
| 1582 |
def get_insurance_amount(itemId, price, insurerId, quantity):
|
1594 |
def get_insurance_amount(itemId, price, insurerId, quantity):
|
| - |
|
1595 |
if insurerId ==1:
|
| 1583 |
itemInsurerMapping = ItemInsurerMapping.query.filter(ItemInsurerMapping.itemId == itemId).filter(ItemInsurerMapping.insurerId == insurerId).first()
|
1596 |
#itemInsurerMapping = ItemInsurerMapping.query.filter(ItemInsurerMapping.itemId == itemId).filter(ItemInsurerMapping.insurerId == insurerId).first()
|
| 1584 |
if not itemInsurerMapping:
|
1597 |
#if itemInsurerMapping:
|
| 1585 |
#Default insurance premium is 1.5%
|
1598 |
#Default insurance premium is 1.5%
|
| - |
|
1599 |
# return round(price * (1.5/100) * quantity)
|
| 1586 |
return round(price * (1.5/100) * quantity)
|
1600 |
return round(price * (1.5/100) * quantity)
|
| 1587 |
insuranceAmount = 0.0
|
1601 |
'''insuranceAmount = 0.0
|
| 1588 |
if itemInsurerMapping.premiumType == PremiumType._NAMES_TO_VALUES.get("PERCENT"):
|
1602 |
if itemInsurerMapping.premiumType == PremiumType._NAMES_TO_VALUES.get("PERCENT"):
|
| 1589 |
insuranceAmount = price * (itemInsurerMapping.premiumAmount/100) * quantity
|
1603 |
insuranceAmount = price * (itemInsurerMapping.premiumAmount/100) * quantity
|
| 1590 |
else :
|
1604 |
else :
|
| 1591 |
insuranceAmount = itemInsurerMapping.premiumAmount * quantity
|
1605 |
insuranceAmount = itemInsurerMapping.premiumAmount * quantity
|
| - |
|
1606 |
'''
|
| - |
|
1607 |
if insurerId ==2:
|
| - |
|
1608 |
return 0.0 #FOR PROMOTION PURPOSE
|
| - |
|
1609 |
#return 449.0 * quantity
|
| 1592 |
|
1610 |
|
| - |
|
1611 |
return 0.0
|
| - |
|
1612 |
|
| - |
|
1613 |
def get_preffered_insurer_for_item(itemId, insurerType):
|
| - |
|
1614 |
itemInsurerMapping = ItemInsurerMapping.query.filter(ItemInsurerMapping.itemId == itemId).filter(ItemInsurerMapping.insurerType == insurerType).first()
|
| - |
|
1615 |
if not itemInsurerMapping:
|
| - |
|
1616 |
return 0
|
| - |
|
1617 |
else:
|
| 1593 |
return insuranceAmount
|
1618 |
return itemInsurerMapping.insurerId
|
| 1594 |
|
1619 |
|
| 1595 |
def get_insurer(insurerId):
|
1620 |
def get_insurer(insurerId):
|
| 1596 |
return Insurer.get_by(id = insurerId)
|
1621 |
return Insurer.get_by(id = insurerId)
|
| 1597 |
|
1622 |
|
| 1598 |
def get_all_entity_tags():
|
1623 |
def get_all_entity_tags():
|
| 1599 |
entitiesTag = EntityTag.query.all()
|
1624 |
entitiesTag = EntityTag.query.all()
|