Subversion Repositories SmartDukaan

Rev

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

Rev Author Line No. Line
420 ashish 1
'''
2
Created on 26-Aug-2010
3
 
4
@author: ashish
5
'''
6
from elixir import *
7
 
8
 
701 chandransh 9
class PaymentGateway(Entity):
420 ashish 10
    id = Field(Integer, primary_key=True, autoincrement=True)
11
    name = Field(String(100))
701 chandransh 12
    aliasName = Field(String(100))
13
    url = Field(String(500))
14
    responseUrl = Field(String(500))
15
    errorUrl = Field(String(500))
16
    status = Field(Integer)
17
    addedOn = Field(DateTime)
18
    attributes = OneToMany("GatewayAttribute")
703 chandransh 19
    using_options(shortnames=True)
420 ashish 20
 
701 chandransh 21
class GatewayAttribute(Entity):
22
    payment_gateway = ManyToOne("PaymentGateway", primary_key=True)
23
    name = Field(String(50), primary_key=True)
24
    value = Field(String(100))
703 chandransh 25
    using_options(shortnames=True)
420 ashish 26
 
701 chandransh 27
class PaymentAttribute(Entity):
28
    payment = ManyToOne("Payment", primary_key=True)
29
    name = Field(String(50), primary_key=True)
30
    value = Field(String(100))
703 chandransh 31
    using_options(shortnames=True)
701 chandransh 32
 
33
class Payment(Entity):
420 ashish 34
    id = Field(Integer, primary_key=True, autoincrement=True)
701 chandransh 35
    gatewayId = Field(Integer)
36
    gatewayPaymentId = Field(String(50))
37
    merchantTxnId = Field(Integer)
38
    gatewayTxnId = Field(String(50))
39
    amount = Field(Float)
703 chandransh 40
    gatewayTxnStatus = Field(String(20))
41
    status = Field(Integer)
42
    userId = Field(Integer)
43
    errorCode = Field(String(20))
44
    description = Field(String(50))
45
    authCode = Field(String(20))
46
    referenceCode = Field(String(20))
47
    sessionId = Field(String(50))
48
    gatewayTxnDate = Field(String(50))
49
    attributes = OneToMany("PaymentAttribute")
50
    initTimestamp = Field(DateTime)
51
    successTimestamp = Field(DateTime)
701 chandransh 52
    errorTimestamp = Field(DateTime)
703 chandransh 53
    using_options(shortnames=True)
420 ashish 54
 
55
def initialize():
56
    metadata.bind = "sqlite:///payment.sqlite" #need to read it from configserver.
57
    metadata.bind.echo = True
58
    setup_all(True)
59
 
60
if __name__=="__main__":
703 chandransh 61
    initialize()