Subversion Repositories SmartDukaan

Rev

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

Rev 1405 Rev 1528
Line 11... Line 11...
11
    get_returnable_orders_for_customer, get_cancellable_orders_for_customer, get_orders_by_billing_date,\
11
    get_returnable_orders_for_customer, get_cancellable_orders_for_customer, get_orders_by_billing_date,\
12
    get_all_orders, change_order_status, get_alerts, set_alert, add_billing_details,\
12
    get_all_orders, change_order_status, get_alerts, set_alert, add_billing_details,\
13
    mark_orders_as_manifested, close_session, accept_order, bill_order, mark_orders_as_picked_up,\
13
    mark_orders_as_manifested, close_session, accept_order, bill_order, mark_orders_as_picked_up,\
14
    mark_orders_as_delivered, mark_orders_as_failed, add_jacket_number,\
14
    mark_orders_as_delivered, mark_orders_as_failed, add_jacket_number,\
15
    order_outofstock, batch_orders, update_non_delivery_reason, enqueue_transaction_info_email,\
15
    order_outofstock, batch_orders, update_non_delivery_reason, enqueue_transaction_info_email,\
16
    get_undelivered_orders
16
    get_undelivered_orders, get_order_for_customer
17
 
17
 
18
from shop2020.model.v1.order.impl.Convertors import to_t_transaction,\
18
from shop2020.model.v1.order.impl.Convertors import to_t_transaction,\
19
    to_t_alert, to_t_order, to_t_lineitem
19
    to_t_alert, to_t_order, to_t_lineitem
20
from shop2020.thriftpy.model.v1.order.ttypes import Transaction, OrderStatus,\
20
from shop2020.thriftpy.model.v1.order.ttypes import Transaction, OrderStatus,\
21
    LineItem, Order
21
    LineItem, Order
Line 105... Line 105...
105
        try:
105
        try:
106
            return change_transaction_status(transactionId, status, description)
106
            return change_transaction_status(transactionId, status, description)
107
        finally:
107
        finally:
108
            close_session()
108
            close_session()
109
            
109
            
110
    def getOrdersForTransaction(self, transactionId):
110
    def getOrdersForTransaction(self, transactionId, customerId):
111
        """
111
        """
-
 
112
        Returns list of orders for given transaction Id. Also filters based on customer Id so that
-
 
113
        only user who owns the transaction can view its order details.
-
 
114
        
112
        Parameters:
115
        Parameters:
113
         - transactionId
116
         - transactionId
-
 
117
         - customerId
114
        """
118
        """
115
        try:
119
        try:
116
            orders = get_orders_for_transaction(transactionId)
120
            orders = get_orders_for_transaction(transactionId, customerId)
117
            return [to_t_order(order) for order in orders]    
121
            return [to_t_order(order) for order in orders]    
118
        finally:
122
        finally:
119
            close_session()
123
            close_session()
120
            
124
            
121
    def getAllOrders(self, status, from_date, to_date, warehouse_id):
125
    def getAllOrders(self, status, from_date, to_date, warehouse_id):
Line 216... Line 220...
216
            
220
            
217
            orders = get_orders_for_customer(customerId, current_from_date, current_to_date, status)
221
            orders = get_orders_for_customer(customerId, current_from_date, current_to_date, status)
218
            return [to_t_order(order) for order in orders]
222
            return [to_t_order(order) for order in orders]
219
        finally:
223
        finally:
220
            close_session()
224
            close_session()
-
 
225
    
-
 
226
    def getOrderForCustomer(self, orderId, customerId):
-
 
227
        """
-
 
228
        Returns an order for the order Id. Also checks if the order belongs to the customer whose Id is passed.
-
 
229
        Throws exception if either order Id is invalid or order does not below to the customer whose Id is passed.
-
 
230
        
-
 
231
        Parameters:
-
 
232
         - customerId
-
 
233
         - orderId
-
 
234
        """
-
 
235
        try:
-
 
236
            return to_t_order(get_order_for_customer(orderId, customerId))
-
 
237
        finally:
-
 
238
            close_session()
221
            
239
            
222
    def getOrder(self, id):
240
    def getOrder(self, id):
223
        """
241
        """
224
        Parameters:
242
        Parameters:
225
         - id
243
         - id