Subversion Repositories SmartDukaan

Rev

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

Rev Author Line No. Line
14371 kshitij.so 1
from dtr.utils import FetchLivePrices
2
from shop2020.model.v1.dtr.impl.Convertors import to_t_livePricing
3
 
4
class DtrServiceHandler:
5
    '''
6
    classdocs
7
    '''
8
 
9
    def __init__(self):
10
        '''
11
        Constructor
12
        '''
13
 
14
    def getLatestPricing(self, skuBundleId, source_id):
15
        try:
16
            pricing_info = FetchLivePrices.getLatestPrice(skuBundleId, source_id)
14435 kshitij.so 17
            if len(pricing_info) == 0:
14436 kshitij.so 18
                raise
14371 kshitij.so 19
            return [to_t_livePricing(pricing) for pricing in pricing_info]
14796 kshitij.so 20
        except Exception as e:
21
            print "Dtr handler exception ",e
14436 kshitij.so 22
            return [to_t_livePricing(pricing) for pricing in [{}]]
14371 kshitij.so 23
 
24
 
25
if __name__ == '__main__':
14435 kshitij.so 26
    dt  = DtrServiceHandler()
27
    print dt.getLatestPricing(100, 1)