| Line 22... |
Line 22... |
| 22 |
class Store(MStore):
|
22 |
class Store(MStore):
|
| 23 |
OrderStatusMap = {
|
23 |
OrderStatusMap = {
|
| 24 |
main.Store.ORDER_PLACED : ['in process', 'ready to be shipped', 'order recieved', 'order received', 'pending confirmation', 'waiting for courier pickup'],
|
24 |
main.Store.ORDER_PLACED : ['in process', 'ready to be shipped', 'order recieved', 'order received', 'pending confirmation', 'waiting for courier pickup'],
|
| 25 |
main.Store.ORDER_DELIVERED : ['delivered'],
|
25 |
main.Store.ORDER_DELIVERED : ['delivered'],
|
| 26 |
main.Store.ORDER_SHIPPED : ['in transit', 'shipped'],
|
26 |
main.Store.ORDER_SHIPPED : ['in transit', 'shipped'],
|
| 27 |
main.Store.ORDER_CANCELLED : ['failed', 'payment failed']
|
27 |
main.Store.ORDER_CANCELLED : ['failed', 'payment failed', 'cancelled']
|
| 28 |
|
28 |
|
| 29 |
}
|
29 |
}
|
| 30 |
def __init__(self,store_id):
|
30 |
def __init__(self,store_id):
|
| 31 |
client = MongoClient('mongodb://localhost:27017/')
|
31 |
client = MongoClient('mongodb://localhost:27017/')
|
| 32 |
self.db = client.dtr
|
32 |
self.db = client.dtr
|
| Line 142... |
Line 142... |
| 142 |
order = Order(orderId, userId, subTagId, self.store_id, orderSuccessUrl)
|
142 |
order = Order(orderId, userId, subTagId, self.store_id, orderSuccessUrl)
|
| 143 |
order.deliveryCharges = ordermap.get("shipping_charges") - ordermap.get("shipping_discount")
|
143 |
order.deliveryCharges = ordermap.get("shipping_charges") - ordermap.get("shipping_discount")
|
| 144 |
order.merchantOrderId = str(ordermap.get("id"))
|
144 |
order.merchantOrderId = str(ordermap.get("id"))
|
| 145 |
order.discountApplied = ordermap.get("discount_amount")
|
145 |
order.discountApplied = ordermap.get("discount_amount")
|
| 146 |
order.paidAmount = ordermap.get("grandtotal")
|
146 |
order.paidAmount = ordermap.get("grandtotal")
|
| 147 |
order.placedOn = ordermap.get("date") + " "+ ordermap.get("time")
|
147 |
order.placedOn = datetime.strftime(getISTDate(ordermap.get("created_at")),"%d-%m-%Y %H:%M:%S")
|
| 148 |
order.requireDetail = False
|
148 |
order.requireDetail = False
|
| 149 |
order.status = 'success'
|
149 |
order.status = 'success'
|
| 150 |
order.totalAmount = ordermap.get("subtotal")
|
150 |
order.totalAmount = ordermap.get("subtotal")
|
| 151 |
subOrders = []
|
151 |
subOrders = []
|
| 152 |
order.subOrders = subOrders
|
152 |
order.subOrders = subOrders
|
| Line 211... |
Line 211... |
| 211 |
return tzDate
|
211 |
return tzDate
|
| 212 |
|
212 |
|
| 213 |
def main():
|
213 |
def main():
|
| 214 |
store = getStore(6)
|
214 |
store = getStore(6)
|
| 215 |
#store.scrapeStoreOrders()
|
215 |
#store.scrapeStoreOrders()
|
| 216 |
store.parseOrderRawHtml(312119, 'SUB1', 14, readSSh("/root/paytm.json"), "someurl")
|
216 |
store.parseOrderRawHtml(312119, 'SUB1', 14, readSSh("/home/amit/paytm.json"), "someurl")
|
| 217 |
#print store.getTrackingUrls(14)
|
217 |
#print store.getTrackingUrls(14)
|
| 218 |
|
218 |
|
| 219 |
if __name__ == '__main__':
|
219 |
if __name__ == '__main__':
|
| 220 |
main()
|
220 |
main()
|
| 221 |
|
221 |
|