Subversion Repositories SmartDukaan

Rev

Rev 743 | Rev 1130 | 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 *
746 rajveer 7
import elixir
420 ashish 8
 
9
 
701 chandransh 10
class PaymentGateway(Entity):
420 ashish 11
    id = Field(Integer, primary_key=True, autoincrement=True)
12
    name = Field(String(100))
701 chandransh 13
    aliasName = Field(String(100))
14
    url = Field(String(500))
15
    responseUrl = Field(String(500))
16
    errorUrl = Field(String(500))
17
    status = Field(Integer)
18
    addedOn = Field(DateTime)
19
    attributes = OneToMany("GatewayAttribute")
703 chandransh 20
    using_options(shortnames=True)
746 rajveer 21
    using_table_options(mysql_engine="InnoDB")
420 ashish 22
 
701 chandransh 23
class GatewayAttribute(Entity):
24
    payment_gateway = ManyToOne("PaymentGateway", primary_key=True)
25
    name = Field(String(50), primary_key=True)
26
    value = Field(String(100))
703 chandransh 27
    using_options(shortnames=True)
746 rajveer 28
    using_table_options(mysql_engine="InnoDB")
420 ashish 29
 
701 chandransh 30
class PaymentAttribute(Entity):
31
    payment = ManyToOne("Payment", primary_key=True)
32
    name = Field(String(50), primary_key=True)
743 rajveer 33
    value = Field(String(250))
703 chandransh 34
    using_options(shortnames=True)
746 rajveer 35
    using_table_options(mysql_engine="InnoDB")
701 chandransh 36
 
37
class Payment(Entity):
420 ashish 38
    id = Field(Integer, primary_key=True, autoincrement=True)
701 chandransh 39
    gatewayId = Field(Integer)
40
    gatewayPaymentId = Field(String(50))
41
    merchantTxnId = Field(Integer)
42
    gatewayTxnId = Field(String(50))
43
    amount = Field(Float)
703 chandransh 44
    gatewayTxnStatus = Field(String(20))
45
    status = Field(Integer)
46
    userId = Field(Integer)
47
    errorCode = Field(String(20))
48
    description = Field(String(50))
49
    authCode = Field(String(20))
50
    referenceCode = Field(String(20))
51
    sessionId = Field(String(50))
52
    gatewayTxnDate = Field(String(50))
53
    attributes = OneToMany("PaymentAttribute")
54
    initTimestamp = Field(DateTime)
55
    successTimestamp = Field(DateTime)
701 chandransh 56
    errorTimestamp = Field(DateTime)
703 chandransh 57
    using_options(shortnames=True)
746 rajveer 58
    using_table_options(mysql_engine="InnoDB")
420 ashish 59
 
60
def initialize():
746 rajveer 61
    #metadata.bind = "sqlite:///payment.sqlite" #need to read it from configserver.
62
    metadata.bind = 'mysql://root:shop2020@localhost/payment'
420 ashish 63
    metadata.bind.echo = True
64
    setup_all(True)
65
 
66
if __name__=="__main__":
703 chandransh 67
    initialize()