Subversion Repositories SmartDukaan

Rev

Rev 12243 | Rev 12363 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
94 ashish 1
'''
2
Created on 23-Mar-2010
3
 
4
@author: ashish
5
'''
8754 vikram.rag 6
from shop2020.model.v1.catalog.impl.DataService import Insurer, SnapdealItem, Item
6511 kshitij.so 7
from shop2020.thriftpy.model.v1.catalog.ttypes import Item, Category, \
8
    SourceItemPricing, Source, ItemType, \
5110 mandeep.dh 9
    ProductNotificationRequest as TProductNotificationRequest, \
10
    ProductNotificationRequestCount as TProductNotificationRequestCount, \
7281 kshitij.so 11
    VoucherItemMapping, EntityTag as TEntityTag, Banner as TBanner, BannerMap as TBannerMap, \
8182 amar.kumar 12
    Insurer as TInsurer, BrandInfo as TBrandInfo, Amazonlisted as TAmazonlisted, \
8739 vikram.rag 13
    EbayItem as TEbayItem, BannerUriMapping as TBannerUriMapping, Campaign as TCampaign, \
9724 kshitij.so 14
    SnapdealItem as TSnapdealItem, SnapdealItemDetails as TSnapdealItemDetails,ProductFeedSubmit as TProductFeedSubmit, \
9779 kshitij.so 15
    MarketplaceItems as TMarketplaceItems, MarketplacePercentage as TMarketplacePercentage, \
10097 kshitij.so 16
    MarketPlaceItemPrice as TMarketPlaceItemPrice, FlipkartItem as TFlipkartItem,\
11531 vikram.rag 17
    FlipkartItemDetails as TFlipkartItemDetails,MarketplaceHistory as TMarketplaceHistory,\
12256 kshitij.so 18
    PrivateDeal as TPrivateDeal, AmazonOutOfSync as TAmazonOutOfSync, PdPriceComp as TPdPriceComp, CompetitorPricing as TCompetitorPricing
5110 mandeep.dh 19
from shop2020.utils.Utils import to_java_date
94 ashish 20
 
21
def to_t_item(item):
22
    t_item = Item()
576 chandransh 23
    if item is None:
24
        return t_item
94 ashish 25
    t_item.id = item.id
963 chandransh 26
    t_item.productGroup = item.product_group
27
    t_item.brand = item.brand
591 chandransh 28
    t_item.modelNumber = item.model_number
29
    t_item.modelName = item.model_name
609 chandransh 30
    t_item.color = item.color
591 chandransh 31
    t_item.category = item.category
122 ashish 32
    t_item.catalogItemId = item.catalog_item_id
33
    t_item.weight = item.weight
34
    t_item.featureId = item.feature_id
35
    t_item.featureDescription = item.feature_description
36
    if item.startDate:
37
        t_item.startDate = to_java_date(item.startDate)
5217 amit.gupta 38
    if item.comingSoonStartDate:
39
        t_item.comingSoonStartDate = to_java_date(item.comingSoonStartDate)
40
    if item.expectedArrivalDate:
41
        t_item.expectedArrivalDate = to_java_date(item.expectedArrivalDate)
122 ashish 42
    if item.addedOn:
43
        t_item.addedOn = to_java_date(item.addedOn)
609 chandransh 44
    if item.updatedOn:
45
        t_item.updatedOn = to_java_date(item.updatedOn)
122 ashish 46
    t_item.itemStatus = item.status
2035 rajveer 47
    t_item.status_description = item.status_description
501 rajveer 48
    if item.sellingPrice:
609 chandransh 49
        t_item.sellingPrice = item.sellingPrice
630 chandransh 50
    if item.mrp:
501 rajveer 51
        t_item.mrp = item.mrp    
122 ashish 52
 
2028 ankur.sing 53
    if item.comments:
54
        t_item.comments = item.comments
609 chandransh 55
    if item.bestDealText:
56
        t_item.bestDealText = item.bestDealText
6777 vikram.rag 57
    if item.bestDealsDetailsText:
58
        t_item.bestDealsDetailsText = item.bestDealsDetailsText
59
    if item.bestDealsDetailsLink:
60
        t_item.bestDealsDetailsLink = item.bestDealsDetailsLink 
609 chandransh 61
    if item.bestDealValue:
62
        t_item.bestDealValue = item.bestDealValue
7291 vikram.rag 63
    if item.asin:
64
        t_item.asin = item.asin    
1910 varun.gupt 65
    t_item.defaultForEntity = item.defaultForEntity
2065 ankur.sing 66
    t_item.bestSellingRank = item.bestSellingRank
2251 ankur.sing 67
    t_item.risky = item.risky
3355 chandransh 68
    t_item.expectedDelay = item.expectedDelay
4406 anupam.sin 69
    t_item.isWarehousePreferenceSticky = item.isWarehousePreferenceSticky
4295 varun.gupt 70
    t_item.warrantyPeriod = item.warranty_period
4506 phani.kuma 71
    t_item.preferredVendor = item.preferredVendor
5110 mandeep.dh 72
    t_item.type = ItemType._NAMES_TO_VALUES[item.type]
5385 phani.kuma 73
    t_item.hasItemNo = item.hasItemNo
7256 rajveer 74
    t_item.activeOnStore = item.activeOnStore
6241 amit.gupta 75
    t_item.showSellingPrice = item.showSellingPrice
6805 anupam.sin 76
    t_item.preferredInsurer = item.preferredInsurer
7291 vikram.rag 77
    t_item.holdInventory = item.holdInventory
78
    t_item.defaultInventory = item.defaultInventory
9841 rajveer 79
    t_item.holdOverride = item.holdOverride
94 ashish 80
    return t_item
122 ashish 81
 
6805 anupam.sin 82
def to_t_insurer(insurer):
83
    t_insurer = TInsurer()
84
    t_insurer.id = insurer.id
85
    t_insurer.name = insurer.name 
86
    t_insurer.address = insurer.address
6903 anupam.sin 87
    t_insurer.declaredAmount = insurer.declaredAmount
88
    t_insurer.creditedAmount = insurer.creditedAmount
6805 anupam.sin 89
    return t_insurer
90
 
5504 phani.kuma 91
def to_t_voucher_item_mapping(voucher):
92
    t_voucher = VoucherItemMapping()
93
    t_voucher.voucherType = voucher.voucherType
94
    t_voucher.itemId = voucher.item.id
95
    t_voucher.amount = voucher.amount
96
    return t_voucher
97
 
1970 rajveer 98
def to_t_category(category):
99
    t_category = Category()
100
    t_category.id = category.id
101
    t_category.label = category.label
102
    t_category.description = category.description
103
    t_category.parent_category_id = category.parent_category_id
4762 phani.kuma 104
    t_category.display_name = category.display_name
3557 rajveer 105
    return t_category
106
 
107
def to_t_source_item_pricing(source_item_pricing):
108
    t_source_item_pricing = SourceItemPricing()
109
    t_source_item_pricing.sourceId = source_item_pricing.source.id
110
    t_source_item_pricing.itemId = source_item_pricing.item.id
111
    t_source_item_pricing.mrp = source_item_pricing.mrp
112
    t_source_item_pricing.sellingPrice = source_item_pricing.sellingPrice
113
    return t_source_item_pricing
114
 
115
def to_t_source(source):
116
    t_source = Source()
117
    t_source.id = source.id
118
    t_source.name = source.name
119
    t_source.identifier = source.identifier
120
    return t_source
4295 varun.gupt 121
 
122
def to_t_product_notification_request(product_notification_request):
123
    t_product_notification_request = TProductNotificationRequest()
124
 
125
    if product_notification_request:
126
        t_product_notification_request.item = to_t_item(product_notification_request.item)
127
        t_product_notification_request.email = product_notification_request.email
128
        t_product_notification_request.addedOn = to_java_date(product_notification_request.addedOn)
129
 
130
    return t_product_notification_request
131
 
132
def to_t_product_notification_request_count(product_notification_request_count):
133
 
134
    t_product_notification_request_count = TProductNotificationRequestCount()
135
 
136
    if product_notification_request_count:
137
        item, count = product_notification_request_count
138
        t_product_notification_request_count.item = to_t_item(item)
139
        t_product_notification_request_count.count = count
140
 
6511 kshitij.so 141
    return t_product_notification_request_count
142
 
143
def to_t_entity_tag(entity_tag):
144
    t_entity_tag = TEntityTag()
145
    t_entity_tag.entityId = entity_tag.entityId
6848 kshitij.so 146
    t_entity_tag.tag = entity_tag.tag
147
 
148
def to_t_banner(banner):
149
    t_banner = TBanner()
150
    t_banner.bannerName = banner.bannerName
151
    t_banner.imageName = banner.imageName
152
    t_banner.link = banner.link
153
    t_banner.priority = banner.priority
154
    t_banner.hasMap = banner.hasMap
9155 kshitij.so 155
    t_banner.bannerType = banner.bannerType
6848 kshitij.so 156
    return t_banner
157
 
8579 kshitij.so 158
def to_t_banner_list(bannerList):
159
    t_banner_list = []
160
    for banner in bannerList:
161
        t_banner = TBanner()
162
        t_banner.bannerName = banner.bannerName
163
        t_banner.imageName = banner.imageName
164
        t_banner.link = banner.link
165
        t_banner.priority = banner.priority
166
        t_banner.hasMap = banner.hasMap
9155 kshitij.so 167
        t_banner.bannerType = banner.bannerType
8579 kshitij.so 168
        t_banner_list.append(t_banner)
169
    return t_banner_list
170
 
171
 
6848 kshitij.so 172
def to_t_banner_map(banner_map):
173
    t_banner_map = TBannerMap()
174
    t_banner_map.bannerName = banner_map.bannerName
175
    t_banner_map.mapLink = banner_map.mapLink
176
    t_banner_map.coordinates = banner_map.coordinates
177
    return t_banner_map
7272 amit.gupta 178
 
8579 kshitij.so 179
def to_t_uri_mapping(uriMapping):
180
    t_uri_mapping =TBannerUriMapping()
181
    t_uri_mapping.bannerName = uriMapping.bannerName
182
    t_uri_mapping.uri = uriMapping.uri
183
    t_uri_mapping.isActive = uriMapping.isActive
10097 kshitij.so 184
    t_uri_mapping.target = uriMapping.target
8579 kshitij.so 185
    return t_uri_mapping
186
 
187
def to_t_campaign(campaign):
188
    t_campaign = TCampaign()
189
    t_campaign.id = campaign.id
190
    t_campaign.campaignName = campaign.campaignName
191
    t_campaign.imageName = campaign.imageName
192
    return t_campaign
193
 
7281 kshitij.so 194
def to_t_Amazonlisted(Amazonlisted):
195
    t_amazonlisted = TAmazonlisted()
8362 kshitij.so 196
    if Amazonlisted is None:
197
        return t_amazonlisted
7281 kshitij.so 198
    t_amazonlisted.asin = Amazonlisted.asin
199
    t_amazonlisted.brand = Amazonlisted.brand 
200
    t_amazonlisted.itemid = Amazonlisted.itemId
201
    t_amazonlisted.model = Amazonlisted.model
202
    t_amazonlisted.manufacturer_name = Amazonlisted.manufacturer_name
203
    t_amazonlisted.upc = Amazonlisted.upc
204
    t_amazonlisted.part_number = Amazonlisted.part_number
205
    t_amazonlisted.name = Amazonlisted.name
206
    t_amazonlisted.ean = Amazonlisted.ean
207
    t_amazonlisted.fbaPrice = Amazonlisted.fbaPrice
10909 vikram.rag 208
    t_amazonlisted.fbbPrice = Amazonlisted.fbbPrice
7281 kshitij.so 209
    t_amazonlisted.sellingPrice = Amazonlisted.sellingPrice
210
    t_amazonlisted.isFba = Amazonlisted.isFba
10909 vikram.rag 211
    t_amazonlisted.isFbb = Amazonlisted.isFbb
7281 kshitij.so 212
    t_amazonlisted.isNonFba = Amazonlisted.isNonFba
213
    t_amazonlisted.isInventoryOverride = Amazonlisted.isInventoryOverride
214
    t_amazonlisted.color = Amazonlisted.color
215
    t_amazonlisted.category = Amazonlisted.category
7367 kshitij.so 216
    t_amazonlisted.handlingTime = Amazonlisted.handlingTime
217
    t_amazonlisted.isCustomTime = Amazonlisted.isCustomTime
7516 vikram.rag 218
    t_amazonlisted.category_code = Amazonlisted.category_code
7770 kshitij.so 219
    t_amazonlisted.mfnPriceLastUpdatedOn = to_java_date(Amazonlisted.mfnPriceLastUpdatedOn)
220
    t_amazonlisted.fbaPriceLastUpdatedOn = to_java_date(Amazonlisted.fbaPriceLastUpdatedOn)
10909 vikram.rag 221
    t_amazonlisted.fbbPriceLastUpdatedOn = to_java_date(Amazonlisted.fbbPriceLastUpdatedOn)
7770 kshitij.so 222
    t_amazonlisted.mfnPriceLastUpdatedOnSc = to_java_date(Amazonlisted.mfnPriceLastUpdatedOnSc)
10909 vikram.rag 223
    t_amazonlisted.fbbPriceLastUpdatedOnSc = to_java_date(Amazonlisted.fbbPriceLastUpdatedOnSc)
7770 kshitij.so 224
    t_amazonlisted.fbaPriceLastUpdatedOnSc = to_java_date(Amazonlisted.fbaPriceLastUpdatedOnSc)
8139 kshitij.so 225
    t_amazonlisted.suppressMfnPriceUpdate = Amazonlisted.suppressMfnPriceUpdate
8140 kshitij.so 226
    t_amazonlisted.suppressFbaPriceUpdate = Amazonlisted.suppressFbaPriceUpdate
10909 vikram.rag 227
    t_amazonlisted.suppressFbbPriceUpdate = Amazonlisted.suppressFbbPriceUpdate
8619 kshitij.so 228
    t_amazonlisted.taxCode = Amazonlisted.taxCode
10918 vikram.rag 229
    t_amazonlisted.fbbtaxCode = Amazonlisted.fbbtaxCode
7291 vikram.rag 230
    return t_amazonlisted
231
 
8182 amar.kumar 232
def to_t_ebay_item(ebay_item):
233
    t_ebay_item = TEbayItem()
234
    t_ebay_item.ebayListingId = ebay_item.ebayListingId
235
    t_ebay_item.itemId = ebay_item.itemId
236
    t_ebay_item.listingName = ebay_item.listingName
237
    t_ebay_item.listingPrice = ebay_item.listingPrice
238
    t_ebay_item.listingExpiryDate = to_java_date(ebay_item.listingExpiryDate)
239
    t_ebay_item.subsidy = ebay_item.subsidy
8274 amit.gupta 240
    return t_ebay_item
241
 
242
def to_t_brand_info(brand_info):
243
    t_brand_info = TBrandInfo()
244
    t_brand_info.name = brand_info.name
245
    t_brand_info.serviceCenterLocatorUrl = brand_info.serviceCenterLocatorUrl
8739 vikram.rag 246
    return t_brand_info
247
 
248
def to_t_snapdeal_item(snapdealitem):
8754 vikram.rag 249
    if snapdealitem is None:
8746 vikram.rag 250
        t_snapdeal_item = TSnapdealItem()
251
        return t_snapdeal_item
8739 vikram.rag 252
    t_snapdeal_item = TSnapdealItem()
8754 vikram.rag 253
    t_snapdeal_item.item_id = snapdealitem[0].item_id
8739 vikram.rag 254
    t_snapdeal_item.warehouseId = snapdealitem[0].warehouseId
255
    t_snapdeal_item.exceptionPrice = snapdealitem[0].exceptionPrice
9242 kshitij.so 256
    t_snapdeal_item.transferPrice = snapdealitem[0].transferPrice
257
    t_snapdeal_item.sellingPrice = snapdealitem[0].sellingPrice
258
    t_snapdeal_item.courierCost = snapdealitem[0].courierCost
11095 kshitij.so 259
    t_snapdeal_item.courierCostMarketplace = snapdealitem[0].courierCostMarketplace
9242 kshitij.so 260
    t_snapdeal_item.commission = snapdealitem[0].commission
261
    t_snapdeal_item.serviceTax = snapdealitem[0].serviceTax
262
    t_snapdeal_item.isListedOnSnapdeal = snapdealitem[0].isListedOnSnapdeal
263
    t_snapdeal_item.suppressPriceFeed = snapdealitem[0].suppressPriceFeed
264
    t_snapdeal_item.suppressInventoryFeed = snapdealitem[0].suppressInventoryFeed
9404 vikram.rag 265
    t_snapdeal_item.maxNlc = snapdealitem[0].maxNlc
9456 vikram.rag 266
    t_snapdeal_item.skuAtSnapdeal = snapdealitem[0].skuAtSnapdeal
9568 kshitij.so 267
    t_snapdeal_item.supc = snapdealitem[0].supc
9724 kshitij.so 268
    t_snapdeal_item.shippingTime = snapdealitem[0].shippingTime
9242 kshitij.so 269
    return t_snapdeal_item
270
 
9724 kshitij.so 271
def to_t_snapdeal_item_details(snapdealitem,snapdealItemInventory):
9242 kshitij.so 272
    if snapdealitem is None:
273
        t_snapdeal_item_details = TSnapdealItemDetails()
274
        return t_snapdeal_item_details
275
    t_snapdeal_item_details = TSnapdealItemDetails()
276
    t_snapdeal_item_details.item_id = snapdealitem[0].item_id
277
    t_snapdeal_item_details.warehouseId = snapdealitem[0].warehouseId
278
    t_snapdeal_item_details.exceptionPrice = snapdealitem[0].exceptionPrice
279
    t_snapdeal_item_details.transferPrice = snapdealitem[0].transferPrice
280
    t_snapdeal_item_details.sellingPrice = snapdealitem[0].sellingPrice
281
    t_snapdeal_item_details.courierCost = snapdealitem[0].courierCost
11095 kshitij.so 282
    t_snapdeal_item_details.courierCostMarketplace = snapdealitem[0].courierCostMarketplace
9242 kshitij.so 283
    t_snapdeal_item_details.commission = snapdealitem[0].commission
284
    t_snapdeal_item_details.serviceTax = snapdealitem[0].serviceTax
285
    t_snapdeal_item_details.brand = snapdealitem[1].brand
286
    t_snapdeal_item_details.model_name = snapdealitem[1].model_name
287
    t_snapdeal_item_details.model_number = snapdealitem[1].model_number
288
    t_snapdeal_item_details.color = snapdealitem[1].color
289
    t_snapdeal_item_details.risky = snapdealitem[1].risky
290
    t_snapdeal_item_details.itemStatus = snapdealitem[1].status
291
    t_snapdeal_item_details.isListedOnSnapdeal = snapdealitem[0].isListedOnSnapdeal
292
    t_snapdeal_item_details.weight = snapdealitem[1].weight
293
    t_snapdeal_item_details.mrp = snapdealitem[1].mrp
294
    t_snapdeal_item_details.websiteSellingPrice = snapdealitem[1].sellingPrice
295
    t_snapdeal_item_details.suppressPriceFeed = snapdealitem[0].suppressPriceFeed
296
    t_snapdeal_item_details.suppressInventoryFeed = snapdealitem[0].suppressInventoryFeed
9478 kshitij.so 297
    t_snapdeal_item_details.maxNlc = snapdealitem[0].maxNlc
9456 vikram.rag 298
    t_snapdeal_item_details.skuAtSnapdeal = snapdealitem[0].skuAtSnapdeal
9568 kshitij.so 299
    t_snapdeal_item_details.supc = snapdealitem[0].supc
9724 kshitij.so 300
    t_snapdeal_item_details.shippingTime = snapdealitem[0].shippingTime
301
    if snapdealItemInventory is not None:
302
        t_snapdeal_item_details.lastUpdatedInventory = snapdealItemInventory.availability
303
        t_snapdeal_item_details.lastUpdatedInventoryTimestamp = snapdealItemInventory.lastUpdatedOnSnapdeal 
9242 kshitij.so 304
    return t_snapdeal_item_details
9621 manish.sha 305
 
306
def to_t_product_feed_submit(productfeedsubmit):
307
    if productfeedsubmit is None:
308
        t_product_feed_submit = TProductFeedSubmit()
309
        return t_product_feed_submit
310
    t_product_feed_submit = TProductFeedSubmit()
311
    t_product_feed_submit.catalogItemId = productfeedsubmit.catalogItemId
312
    t_product_feed_submit.stockLinkedFeed = productfeedsubmit.stockLinkedFeed
9724 kshitij.so 313
    return t_product_feed_submit
314
 
315
def to_t_marketplace_items(marketplaceItem):
316
    t_marketplace_item = TMarketplaceItems() 
317
    if marketplaceItem is None:
318
        return t_marketplace_item
319
    t_marketplace_item.itemId = marketplaceItem.itemId
320
    t_marketplace_item.source = marketplaceItem.source
321
    t_marketplace_item.emiFee = marketplaceItem.emiFee
322
    t_marketplace_item.courierCost = marketplaceItem.courierCost
11095 kshitij.so 323
    t_marketplace_item.courierCostMarketplace = marketplaceItem.courierCostMarketplace
9724 kshitij.so 324
    t_marketplace_item.closingFee = marketplaceItem.closingFee
325
    t_marketplace_item.commission = marketplaceItem.commission
326
    t_marketplace_item.returnProvision = marketplaceItem.returnProvision
327
    t_marketplace_item.vat = marketplaceItem.vat
328
    t_marketplace_item.packagingCost = marketplaceItem.packagingCost
329
    t_marketplace_item.otherCost = marketplaceItem.otherCost
330
    t_marketplace_item.serviceTax = marketplaceItem.serviceTax
331
    t_marketplace_item.autoIncrement = marketplaceItem.autoIncrement
332
    t_marketplace_item.autoDecrement = marketplaceItem.autoDecrement
333
    t_marketplace_item.autoFavourite = marketplaceItem.autoFavourite
334
    t_marketplace_item.manualFavourite = marketplaceItem.manualFavourite
335
    t_marketplace_item.currentSp = marketplaceItem.currentSp
336
    t_marketplace_item.currentTp = marketplaceItem.currentTp
337
    t_marketplace_item.minimumPossibleSp = marketplaceItem.minimumPossibleSp
338
    t_marketplace_item.minimumPossibleTp = marketplaceItem.minimumPossibleTp
339
    t_marketplace_item.lastCheckedTimestamp = to_java_date(marketplaceItem.lastCheckedTimestamp)
9923 kshitij.so 340
    t_marketplace_item.maximumSellingPrice = marketplaceItem.maximumSellingPrice
10287 kshitij.so 341
    t_marketplace_item.pgFee = marketplaceItem.pgFee
9724 kshitij.so 342
    return t_marketplace_item
9776 vikram.rag 343
 
344
def to_t_marketplace_itemprice(marketplaceitemprice):
345
    t_marketplace_priceitem = TMarketPlaceItemPrice()    
346
    t_marketplace_priceitem.item_id = marketplaceitemprice.item_id
347
    t_marketplace_priceitem.source = marketplaceitemprice.source
348
    t_marketplace_priceitem.sellingPrice = marketplaceitemprice.sellingPrice
349
    t_marketplace_priceitem.lastUpdatedOn = to_java_date(marketplaceitemprice.lastUpdatedOn)
350
    t_marketplace_priceitem.lastUpdatedOnMarketplace = to_java_date(marketplaceitemprice.lastUpdatedOnMarketplace)
351
    t_marketplace_priceitem.isPriceOverride = marketplaceitemprice.suppressPriceFeed
352
    t_marketplace_priceitem.isListedOnSource = marketplaceitemprice.isListedOnSource
353
    return t_marketplace_priceitem 
9779 kshitij.so 354
 
355
def to_t_marketplacepercentage(marketplacePercentage):
356
    t_marketplacepercentage = TMarketplacePercentage()
357
    if marketplacePercentage is None:
358
        return t_marketplacepercentage
359
    t_marketplacepercentage.source =  marketplacePercentage.source
360
    t_marketplacepercentage.emiFee =  marketplacePercentage.emiFee
361
    t_marketplacepercentage.closingFee = marketplacePercentage.closingFee
362
    t_marketplacepercentage.returnProvision = marketplacePercentage.returnProvision
363
    t_marketplacepercentage.commission = marketplacePercentage.commission
364
    t_marketplacepercentage.serviceTax = marketplacePercentage.serviceTax
10287 kshitij.so 365
    t_marketplacepercentage.pgFee = marketplacePercentage.pgFee
9779 kshitij.so 366
    return t_marketplacepercentage
9945 vikram.rag 367
 
368
def to_t_flipkart_item(flipkartItem):
369
    t_flipkartitem = TFlipkartItem()
370
    if flipkartItem is None:
371
        return t_flipkartitem
10097 kshitij.so 372
    t_flipkartitem.item_id = flipkartItem[0].item_id  
373
    t_flipkartitem.exceptionPrice = flipkartItem[0].exceptionPrice
374
    t_flipkartitem.warehouseId = flipkartItem[0].warehouseId
375
    t_flipkartitem.commissionValue  =  flipkartItem[0].commissionValue
376
    t_flipkartitem.serviceTaxValue  =  flipkartItem[0].serviceTaxValue
377
    t_flipkartitem.maxNlc = flipkartItem[0].maxNlc
378
    t_flipkartitem.skuAtFlipkart = flipkartItem[0].skuAtFlipkart
379
    t_flipkartitem.isListedOnFlipkart = flipkartItem[0].isListedOnFlipkart
380
    t_flipkartitem.suppressPriceFeed = flipkartItem[0].suppressPriceFeed
381
    t_flipkartitem.suppressInventoryFeed = flipkartItem[0].suppressInventoryFeed
382
    #t_flipkartitem.updatedOn = to_java_date(flipkartItem.updatedOn)
383
    t_flipkartitem.updatedBy = flipkartItem[0].updatedBy
384
    t_flipkartitem.flipkartSerialNumber = flipkartItem[0].flipkartSerialNumber
9945 vikram.rag 385
    return t_flipkartitem
10097 kshitij.so 386
 
387
def to_t_flipkart_item_details(flipkartitem,flipkartItemInventory):
388
    if flipkartitem is None:
389
        t_flipkart_item_details = TFlipkartItemDetails()
390
        return t_flipkart_item_details
391
    t_flipkart_item_details = TFlipkartItemDetails()
392
    t_flipkart_item_details.item_id = flipkartitem[0].item_id
393
    t_flipkart_item_details.warehouseId = flipkartitem[0].warehouseId
394
    t_flipkart_item_details.exceptionPrice = flipkartitem[0].exceptionPrice
395
    t_flipkart_item_details.commission = flipkartitem[0].commissionValue
396
    t_flipkart_item_details.serviceTax = flipkartitem[0].serviceTaxValue
397
    t_flipkart_item_details.brand = flipkartitem[1].brand
398
    t_flipkart_item_details.model_name = flipkartitem[1].model_name
399
    t_flipkart_item_details.model_number = flipkartitem[1].model_number
400
    t_flipkart_item_details.color = flipkartitem[1].color
401
    t_flipkart_item_details.risky = flipkartitem[1].risky
402
    t_flipkart_item_details.itemStatus = flipkartitem[1].status
403
    t_flipkart_item_details.isListedOnFlipkart = flipkartitem[0].isListedOnFlipkart
404
    t_flipkart_item_details.weight = flipkartitem[1].weight
405
    t_flipkart_item_details.mrp = flipkartitem[1].mrp
406
    t_flipkart_item_details.websiteSellingPrice = flipkartitem[1].sellingPrice
407
    t_flipkart_item_details.suppressPriceFeed = flipkartitem[0].suppressPriceFeed
408
    t_flipkart_item_details.suppressInventoryFeed = flipkartitem[0].suppressInventoryFeed
409
    t_flipkart_item_details.maxNlc = flipkartitem[0].maxNlc
410
    t_flipkart_item_details.skuAtFlipkart = flipkartitem[0].skuAtFlipkart
411
    t_flipkart_item_details.flipkartSerialNumber = flipkartitem[0].flipkartSerialNumber
10156 amar.kumar 412
    t_flipkart_item_details.category = flipkartitem[1].category
10097 kshitij.so 413
    if flipkartItemInventory is not None:
414
        t_flipkart_item_details.lastUpdatedInventory = flipkartItemInventory.availability
415
        #t_flipkart_item_details.lastUpdatedInventoryTimestamp = flipkartItemInventory.lastUpdatedOnFlipkart 
416
    return t_flipkart_item_details
11015 kshitij.so 417
 
418
def to_t_market_place_history(marketplaceHistory):
419
    t_marketplace_history = TMarketplaceHistory()
420
    if marketplaceHistory is None:
421
        return t_marketplace_history
422
    t_marketplace_history.item_id = marketplaceHistory.item_id
423
    t_marketplace_history.source = marketplaceHistory.source
424
    t_marketplace_history.timestamp = to_java_date(marketplaceHistory.timestamp)
11076 kshitij.so 425
    if marketplaceHistory.lowestPossibleTp is None:
426
        t_marketplace_history.lowest_possible_tp =0
427
    else:
428
        t_marketplace_history.lowest_possible_tp = int(marketplaceHistory.lowestPossibleTp)
429
    if marketplaceHistory.lowestPossibleSp is None:
430
        t_marketplace_history.lowest_possible_sp = 0
431
    else:
432
        t_marketplace_history.lowest_possible_sp = int(marketplaceHistory.lowestPossibleSp)
11015 kshitij.so 433
    t_marketplace_history.ourInventory = marketplaceHistory.ourInventory
434
    t_marketplace_history.otherInventory = marketplaceHistory.otherInventory
435
    t_marketplace_history.secondLowestInventory = marketplaceHistory.secondLowestInventory
436
    t_marketplace_history.ourRank = marketplaceHistory.ourRank
11076 kshitij.so 437
    if marketplaceHistory.ourOfferPrice is None:
438
        t_marketplace_history.ourOfferPrice = 0
439
    else: 
440
        t_marketplace_history.ourOfferPrice = int(marketplaceHistory.ourOfferPrice)
441
    if marketplaceHistory.ourSellingPrice is None:
442
        t_marketplace_history.ourSellingPrice = 0
443
    else:
444
        t_marketplace_history.ourSellingPrice = int(marketplaceHistory.ourSellingPrice)
445
    if marketplaceHistory.ourTp is None:
446
        t_marketplace_history.ourTp = 0
447
    else:
448
        t_marketplace_history.ourTp = int(marketplaceHistory.ourTp)
449
    if marketplaceHistory.ourNlc is None:
450
        t_marketplace_history.ourNlc = 0
451
    else:
452
        t_marketplace_history.ourNlc = int(marketplaceHistory.ourNlc)
11015 kshitij.so 453
    t_marketplace_history.competitiveCategory = marketplaceHistory.competitiveCategory
454
    t_marketplace_history.risky = marketplaceHistory.risky
11076 kshitij.so 455
    if marketplaceHistory.lowestOfferPrice is None:
456
        t_marketplace_history.lowestOfferPrice = 0
457
    else:
458
        t_marketplace_history.lowestOfferPrice = int(marketplaceHistory.lowestOfferPrice)
459
    if marketplaceHistory.lowestSellingPrice is None:
460
        t_marketplace_history.lowestSellingPrice = 0
461
    else:
462
        t_marketplace_history.lowestSellingPrice = int(marketplaceHistory.lowestSellingPrice)
463
    if marketplaceHistory.lowestTp is None:
464
        t_marketplace_history.lowestTp = 0
465
    else:
466
        t_marketplace_history.lowestTp = int(marketplaceHistory.lowestTp)
11015 kshitij.so 467
    if marketplaceHistory.lowestSellerName is None:
468
        t_marketplace_history.lowestSellerName = ''
469
    else:
470
        t_marketplace_history.lowestSellerName = marketplaceHistory.lowestSellerName
11076 kshitij.so 471
    if marketplaceHistory.proposedSellingPrice is None:
472
        t_marketplace_history.proposedSellingPrice = 0
473
    else:
474
        t_marketplace_history.proposedSellingPrice = int(marketplaceHistory.proposedSellingPrice)
475
    if marketplaceHistory.proposedTp is None:
476
        t_marketplace_history.proposedTp = 0
477
    else:
478
        t_marketplace_history.proposedTp = int(marketplaceHistory.proposedTp)
479
    if marketplaceHistory.targetNlc is None:
480
        t_marketplace_history.targetNlc = 0
481
    else:
482
        t_marketplace_history.targetNlc = int(marketplaceHistory.targetNlc)
11015 kshitij.so 483
    t_marketplace_history.salesPotential = marketplaceHistory.salesPotential
484
    if marketplaceHistory.secondLowestSellerName is None:
485
        t_marketplace_history.secondLowestSellerName = ''
486
    else:
487
        t_marketplace_history.secondLowestSellerName = marketplaceHistory.secondLowestSellerName
11017 kshitij.so 488
    if marketplaceHistory.secondLowestSellingPrice is None:
11076 kshitij.so 489
        t_marketplace_history.secondLowestSellingPrice=0
11017 kshitij.so 490
    else:
11076 kshitij.so 491
        t_marketplace_history.secondLowestSellingPrice = int(marketplaceHistory.secondLowestSellingPrice)
11017 kshitij.so 492
    if marketplaceHistory.secondLowestOfferPrice is None:
11076 kshitij.so 493
        t_marketplace_history.secondLowestOfferPrice = 0
11017 kshitij.so 494
    else:
11076 kshitij.so 495
        t_marketplace_history.secondLowestOfferPrice = int(marketplaceHistory.secondLowestOfferPrice)
11017 kshitij.so 496
    if marketplaceHistory.secondLowestTp is None:
11076 kshitij.so 497
        t_marketplace_history.secondLowestTp=0
11017 kshitij.so 498
    else:
11076 kshitij.so 499
        t_marketplace_history.secondLowestTp = int(marketplaceHistory.secondLowestTp)
11015 kshitij.so 500
    t_marketplace_history.marginIncreasedPotential = marketplaceHistory.marginIncreasedPotential
11076 kshitij.so 501
    if marketplaceHistory.margin is None:
502
        t_marketplace_history.margin = 0
503
    else:
504
        t_marketplace_history.margin = int(marketplaceHistory.margin)
11015 kshitij.so 505
    t_marketplace_history.ourEnoughStock = marketplaceHistory.ourEnoughStock
506
    t_marketplace_history.totalSeller = marketplaceHistory.totalSeller
507
    t_marketplace_history.averageSale = marketplaceHistory.avgSales
508
    t_marketplace_history.toGroup = marketplaceHistory.toGroup
11076 kshitij.so 509
    t_marketplace_history.decision = marketplaceHistory.decision
510
    t_marketplace_history.reason = marketplaceHistory.reason
11015 kshitij.so 511
    return t_marketplace_history
9945 vikram.rag 512
 
11531 vikram.rag 513
def to_t_private_deal(private_deal_item):
514
    if private_deal_item is None:
515
        t_private_deal_item = TPrivateDeal()
516
        return t_private_deal_item
517
    t_private_deal_item = TPrivateDeal()
518
    t_private_deal_item.item_id = private_deal_item.item_id
519
    t_private_deal_item.dealPrice = private_deal_item.dealPrice
520
    t_private_deal_item.dealFreebieItemId = private_deal_item.dealFreebieItemId
11579 vikram.rag 521
    t_private_deal_item.startDate = to_java_date(private_deal_item.startDate)
522
    t_private_deal_item.endDate = to_java_date(private_deal_item.endDate)
11566 vikram.rag 523
    t_private_deal_item.dealTextOption = private_deal_item.dealTextOption
11635 vikram.rag 524
    if private_deal_item.dealText is None: 
11613 vikram.rag 525
        t_private_deal_item.dealText = ''
526
    else:
527
        t_private_deal_item.dealText = private_deal_item.dealText    
11531 vikram.rag 528
    t_private_deal_item.isCod = private_deal_item.isCod
529
    t_private_deal_item.rank = private_deal_item.rank
11566 vikram.rag 530
    t_private_deal_item.dealFreebieOption = private_deal_item.dealFreebieOption
11606 vikram.rag 531
    t_private_deal_item.isActive = private_deal_item.isActive
11905 kshitij.so 532
    return t_private_deal_item
533
 
534
def to_t_amazonoutofsync(amazonOutOfSync):
535
    t_amazonoutofsync = TAmazonOutOfSync()
536
    if amazonOutOfSync is None:
537
        return t_amazonoutofsync
538
    else:
539
        t_amazonoutofsync.item_id = amazonOutOfSync.item_id
540
        t_amazonoutofsync.mfn = amazonOutOfSync.mfn
541
        t_amazonoutofsync.fba = amazonOutOfSync.fba
542
        t_amazonoutofsync.fbb = amazonOutOfSync.fbb
543
        return t_amazonoutofsync
544
 
545
def to_t_private_deals_comparison(item):
546
    xstr = lambda s: s or ""
547
    t_pdcomp = TPdPriceComp()
548
    pdComp = item[0]
549
    catItem  = item[1]
550
    t_pdcomp.item_id = pdComp.item_id
551
    t_pdcomp.dealPrice = pdComp.dealPrice
552
    t_pdcomp.saholicPrice = pdComp.saholicPrice
553
    t_pdcomp.sdPrice = pdComp.sdPrice
554
    t_pdcomp.fkPrice = pdComp.fkPrice
555
    t_pdcomp.amazonPrice = pdComp.amazonPrice
556
    t_pdcomp.productName = xstr(catItem.brand)+" "+xstr(catItem.model_name)+" "+xstr(catItem.model_number)+" "+xstr(catItem.color)
12169 kshitij.so 557
    t_pdcomp.lastProcessedTimestamp = to_java_date(pdComp.lastProcessedTimestamp)
11905 kshitij.so 558
    return t_pdcomp
559
 
12133 kshitij.so 560
def to_t_snapdeal_marketplace_item(item):
561
    mpItem = item[1]
562
    dItem = item[2]
563
    t_sd_item = to_t_snapdeal_item(item)
564
    t_sd_item.marketplaceItems = to_t_marketplace_items(mpItem)
565
    t_sd_item.item = to_t_item(dItem)
566
    return t_sd_item
567
 
568
def to_t_flipkart_marketplace_item(item):
569
    mpItem = item[1]
570
    dItem = item[2]
571
    t_fk_item = to_t_flipkart_item(item)
572
    t_fk_item.marketplaceItems = to_t_marketplace_items(mpItem)
573
    t_fk_item.item = to_t_item(dItem)
574
    return t_fk_item
12243 kshitij.so 575
 
12256 kshitij.so 576
def to_t_competitor_pricing(compPricing):
577
    xstr = lambda s: s or ""
578
    item = compPricing[0]
579
    catItem = compPricing[1]
580
    t_comp = TCompetitorPricing()
581
    t_comp.productName = xstr(catItem.brand)+" "+xstr(catItem.model_name)+" "+xstr(catItem.model_number)+" "+xstr(catItem.color)
582
    t_comp.item_id = item.item_id
583
    t_comp.lowestSnapdealPrice = item.lowestSnapdealPrice
584
    t_comp.lowestFlipkartPrice = item.lowestFlipkartPrice
585
    t_comp.lowestAmazonPrice = item.lowestAmazonPrice
586
    t_comp.ourSnapdealPrice = item.ourSnapdealPrice
587
    t_comp.ourSnapdealOfferPrice = item.ourSnapdealOfferPrice
588
    t_comp.ourSnapdealInventory = item.ourSnapdealInventory
589
    t_comp.lowestSnapdealOfferPrice = item.lowestSnapdealOfferPrice
590
    if item.lowestSnapdealSeller is None:
591
        t_comp.lowestSnapdealSeller=''
592
    else:
593
        t_comp.lowestSnapdealSeller = item.lowestSnapdealSeller
594
    t_comp.lowestSnapdealSellerInventory = item.lowestSnapdealSellerInventory
595
    t_comp.ourFlipkartPrice = item.ourFlipkartPrice
596
    t_comp.ourFlipkartInventory = item.ourFlipkartInventory
597
    if item.lowestFlipkartSeller is None:
598
        t_comp.lowestFlipkartSeller=''
599
    else:
600
        t_comp.lowestFlipkartSeller = item.lowestFlipkartSeller
601
    t_comp.ourMfnPrice = item.ourMfnPrice
602
    t_comp.ourFbaPrice = item.ourFbaPrice
603
    t_comp.ourMfnInventory = item.ourMfnInventory
604
    t_comp.ourFbaInventory = item.ourFbaInventory
605
    t_comp.lowestAmazonPrice = item.lowestAmazonPrice
606
    if item.lowestAmazonSeller is None:
607
        t_comp.lowestAmazonSeller=''
608
    else:
609
        t_comp.lowestAmazonSeller = item.lowestAmazonSeller
610
    return t_comp
611