Subversion Repositories SmartDukaan

Rev

Rev 19587 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
13569 amit.gupta 1
'''
2
Created on Jan 16, 2015
3
 
4
@author: amit
5
'''
14460 amit.gupta 6
from datetime import datetime
16399 amit.gupta 7
from dtr.utils.utils import ORDER_PLACED
14460 amit.gupta 8
import time
13569 amit.gupta 9
class AffiliateInfo():
10
 
11
 
12
    subTagId = None
13
    adId = None
14
    adDate = None
15
    payOut = None
16
    offerName = None
17
    storeId = None
18
    saleAmount = None
19
    saleDate = None
14460 amit.gupta 20
    saleTime = None
14418 amit.gupta 21
    conversionStatus = None
13569 amit.gupta 22
    ip = None
16970 amit.gupta 23
    orderId = None
14418 amit.gupta 24
    missingOrder = None
16970 amit.gupta 25
    productCode = None
26
    unitPrice = None
27
    quantity = None
13569 amit.gupta 28
    def __init__(self,subTagId, storeId, conversionStatus, adId, saleDate, payOut, offerName, ip, saleAmount):
29
        self.subTagId = subTagId
30
        self.conversionStatus = conversionStatus
31
        self.adId = adId
32
        self.payOut = payOut
33
        self.offerName = offerName
34
        self.ip = ip
35
        self.saleAmount = saleAmount
36
        self.storeId = storeId
37
        self.saleDate = saleDate
14418 amit.gupta 38
        self.missingOrder = True
13569 amit.gupta 39
 
40
    def __repr__(self):
41
        return None
42
 
14418 amit.gupta 43
class FlipkartAffiliateInfo():
44
 
45
 
46
    subTagId = None
47
    productCode = None
48
    price = None
49
    quantity = None
14460 amit.gupta 50
    category = None
14418 amit.gupta 51
    payOut = None
52
    saleAmount = None
53
    storeId = None
54
    saleDate = None
55
    conversionStatus = None
56
    missingOrder = None
14460 amit.gupta 57
    saleDateInt = None
14418 amit.gupta 58
 
14460 amit.gupta 59
    def __init__(self,subTagId, saleDate, productCode, price, quantity, saleAmount, payOut, conversionStatus, category):
14418 amit.gupta 60
        self.subTagId = subTagId
61
        self.conversionStatus = conversionStatus
62
        self.payOut = payOut
63
        self.saleAmount = saleAmount
14460 amit.gupta 64
        self.productCode = productCode
14418 amit.gupta 65
        self.storeId = 2
66
        self.saleDate = saleDate
67
        self.price = price
68
        self.quantity = quantity
69
        self.missingOrder = True
14460 amit.gupta 70
        self.category = category
71
        self.saleDateInt = int(time.mktime(datetime.strptime(saleDate, "%Y-%m-%d").timetuple()))
14418 amit.gupta 72
 
73
    def __repr__(self):
74
        return None
14650 amit.gupta 75
 
76
class AmazonAffiliateInfo():
77
    productLine = None
78
    dateOrdered = None
79
    time = None
80
    linkType = None
81
    trackingId= None
82
    directConversion = None
83
    directClicks = None
84
    directOrderedQuantity = None
85
    indirectOrderedQuantity = None
86
    totalOrderedQuantity = None
87
    subTagId = None
88
    def __init__(self,productLine, dateOrdered, linkType, trackingId, directConversion, directClicks, directOrderedQuantity, indirectOrderedQuantity, totalOrderedQuantity, subTagId):
89
        self.productLine = productLine
90
        self.dateOrdered = dateOrdered
91
        self.linkType = linkType
92
        self.trackingId = trackingId
93
        self.directConversion = directConversion
94
        self.directClicks = directClicks
95
        self.directOrderedQuantity= directOrderedQuantity
96
        self.indirectOrderedQuantity = indirectOrderedQuantity
97
        self.totalOrderedQuantity = totalOrderedQuantity
98
        self.subTagId = subTagId
99
        self.time = int(time.mktime(datetime.strptime(dateOrdered, "%B %d, %Y").timetuple()))
14418 amit.gupta 100
 
14650 amit.gupta 101
class AmazonAffiliateConversionInfo():
102
    productLine = None
103
    seller = None
104
    trackingId = None
105
    dateShipped = None
106
    price = None
107
    referralFeeRate = None
108
    quantity = None
109
    revenue = None
110
    earnings = None
111
    subTag = None
112
 
113
    subTag = None
114
    def __init__(self,productLine, seller, trackingId, dateShipped, price, referralFeeRate, quantity,revenue, earnings, subTag):
115
        self.productLine = productLine
116
        self.seller = seller
117
        self.trackingId = trackingId
118
        self.dateShipped = dateShipped
119
        self.price = price
120
        self.referralFeeRate = referralFeeRate
121
        self.quantity = quantity
122
        self.revenue= revenue
123
        self.earnings = earnings
124
        self.subTag = subTag
125
 
15791 manish.sha 126
class ShopCluesAffiliateInfo():
127
    subTagId = None
128
    transactionTime = None
129
    transactionId = None
130
    orderRef = None
131
    merchantOrderId = None
132
    merchantName= None
133
    productCode = None
134
    productName = None
135
    payOut = None
136
    transactionValue = None
137
    uniqueKey = None
138
    clickTime = None
139
    status = None
140
 
141
    def __init__(self,subTagId, transactionTime, transactionId, orderRef, merchantOrderId, merchantName, productCode, productName,payOut, transactionValue, uniqueKey, clickTime, status):
142
        self.subTagId = subTagId
143
        self.transactionTime = int(time.mktime(datetime.strptime(transactionTime,"%Y-%m-%dT%H:%M:%S").timetuple()))
144
        self.transactionId = transactionId
145
        self.orderRef = orderRef
146
        self.merchantOrderId = merchantOrderId
147
        self.merchantName= merchantName
148
        self.productCode = productCode
149
        self.productName = productName
150
        self.payOut = payOut
151
        self.transactionValue = transactionValue
152
        self.uniqueKey = uniqueKey
153
        self.clickTime = int(time.mktime(datetime.strptime(clickTime,"%Y-%m-%dT%H:%M:%S").timetuple()))
154
        self.status = status
16631 manish.sha 155
 
17013 manish.sha 156
 
16631 manish.sha 157
class HomeShopAffiliateInfo():
158
    subTagId = None
159
    transactionTime = None
160
    transactionId = None
161
    orderRef = None
162
    merchantOrderId = None
163
    merchantName= None
164
    productCode = None
165
    productName = None
166
    payOut = None
167
    transactionValue = None
168
    uniqueKey = None
169
    clickTime = None
170
    status = None
171
 
15791 manish.sha 172
 
16631 manish.sha 173
    def __init__(self,subTagId, transactionTime, transactionId, orderRef, merchantOrderId, merchantName, productCode, productName,payOut, transactionValue, uniqueKey, clickTime, status):
174
        self.subTagId = subTagId
175
        self.transactionTime = int(time.mktime(datetime.strptime(transactionTime,"%Y-%m-%dT%H:%M:%S").timetuple()))
176
        self.transactionId = transactionId
177
        self.orderRef = orderRef
178
        self.merchantOrderId = merchantOrderId
179
        self.merchantName= merchantName
180
        self.productCode = productCode
181
        self.productName = productName
182
        self.payOut = payOut
183
        self.transactionValue = transactionValue
184
        self.uniqueKey = uniqueKey
185
        self.clickTime = int(time.mktime(datetime.strptime(clickTime,"%Y-%m-%dT%H:%M:%S").timetuple()))
17013 manish.sha 186
        self.status = status   
14650 amit.gupta 187
 
13576 amit.gupta 188
class Order():
13577 amit.gupta 189
    orderId = None
13576 amit.gupta 190
    subOrders = None
191
    deliveryCharges = None
192
    userId = None
14023 amit.gupta 193
    merchantOrderId = None
13576 amit.gupta 194
    storeId = None
195
    discountApplied = None
196
    subTagId = None
197
    closed = None
198
    placedOn = None
199
    totalAmount = None
200
    paidAmount = None
201
    orderSuccessUrl = None
14145 amit.gupta 202
    orderTrackingUrl = None
14171 amit.gupta 203
    createdOn = None
16970 amit.gupta 204
    createdOnInt = None
14291 amit.gupta 205
    requireDetail = None
14699 amit.gupta 206
    def __init__(self, orderId, userId, subTagId, storeId, orderSuccessUrl, new = True):
13577 amit.gupta 207
        self.orderId = orderId
13576 amit.gupta 208
        self.userId = userId
209
        self.subTagId = subTagId
14699 amit.gupta 210
        self.closed = False
13576 amit.gupta 211
        self.storeId = storeId
212
        self.orderSuccessUrl = orderSuccessUrl
14938 amit.gupta 213
        self.requireDetail = False
14699 amit.gupta 214
        if new:
14735 amit.gupta 215
            created = datetime.now()
216
            self.createdOn = str(created)
217
            self.createdOnInt = int(time.mktime(created.timetuple()))
13576 amit.gupta 218
 
219
class SubOrder():
220
    status = None
221
    productTitle = None
222
    estimatedDeliveryDate  = None
14356 amit.gupta 223
    estimatedShippingDate  = None
13576 amit.gupta 224
    productCode  = None
13721 amit.gupta 225
    detailedStatus  = None
13576 amit.gupta 226
    merchantSubOrderId  = None
227
    productUrl  = None
228
    courierName  = None
13664 amit.gupta 229
    unitPrice  = None
230
    amountPaid  = None 
13576 amit.gupta 231
    offerDiscount  = None
13664 amit.gupta 232
    deliveryCharges  = None
13576 amit.gupta 233
    tracingkUrl  = None
14246 amit.gupta 234
    orderDetailUrl = None
13576 amit.gupta 235
    placedOn  = None
236
    trackingNumber  = None
237
    quantity  = None
13610 amit.gupta 238
    cashBackStatus = None
239
    cashBackAmount = None
13721 amit.gupta 240
    cashBackPercentage = None
13690 amit.gupta 241
    imgUrl = None
13610 amit.gupta 242
    closed = None
13781 amit.gupta 243
    missingAff = None
13576 amit.gupta 244
 
16399 amit.gupta 245
    def __init__(self, productTitle, productUrl, placedOn, amountPaid, status=ORDER_PLACED, quantity = 1):
13576 amit.gupta 246
        self.productTitle = productTitle
247
        self.productUrl = productUrl
248
        self.placedOn = placedOn
249
        self.amountPaid = amountPaid
250
        self.status = status
14097 amit.gupta 251
        self.quantity = quantity
13610 amit.gupta 252
        self.closed = False
13781 amit.gupta 253
        self.missingAff = True
14532 kshitij.so 254
 
255
class FeaturedDeals():
13576 amit.gupta 256
 
19247 kshitij.so 257
    def __init__(self, skuBundleId, thresholdPrice, rank):
258
        self.skuBundleId = skuBundleId
14532 kshitij.so 259
        self.thresholdPrice = thresholdPrice
16547 kshitij.so 260
        self.rank = rank
13576 amit.gupta 261
 
19247 kshitij.so 262
 
14725 amit.gupta 263
class obj(object):
264
    def __init__(self, d):
265
        for a, b in d.items():
266
            if isinstance(b, (list, tuple)):
267
                setattr(self, a, [obj(x) if isinstance(x, dict) else x for x in b])
268
            else:
16547 kshitij.so 269
                setattr(self, a, obj(b) if isinstance(b, dict) else b)
270
 
271
class AppTransactions():
16914 manish.sha 272
    def __init__(self, app_id, retailer_id, transaction_time, redirect_url, payout_status, payout_description, cashback_status, cash_back_description, payout_amount, payout_time, offer_price, overridenCashBack ,isCashBackOverriden, user_payout, final_user_payout):
16547 kshitij.so 273
        self.app_id = app_id
274
        self.retailer_id = retailer_id
275
        self.transaction_time = transaction_time
276
        self.redirect_url = redirect_url
277
        self.payout_status = payout_status
278
        self.payout_description = payout_description
279
        self.cashback_status = cashback_status
280
        self.cash_back_description = cash_back_description
281
        self.payout_amount = payout_amount
282
        self.payout_time = payout_time
283
        self.offer_price = offer_price
284
        self.overridenCashBack = overridenCashBack
285
        self.isCashBackOverriden = isCashBackOverriden
16552 kshitij.so 286
        self.user_payout = user_payout
16914 manish.sha 287
        self.final_user_payout = final_user_payout
16547 kshitij.so 288
 
16631 manish.sha 289
class AppOfferObj():
16733 manish.sha 290
    def __init__(self, app_id, appmaster_id, app_name, affiliate_offer_id, image_url, downloads, link, offer_price, offerCategory, package_name, promoImage, ratings, user_payout, shortDescription, longDescription, customerOneLiner, retailerOneLiner, priority, offerCondition, location):
16631 manish.sha 291
        self.app_id = app_id
292
        self.appmaster_id= appmaster_id
293
        self.app_name = app_name
294
        self.affiliate_offer_id = affiliate_offer_id
295
        self.image_url = image_url
296
        self.downloads = downloads
297
        self.link = link
298
        self.offer_price = offer_price 
299
        self.offerCategory = offerCategory
300
        self.package_name = package_name
301
        self.promoImage = promoImage
302
        self.ratings = ratings
303
        self.user_payout = user_payout
304
        self.shortDescription = shortDescription
305
        self.longDescription = longDescription
306
        self.customerOneLiner = customerOneLiner
307
        self.retailerOneLiner = retailerOneLiner
308
        self.priority = priority
16698 manish.sha 309
        self.offerCondition = offerCondition
16733 manish.sha 310
        self.location = location
16547 kshitij.so 311
 
16727 manish.sha 312
class UserAppBatchDrillDown():
313
    def __init__(self, dateVal, downloads, amount):
314
        self.dateVal = dateVal
315
        self.downloads = downloads
316
        self.amount = amount
16547 kshitij.so 317
 
16727 manish.sha 318
class UserAppBatchDateDrillDown():
319
    def __init__(self, appName, downloads, amount):
320
        self.appName = appName
321
        self.downloads = downloads
322
        self.amount = amount
16547 kshitij.so 323
 
19247 kshitij.so 324
class ProductInfo:
325
 
326
    def __init__(self, _id, skuBundleId, sourceProductId, sourceCategoryId, source_url ,source, source_id, category, category_id ,\
327
                 offer, cashback, available_price, mrp, thumbnail, brand, model_name, product_name, source_product_name, \
328
                 url, stock_status, in_stock, rank, identifier,addedOn,updatedOn,secondaryIdentifier,marketPlaceUrl,status, \
329
                 priceUpdatedOn, tagline, is_shortage, brand_id,maxPrice,buyBoxFlag,coupon,codAvailable,gross_price,ignorePricing,quantity, \
19587 kshitij.so 330
                 videoLink,showVideo,subCategoryId,subCategory,showMrp,shippingCost, showNetPrice,internalRank):
19247 kshitij.so 331
        self. _id = _id
332
        self.addedOn =       addedOn
333
        self.available_price =       available_price
334
        self.brand   =       brand
335
        self.cashback=       cashback
336
        self.category=       category
337
        self.category_id     =       category_id
338
        self.identifier      =       identifier
339
        self.in_stock=       in_stock
340
        self.marketPlaceUrl  =       marketPlaceUrl
341
        self.model_name      =       model_name
342
        self.mrp     =       mrp
343
        self.product_name    =       product_name
344
        self.rank    =       rank
345
        self.secondaryIdentifier     =       secondaryIdentifier
346
        self.skuBundleId     =       skuBundleId
347
        self.source  =       source
348
        self.sourceCategoryId=sourceCategoryId
349
        self.sourceProductId=sourceProductId
350
        self.source_id=source_id
351
        self.source_product_name     =       source_product_name
352
        self.source_url      =       source_url
353
        self.status  =       status
354
        self.stock_status    =       stock_status
355
        self.thumbnail       =       thumbnail
356
        self.updatedOn       =       updatedOn
357
        self.url     =       url
358
        self.priceUpdatedOn  =       priceUpdatedOn
359
        self.offer   =       offer
360
        self.tagline =       tagline
361
        self.is_shortage     =       is_shortage
362
        self.brand_id=       brand_id
363
        self.maxPrice=       maxPrice
364
        self.buyBoxFlag      =       buyBoxFlag
365
        self.coupon  =       coupon
366
        self.codAvailable    =       codAvailable
367
        self.gross_price     =       gross_price
368
        self.ignorePricing   =       ignorePricing
369
        self.quantity=       quantity
370
        self.videoLink       =       videoLink
371
        self.showVideo       =       showVideo
372
        self.subCategoryId   =       subCategoryId
373
        self.subCategory     =       subCategory
374
        self.showMrp =       showMrp
375
        self.shippingCost    =       shippingCost
19587 kshitij.so 376
        self.showNetPrice = showNetPrice
377
        self.internalRank = internalRank 
19291 kshitij.so 378
 
379
class Promotion:
380
    def __init__(self, offer_id,offer_name,offer_description , categories_applicable, sub_categories_not_applicable,
19332 kshitij.so 381
                     startDate, endDate, target1, target1_cash_back_percetage, target2, target2_cash_back_percetage, maxCashBack, url,
19351 kshitij.so 382
                     pending_order_value, delivered_order_value, last_run_timestamp):
19291 kshitij.so 383
            self.offer_id = offer_id
384
            self.offer_name = offer_name
385
            self.offer_description = offer_description
386
            self.categories_applicable = categories_applicable
387
            self.sub_categories_not_applicable = sub_categories_not_applicable
388
            self.startDate = startDate
389
            self.endDate = endDate 
390
            self.target1 = target1
391
            self.target1_cash_back_percetage = target1_cash_back_percetage
392
            self.target2 = target2
393
            self.target2_cash_back_percetage = target2_cash_back_percetage
394
            self.maxCashBack = maxCashBack
395
            self.url = url
19332 kshitij.so 396
            self.pending_order_value = pending_order_value
397
            self.delivered_order_value = delivered_order_value
19351 kshitij.so 398
            self.last_run_timestamp = last_run_timestamp
19341 kshitij.so 399
 
400
class NotificationCampaign:
21261 kshitij.so 401
    def __init__(self, campaignId, name, title, message, sql, url, created, expiresat, type, status, sendsms, messagetext, smsprocessed, notification_processed, notification_type, image=""):
19341 kshitij.so 402
        self._id = campaignId
403
        self.name = name
404
        self.title = title
405
        self.message = message
406
        self.sql = sql
407
        self.url = url
408
        self.created = created
409
        self.expiresat = expiresat
410
        self.type = type
411
        self.status = status
412
        self.sendsms = sendsms
413
        self.messagetext = messagetext 
414
        self.smsprocessed = smsprocessed
415
        self.notification_processed = notification_processed
416
        self.notification_type = notification_type 
417
        self.notification_long_text = None
21261 kshitij.so 418
        self.image = image
19451 manas 419
 
420
class CrmRefundWallet:
421
    def __init__(self, user_id,email_id,mobile,amount,type,store,reference_no,reference_desc,status,created):
422
        self.user_id = user_id
423
        self.email_id = email_id
424
        self.mobile = mobile
425
        self.amount = amount
426
        self.type = type
427
        self.store = store
428
        self.reference_no = reference_no
429
        self.reference_desc = reference_desc
430
        self.status = status
431
        self.created_timestamp = created
19482 manas 432
        self.batchId = None
19497 manas 433
        self.update_timestamp = None
434
        self.approved_by = None