Subversion Repositories SmartDukaan

Rev

Rev 7723 | Rev 7739 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 7723 Rev 7730
Line 3432... Line 3432...
3432
    order.promised_shipping_time = order.expected_shipping_time
3432
    order.promised_shipping_time = order.expected_shipping_time
3433
    order.promised_delivery_time = order.expected_delivery_time 
3433
    order.promised_delivery_time = order.expected_delivery_time 
3434
 
3434
 
3435
    session.commit()
3435
    session.commit()
3436
 
3436
 
-
 
3437
def convert_store_to_normal(orderId):
-
 
3438
    """
-
 
3439
    This method is used to convert a pickup in store order into a normal one.
-
 
3440
    """
-
 
3441
    order = get_order(orderId)
-
 
3442
    
-
 
3443
    deliveryType = DeliveryType.PREPAID
-
 
3444
    if order.cod:
-
 
3445
        deliveryType = DeliveryType.COD
-
 
3446
        
-
 
3447
    
-
 
3448
    logistics_client = LogisticsClient().get_client()
-
 
3449
    logistics_info = logistics_client.getLogisticsEstimation(order.lineitems[0].item_id, order.customer_pincode, deliveryType)
-
 
3450
 
-
 
3451
    # Check for new estimate. Raise exception if new address is not serviceable
-
 
3452
    if logistics_info.deliveryTime == -1:
-
 
3453
        raise TransactionServiceException(1, 'Location not serviceable')
-
 
3454
 
-
 
3455
    # COD services are not available everywhere
-
 
3456
    if order.cod:
-
 
3457
        if not logistics_info.codAllowed:
-
 
3458
            raise TransactionServiceException(2, 'COD service not available')
-
 
3459
 
-
 
3460
    if logistics_info.providerId != order.logistics_provider_id:
-
 
3461
        #logistics_info = logistics_client.getLogisticsInfo(address.pin, order.lineitems[0].item_id, type, PickUpType.COURIER)
-
 
3462
        order.tracking_id = logistics_info.airway_billno
-
 
3463
        order.airwaybill_no = logistics_info.airway_billno
-
 
3464
        order.logistics_provider_id = logistics_info.providerId
-
 
3465
        current_time = datetime.datetime.now()
-
 
3466
        logistics_info.deliveryTime = adjust_delivery_time(current_time, logistics_info.deliveryTime)
-
 
3467
        logistics_info.shippingTime = adjust_delivery_time(current_time, logistics_info.shippingTime)
-
 
3468
        logistics_info.deliveryDelay = adjust_delivery_time(current_time, (logistics_info.shippingTime+logistics_info.deliveryDelay))
-
 
3469
        
-
 
3470
    order.pickupStoreId = 0
-
 
3471
    session.commit()
-
 
3472
    return True
-
 
3473
 
3437
def mark_order_cancellation_request_received(orderId):
3474
def mark_order_cancellation_request_received(orderId):
3438
    """
3475
    """
3439
    Mark order as cancellation request received. If customer sends request of cancellation of
3476
    Mark order as cancellation request received. If customer sends request of cancellation of
3440
    a particular order, this method will be called. It will just change status of the order
3477
    a particular order, this method will be called. It will just change status of the order
3441
    depending on its current status. It also records the previous status, so that we can move
3478
    depending on its current status. It also records the previous status, so that we can move