Subversion Repositories SmartDukaan

Rev

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

Rev 743 Rev 746
Line 2... Line 2...
2
Created on 26-Aug-2010
2
Created on 26-Aug-2010
3
 
3
 
4
@author: ashish
4
@author: ashish
5
'''
5
'''
6
from elixir import *
6
from elixir import *
-
 
7
import elixir
7
 
8
 
8
 
9
 
9
class PaymentGateway(Entity):
10
class PaymentGateway(Entity):
10
    id = Field(Integer, primary_key=True, autoincrement=True)
11
    id = Field(Integer, primary_key=True, autoincrement=True)
11
    name = Field(String(100))
12
    name = Field(String(100))
Line 15... Line 16...
15
    errorUrl = Field(String(500))
16
    errorUrl = Field(String(500))
16
    status = Field(Integer)
17
    status = Field(Integer)
17
    addedOn = Field(DateTime)
18
    addedOn = Field(DateTime)
18
    attributes = OneToMany("GatewayAttribute")
19
    attributes = OneToMany("GatewayAttribute")
19
    using_options(shortnames=True)
20
    using_options(shortnames=True)
-
 
21
    using_table_options(mysql_engine="InnoDB")
20
 
22
 
21
class GatewayAttribute(Entity):
23
class GatewayAttribute(Entity):
22
    payment_gateway = ManyToOne("PaymentGateway", primary_key=True)
24
    payment_gateway = ManyToOne("PaymentGateway", primary_key=True)
23
    name = Field(String(50), primary_key=True)
25
    name = Field(String(50), primary_key=True)
24
    value = Field(String(100))
26
    value = Field(String(100))
25
    using_options(shortnames=True)
27
    using_options(shortnames=True)
-
 
28
    using_table_options(mysql_engine="InnoDB")
26
 
29
 
27
class PaymentAttribute(Entity):
30
class PaymentAttribute(Entity):
28
    payment = ManyToOne("Payment", primary_key=True)
31
    payment = ManyToOne("Payment", primary_key=True)
29
    name = Field(String(50), primary_key=True)
32
    name = Field(String(50), primary_key=True)
30
    value = Field(String(250))
33
    value = Field(String(250))
31
    using_options(shortnames=True)
34
    using_options(shortnames=True)
-
 
35
    using_table_options(mysql_engine="InnoDB")
32
 
36
 
33
class Payment(Entity):
37
class Payment(Entity):
34
    id = Field(Integer, primary_key=True, autoincrement=True)
38
    id = Field(Integer, primary_key=True, autoincrement=True)
35
    gatewayId = Field(Integer)
39
    gatewayId = Field(Integer)
36
    gatewayPaymentId = Field(String(50))
40
    gatewayPaymentId = Field(String(50))
Line 49... Line 53...
49
    attributes = OneToMany("PaymentAttribute")
53
    attributes = OneToMany("PaymentAttribute")
50
    initTimestamp = Field(DateTime)
54
    initTimestamp = Field(DateTime)
51
    successTimestamp = Field(DateTime)
55
    successTimestamp = Field(DateTime)
52
    errorTimestamp = Field(DateTime)
56
    errorTimestamp = Field(DateTime)
53
    using_options(shortnames=True)
57
    using_options(shortnames=True)
-
 
58
    using_table_options(mysql_engine="InnoDB")
54
 
59
 
55
def initialize():
60
def initialize():
56
    metadata.bind = "sqlite:///payment.sqlite" #need to read it from configserver.
61
    #metadata.bind = "sqlite:///payment.sqlite" #need to read it from configserver.
-
 
62
    metadata.bind = 'mysql://root:shop2020@localhost/payment'
57
    metadata.bind.echo = True
63
    metadata.bind.echo = True
58
    setup_all(True)
64
    setup_all(True)
59
 
65
 
60
if __name__=="__main__":
66
if __name__=="__main__":
61
    initialize()
67
    initialize()
62
68