Subversion Repositories SmartDukaan

Rev

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

Rev 2026 Rev 2035
Line 112... Line 112...
112
        raise ShoppingCartException(101, "quantity cannot be null")    
112
        raise ShoppingCartException(101, "quantity cannot be null")    
113
 
113
 
114
    cart = Cart.get_by(id = cart_id)
114
    cart = Cart.get_by(id = cart_id)
115
    if not cart:
115
    if not cart:
116
        raise ShoppingCartException(101, "no cart attached to this id")
116
        raise ShoppingCartException(101, "no cart attached to this id")
-
 
117
    inventory_client = InventoryClient().get_client()
-
 
118
    if not inventory_client.isActive(item_id):
-
 
119
        return inventory_client.getItemStatusDescription(item_id)
117
    
120
    
118
    current_time = datetime.datetime.now()
121
    current_time = datetime.datetime.now()
119
    cart.updated_on = current_time
122
    cart.updated_on = current_time
120
    line = get_line(item_id, cart_id, None,True)
123
    line = get_line(item_id, cart_id, None,True)
121
    if line:
124
    if line:
Line 129... Line 132...
129
        line.quantity = quantity
132
        line.quantity = quantity
130
        line.created_on = current_time
133
        line.created_on = current_time
131
        line.updated_on = current_time
134
        line.updated_on = current_time
132
        line.line_status = LineStatus.LINE_ACTIVE
135
        line.line_status = LineStatus.LINE_ACTIVE
133
    session.commit()
136
    session.commit()
-
 
137
    return None
134
    #validate_cart(cart_id)
138
    #validate_cart(cart_id)
135
 
139
 
136
def delete_item_from_cart(cart_id, item_id):
140
def delete_item_from_cart(cart_id, item_id):
137
    if not item_id:
141
    if not item_id:
138
        raise ShoppingCartException(101, "item_id cannot be null")
142
        raise ShoppingCartException(101, "item_id cannot be null")