| Line 4649... |
Line 4649... |
| 4649 |
if order:
|
4649 |
if order:
|
| 4650 |
order.customer_address1 = line1
|
4650 |
order.customer_address1 = line1
|
| 4651 |
order.customer_address2 = line2
|
4651 |
order.customer_address2 = line2
|
| 4652 |
order.customer_city = city
|
4652 |
order.customer_city = city
|
| 4653 |
order.customer_state = state
|
4653 |
order.customer_state = state
|
| - |
|
4654 |
|
| - |
|
4655 |
# Start:- Added/Modified by Manish Sharma on 13 May 2013 for Change Shipping Address functionality
|
| - |
|
4656 |
if order.customer_pincode != pin :
|
| - |
|
4657 |
type = DeliveryType.PREPAID
|
| - |
|
4658 |
if order.cod:
|
| - |
|
4659 |
type = DeliveryType.COD
|
| - |
|
4660 |
logistics_client = LogisticsClient().get_client()
|
| - |
|
4661 |
logistics_info = logistics_client.getLogisticsEstimation(order.lineitems[0].item_id, pin, type)
|
| - |
|
4662 |
|
| - |
|
4663 |
# Check for new estimate. Raise exception if new address is not serviceable
|
| - |
|
4664 |
if logistics_info.deliveryTime == -1:
|
| - |
|
4665 |
raise TransactionServiceException(1, 'Location not serviceable')
|
| - |
|
4666 |
|
| - |
|
4667 |
# COD services are not available everywhere
|
| - |
|
4668 |
if order.cod:
|
| - |
|
4669 |
if not logistics_info.codAllowed:
|
| - |
|
4670 |
raise TransactionServiceException(2, 'COD service not available')
|
| - |
|
4671 |
|
| - |
|
4672 |
logistics_info_new = logistics_client.getLogisticsInfo(pin, order.lineitems[0].item_id, type, PickUpType.COURIER)
|
| - |
|
4673 |
order.tracking_id = logistics_info_new.airway_billno
|
| - |
|
4674 |
order.airwaybill_no = logistics_info_new.airway_billno
|
| - |
|
4675 |
order.logistics_provider_id = logistics_info_new.providerId
|
| - |
|
4676 |
current_time = datetime.datetime.now()
|
| - |
|
4677 |
|
| - |
|
4678 |
logistics_info.deliveryTime = adjust_delivery_time(current_time, logistics_info.deliveryTime)
|
| - |
|
4679 |
logistics_info.shippingTime = adjust_delivery_time(current_time, logistics_info.shippingTime)
|
| - |
|
4680 |
logistics_info.deliveryDelay = adjust_delivery_time(current_time, (logistics_info.shippingTime+logistics_info.deliveryDelay))
|
| - |
|
4681 |
new_expected_shipping_time_cod = (current_time + datetime.timedelta(days=logistics_info.shippingTime)).replace(hour=COD_SHIPPING_CUTOFF_TIME, minute=0, second=0)
|
| - |
|
4682 |
new_expected_shipping_time_prepaid = (current_time + datetime.timedelta(days=logistics_info.shippingTime)).replace(hour=PREPAID_SHIPPING_CUTOFF_TIME, minute=0, second=0)
|
| - |
|
4683 |
|
| - |
|
4684 |
if order.cod:
|
| - |
|
4685 |
if order.expected_shipping_time.date() == new_expected_shipping_time_cod.date() :
|
| - |
|
4686 |
if order.otg :
|
| - |
|
4687 |
order.otg = logistics_info.otgAvailable
|
| - |
|
4688 |
else:
|
| - |
|
4689 |
if order.otg:
|
| - |
|
4690 |
order.otg = False
|
| - |
|
4691 |
order.expected_shipping_time = new_expected_shipping_time_cod
|
| - |
|
4692 |
order.expected_delivery_time = (current_time + datetime.timedelta(days=logistics_info.deliveryTime)).replace(hour=COD_SHIPPING_CUTOFF_TIME, minute=0, second=0)
|
| - |
|
4693 |
order.courier_delivery_time = (current_time + datetime.timedelta(days=logistics_info.deliveryDelay)).replace(hour=COD_SHIPPING_CUTOFF_TIME, minute=0, second=0)
|
| - |
|
4694 |
else:
|
| - |
|
4695 |
if order.expected_shipping_time.date() == new_expected_shipping_time_prepaid.date() :
|
| - |
|
4696 |
if order.otg :
|
| - |
|
4697 |
order.otg = logistics_info.otgAvailable
|
| - |
|
4698 |
else:
|
| - |
|
4699 |
if order.otg:
|
| - |
|
4700 |
order.otg = False
|
| - |
|
4701 |
order.expected_shipping_time = new_expected_shipping_time_prepaid
|
| - |
|
4702 |
order.expected_delivery_time = (current_time + datetime.timedelta(days=logistics_info.deliveryTime)).replace(hour=PREPAID_SHIPPING_CUTOFF_TIME, minute=0, second=0)
|
| - |
|
4703 |
order.courier_delivery_time = (current_time + datetime.timedelta(days=logistics_info.deliveryDelay)).replace(hour=PREPAID_SHIPPING_CUTOFF_TIME, minute=0, second=0)
|
| - |
|
4704 |
|
| 4654 |
order.customer_pin = pin
|
4705 |
order.customer_pincode = pin
|
| - |
|
4706 |
# End:- Added/Modified by Manish Sharma on 13 May 2013 for Change Shipping Address functionality
|
| 4655 |
session.commit()
|
4707 |
session.commit()
|
| 4656 |
return True
|
4708 |
return True
|
| 4657 |
return False
|
4709 |
return False
|
| 4658 |
|
4710 |
|
| 4659 |
def get_recharge_transactions(storeId):
|
4711 |
def get_recharge_transactions(storeId):
|