Subversion Repositories SmartDukaan

Rev

Rev 20954 | 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)
6031 rajveer 21
    userWalletHistory = OneToMany("UserWalletHistory")
22
    using_options(shortnames=True)
23
    using_table_options(mysql_engine="InnoDB")
24
 
25
    def __init__(self):
26
        '''
27
        Constructor
28
        '''
29
 
30
    def to_thrift_object(self, ):
31
        '''
32
        Copies attributes to thrift object
33
        '''
34
        thriftObject = tUserWallet()
35
        thriftObject.id = self.id
36
        thriftObject.userId = self.userId
37
        thriftObject.amount = self.amount
20954 kshitij.so 38
        thriftObject.refundable_amount = self.refundable_amount
6031 rajveer 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
20954 kshitij.so 45
        self.refundable_amount = thriftUserWallet.refundable_amount
6031 rajveer 46
 
47
    def is_valid(self):
48
        return True