Subversion Repositories SmartDukaan

Rev

Rev 196 | Rev 351 | 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 PaymentStatus{
        FAILURE,
        SUCCESS
}

enum ShipmentStatus{
        YET_TO_SHIP,
        SHIPPED,
        IN_TRANSIT,
        DELIVERY_SUCCESS,
        DELIVERY_FAILED_FIRST_ATTEMPT,
        DELIVERY_FAILED_SECOND_ATTEMPT,
        DELIVERY_FAILED_THIRD_ATTEMPT,
        DELIVERY_FAILED_WORNG_ADDRESS
}

enum TransactionStatus{
        INIT,
        SUBMITTED_FOR_PROCESSING,
        ORDER_FULFILLMENT,
        READY_FOR_SHIPPING,
        SHIPPED,
        COMPLETED,
        CANCELED,
        FAILED, 
        BILLED  
}

struct Item{
        1:i64 id,
        2:double price,
        3:double weight
}

struct LineItem{
        1:Item item,
        2:i64 id,
        3:i64 addedOn,
        4:map<string,string> additionalInfo
}

struct OrderInfo{
        1:i64 id,
        2:list<LineItem> lineitems
}

struct Billing{
        1:i64 id,
        2:string billNumber,
        3:list<LineItem> lineItem,
        4:i64 generatedTimestamp,
        5:string generatedBy
}

struct BillingInfo{
        1:i64 id,
        2:list<Billing> billings
}

struct Shipment{
        1:i64 id,
        2:string address,
        3:string trackingId,
        4:list<LineItem> lineItems,
        5:ShipmentStatus status,
        6:i64 shipmentTimestamp,
        7:i64 deliveryTimestamp,
        8:double value,
        9:double insurance,
        10:double weight,
        11:string airwayBillNo,
        12:string provider
}

struct ShipmentInfo{
        1:list<Shipment> shipments,
        2:i64 id
}

struct Payment{
        1:i64 id,
        2:string merchant_tx_id,
        3:string bank_tx_id,
        4:string mode,
        5:double amount,
        6:PaymentStatus status,
        7:string description,
        9:i64 submissionTimestamp,
        10:i64 completionTimestamp
}

struct PaymentInfo{
        1:i64 id,
        2:map<i64,Payment> payments
}

struct Transaction{
        1:i64 id,
        2:OrderInfo orderInfo,
        3:ShipmentInfo shipmentInfo,
        4:BillingInfo billingInfo,
        5:PaymentInfo paymentInfo,
        6:i64 createdOn,
        7:i64 expectedDeliveryTime,
        8:TransactionStatus transactionStatus,
        9:string statusDescription,
        10:i64 customer_id,
        11:i64 shoppingCartid
}

struct Alert{
        1:i64 id,
        2:i64 transaction_id,
        3:i64 type,
        4:i64 time_set,
        5:string comment,
        6:i64 time_unset
}

struct ExtraOrderInfo{
        1:i64 id,
        2:i64 transaction_id,
        3:i64 sku_id,
        4:string model_name,
        5:string vendor_info,
        6:string colour
}

exception TransactionServiceException{
        1:i32 errorCode,
        2:string message
}

service TransactionService{
        
        i64 createTransaction(1:Transaction transaction) throws (1:TransactionServiceException ex),
        /**
                Get transaction methods.
        **/
        Transaction getTransaction(1:i64 id) throws (1:TransactionServiceException ex),
        list<Transaction> getAllTransactions(1:TransactionStatus status, 2:i64 from_date, 3:i64 to_date) throws (1:TransactionServiceException ex),
        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),
        /**
                Get and set individual objects in it
        **/
        OrderInfo getOrderInfo(1:i64 transactionId) throws (1:TransactionServiceException ex),
        ShipmentInfo getShippingInfo(1:i64 transactionId) throws (1:TransactionServiceException ex),
        BillingInfo getBillingInfo(1:i64 transactionId) throws (1:TransactionServiceException ex),
        bool addBilling(1:i64 tranactionId,2: Billing billing) throws (1:TransactionServiceException ex),
        bool setShippingTracker(1:i64 transactionId, 2:i64 shippingId, 3:string trackingId, 4:string airwayBillNo, 5:string provider) throws (1:TransactionServiceException ex),
        bool setShippingDate(1:i64 transactionId, 2:i64 shippingId, 3:i64 timestamp) throws (1:TransactionServiceException ex),
        bool setDeliveryDate(1:i64 transactionId, 2:i64 shippingid, 3:i64 timestamp) throws (1:TransactionServiceException ex),
        bool changeShippingStatus(1:i64 transactionId, 2:i64 shippingId, 3:ShipmentStatus status, 4:string description) throws (1:TransactionServiceException ex),
        bool addTrail(1:i64 transactionId, 2:string description)throws (1:TransactionServiceException ex),
        //Alerts apis set on 5th June
        list<Alert> getAlerts(1:i64 transactionId, 2:bool valid),
        void setAlert(1:i64 transactionId, 2:bool unset, 3:i64 type, 4: string comment),
        //extra order info apis. added for demo
        ExtraOrderInfo getExtraInfo(1:i64 transaction_id),
        void setExtraInfo(1:i64 transaction_id, 2:i64 sku_id, 3:string model, 4:string colour, 5:string vendor)
}