Rev 2611 | Rev 2675 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
namespace java in.shop2020.model.v1.ordernamespace py shop2020.thriftpy.model.v1.order/***Order objects.*/enum OrderStatus{PAYMENT_PENDING,PAYMENT_FAILED,INIT,SUBMITTED_FOR_PROCESSING,ACCEPTED,INVENTORY_LOW,REJECTED,BILLED,READY_FOR_SHIPPING,SHIPPED_FROM_WH,SHIPPED_TO_LOGST,IN_TRANSIT,DELIVERY_SUCCESS,DELIVERY_FAILED_FIRST_ATTEMPT,DELIVERY_FAILED_SECOND_ATTEMPT,DELIVERY_FAILED_THIRD_ATTEMPT,DELIVERY_FAILED_WORNG_ADDRESSCOMPLETED,CANCELED,FAILED,SALES_RETURN_IN_TRANSIT,SALES_RET_RECEIVED,DOA_PICKUP_REQUESTED,DOA_RETURN_AUTHORIZED,DOA_RETURN_IN_TRANSIT,DOA_RECEIVED,DOA_CERT_INVALID,DOA_CERT_VALID,SALES_RET_RESHIPPED,DOA_INVALID_RESHIPPED,DOA_RESHIPPED,SALES_RET_REFUNDED,DOA_VALID_REFUNDED,DOA_INVALID_REFUNDED,REFUNDED}enum TransactionStatus{INIT,IN_PROCESS,COMPLETED,FAILED}struct LineItem{1:i64 id,2:i64 item_id,3:string productGroup4:string brand,5:string model_number,6:string color7:string model_name,8:string extra_info,9:double quantity,10:double unit_price,11:double unit_weight,12:double total_price,13:double transfer_price,14:double total_weight}struct Order{1:i64 id,2:i64 warehouse_id,/**item info**/3:list<LineItem> lineitems,/**logistics info**/4:i64 logistics_provider_id,5:string airwaybill_no,6:string tracking_id,7:i64 expected_delivery_time,/**customer info**/8:i64 customer_id,9:string customer_name,10:string customer_mobilenumber,11:string customer_pincode,12:string customer_address1,13:string customer_address2,14:string customer_email,15:string customer_city,16:string customer_state,/**status and misc info**/17:OrderStatus status,18:string statusDescription,19:double total_amount,20:double total_weight,/**billing info**/21:string invoice_number,22:string billed_by,/**timestamps**/23:i64 created_timestamp,24:i64 accepted_timestamp,25:i64 billing_timestamp,26:i64 shipping_timestamp,27:i64 pickup_timestamp,28:i64 delivery_timestamp,29:i64 outofstock_timestamp,30:i64 jacket_number,31:string receiver,32:i64 batchNo,33:i64 serialNo,34:bool doaFlag,35:string pickupRequestNo}struct Transaction{1:i64 id,2:list<Order> orders,3:i64 createdOn,4:TransactionStatus transactionStatus,5:string statusDescription,6:i64 shoppingCartid,7:i64 customer_id,8:string coupon_code}struct Alert{1:i64 id,2:i64 order_id,3:i64 type,4:i64 time_set,5:string comment,6:i64 time_unset}exception TransactionServiceException{1:i32 errorCode,2:string message}service TransactionService{/*** For closing the open session in sqlalchemy*/void closeSession(),i64 createTransaction(1:Transaction transaction) throws (1:TransactionServiceException ex),// Get transaction methods.Transaction getTransaction(1:i64 id) throws (1:TransactionServiceException ex),list<Transaction> getTransactionsForCustomer(1:i64 customerId, 2:i64 from_date, 3:i64 to_date, 4:TransactionStatus status) throws (1:TransactionServiceException ex),list<Transaction> getTransactionsForShoppingCartId(1:i64 shoppingCartId) throws (1:TransactionServiceException ex),TransactionStatus getTransactionStatus(1:i64 transactionId) throws (1:TransactionServiceException ex),bool changeTransactionStatus(1:i64 transactionId, 2:TransactionStatus status, 3:string description) throws (1:TransactionServiceException ex),bool enqueueTransactionInfoEmail(1:i64 transactionId) throws (1:TransactionServiceException ex),// Order getter and setters/*list<Transaction> getTransactionsForShipmentStatus(1:ShipmentStatus status, 2:i64 from_date, 3:i64 to_date) throws (1:TransactionServiceException ex),list<Transaction> getTransactionsForCustomer(1:i64 customerId, 2:i64 from_date, 3:i64 to_date, 4:TransactionStatus status) throws (1:TransactionServiceException ex),list<Transaction> getTransactionsForCustomerAndShipmentStatus(1:i64 customerId, 2:i64 from_date, 3:i64 to_date, 4:ShipmentStatus status) throws (1:TransactionServiceException ex),list<Transaction> getTransactionsForShoppingCartId(1:i64 shoppingCartId) throws (1:TransactionServiceException ex),TransactionStatus getTransactionStatus(1:i64 transactionId) throws (1:TransactionServiceException ex),bool changeTransactionStatus(1:i64 transactionId, 2:TransactionStatus status, 3:string description) throws (1:TransactionServiceException ex),*/list<Order> getAllOrders(1:OrderStatus status, 2:i64 from_date, 3:i64 to_date, 4:i64 warehouse_id) throws (1:TransactionServiceException ex),/**Returns orders within a range of their billing dates*/list<Order> getOrdersByBillingDate(1:OrderStatus status, 2:i64 start_billing_date, 3:i64 end_billing_date, 4:i64 warehouse_id) throws (1:TransactionServiceException ex),/**Returns order ids for orders which can be returned*/list<i64> getReturnableOrdersForCustomer(1:i64 customer_id, 2:i64 limit) throws (1:TransactionServiceException ex),/**Returns order ids for orders which can be cancelled*/list<i64> getCancellableOrdersForCustomer(1:i64 customer_id, 2:i64 limit) throws (1:TransactionServiceException ex),bool changeOrderStatus(1:i64 orderId, 2:OrderStatus status, 3:string description) throws (1:TransactionServiceException ex),/**Add billing details such as the bill number and the biller to the Order.*/bool addBillingDetails(1:i64 orderId, 2:string invoice_number, 3:string billed_by) throws (1:TransactionServiceException ex),/**Adds jacket number and IMEI no. to the order. Doesn't update the IMEI no. if a -1 is supplied.Also marks the order as billed and sets the billing timestamp.Return false if it doesn't find the order with the given ID.*/bool addJacketNumber(1:i64 orderId, 2:i64 jacketNumber) throws (1:TransactionServiceException ex),bool acceptOrder(1:i64 orderId) throws (1:TransactionServiceException ex),bool billOrder(1:i64 orderId) throws (1:TransactionServiceException ex),/**Returns list of orders for given transaction Id. Also filters based on customer Id so thatonly user who owns the transaction can view its order details.*/list<Order> getOrdersForTransaction(1:i64 transactionId 2:i64 customerId) throws (1:TransactionServiceException ex),list<Order> getOrdersForCustomer(1:i64 customerId, 2:i64 from_date, 3:i64 to_date, 4:OrderStatus status) throws (1:TransactionServiceException ex),i64 createOrder(1:Order order) throws (1:TransactionServiceException ex),Order getOrder(1:i64 id) throws (1:TransactionServiceException ex),list<LineItem> getLineItemsForOrder(1:i64 orderId) throws (1:TransactionServiceException ex),/**Returns an order for the order Id. Also checks if the order belongs to the customer whose Id is passed.Throws exception if either order Id is invalid or order does not below to the customer whose Id is passed.*/Order getOrderForCustomer(1:i64 orderId, 2:i64 customerId) throws (1:TransactionServiceException ex),/**Create a batch of all the pending orders for the given warehouse.The returned list is orderd by created_timestamp.If there are no pending orders, an empty list is returned.*/list<Order> batchOrders(1:i64 warehouseId) throws (1:TransactionServiceException ex),/**Mark the given order as out of stock. Throws an exception if the order with the given Id couldn't be found.*/bool markOrderAsOutOfStock(1:i64 orderId) throws (1:TransactionServiceException ex),/**Marks all BILLED orders for a warehouse and a provider as SHIPPED_FROM_WH*/bool markOrdersAsManifested(1:i64 warehouseId, 2:i64 providerId) throws (1:TransactionServiceException ex),/**Marks all SHIPPED_FROM_WH orders of the previous day for a provider as SHIPPED_TO_LOGISTICS.Returns a list of orders that were shipped from warehouse but did not appear in the pick-up report.Raises an exception if we encounter report for an AWB number that we did not ship.*/list<Order> markOrdersAsPickedUp(1:i64 providerId, 2:map<string, string> pickupDetails) throws (1:TransactionServiceException ex),/**Marks all orders with AWBs in the given map as delivered. Also sets the delivery timestamp andthe name of the receiver.Raises an exception if we encounter report for an AWB number that we did not ship.*/void markOrdersAsDelivered(1:i64 providerId, 2:map<string, string> deliveredOrders) throws (1:TransactionServiceException ex),/**Mark all orders with AWBs in the given map as failed. Also sets the delivery timestamp.Raises an exception if we encounter report for an AWB number that we did not ship.*/void markOrdersAsFailed(1:i64 providerId, 2:map<string, string> returnedOrders) throws (1:TransactionServiceException ex),/**Update the status description of orders whose AWB numbers are keys of the Map.*/void updateNonDeliveryReason(1:i64 providerId, 2:map<string, string> undeliveredOrders) throws (1:TransactionServiceException ex),/**Returns the list of orders whose delivery time has passed but have not beendelivered yet for the given provider and warehouse. To get a complete list ofundelivered orders, pass them as -1.Returns an empty list if no such orders exist.*/list<Order> getUndeliveredOrders(1:i64 providerId, 2:i64 warehouseId),//Alerts apislist<Alert> getAlerts(1:i64 orderId, 2:bool valid),void setAlert(1:i64 orderId, 2:bool unset, 3:i64 type, 4: string comment),/**Return the number of valid orders. (OrderStatus >= OrderStatus.SUBMITTED_FOR_PROCESSING)*/i64 getValidOrderCount(),/**Returns the number of distinct customers who have done successful transactions*/i64 getNoOfCustomersWithSuccessfulTransaction(),/**Returns the minimum and maximum amounts of a valid order. (OrderStatus >= OrderStatus.SUBMITTED_FOR_PROCESSING)List contains two values, first minimum amount and second maximum amount.*/list<double> getValidOrdersAmountRange(),/**Returns list of Orders in descending order by Order creation date. List is restricted to limit Orders.If limit is passed as 0, then all valid Orders are returned.*/list<Order> getValidOrders(1:i64 limit),/**Toggle the DOA flag of an order. This should be used to flag an order for follow-up and unflag it when the follow-up is complete.Returns the final flag status.Throws an exception if the order with the given id couldn't be found or if the order status is not DELVIERY_SUCCESS.*/bool toggleDOAFlag(1:i64 orderId) throws (1:TransactionServiceException ex),/**Sends out an email to the account manager of the original courier provider used to ship the order.If the order status was DELIVERY_SUCCESS, it is changed to be DOA_PICKUP_REQUESTED.If the order status was DOA_PICKUP_REQUESTED, it is left unchanged.For any other status, it returns false.Throws an exception if the order with the given id couldn't be found.*/bool requestPickupNumber(1:i64 orderId) throws (1:TransactionServiceException ex),/**If the order status is DOA_PICKUP_REQUESTED, it does the following1. Sends out an email to the customer with the dispatch advice that he has to print as an attachment.2. Changes order status to be DOA_PICKUP_AUTHORIZED.3. Returns trueIf the order is in any other status, it returns false.Throws an exception if the order with the given id couldn't be found.*/bool authorizePickup(1:i64 orderId, 2:string pickupNumber) throws (1:TransactionServiceException ex),/**If the order status is DOA_RETURN_AUTHORIZED or DOA_RETURN_IN_TRANSIT, marks the order status as DOA_RECEIVED and returns true.If the order status is SALES_RETURN_IN_TRANSIT, marks the order status as SALES_RET_RECEIVED and returns true.If the order is in any other state, it returns false.Throws an exception if the order with the given id couldn't be found.*/bool receiveReturn(1:i64 orderId) throws (1:TransactionServiceException ex),/**Used to validate the DOA certificate for an order in the DOA_RECEIVED state. If the certificate is valid,the order state is changed to DOA_CERT_VALID. If the certificate is invalid, the order state is changed to DOA_CERT_INVALID.If the order is in any other state, it returns false.Throws an exception if the order with the given id couldn't be found.*/bool validateDoa(1:i64 orderId, 2:bool isValid) throws (1:TransactionServiceException ex),/**If the order is in SALES_RET_RECEIVED or DOA_CERT_INVALID state, it does the following:1. Creates a new order for processing in the BILLED state. All billing information is saved.2. Marks the current order as one of the final states SALES_RET_RESHIPPED and DOA_INVALID_RESHIPPED depending on what state the order started in.If the order is in DOA_CERT_VALID state, it does the following:1. Creates a new order for processing in the SUBMITTED_FOR_PROCESSING state.2. Creates a return order for the warehouse executive to return the DOA material.3. Marks the current order as the final DOA_RESHIPPED state.Returns the id of the newly created order.Throws an exception if the order with the given id couldn't be found.*/i64 reshipOrder(1:i64 orderId) throws (1:TransactionServiceException ex),/**If the order is in SALES_RET_RECEIVED, DOA_CERT_VALID or DOA_CERT_INVALID state, it does the following:1. Creates a refund request for batch processing.2. Creates a return order for the warehouse executive to return the shipped material.3. Marks the current order as SALES_RET_REFUNDED, DOA_VALID_REFUNDED or DOA_INVALID_REFUNDED final states.If the order is in SUBMITTED_FOR_PROCESSING or INVENTORY_LOW state, it does the following:1. Creates a refund request for batch processing.2. Marks the current order as the REFUNDED final state.Returns True if it is successful, False otherwise.Throws an exception if the order with the given id couldn't be found.*/bool refundOrder(1:i64 orderId) throws (1:TransactionServiceException ex)}