Subversion Repositories SmartDukaan

Rev

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

Rev Author Line No. Line
6031 rajveer 1
'''
2
Created on 19-Sep-2012
3
 
4
@author: mandeep
5
'''
6
from elixir.entity import Entity
7
from elixir.fields import Field
8
from elixir.options import using_options, using_table_options
9
from elixir.relationships import OneToMany
10
from sqlalchemy.types import Integer
11
from shop2020.thriftpy.model.v1.order.ttypes import UserWallet as tUserWallet
12
 
13
class UserWallet(Entity):
14
    '''
15
    classdocs
16
    '''
17
    id = Field(Integer, primary_key=True, autoincrement=True)
18
    userId = Field(Integer)
19
    amount = Field(Integer)
20927 kshitij.so 20
    refundable_amount = Field(Integer)
21
 
6031 rajveer 22
    userWalletHistory = OneToMany("UserWalletHistory")
23
    using_options(shortnames=True)
24
    using_table_options(mysql_engine="InnoDB")
25
 
26
    def __init__(self):
27
        '''
28
        Constructor
29
        '''
30
 
31
    def to_thrift_object(self, ):
32
        '''
33
        Copies attributes to thrift object
34
        '''
35
        thriftObject = tUserWallet()
36
        thriftObject.id = self.id
37
        thriftObject.userId = self.userId
38
        thriftObject.amount = self.amount
39
        return thriftObject
40
 
41
    def from_thrift_object(self, thriftUserWallet):
42
        self.id = thriftUserWallet.id
43
        self.userId = thriftUserWallet.userId
44
        self.amount = thriftUserWallet.amount
45
 
46
    def is_valid(self):
47
        return True