| 104 |
ashish |
1 |
'''
|
|
|
2 |
Created on 29-Mar-2010
|
|
|
3 |
|
|
|
4 |
@author: ashish
|
|
|
5 |
'''
|
|
|
6 |
from shop2020.thriftpy.model.v1.order.ttypes import PaymentStatus,\
|
|
|
7 |
ShipmentStatus, TransactionStatus, TransactionServiceException
|
|
|
8 |
|
|
|
9 |
status_payment_failure=10
|
|
|
10 |
status_payment_success=11
|
|
|
11 |
status_shipment_shipped=20
|
|
|
12 |
status_shipment_in_transit=21
|
|
|
13 |
status_shipment_delivered=22
|
|
|
14 |
status_shipment_yet_to_ship=23
|
|
|
15 |
status_transaction_init=30
|
|
|
16 |
status_transaction_submitted_for_processing=31
|
|
|
17 |
status_transaction_order_fulfilment=31
|
|
|
18 |
status_transaction_completed=33
|
|
|
19 |
|
|
|
20 |
t_mapping = {
|
|
|
21 |
status_payment_failure : PaymentStatus.FAILURE,
|
|
|
22 |
status_payment_success : PaymentStatus.SUCCESS,
|
|
|
23 |
status_shipment_shipped : ShipmentStatus.SHIPPED,
|
|
|
24 |
status_shipment_in_transit : ShipmentStatus.IN_TRANSIT,
|
|
|
25 |
status_shipment_delivered : ShipmentStatus.DELIVERED,
|
|
|
26 |
status_transaction_init : TransactionStatus.INIT,
|
|
|
27 |
status_transaction_submitted_for_processing : TransactionStatus.SUBMITTED_FOR_PROCESSING,
|
|
|
28 |
status_transaction_order_fulfilment : TransactionStatus.ORDER_FULFILLMENT,
|
|
|
29 |
status_transaction_completed : TransactionStatus.COMPLETED
|
|
|
30 |
}
|
|
|
31 |
|
|
|
32 |
c_mapping = {
|
|
|
33 |
PaymentStatus.FAILURE : status_payment_failure,
|
|
|
34 |
PaymentStatus.SUCCESS : status_payment_success,
|
|
|
35 |
ShipmentStatus.SHIPPED : status_shipment_shipped,
|
|
|
36 |
ShipmentStatus.IN_TRANSIT : status_shipment_in_transit,
|
|
|
37 |
ShipmentStatus.DELIVERED : status_shipment_delivered,
|
|
|
38 |
TransactionStatus.INIT : status_transaction_init,
|
|
|
39 |
TransactionStatus.SUBMITTED_FOR_PROCESSING : status_transaction_submitted_for_processing,
|
|
|
40 |
TransactionStatus.ORDER_FULFILLMENT : status_transaction_order_fulfilment,
|
|
|
41 |
TransactionStatus.COMPLETED : status_transaction_completed
|
|
|
42 |
}
|
|
|
43 |
|
|
|
44 |
def get_t_status(status):
|
|
|
45 |
try:
|
|
|
46 |
return t_mapping[status]
|
|
|
47 |
except:
|
|
|
48 |
raise TransactionServiceException(101,"%s is invalid status "%(str(status)))
|
|
|
49 |
|
|
|
50 |
|
|
|
51 |
def get_c_status(status):
|
|
|
52 |
try:
|
|
|
53 |
return c_mapping[status]
|
|
|
54 |
except:
|
|
|
55 |
raise TransactionServiceException(101,"%s is invalid status "%(str(status)))
|
|
|
56 |
|