| Line 170... |
Line 170... |
| 170 |
productTitle = brand + (" " + modelName if modelName else "") + (" " + modelNumber if modelNumber is not None else "") + ("(" + color +")" if color else "")
|
170 |
productTitle = brand + (" " + modelName if modelName else "") + (" " + modelNumber if modelNumber is not None else "") + ("(" + color +")" if color else "")
|
| 171 |
amountPaid = order['total_amount']- order['gvAmount']
|
171 |
amountPaid = order['total_amount']- order['gvAmount']
|
| 172 |
subOrder = SubOrder(productTitle, None, datetime.strftime(datetime.fromtimestamp(order['created_timestamp']/1000),"%d %B %Y"), amountPaid)
|
172 |
subOrder = SubOrder(productTitle, None, datetime.strftime(datetime.fromtimestamp(order['created_timestamp']/1000),"%d %B %Y"), amountPaid)
|
| 173 |
subOrder.merchantSubOrderId = str(order['id'])
|
173 |
subOrder.merchantSubOrderId = str(order['id'])
|
| 174 |
subOrder.orderDetailUrl = "http://m.saholic.com/order/" + subOrder.merchantSubOrderId
|
174 |
subOrder.orderDetailUrl = "http://m.saholic.com/order/" + subOrder.merchantSubOrderId
|
| 175 |
|
175 |
subOrder.quantity = int(lineitem['quantity'])
|
| 176 |
subOrder.estimatedDeliveryDate = datetime.strftime(datetime.fromtimestamp(order['promised_delivery_time']/1000),"%d %B %Y")
|
176 |
subOrder.estimatedDeliveryDate = datetime.strftime(datetime.fromtimestamp(order['promised_delivery_time']/1000),"%d %B %Y")
|
| 177 |
subOrder.imgUrl = item['imgUrl']
|
177 |
subOrder.imgUrl = item['imgUrl']
|
| 178 |
subOrder.productUrl = "http://m.saholic.com/" + item['url']
|
178 |
subOrder.productUrl = "http://m.saholic.com/" + item['url']
|
| 179 |
subOrder.productCode = item['url'].split('-')[-1]
|
179 |
subOrder.productCode = item['url'].split('-')[-1]
|
| 180 |
subOrder.detailedStatus = order['statusDescription']
|
180 |
subOrder.detailedStatus = order['statusDescription']
|
| 181 |
(cashbackAmount, percentage) = self.getCashbackAmount(subOrder.productCode, amountPaid)
|
181 |
(cashbackAmount, percentage) = self.getCashbackAmount(subOrder.productCode, amountPaid/subOrder.quantity)
|
| 182 |
dealRank = getDealRank(subOrder.productCode, self.store_id, self.userId)
|
182 |
dealRank = getDealRank(subOrder.productCode, self.store_id, self.userId)
|
| 183 |
subOrder.dealRank = dealRank.get('rank')
|
183 |
subOrder.dealRank = dealRank.get('rank')
|
| 184 |
subOrder.rankDesc = dealRank.get('description')
|
184 |
subOrder.rankDesc = dealRank.get('description')
|
| 185 |
subOrder.maxNlc = dealRank.get('maxNlc')
|
185 |
subOrder.maxNlc = dealRank.get('maxNlc')
|
| 186 |
subOrder.minNlc = dealRank.get('minNlc')
|
186 |
subOrder.minNlc = dealRank.get('minNlc')
|
| Line 188... |
Line 188... |
| 188 |
subOrder.itemStatus = dealRank.get('status')
|
188 |
subOrder.itemStatus = dealRank.get('status')
|
| 189 |
cashbackStatus = Store.CB_PENDING
|
189 |
cashbackStatus = Store.CB_PENDING
|
| 190 |
if cashbackAmount <= 0:
|
190 |
if cashbackAmount <= 0:
|
| 191 |
cashbackStatus = Store.CB_NA
|
191 |
cashbackStatus = Store.CB_NA
|
| 192 |
subOrder.cashBackStatus = cashbackStatus
|
192 |
subOrder.cashBackStatus = cashbackStatus
|
| 193 |
subOrder.cashBackAmount = cashbackAmount
|
193 |
subOrder.cashBackAmount = cashbackAmount*subOrder.quantity
|
| 194 |
if percentage > 0:
|
194 |
if percentage > 0:
|
| 195 |
subOrder.cashBackPercentage = percentage
|
195 |
subOrder.cashBackPercentage = percentage
|
| 196 |
return subOrder
|
196 |
return subOrder
|
| 197 |
def _getStatusFromDetailedStatus(self, detailedStatus):
|
197 |
def _getStatusFromDetailedStatus(self, detailedStatus):
|
| 198 |
for key, value in Store.OrderStatusMap.iteritems():
|
198 |
for key, value in Store.OrderStatusMap.iteritems():
|
| Line 311... |
Line 311... |
| 311 |
|
311 |
|
| 312 |
store = getStore(4)
|
312 |
store = getStore(4)
|
| 313 |
#store.scrapeStoreOrders()
|
313 |
#store.scrapeStoreOrders()
|
| 314 |
#store._isSubOrderActive(8, "5970688907")
|
314 |
#store._isSubOrderActive(8, "5970688907")
|
| 315 |
#store.scrapeAffiliate()
|
315 |
#store.scrapeAffiliate()
|
| 316 |
store.parseOrderRawHtml(112345, "subtagId", 1122323, "html", 'http://www.saholic.com/pay-success?paymentId=1719484')
|
316 |
store.parseOrderRawHtml(112345, "subtagId", 1122323, "html", 'http://www.saholic.com/pay-success?paymentId=1798123')
|
| 317 |
#print store.getCashbackAmount('1011378', 500)
|
317 |
#print store.getCashbackAmount('1011378', 500)
|
| 318 |
|
318 |
|
| 319 |
|
319 |
|
| 320 |
if __name__ == '__main__':
|
320 |
if __name__ == '__main__':
|
| 321 |
main()
|
321 |
main()
|