Subversion Repositories SmartDukaan

Rev

Rev 20745 | 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, \
20745 kshitij.so 2
        ProviderDetails as TProviderDetails, PickupStore as TPickupStore, BluedartAttributes as TBluedartAttributes
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
7792 anupam.sin 11
    t_provider.details = []
3044 chandransh 12
    for detail in provider.details:
20835 amit.gupta 13
        if detail.active:
14
            t_provider.details.append(to_t_proivder_details(detail))
13146 manish.sha 15
    if provider.bundleWeightLimit:
16
        t_provider.bundleWeightLimit = provider.bundleWeightLimit
17
    t_provider.groupShipmentAllowed = provider.groupShipmentAllowed
18
    t_provider.maxCodLimit = provider.maxCodLimit
442 rajveer 19
    return t_provider
3044 chandransh 20
 
21
def to_t_proivder_details(detail):
22
    t_provider_details = TProviderDetails()
23
    t_provider_details.accountNo = detail.accountNo
24
    t_provider_details.email = detail.email
7792 anupam.sin 25
    t_provider_details.logisticLocation = detail.logisticLocation
26
    t_provider_details.deliveryType = detail.type
3044 chandransh 27
    return t_provider_details 
28
 
644 chandransh 29
def to_t_awbupdate(update):
30
    t_update = TAwbUpdate()
6643 rajveer 31
    t_update.awbNumber    = update.awbNumber
32
    t_update.providerId = update.providerId
644 chandransh 33
    t_update.location     = update.location
6643 rajveer 34
    t_update.status  = update.status
35
    t_update.description  = update.description
36
    t_update.date    = to_java_date(update.date)
4386 anupam.sin 37
    return t_update
5555 rajveer 38
 
39
def to_t_pickup_store(store):
40
    t_store = TPickupStore()
5719 rajveer 41
    t_store.id = store.id
42
    t_store.hotspotId = store.hotspotId 
5555 rajveer 43
    t_store.name = store.name
5572 anupam.sin 44
    t_store.line1 = store.line_1
45
    t_store.line2 = store.line_2
5555 rajveer 46
    t_store.city = store.city
47
    t_store.state = store.state
48
    t_store.pin = store.pin
49
    t_store.phone = store.phone
5863 rajveer 50
    t_store.email = store.email
5739 rajveer 51
    t_store.zone = store.zone
5813 rajveer 52
    t_store.bdm = store.bdm
53
    t_store.bdmEmail = store.bdmEmail
20745 kshitij.so 54
    return t_store
55
 
56
def to_t_bluedart_attribute(bluedartAttr):
57
    t_bluedart_attr = TBluedartAttributes()
58
    t_bluedart_attr.logisticsTransactionId = bluedartAttr.logisticsTransactionId
59
    t_bluedart_attr.name = bluedartAttr.name
60
    t_bluedart_attr.value = bluedartAttr.value
61
    return t_bluedart_attr
62