| Line 616... |
Line 616... |
| 616 |
costingAndDeliveryEstimateObj = None
|
616 |
costingAndDeliveryEstimateObj = None
|
| 617 |
try:
|
617 |
try:
|
| 618 |
costingAndDeliveryEstimateObj = logistics_client.getCostingAndDeliveryEstimateForPincode(orders[0].customer_pincode, transactionAmount, False, transactionWeight, billingWarehouseId, False)
|
618 |
costingAndDeliveryEstimateObj = logistics_client.getCostingAndDeliveryEstimateForPincode(orders[0].customer_pincode, transactionAmount, False, transactionWeight, billingWarehouseId, False)
|
| 619 |
except:
|
619 |
except:
|
| 620 |
try:
|
620 |
try:
|
| - |
|
621 |
#This will pass the maximum unit price of available product in all scenarios.
|
| 621 |
subOrderAmountsList = sorted(subOrderAmountsMap.keys())
|
622 |
subOrderAmountsList = sorted(subOrderAmountsMap.keys())
|
| 622 |
maxUnitPriceOrder = subOrderAmountsMap.get(subOrderAmountsList[len(subOrderAmountsList)-1])
|
623 |
maxUnitPriceOrder = subOrderAmountsMap.get(subOrderAmountsList[len(subOrderAmountsList)-1])
|
| 623 |
costingAndDeliveryEstimateObj = logistics_client.getCostingAndDeliveryEstimateForPincode(orders[0].customer_pincode, maxUnitPriceOrder.lineitems[0].unit_price, False, maxUnitPriceOrder.lineitems[0].unit_weight, billingWarehouseId, False)
|
624 |
costingAndDeliveryEstimateObj = logistics_client.getCostingAndDeliveryEstimateForPincode(orders[0].customer_pincode, maxUnitPriceOrder.lineitems[0].unit_price, False, maxUnitPriceOrder.lineitems[0].unit_weight, billingWarehouseId, False)
|
| 624 |
except:
|
625 |
except:
|
| 625 |
raise TransactionServiceException(108, "No Logistics Provider Assigned")
|
626 |
raise TransactionServiceException(108, "No Logistics Provider Assigned")
|
| Line 639... |
Line 640... |
| 639 |
else:
|
640 |
else:
|
| 640 |
shipping_delay = shipping_delay + 24 * shippingTime
|
641 |
shipping_delay = shipping_delay + 24 * shippingTime
|
| 641 |
shipping_delay = int(math.ceil(shipping_delay/24.0))
|
642 |
shipping_delay = int(math.ceil(shipping_delay/24.0))
|
| 642 |
deliveryTime = adjust_delivery_time(current_time, deliveryTime+shipping_delay)
|
643 |
deliveryTime = adjust_delivery_time(current_time, deliveryTime+shipping_delay)
|
| 643 |
shippingTime = adjust_delivery_time(current_time, shipping_delay)
|
644 |
shippingTime = adjust_delivery_time(current_time, shipping_delay)
|
| 644 |
delivery_delay = adjust_delivery_time(current_time, shipping_delay+delivery_delay)
|
645 |
delivery_delay = adjust_delivery_time(current_time, shipping_delay+delivery_delay)
|
| - |
|
646 |
#Otg is currently available to both type of users.
|
| 645 |
order.otg = costingAndDeliveryEstimateObj.otgAvailable
|
647 |
order.otg = costingAndDeliveryEstimateObj.otgAvailable
|
| 646 |
|
648 |
|
| 647 |
order.logistics_provider_id = costingAndDeliveryEstimateObj.logistics_provider_id
|
649 |
order.logistics_provider_id = costingAndDeliveryEstimateObj.logistics_provider_id
|
| 648 |
#Start:- Added by Manish Sharma for FedEx Integration - Shipment Creation on 31-Jul-2013
|
650 |
#Start:- Added by Manish Sharma for FedEx Integration - Shipment Creation on 31-Jul-2013
|
| 649 |
#order.airwaybill_no = logistics_info.airway_billno
|
651 |
#order.airwaybill_no = logistics_info.airway_billno
|
| 650 |
#order.tracking_id = order.airwaybill_no
|
652 |
#order.tracking_id = order.airwaybill_no
|
| 651 |
#End:- Added by Manish Sharma for FedEx Integration- Shipment Creation on 31-Jul-2013
|
653 |
#End:- Added by Manish Sharma for FedEx Integration- Shipment Creation on 31-Jul-2013
|
| - |
|
654 |
#TODO APR2516 Promised Delivery Time should also consider delivery delay.
|
| 652 |
order.courier_delivery_time = (current_time + datetime.timedelta(days=delivery_delay)).replace(hour=PREPAID_SHIPPING_CUTOFF_TIME, minute=0, second=0)
|
655 |
order.courier_delivery_time = (current_time + datetime.timedelta(days=delivery_delay)).replace(hour=PREPAID_SHIPPING_CUTOFF_TIME, minute=0, second=0)
|
| 653 |
order.expected_shipping_time = (current_time + datetime.timedelta(days=shippingTime)).replace(hour=PREPAID_SHIPPING_CUTOFF_TIME, minute=0, second=0)
|
656 |
order.expected_shipping_time = (current_time + datetime.timedelta(days=shippingTime)).replace(hour=PREPAID_SHIPPING_CUTOFF_TIME, minute=0, second=0)
|
| 654 |
order.promised_shipping_time = order.expected_shipping_time
|
657 |
order.promised_shipping_time = order.expected_shipping_time
|
| 655 |
order.expected_delivery_time = (current_time + datetime.timedelta(days=deliveryTime)).replace(hour=PREPAID_SHIPPING_CUTOFF_TIME, minute=0, second=0)
|
658 |
order.expected_delivery_time = (current_time + datetime.timedelta(days=deliveryTime)).replace(hour=PREPAID_SHIPPING_CUTOFF_TIME, minute=0, second=0)
|
| 656 |
order.promised_delivery_time = order.expected_delivery_time
|
659 |
order.promised_delivery_time = order.expected_delivery_time
|
| Line 3664... |
Line 3667... |
| 3664 |
raise TransactionServiceException(114, "This order can't be refunded")
|
3667 |
raise TransactionServiceException(114, "This order can't be refunded")
|
| 3665 |
|
3668 |
|
| 3666 |
if order.status in [OrderStatus.COD_VERIFICATION_PENDING, OrderStatus.SUBMITTED_FOR_PROCESSING, OrderStatus.INVENTORY_LOW, OrderStatus.LOW_INV_PO_RAISED, OrderStatus.LOW_INV_REVERSAL_IN_PROCESS, OrderStatus.LOW_INV_NOT_AVAILABLE_AT_HOTSPOT, OrderStatus.ACCEPTED]:
|
3669 |
if order.status in [OrderStatus.COD_VERIFICATION_PENDING, OrderStatus.SUBMITTED_FOR_PROCESSING, OrderStatus.INVENTORY_LOW, OrderStatus.LOW_INV_PO_RAISED, OrderStatus.LOW_INV_REVERSAL_IN_PROCESS, OrderStatus.LOW_INV_NOT_AVAILABLE_AT_HOTSPOT, OrderStatus.ACCEPTED]:
|
| 3667 |
__update_inventory_reservation(order)
|
3670 |
__update_inventory_reservation(order)
|
| 3668 |
order.statusDescription = "Order Cancelled"
|
3671 |
order.statusDescription = "Order Cancelled"
|
| - |
|
3672 |
#Shipment Id and Airway Bill No should be none in case of Cancellation
|
| - |
|
3673 |
order.logisticsTransactionId = None
|
| - |
|
3674 |
order.airwaybill_no = None
|
| 3669 |
elif order.status == OrderStatus.BILLED:
|
3675 |
elif order.status == OrderStatus.BILLED:
|
| 3670 |
__create_return_order(order)
|
3676 |
__create_return_order(order)
|
| 3671 |
order.statusDescription = "Order Cancelled"
|
3677 |
order.statusDescription = "Order Cancelled"
|
| 3672 |
elif order.status in [OrderStatus.RTO_RECEIVED_PRESTINE, OrderStatus.RTO_RECEIVED_DAMAGED, OrderStatus.RTO_LOST_IN_TRANSIT]:
|
3678 |
elif order.status in [OrderStatus.RTO_RECEIVED_PRESTINE, OrderStatus.RTO_RECEIVED_DAMAGED, OrderStatus.RTO_LOST_IN_TRANSIT]:
|
| 3673 |
if order.status != OrderStatus.RTO_LOST_IN_TRANSIT:
|
3679 |
if order.status != OrderStatus.RTO_LOST_IN_TRANSIT:
|
| Line 8596... |
Line 8602... |
| 8596 |
|
8602 |
|
| 8597 |
errorString = ""
|
8603 |
errorString = ""
|
| 8598 |
missingString = "Billing Details Missing for following Orders:- "
|
8604 |
missingString = "Billing Details Missing for following Orders:- "
|
| 8599 |
|
8605 |
|
| 8600 |
for ordObj in grouppedOrders:
|
8606 |
for ordObj in grouppedOrders:
|
| 8601 |
if ordObj.id not in orderIds:
|
8607 |
if ordObj.id not in orderIds and ordObj.status==OrderStatus.ACCEPTED :
|
| 8602 |
errorString = errorString + "Order Id:- " +str(ordObj.id) +" "
|
8608 |
errorString = errorString + "Order Id:- " +str(ordObj.id) +" "
|
| 8603 |
|
8609 |
|
| 8604 |
if len(errorString)>0:
|
8610 |
if len(errorString)>0:
|
| 8605 |
raise TransactionServiceException(301, missingString + errorString)
|
8611 |
raise TransactionServiceException(301, missingString + errorString)
|
| 8606 |
|
8612 |
|