Subversion Repositories SmartDukaan

Rev

Rev 85 | Rev 132 | 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{
        SHIPPED,
        IN_TRANSIT,
        DELIVERED
}

enum TransactionStatus{
        INIT,
        SUBMITTED_FOR_PROCESSING,
        ORDER_FULFILLMENT,
        COMPLETED               
}

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

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: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
}

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

service TransactionService{
        
        void 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),
        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)
}