| 759 |
chandransh |
1 |
'''
|
|
|
2 |
Created on 03-Feb-2011
|
|
|
3 |
|
|
|
4 |
@author: ashish
|
|
|
5 |
'''
|
| 1610 |
ankur.sing |
6 |
from shop2020.thriftpy.utils.ttypes import LogisticsUser as TLogisticsUser,\
|
| 2025 |
ankur.sing |
7 |
StatisticsUser as TStatisticsUser, ReportUser as TReportUser, Report as TReport,\
|
| 4806 |
varun.gupt |
8 |
CatalogDashboardUser as TCatalogUser, QuickLink as TQuickLink
|
| 12691 |
manish.sha |
9 |
from shop2020.thriftpy.utils.ttypes import UserEmail as TUserEmail, UserSms as TUserSms, \
|
| 12881 |
manish.sha |
10 |
UserSmsInfo as TUserSmsInfo, SmsType, SmsStatus, SmsDeliveryStatus
|
| 1422 |
varun.gupt |
11 |
from shop2020.utils.Utils import to_java_date
|
| 759 |
chandransh |
12 |
|
|
|
13 |
def to_t_luser(luser):
|
|
|
14 |
t_luser = TLogisticsUser()
|
|
|
15 |
t_luser.username = luser.username
|
|
|
16 |
t_luser.providerId = luser.providerId
|
| 1422 |
varun.gupt |
17 |
return t_luser
|
|
|
18 |
|
| 1610 |
ankur.sing |
19 |
def to_t_suser(suser):
|
|
|
20 |
t_suser = TStatisticsUser()
|
|
|
21 |
t_suser.username = suser.username
|
|
|
22 |
return t_suser
|
|
|
23 |
|
| 1891 |
ankur.sing |
24 |
def to_t_ruser(ruser):
|
|
|
25 |
t_ruser = TReportUser()
|
|
|
26 |
t_ruser.username = ruser.username
|
|
|
27 |
t_ruser.role = ruser.role
|
| 12256 |
kshitij.so |
28 |
t_ruser.email = ruser.email
|
| 1891 |
ankur.sing |
29 |
return t_ruser
|
|
|
30 |
|
|
|
31 |
def to_t_report(report):
|
|
|
32 |
t_report = TReport()
|
|
|
33 |
t_report.id = report.id
|
|
|
34 |
t_report.description = report.description
|
|
|
35 |
t_report.controller = report.controller
|
|
|
36 |
return t_report
|
|
|
37 |
|
| 2025 |
ankur.sing |
38 |
def to_t_catalog_user(cuser):
|
|
|
39 |
t_catalog_user = TCatalogUser()
|
|
|
40 |
t_catalog_user.username = cuser.username
|
|
|
41 |
t_catalog_user.password = cuser.password
|
| 2358 |
ankur.sing |
42 |
t_catalog_user.role = cuser.role
|
| 2025 |
ankur.sing |
43 |
return t_catalog_user
|
|
|
44 |
|
| 1422 |
varun.gupt |
45 |
def to_t_useremail(useremail):
|
|
|
46 |
t_useremail = TUserEmail()
|
|
|
47 |
t_useremail.id = useremail.id
|
|
|
48 |
t_useremail.emailFrom = useremail.emailFrom
|
| 5864 |
rajveer |
49 |
if useremail.emailTo:
|
|
|
50 |
t_useremail.emailTo = useremail.emailTo.split(";")
|
| 1422 |
varun.gupt |
51 |
t_useremail.subject = useremail.subject
|
|
|
52 |
t_useremail.body = useremail.body
|
|
|
53 |
t_useremail.emailType = useremail.emailType
|
|
|
54 |
t_useremail.source = useremail.source
|
|
|
55 |
t_useremail.status = useremail.status
|
|
|
56 |
t_useremail.timestamp = to_java_date(useremail.timestamp)
|
| 5864 |
rajveer |
57 |
t_useremail.cc = []
|
|
|
58 |
if useremail.cc:
|
|
|
59 |
t_useremail.cc = useremail.cc.split(";")
|
|
|
60 |
t_useremail.bcc = []
|
|
|
61 |
if useremail.bcc:
|
|
|
62 |
t_useremail.bcc = useremail.bcc.split(";")
|
| 4806 |
varun.gupt |
63 |
return t_useremail
|
|
|
64 |
|
|
|
65 |
def to_t_quicklink(quicklink):
|
|
|
66 |
t_quicklink = TQuickLink()
|
| 4996 |
varun.gupt |
67 |
t_quicklink.id = quicklink.id
|
| 4806 |
varun.gupt |
68 |
t_quicklink.url = quicklink.url
|
|
|
69 |
t_quicklink.text = quicklink.text
|
| 12691 |
manish.sha |
70 |
return t_quicklink
|
|
|
71 |
|
|
|
72 |
def to_t_user_sms(userSms):
|
|
|
73 |
t_usersms = TUserSms()
|
|
|
74 |
t_usersms.id = userSms.id
|
|
|
75 |
t_usersms.user_id = userSms.user_id
|
|
|
76 |
t_usersms.createdTimestamp = to_java_date(userSms.createdTimestamp)
|
|
|
77 |
t_usersms.mobileNumber = userSms.mobileNumber
|
|
|
78 |
t_usersms.smsText = userSms.smsText
|
|
|
79 |
t_usersms.attempts = userSms.attempts
|
| 12881 |
manish.sha |
80 |
t_usersms.status = SmsStatus._NAMES_TO_VALUES[userSms.status]
|
|
|
81 |
t_usersms.type = SmsType._NAMES_TO_VALUES[userSms.type]
|
| 12691 |
manish.sha |
82 |
if userSms.responseId:
|
|
|
83 |
t_usersms.responseId = userSms.responseId
|
|
|
84 |
if userSms.responseText:
|
|
|
85 |
t_usersms.responseText = userSms.responseText
|
| 12881 |
manish.sha |
86 |
t_usersms.deliveryStatus = SmsDeliveryStatus._NAMES_TO_VALUES[userSms.deliveryStatus]
|
| 12691 |
manish.sha |
87 |
return t_usersms
|
|
|
88 |
|
|
|
89 |
def to_t_user_sms_info(userSmsInfo):
|
|
|
90 |
t_usersmsinfo = TUserSmsInfo()
|
| 12879 |
manish.sha |
91 |
if userSmsInfo is not None:
|
|
|
92 |
t_usersmsinfo.userId = userSmsInfo.userId
|
|
|
93 |
t_usersmsinfo.mobileNo = userSmsInfo.mobileNo
|
|
|
94 |
t_usersmsinfo.dailyCount = userSmsInfo.dailyCount
|
|
|
95 |
t_usersmsinfo.createdTimestamp = to_java_date(userSmsInfo.createdTimestamp)
|
|
|
96 |
t_usersmsinfo.updateTimestamp = to_java_date(userSmsInfo.updateTimestamp)
|
|
|
97 |
t_usersmsinfo.dndStatus = userSmsInfo.dndStatus
|
|
|
98 |
t_usersmsinfo.smsSubscribed = userSmsInfo.smsSubscribed
|
|
|
99 |
t_usersmsinfo.weeklyCount = userSmsInfo.weeklyCount
|
|
|
100 |
|
| 12691 |
manish.sha |
101 |
return t_usersmsinfo
|