Subversion Repositories SmartDukaan

Rev

Rev 3044 | Rev 4391 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
4386 anupam.sin 1
from shop2020.thriftpy.logistics.ttypes import Provider as TProvider, AwbUpdate as TAwbUpdate, \
2
        ProviderDetails as TProviderDetails, Awb as TAwb
442 rajveer 3
from shop2020.utils.Utils import to_java_date
4
 
5
 
6
def to_t_provider(provider):
7
    t_provider = TProvider()
8
    t_provider.id = provider.id
9
    t_provider.name = provider.name
3044 chandransh 10
    t_provider.details = {}
11
    for detail in provider.details:
12
        t_provider.details[detail.type] = to_t_proivder_details(detail)
442 rajveer 13
    return t_provider
3044 chandransh 14
 
15
def to_t_proivder_details(detail):
16
    t_provider_details = TProviderDetails()
17
    t_provider_details.accountNo = detail.accountNo
18
    t_provider_details.email = detail.email
19
    return t_provider_details 
20
 
644 chandransh 21
def to_t_awbupdate(update):
22
    t_update = TAwbUpdate()
23
    t_update.awbNumber    = update.awb.awb_number
24
    t_update.providerName = update.awb.provider.name
25
    t_update.description  = update.description + " - " + update.comments
26
    t_update.location     = update.location
27
    t_update.entryDate    = to_java_date(update.entry_date)
4386 anupam.sin 28
    return t_update
29
 
30
def to_t_awb(awb):
31
    t_awb = TAwb()
32
    t_awb.id = awb.id
33
    t_awb.awbNumber = awb.awb_number
34
    t_awb.providerId = awb.provider.id
35
    t_awb.deliveryType = awb.type
36
    return t_awb