| Line 168... |
Line 168... |
| 168 |
subOrder.deliveryCharges = deliveryCharges
|
168 |
subOrder.deliveryCharges = deliveryCharges
|
| 169 |
subOrder.offerDiscount = offerDiscount
|
169 |
subOrder.offerDiscount = offerDiscount
|
| 170 |
subOrder.unitPrice = unitPrice
|
170 |
subOrder.unitPrice = unitPrice
|
| 171 |
subOrder.productCode = re.findall(r'\d+$', productUrl)[0]
|
171 |
subOrder.productCode = re.findall(r'\d+$', productUrl)[0]
|
| 172 |
(cashbackAmount, percentage) = self.getCashbackAmount(subOrder.productCode, amount)
|
172 |
(cashbackAmount, percentage) = self.getCashbackAmount(subOrder.productCode, amount)
|
| 173 |
cashbackStatus = Store.CB_INIT
|
173 |
cashbackStatus = Store.CB_PENDING
|
| 174 |
if cashbackAmount <= 0:
|
174 |
if cashbackAmount <= 0:
|
| 175 |
cashbackStatus = Store.CB_NA
|
175 |
cashbackStatus = Store.CB_NA
|
| 176 |
subOrder.cashBackStatus = cashbackStatus
|
176 |
subOrder.cashBackStatus = cashbackStatus
|
| 177 |
subOrder.cashBackAmount = cashbackAmount
|
177 |
subOrder.cashBackAmount = cashbackAmount
|
| 178 |
if percentage > 0:
|
178 |
if percentage > 0:
|
| Line 280... |
Line 280... |
| 280 |
updateMap["subOrders.$.detailedStatus"] = detailedStatus
|
280 |
updateMap["subOrders.$.detailedStatus"] = detailedStatus
|
| 281 |
status = self._getStatusFromDetailedStatus(detailedStatus)
|
281 |
status = self._getStatusFromDetailedStatus(detailedStatus)
|
| 282 |
closedStatus = status in [Store.ORDER_DELIVERED, Store.ORDER_CANCELLED]
|
282 |
closedStatus = status in [Store.ORDER_DELIVERED, Store.ORDER_CANCELLED]
|
| 283 |
updateMap["subOrders.$.status"] = status
|
283 |
updateMap["subOrders.$.status"] = status
|
| 284 |
if detailedStatus == 'Closed For Vendor Reallocation':
|
284 |
if detailedStatus == 'Closed For Vendor Reallocation':
|
| 285 |
#if it is more than 6hours mark closed assuming it would be relocated in 6 hours.
|
285 |
#if it is more than 6hours mark closed.
|
| 286 |
closeAt = subOrder.get("closeAt")
|
286 |
closeAt = subOrder.get("closeAt")
|
| 287 |
if closeAt is None:
|
287 |
if closeAt is None:
|
| 288 |
closeAt = datetime.now() + timedelta(hours=6)
|
288 |
closeAt = datetime.now() + timedelta(hours=6)
|
| 289 |
updateMap["subOrders.$.closeAt"] = closeAt
|
289 |
updateMap["subOrders.$.closeAt"] = datetime.strftime(closeAt,"%Y-%m-%d %H:%M:%S")
|
| 290 |
else:
|
290 |
else:
|
| - |
|
291 |
closeAt = datetime.strptime(closeAt,"%Y-%m-%d %H:%M:%S")
|
| 291 |
if datetime.now() > closeAt:
|
292 |
if datetime.now() > closeAt:
|
| 292 |
closedStatus = True
|
293 |
closedStatus = True
|
| 293 |
|
294 |
|
| 294 |
|
295 |
|
| 295 |
if closedStatus:
|
296 |
if closedStatus:
|