Subversion Repositories SmartDukaan

Rev

Rev 3499 | Rev 4189 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3499 Rev 3554
Line 1... Line 1...
1
from shop2020.thriftpy.model.v1.user.ttypes import Address as TAddress,\
1
from shop2020.thriftpy.model.v1.user.ttypes import Address as TAddress,\
2
    Phone as TPhone, SocialHandles as TSocialHandles, UserCommunication as TUserCommunication,\
2
    Phone as TPhone, SocialHandles as TSocialHandles, UserCommunication as TUserCommunication,\
3
    UserState as TUserState, User as TUser, Cart as TCart, Line as TLine, Sex as TSex,\
3
    UserState as TUserState, User as TUser, Cart as TCart, Line as TLine, Sex as TSex,\
4
    MasterAffiliate as TMasterAffiliate, Affiliate as TAffiliate, Tracker as TTracker, TrackLog as TTrackLog,\
4
    MasterAffiliate as TMasterAffiliate, Affiliate as TAffiliate, Tracker as TTracker, TrackLog as TTrackLog,\
5
    Promotion as TPromotion, Coupon as TCoupon, UserNote as TUserNote
5
    Promotion as TPromotion, Coupon as TCoupon, UserNote as TUserNote, Discount as TDiscount
6
from shop2020.utils.Utils import to_java_date
6
from shop2020.utils.Utils import to_java_date
7
 
7
 
8
def to_t_address(address):
8
def to_t_address(address):
9
    t_address = TAddress()
9
    t_address = TAddress()
10
    t_address.id = address.id
10
    t_address.id = address.id
Line 114... Line 114...
114
        t_line.itemId = line.item_id
114
        t_line.itemId = line.item_id
115
        t_line.quantity = line.quantity
115
        t_line.quantity = line.quantity
116
        t_line.estimate = line.estimate
116
        t_line.estimate = line.estimate
117
        t_line.actualPrice = line.actual_price
117
        t_line.actualPrice = line.actual_price
118
        t_line.discountedPrice = line.discounted_price
118
        t_line.discountedPrice = line.discounted_price
-
 
119
        t_line.discounts = [to_t_discount(discount) for discount in line.discounts]
119
        t_line.createdOn = to_java_date(line.created_on)
120
        t_line.createdOn = to_java_date(line.created_on)
120
        t_line.updatedOn = to_java_date(line.updated_on)
121
        t_line.updatedOn = to_java_date(line.updated_on)
121
        t_line.lineStatus = line.line_status
122
        t_line.lineStatus = line.line_status
-
 
123
        
122
    return t_line
124
    return t_line
123
 
125
 
-
 
126
def to_t_discount(discount):
-
 
127
    t_discount = TDiscount()
-
 
128
    
-
 
129
    if discount:
-
 
130
        t_discount.cart_id = discount.line_cart_id
-
 
131
        t_discount.item_id = discount.line_item_id
-
 
132
        t_discount.discount = discount.discount
-
 
133
        t_discount.quantity = discount.quantity
-
 
134
    
-
 
135
    return t_discount
-
 
136
 
124
def to_t_user_communication(user_communication):
137
def to_t_user_communication(user_communication):
125
    t_user_communication = TUserCommunication()
138
    t_user_communication = TUserCommunication()
126
    
139
    
127
    if user_communication:
140
    if user_communication:
128
        t_user_communication.id = user_communication.id
141
        t_user_communication.id = user_communication.id