Subversion Repositories SmartDukaan

Rev

Rev 5555 | Rev 5719 | 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, \
5555 rajveer 2
        ProviderDetails as TProviderDetails, PickupStore as TPickupStore
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
5527 anupam.sin 10
    t_provider.pickup = provider.pickup
3044 chandransh 11
    t_provider.details = {}
12
    for detail in provider.details:
13
        t_provider.details[detail.type] = to_t_proivder_details(detail)
442 rajveer 14
    return t_provider
3044 chandransh 15
 
16
def to_t_proivder_details(detail):
17
    t_provider_details = TProviderDetails()
18
    t_provider_details.accountNo = detail.accountNo
19
    t_provider_details.email = detail.email
20
    return t_provider_details 
21
 
644 chandransh 22
def to_t_awbupdate(update):
23
    t_update = TAwbUpdate()
24
    t_update.awbNumber    = update.awb.awb_number
25
    t_update.providerName = update.awb.provider.name
26
    t_update.description  = update.description + " - " + update.comments
27
    t_update.location     = update.location
28
    t_update.entryDate    = to_java_date(update.entry_date)
4386 anupam.sin 29
    return t_update
5555 rajveer 30
 
31
def to_t_pickup_store(store):
32
    t_store = TPickupStore()
33
    t_store.id = store.id 
34
    t_store.name = store.name
5572 anupam.sin 35
    t_store.line1 = store.line_1
36
    t_store.line2 = store.line_2
5555 rajveer 37
    t_store.city = store.city
38
    t_store.state = store.state
39
    t_store.pin = store.pin
40
    t_store.phone = store.phone
41
    return t_store