| 3044 |
chandransh |
1 |
from shop2020.thriftpy.logistics.ttypes import Provider as TProvider, AwbUpdate as TAwbUpdate, ProviderDetails as TProviderDetails
|
| 442 |
rajveer |
2 |
from shop2020.utils.Utils import to_java_date
|
|
|
3 |
|
|
|
4 |
|
|
|
5 |
def to_t_provider(provider):
|
|
|
6 |
t_provider = TProvider()
|
|
|
7 |
t_provider.id = provider.id
|
|
|
8 |
t_provider.name = provider.name
|
| 3044 |
chandransh |
9 |
t_provider.details = {}
|
|
|
10 |
for detail in provider.details:
|
|
|
11 |
t_provider.details[detail.type] = to_t_proivder_details(detail)
|
| 442 |
rajveer |
12 |
return t_provider
|
| 3044 |
chandransh |
13 |
|
|
|
14 |
def to_t_proivder_details(detail):
|
|
|
15 |
t_provider_details = TProviderDetails()
|
|
|
16 |
t_provider_details.accountNo = detail.accountNo
|
|
|
17 |
t_provider_details.email = detail.email
|
|
|
18 |
return t_provider_details
|
|
|
19 |
|
| 644 |
chandransh |
20 |
def to_t_awbupdate(update):
|
|
|
21 |
t_update = TAwbUpdate()
|
|
|
22 |
t_update.awbNumber = update.awb.awb_number
|
|
|
23 |
t_update.providerName = update.awb.provider.name
|
|
|
24 |
t_update.description = update.description + " - " + update.comments
|
|
|
25 |
t_update.location = update.location
|
|
|
26 |
t_update.entryDate = to_java_date(update.entry_date)
|
|
|
27 |
return t_update
|