Subversion Repositories SmartDukaan

Rev

Rev 669 | Rev 699 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 669 Rev 685
Line 3... Line 3...
3
 
3
 
4
@author: ashish
4
@author: ashish
5
'''
5
'''
6
 
6
 
7
from shop2020.thriftpy.model.v1.order.ttypes import Transaction as T_Transaction,\
7
from shop2020.thriftpy.model.v1.order.ttypes import Transaction as T_Transaction,\
8
    LineItem as T_LineItem, PaymentInfo, Payment, Order as T_Order, Alert as T_Alert
8
    LineItem as T_LineItem, Order as T_Order, Alert as T_Alert
9
from shop2020.utils.Utils import to_java_date
9
from shop2020.utils.Utils import to_java_date
10
from shop2020.utils import OrderStatus
10
from shop2020.utils import OrderStatus
11
from shop2020.model.v1.order.impl.DataService import Alerts
11
from shop2020.model.v1.order.impl.DataService import Alerts
12
    
12
    
13
from shop2020.utils.OrderStatus import get_t_status
13
from shop2020.utils.OrderStatus import get_t_status
Line 77... Line 77...
77
    t_lineitem.model_name = lineitem.model_name 
77
    t_lineitem.model_name = lineitem.model_name 
78
    t_lineitem.extra_info = lineitem.extra_info
78
    t_lineitem.extra_info = lineitem.extra_info
79
    t_lineitem.brand = lineitem.brand
79
    t_lineitem.brand = lineitem.brand
80
    return t_lineitem
80
    return t_lineitem
81
 
81
 
82
def to_t_payment_info(payments):
-
 
83
    t_payment_info = PaymentInfo()
-
 
84
    if payments:
-
 
85
        payment_map = {}
-
 
86
        for payment in payments:
-
 
87
            t_payment_info.id = payment.id
-
 
88
            t_payment = Payment()
-
 
89
            t_payment.merchant_tx_id = payment.merchant_tx_id
-
 
90
            t_payment.bank_tx_id = payment.bank_tx_id
-
 
91
            t_payment.mode = payment.mode
-
 
92
            t_payment.amount = payment.amount
-
 
93
            t_payment.status = payment.status
-
 
94
            t_payment.description = payment.status_message
-
 
95
            t_payment.submissionTimestamp = to_java_date(payment.start_time)
-
 
96
            t_payment.completionTimestamp = to_java_date(payment.finish_time)
-
 
97
            payment_map[t_payment.submissionTimestamp] = t_payment
-
 
98
        t_payment_info.payments = payment_map
-
 
99
        
-
 
100
    return t_payment_info
-
 
101
 
-
 
102
def to_t_alert(alert):
82
def to_t_alert(alert):
103
    t_alert = T_Alert()
83
    t_alert = T_Alert()
104
    t_alert.id = alert.id
84
    t_alert.id = alert.id
105
    t_alert.comment = alert.comment
85
    t_alert.comment = alert.comment
106
    try:
86
    try: