Subversion Repositories SmartDukaan

Rev

Rev 1111 | Rev 1134 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

namespace java in.shop2020.model.v1.order
namespace 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_ADDRESS
        COMPLETED,
        CANCELED,
        FAILED
}

enum TransactionStatus{
        INIT,
        IN_PROCESS,
        COMPLETED,
        FAILED
}


struct LineItem{
        1:i64 id,
        2:i64 item_id,
        3:string productGroup
        4:string brand,
        5:string model_number,
        6:string color
        7: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 jacket_number,
}

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
}

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),

        //      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),
        
        bool changeOrderStatus(1:i64 orderId, 2:OrderStatus status, 3:string description) throws (1:TransactionServiceException ex),
        bool addBillingDetails(1:i64 orderId, 2:string invoice_number, 3:i64 jacket_number, 4:string billed_by) throws (1:TransactionServiceException ex),

        bool acceptOrder(1:i64 orderId) throws (1:TransactionServiceException ex),
        bool billOrder(1:i64 orderId) throws (1:TransactionServiceException ex),
        
        list<Order> getOrdersForTransaction(1:i64 transactionId)  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),
        
        /**
        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, i64> pickupDetails) throws (1:TransactionServiceException ex),
        //Alerts apis 
        list<Alert> getAlerts(1:i64 orderId, 2:bool valid),
        void setAlert(1:i64 orderId, 2:bool unset, 3:i64 type, 4: string comment),
}