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=31status_transaction_completed=33t_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.DELIVERED,status_transaction_init : TransactionStatus.INIT,status_transaction_submitted_for_processing : TransactionStatus.SUBMITTED_FOR_PROCESSING,status_transaction_order_fulfilment : TransactionStatus.ORDER_FULFILLMENT,status_transaction_completed : TransactionStatus.COMPLETED}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.DELIVERED : status_shipment_delivered,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}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)))