models.py
2.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
from sqlalchemy import (
Column,
Integer,
Float,
DateTime,
String,
Text,
JSON,
ForeignKey,
func,
)
from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base()
# Tabel pertama saat ada request dari LinkAja
class Rpc(Base):
__tablename__ = 'linkaja_trx'
id = Column(Integer, primary_key=True) # Bill Ref
created = Column(
DateTime(timezone=True), nullable=False, server_default=func.now())
ip = Column(String(15), nullable=False)
conf_name = Column(String(16), nullable=False)
merchant = Column(Text, nullable=False)
terminal = Column(String(100), nullable=False)
trx_type = Column(String(3), nullable=False)
msisdn = Column(String(20), nullable=False)
# Invoice ID = SPPT ID di PBB
acc_no = Column(String(64), nullable=False)
msg = Column(String(100))
trx_date = Column(DateTime(timezone=True), nullable=False)
# Dari inquiry response
amount = Column(Float)
# Dari inquiry response (Bill Ref),
# diisi saat payment request (bill_ref)
inquiry_id = Column(Integer, ForeignKey('linkaja_trx.id'))
# Dari payment request (trx_id)
ntb = Column(String(32))
# Penerjemahan bit 39
resp_code = Column(String(2))
# Penjelasan resp_code untuk pelanggan
resp_msg = Column(Text)
# Penjelasan resp_code untuk audit sistem
resp_orig_msg = Column(Text)
# Nama wajib pajak
biller_name = Column(String(200))
# Dari payment response (Transaction ID)
ntp = Column(String(32))
# Dari bit 11, dibutuhkan untuk reversal
stan = Column(String(6))
# Tabel kedua saat berkomunikasi dengan bank
class Bank(Base):
__tablename__ = 'linkaja_bank'
id = Column(Integer, primary_key=True)
created = Column(
DateTime(timezone=True), nullable=False, server_default=func.now())
rpc_id = Column(Integer, ForeignKey(Rpc.id), nullable=False)
url = Column(Text, nullable=False)
conf_name = Column(String(16), nullable=False)
request = Column(JSON, nullable=False)
response = Column(JSON)