| 420 |
ashish |
1 |
'''
|
|
|
2 |
Created on 26-Aug-2010
|
|
|
3 |
|
|
|
4 |
@author: ashish
|
|
|
5 |
'''
|
| 1131 |
chandransh |
6 |
from sqlalchemy import create_engine
|
| 420 |
ashish |
7 |
from elixir import *
|
| 746 |
rajveer |
8 |
import elixir
|
| 420 |
ashish |
9 |
|
|
|
10 |
|
| 701 |
chandransh |
11 |
class PaymentGateway(Entity):
|
| 420 |
ashish |
12 |
id = Field(Integer, primary_key=True, autoincrement=True)
|
|
|
13 |
name = Field(String(100))
|
| 701 |
chandransh |
14 |
aliasName = Field(String(100))
|
|
|
15 |
url = Field(String(500))
|
|
|
16 |
responseUrl = Field(String(500))
|
|
|
17 |
errorUrl = Field(String(500))
|
|
|
18 |
status = Field(Integer)
|
|
|
19 |
addedOn = Field(DateTime)
|
|
|
20 |
attributes = OneToMany("GatewayAttribute")
|
| 703 |
chandransh |
21 |
using_options(shortnames=True)
|
| 746 |
rajveer |
22 |
using_table_options(mysql_engine="InnoDB")
|
| 420 |
ashish |
23 |
|
| 701 |
chandransh |
24 |
class GatewayAttribute(Entity):
|
|
|
25 |
payment_gateway = ManyToOne("PaymentGateway", primary_key=True)
|
|
|
26 |
name = Field(String(50), primary_key=True)
|
|
|
27 |
value = Field(String(100))
|
| 703 |
chandransh |
28 |
using_options(shortnames=True)
|
| 746 |
rajveer |
29 |
using_table_options(mysql_engine="InnoDB")
|
| 420 |
ashish |
30 |
|
| 701 |
chandransh |
31 |
class PaymentAttribute(Entity):
|
|
|
32 |
payment = ManyToOne("Payment", primary_key=True)
|
|
|
33 |
name = Field(String(50), primary_key=True)
|
| 743 |
rajveer |
34 |
value = Field(String(250))
|
| 703 |
chandransh |
35 |
using_options(shortnames=True)
|
| 746 |
rajveer |
36 |
using_table_options(mysql_engine="InnoDB")
|
| 701 |
chandransh |
37 |
|
|
|
38 |
class Payment(Entity):
|
| 420 |
ashish |
39 |
id = Field(Integer, primary_key=True, autoincrement=True)
|
| 701 |
chandransh |
40 |
gatewayId = Field(Integer)
|
|
|
41 |
gatewayPaymentId = Field(String(50))
|
|
|
42 |
merchantTxnId = Field(Integer)
|
|
|
43 |
gatewayTxnId = Field(String(50))
|
|
|
44 |
amount = Field(Float)
|
| 703 |
chandransh |
45 |
gatewayTxnStatus = Field(String(20))
|
|
|
46 |
status = Field(Integer)
|
|
|
47 |
userId = Field(Integer)
|
|
|
48 |
errorCode = Field(String(20))
|
| 1130 |
rajveer |
49 |
description = Field(String(200))
|
| 703 |
chandransh |
50 |
authCode = Field(String(20))
|
|
|
51 |
referenceCode = Field(String(20))
|
|
|
52 |
sessionId = Field(String(50))
|
|
|
53 |
gatewayTxnDate = Field(String(50))
|
|
|
54 |
attributes = OneToMany("PaymentAttribute")
|
|
|
55 |
initTimestamp = Field(DateTime)
|
|
|
56 |
successTimestamp = Field(DateTime)
|
| 701 |
chandransh |
57 |
errorTimestamp = Field(DateTime)
|
| 703 |
chandransh |
58 |
using_options(shortnames=True)
|
| 746 |
rajveer |
59 |
using_table_options(mysql_engine="InnoDB")
|
| 420 |
ashish |
60 |
|
| 2747 |
chandransh |
61 |
class Refund(Entity):
|
|
|
62 |
id = Field(Integer, primary_key=True, autoincrement=True)
|
|
|
63 |
paymentId = Field(Integer)
|
|
|
64 |
gatewayId = Field(Integer)
|
|
|
65 |
orderId = Field(Integer)
|
|
|
66 |
amount = Field(Float)
|
|
|
67 |
gatewayTxnId = Field(String(50))
|
|
|
68 |
attempts = Field(Integer)
|
|
|
69 |
createdAt = Field(DateTime)
|
|
|
70 |
processedAt = Field(DateTime)
|
|
|
71 |
attributes = OneToMany("RefundAttribute")
|
|
|
72 |
using_options(shortnames=True)
|
|
|
73 |
using_table_options(mysql_engine="InnoDB")
|
|
|
74 |
|
|
|
75 |
class RefundAttribute(Entity):
|
|
|
76 |
refund = ManyToOne("Refund", primary_key=True)
|
|
|
77 |
name = Field(String(50), primary_key=True)
|
|
|
78 |
value = Field(String(250))
|
|
|
79 |
using_options(shortnames=True)
|
|
|
80 |
using_table_options(mysql_engine="InnoDB")
|
|
|
81 |
|
| 1248 |
chandransh |
82 |
def initialize(dbname='payment'):
|
| 746 |
rajveer |
83 |
#metadata.bind = "sqlite:///payment.sqlite" #need to read it from configserver.
|
| 1248 |
chandransh |
84 |
engine = create_engine('mysql://root:shop2020@localhost/' + dbname, pool_recycle=7200)
|
| 1131 |
chandransh |
85 |
metadata.bind = engine
|
| 420 |
ashish |
86 |
metadata.bind.echo = True
|
|
|
87 |
setup_all(True)
|
|
|
88 |
|
|
|
89 |
if __name__=="__main__":
|
| 703 |
chandransh |
90 |
initialize()
|