Rev 132 | Blame | Last modification | View Log | RSS feed
'''Created on 29-Mar-2010@author: ashish'''from shop2020.thriftpy.model.v1.order.ttypes import PaymentStatus,\ShipmentStatus, TransactionStatus, TransactionServiceExceptionstatus_payment_failure=10status_payment_success=11status_shipment_shipped=20status_shipment_in_transit=21status_shipment_delivered=22status_shipment_yet_to_ship=23status_transaction_init=30status_transaction_submitted_for_processing=31status_transaction_order_fulfilment=32status_transaction_completed=33status_transaction_billed=34status_transaction_shipped=35t_mapping = {status_payment_failure : PaymentStatus.FAILURE,status_payment_success : PaymentStatus.SUCCESS,status_shipment_shipped : ShipmentStatus.SHIPPED,status_shipment_in_transit : ShipmentStatus.IN_TRANSIT,status_shipment_delivered : ShipmentStatus.DELIVERY_SUCCESS,status_transaction_init : TransactionStatus.INIT,status_transaction_billed : TransactionStatus.BILLED,status_transaction_submitted_for_processing : TransactionStatus.SUBMITTED_FOR_PROCESSING,status_transaction_order_fulfilment : TransactionStatus.ORDER_FULFILLMENT,status_transaction_completed : TransactionStatus.COMPLETED,status_transaction_shipped : TransactionStatus.SHIPPED,status_shipment_yet_to_ship : ShipmentStatus.YET_TO_SHIP}c_mapping = {PaymentStatus.FAILURE : status_payment_failure,PaymentStatus.SUCCESS : status_payment_success,ShipmentStatus.SHIPPED : status_shipment_shipped,ShipmentStatus.IN_TRANSIT : status_shipment_in_transit,ShipmentStatus.DELIVERY_SUCCESS : status_shipment_delivered,ShipmentStatus.YET_TO_SHIP : status_shipment_yet_to_ship,TransactionStatus.INIT : status_transaction_init,TransactionStatus.SUBMITTED_FOR_PROCESSING : status_transaction_submitted_for_processing,TransactionStatus.ORDER_FULFILLMENT : status_transaction_order_fulfilment,TransactionStatus.COMPLETED : status_transaction_completed,TransactionStatus.BILLED : status_transaction_billed,TransactionStatus.SHIPPED : status_transaction_shipped}def get_t_status(status):try:return t_mapping[status]except:raise TransactionServiceException(101,"%s is invalid status "%(str(status)))def get_c_status(status):try:return c_mapping[status]except:raise TransactionServiceException(101,"%s is invalid status "%(str(status)))