Subversion Repositories SmartDukaan

Rev

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

Rev 612 Rev 636
Line 256... Line 256...
256
    t_order.expected_delivery_time = to_java_date(datetime.datetime.now()) + 60*60*1000*logistics_info.delivery_estimate
256
    t_order.expected_delivery_time = to_java_date(datetime.datetime.now()) + 60*60*1000*logistics_info.delivery_estimate
257
    t_order.warehouse_id = logistics_info.warehouse_id
257
    t_order.warehouse_id = logistics_info.warehouse_id
258
 
258
 
259
    return t_order
259
    return t_order
260
        
260
        
261
def create_line_item(catalog_item_id):
261
def create_line_item(item_id):
262
    inventory_client = InventoryClient().get_client()
262
    inventory_client = InventoryClient().get_client()
263
    catalog_item = inventory_client.getItemByCatalogId(catalog_item_id)
263
    item = inventory_client.getItem(item_id)
264
    t_line_item = TLineItem()
264
    t_line_item = TLineItem()
265
    t_line_item.model_name = catalog_item.modelName
265
    t_line_item.model_name = item.modelName
266
    t_line_item.model_number = catalog_item.modelNumber
266
    t_line_item.model_number = item.modelNumber
267
    t_line_item.extra_info = catalog_item.featureDescription
267
    t_line_item.extra_info = item.featureDescription
268
    t_line_item.brand = catalog_item.manufacturerName
268
    t_line_item.brand = item.manufacturerName
269
    t_line_item.sku_id = catalog_item.vendorItemId
269
    t_line_item.sku_id = item.vendorItemId
270
    t_line_item.quantity = 1
270
    t_line_item.quantity = 1
271
    t_line_item.unit_price = catalog_item.sellingPrice
271
    t_line_item.unit_price = item.sellingPrice
272
    t_line_item.unit_weight = catalog_item.weight
272
    t_line_item.unit_weight = item.weight
273
    t_line_item.total_price = catalog_item.sellingPrice
273
    t_line_item.total_price = item.sellingPrice
274
    t_line_item.total_weight = catalog_item.weight
274
    t_line_item.total_weight = item.weight
275
    return t_line_item
275
    return t_line_item
276
 
276
 
277
def get_address_string(address):
277
def get_address_string(address):
278
    return address.line_1 + "\n" + address.line_2 + "\nLandmark: " + address.landmark + "\n" + address.city + "\n" + address.state + "\n" + address.country
278
    return address.line_1 + "\n" + address.line_2 + "\nLandmark: " + address.landmark + "\n" + address.city + "\n" + address.state + "\n" + address.country
279
    
279
    
Line 290... Line 290...
290
    if cart.address_id:
290
    if cart.address_id:
291
        address = Address.get_by(id=cart.address_id)
291
        address = Address.get_by(id=cart.address_id)
292
        customer_pincode = address.pin
292
        customer_pincode = address.pin
293
    for line in cart_lines:
293
    for line in cart_lines:
294
        old_estimate = line.estimate
294
        old_estimate = line.estimate
295
        catalog_item_id = line.item_id
295
        item_id = line.item_id
296
        if inventory_client.isActive(catalog_item_id):
296
        if inventory_client.isActive(item_id):
297
            if customer_pincode:
297
            if customer_pincode:
298
                #FIXME: Provider ID should be returned by the same call and shouldn't be hard-coded as 1
298
                #FIXME: Provider ID should be returned by the same call and shouldn't be hard-coded as 1
299
                try:
299
                try:
300
                    item_delivery_estimate = logistics_client.getLogisticsEstimation(catalog_item_id, customer_pincode, 1).shippingTime
300
                    item_delivery_estimate = logistics_client.getLogisticsEstimation(item_id, customer_pincode, 1).shippingTime
301
                except:
301
                except:
302
                    item_delivery_estimate = 72
302
                    item_delivery_estimate = 72
303
                if old_estimate != item_delivery_estimate:
303
                if old_estimate != item_delivery_estimate:
304
                    line.estimate = item_delivery_estimate
304
                    line.estimate = item_delivery_estimate
305
                    retval = False
305
                    retval = False