| Line 531... |
Line 531... |
| 531 |
elif new_status == TransactionStatus.AUTHORIZED or new_status == TransactionStatus.FLAGGED:
|
531 |
elif new_status == TransactionStatus.AUTHORIZED or new_status == TransactionStatus.FLAGGED:
|
| 532 |
user_client = UserClient().get_client()
|
532 |
user_client = UserClient().get_client()
|
| 533 |
catalog_client = CatalogClient().get_client()
|
533 |
catalog_client = CatalogClient().get_client()
|
| 534 |
|
534 |
|
| 535 |
pdu = user_client.getPrivateDealUser(transaction.orders[0].customer_id)
|
535 |
pdu = user_client.getPrivateDealUser(transaction.orders[0].customer_id)
|
| - |
|
536 |
print "pdu.isFofo----", pdu.isFofo
|
| 536 |
if pdu.isFofo:
|
537 |
if pdu.isFofo:
|
| 537 |
fofoDealMap = catalog_client.getAllFofoDeals([order.lineitems[0].item_id], [4,7])
|
538 |
fofoDealMap = catalog_client.getAllFofoDeals([order.lineitems[0].item_id], [4,7])
|
| 538 |
if fofoDealMap:
|
539 |
if fofoDealMap:
|
| 539 |
itemIds = []
|
540 |
itemIds = []
|
| 540 |
for order in transaction.orders:
|
541 |
for order in transaction.orders:
|
| 541 |
itemIds.append(order.lineitems[0].item_id)
|
542 |
itemIds.append(order.lineitems[0].item_id)
|
| 542 |
inventory_client = InventoryClient().get_client()
|
543 |
inventory_client = InventoryClient().get_client()
|
| - |
|
544 |
print "calling getFofoFulFillmentWarehouseMap"
|
| 543 |
fofoWarehousesMap = inventory_client.getFofoFulFillmentWarehouseMap(itemIds)
|
545 |
fofoWarehousesMap = inventory_client.getFofoFulFillmentWarehouseMap(itemIds)
|
| - |
|
546 |
print "called getFofoFulFillmentWarehouseMap"
|
| 544 |
|
547 |
|
| 545 |
|
548 |
|
| 546 |
expectedDelayMap = {}
|
549 |
expectedDelayMap = {}
|
| 547 |
billingWarehouseIdMap = {}
|
550 |
billingWarehouseIdMap = {}
|
| 548 |
billingWarehouseTxnMap = {}
|
551 |
billingWarehouseTxnMap = {}
|
| Line 561... |
Line 564... |
| 561 |
#After we got payment success, we will set logistics info also
|
564 |
#After we got payment success, we will set logistics info also
|
| 562 |
logistics_client = LogisticsClient().get_client()
|
565 |
logistics_client = LogisticsClient().get_client()
|
| 563 |
#FIXME line item is only one now. If multiple will come, need to fix.
|
566 |
#FIXME line item is only one now. If multiple will come, need to fix.
|
| 564 |
item_id = order.lineitems[0].item_id
|
567 |
item_id = order.lineitems[0].item_id
|
| 565 |
if pickUp == PickUpType.RUNNER or pickUp == PickUpType.SELF:
|
568 |
if pickUp == PickUpType.RUNNER or pickUp == PickUpType.SELF:
|
| 566 |
logistics_info = logistics_client.getLogisticsInfo(order.customer_pincode, item_id, DeliveryType.PREPAID, pickUp)
|
569 |
print 'fofoWarehousesMap', fofoWarehousesMap
|
| 567 |
current_time = datetime.datetime.now()
|
570 |
current_time = datetime.datetime.now()
|
| 568 |
logistics_info.deliveryTime = adjust_delivery_time(current_time, logistics_info.deliveryTime)
|
571 |
logistics_info = logistics_client.getLogisticsInfo(order.customer_pincode, item_id, DeliveryType.PREPAID, pickUp)
|
| 569 |
logistics_info.shippingTime = adjust_delivery_time(current_time, logistics_info.shippingTime)
|
- |
|
| 570 |
logistics_info.deliveryDelay = adjust_delivery_time(current_time, (logistics_info.shippingTime+logistics_info.deliveryDelay))
|
- |
|
| 571 |
|
- |
|
| 572 |
order.otg = logistics_info.otgAvailable
|
- |
|
| 573 |
order.warehouse_id = logistics_info.warehouseId
|
- |
|
| 574 |
order.fulfilmentWarehouseId = logistics_info.fulfilmentWarehouseId
|
- |
|
| 575 |
order.logistics_provider_id = logistics_info.providerId
|
572 |
order.logistics_provider_id = logistics_info.providerId
|
| 576 |
|
- |
|
| 577 |
order.courier_delivery_time = (current_time + datetime.timedelta(days=logistics_info.deliveryDelay)).replace(hour=PREPAID_SHIPPING_CUTOFF_TIME, minute=0, second=0)
|
- |
|
| 578 |
order.expected_shipping_time = (current_time + datetime.timedelta(days=logistics_info.shippingTime)).replace(hour=PREPAID_SHIPPING_CUTOFF_TIME, minute=0, second=0)
|
- |
|
| 579 |
order.promised_shipping_time = order.expected_shipping_time
|
- |
|
| 580 |
order.expected_delivery_time = (current_time + datetime.timedelta(days=logistics_info.deliveryTime)).replace(hour=PREPAID_SHIPPING_CUTOFF_TIME, minute=0, second=0)
|
- |
|
| 581 |
order.promised_delivery_time = order.expected_delivery_time
|
- |
|
| 582 |
|
- |
|
| 583 |
inventory_client = InventoryClient().get_client()
|
- |
|
| 584 |
if fofoWarehousesMap:
|
573 |
if fofoWarehousesMap:
|
| 585 |
order.fulfilmentWarehouseId = fofoWarehousesMap.get(item_id).id
|
574 |
order.fulfilmentWarehouseId = fofoWarehousesMap.get(item_id).id
|
| 586 |
order.warehouse_id = fofoWarehousesMap.get(item_id).billingWarehouseId
|
575 |
order.warehouse_id = fofoWarehousesMap.get(item_id).billingWarehouseId
|
| - |
|
576 |
else:
|
| - |
|
577 |
logistics_info.deliveryTime = adjust_delivery_time(current_time, logistics_info.deliveryTime)
|
| - |
|
578 |
logistics_info.shippingTime = adjust_delivery_time(current_time, logistics_info.shippingTime)
|
| - |
|
579 |
logistics_info.deliveryDelay = adjust_delivery_time(current_time, (logistics_info.shippingTime+logistics_info.deliveryDelay))
|
| - |
|
580 |
|
| - |
|
581 |
order.courier_delivery_time = (current_time + datetime.timedelta(days=logistics_info.deliveryDelay)).replace(hour=PREPAID_SHIPPING_CUTOFF_TIME, minute=0, second=0)
|
| - |
|
582 |
order.expected_shipping_time = (current_time + datetime.timedelta(days=logistics_info.shippingTime)).replace(hour=PREPAID_SHIPPING_CUTOFF_TIME, minute=0, second=0)
|
| - |
|
583 |
order.promised_shipping_time = order.expected_shipping_time
|
| - |
|
584 |
order.expected_delivery_time = (current_time + datetime.timedelta(days=logistics_info.deliveryTime)).replace(hour=PREPAID_SHIPPING_CUTOFF_TIME, minute=0, second=0)
|
| - |
|
585 |
order.promised_delivery_time = order.expected_delivery_time
|
| - |
|
586 |
|
| - |
|
587 |
order.warehouse_id = logistics_info.warehouseId
|
| - |
|
588 |
order.fulfilmentWarehouseId = logistics_info.fulfilmentWarehouseId
|
| - |
|
589 |
order.otg = False
|
| - |
|
590 |
|
| - |
|
591 |
|
| - |
|
592 |
inventory_client = InventoryClient().get_client()
|
| 587 |
|
593 |
|
| 588 |
# if OrderType.B2B == order.orderType:
|
594 |
# if OrderType.B2B == order.orderType:
|
| 589 |
# #get state
|
595 |
# #get state
|
| 590 |
# stateMaster = fetchStateMaster()
|
596 |
# stateMaster = fetchStateMaster()
|
| 591 |
# stateId = -1
|
597 |
# stateId = -1
|