Subversion Repositories SmartDukaan

Rev

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

Rev 12733 Rev 12790
Line 1... Line -...
1
from shop2020.thriftpy.model.v1.user.ttypes import Address as TAddress, UserCommunication as TUserCommunication, \
-
 
2
    User as TUser, Cart as TCart, Line as TLine, MasterAffiliate as TMasterAffiliate, \
-
 
3
    Affiliate as TAffiliate, Tracker as TTracker, TrackLog as TTrackLog, Promotion as TPromotion, \
-
 
4
    Coupon as TCoupon, Discount as TDiscount, ItemCouponDiscount as TItemCouponDiscount,\
-
 
5
    Voucher, CouponCategory, PrivateDealUser as TPrivateDealUser, Counter as TCounter
-
 
6
    
-
 
7
from shop2020.utils.Utils import to_java_date
-
 
8
from shop2020.model.v1.user.impl.Dataservice import Counter
1
from shop2020.model.v1.user.impl.Dataservice import Counter
-
 
2
from shop2020.thriftpy.model.v1.user.ttypes import Address as TAddress, \
-
 
3
    UserCommunication as TUserCommunication, User as TUser, Cart as TCart, \
-
 
4
    Line as TLine, MasterAffiliate as TMasterAffiliate, Affiliate as TAffiliate, \
-
 
5
    Tracker as TTracker, TrackLog as TTrackLog, Promotion as TPromotion, \
-
 
6
    Coupon as TCoupon, Discount as TDiscount, \
-
 
7
    ItemCouponDiscount as TItemCouponDiscount, Voucher, CouponCategory, \
-
 
8
    PrivateDealUser as TPrivateDealUser, Counter as TCounter
-
 
9
from shop2020.utils.Utils import to_java_date
-
 
10
    
9
 
11
 
10
def to_t_address(address):
12
def to_t_address(address):
11
    t_address = TAddress()
13
    t_address = TAddress()
12
    t_address.id = address.id
14
    t_address.id = address.id
13
    t_address.line1 = address.line_1
15
    t_address.line1 = address.line_1
Line 231... Line 233...
231
        t_voucher.expiredOn = to_java_date(voucher.expiredOn)
233
        t_voucher.expiredOn = to_java_date(voucher.expiredOn)
232
        t_voucher.amount = voucher.amount
234
        t_voucher.amount = voucher.amount
233
        t_voucher.userEmail = voucher.email
235
        t_voucher.userEmail = voucher.email
234
    return t_voucher
236
    return t_voucher
235
 
237
 
236
def to_t_private_deal(privateDeal):
238
def to_t_private_deal_user(privateDealUser):
237
    t_private_deal = TPrivateDealUser()
239
    t_private_deal_user = TPrivateDealUser()
238
    if privateDeal is not None:
240
    if privateDealUser is not None:
239
        t_private_deal.userId = privateDeal.id
241
        t_private_deal_user.userId = privateDealUser.id
240
        t_private_deal.addedOn = to_java_date(privateDeal.created_on)
242
        t_private_deal_user.addedOn = to_java_date(privateDealUser.created_on)
241
        t_private_deal.isActive = privateDeal.isActive
243
        t_private_deal_user.isActive = privateDealUser.isActive
-
 
244
        t_private_deal_user.tin = privateDealUser.tin
-
 
245
        t_private_deal_user.counterId = privateDealUser.counter.id
242
    return t_private_deal
246
    return t_private_deal_user
243
 
247
 
244
def to_t_counter(counter):
248
def to_t_counter(counter):
245
    t_counter = TCounter()
249
    t_counter = TCounter()
246
    t_counter.code = counter.code
250
    t_counter.code = counter.code
247
    t_counter.addedOn = to_java_date(counter.createdOn)
251
    t_counter.addedOn = to_java_date(counter.createdOn)