Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Owo Sugiana
/
payment-report
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 6bc5cb93
authored
Jan 25, 2023
by
Owo Sugiana
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Bug fixed belum rollback usai deteksi JSON Log
1 parent
f15b1dd1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
5 deletions
payment_report/scripts/bphtb.py
payment_report/scripts/bphtb.py
View file @
6bc5cb9
...
@@ -82,16 +82,13 @@ class AlternativePayment(PaymentMixin, Base):
...
@@ -82,16 +82,13 @@ class AlternativePayment(PaymentMixin, Base):
dict
(
schema
=
'public'
))
dict
(
schema
=
'public'
))
class
IsoPayment
(
Base
)
:
class
IsoPayment
Mixin
:
__tablename__
=
'bphtb_payment'
__tablename__
=
'bphtb_payment'
__table_args__
=
dict
(
schema
=
'bphtb'
)
id
=
Column
(
Integer
,
ForeignKey
(
Payment
.
id
),
primary_key
=
True
)
tgl
=
Column
(
DateTime
(
timezone
=
True
),
nullable
=
False
)
tgl
=
Column
(
DateTime
(
timezone
=
True
),
nullable
=
False
)
iso_request
=
Column
(
String
(
1024
),
nullable
=
False
)
iso_request
=
Column
(
String
(
1024
),
nullable
=
False
)
transmission
=
Column
(
DateTime
(
timezone
=
True
),
nullable
=
False
)
transmission
=
Column
(
DateTime
(
timezone
=
True
),
nullable
=
False
)
settlement
=
Column
(
Date
,
nullable
=
False
)
settlement
=
Column
(
Date
,
nullable
=
False
)
stan
=
Column
(
Integer
,
nullable
=
False
)
stan
=
Column
(
Integer
,
nullable
=
False
)
invoice_id
=
Column
(
Integer
,
ForeignKey
(
Invoice
.
id
),
nullable
=
False
)
invoice_no
=
Column
(
String
(
32
),
nullable
=
False
)
invoice_no
=
Column
(
String
(
32
),
nullable
=
False
)
ntb
=
Column
(
String
(
32
),
nullable
=
False
)
ntb
=
Column
(
String
(
32
),
nullable
=
False
)
ntp
=
Column
(
String
(
32
),
nullable
=
False
,
unique
=
True
)
ntp
=
Column
(
String
(
32
),
nullable
=
False
,
unique
=
True
)
...
@@ -99,6 +96,22 @@ class IsoPayment(Base):
...
@@ -99,6 +96,22 @@ class IsoPayment(Base):
channel_id
=
Column
(
Integer
)
channel_id
=
Column
(
Integer
)
bank_ip
=
Column
(
String
(
15
),
nullable
=
False
)
bank_ip
=
Column
(
String
(
15
),
nullable
=
False
)
@declared_attr
def
id
(
self
):
return
Column
(
Integer
,
ForeignKey
(
Payment
.
id
),
primary_key
=
True
)
@declared_attr
def
invoice_id
(
self
):
return
Column
(
Integer
,
ForeignKey
(
Invoice
.
id
),
nullable
=
False
)
class
IsoPayment
(
IsoPaymentMixin
,
Base
):
__table_args__
=
dict
(
schema
=
'bphtb'
)
class
AlternativeIsoPayment
(
IsoPaymentMixin
,
Base
):
pass
class
SukabumiKotaLog
(
Base
):
class
SukabumiKotaLog
(
Base
):
__tablename__
=
'iso_log'
__tablename__
=
'iso_log'
...
@@ -133,6 +146,7 @@ class App(BaseApp):
...
@@ -133,6 +146,7 @@ class App(BaseApp):
return
return
self
.
base_q_func
=
self
.
prod_session
.
query
(
func
.
count
())
self
.
base_q_func
=
self
.
prod_session
.
query
(
func
.
count
())
self
.
is_sukabumi_kota
=
False
self
.
is_sukabumi_kota
=
False
self
.
is_cartenz
=
False
try
:
try
:
self
.
set_default_models
()
self
.
set_default_models
()
except
(
ProgrammingError
,
OperationalError
,
DatabaseError
):
except
(
ProgrammingError
,
OperationalError
,
DatabaseError
):
...
@@ -172,6 +186,7 @@ class App(BaseApp):
...
@@ -172,6 +186,7 @@ class App(BaseApp):
self
.
h2h_session
.
query
(
JsonLog
.
bits
)
.
first
()
self
.
h2h_session
.
query
(
JsonLog
.
bits
)
.
first
()
self
.
is_json_log
=
True
self
.
is_json_log
=
True
except
ProgrammingError
:
except
ProgrammingError
:
self
.
h2h_session
.
rollback
()
self
.
is_json_log
=
False
self
.
is_json_log
=
False
self
.
base_q_log
=
self
.
get_base_q_log
()
self
.
base_q_log
=
self
.
get_base_q_log
()
try
:
try
:
...
@@ -180,6 +195,13 @@ class App(BaseApp):
...
@@ -180,6 +195,13 @@ class App(BaseApp):
self
.
h2h_session
.
rollback
()
self
.
h2h_session
.
rollback
()
# Berarti Log ISO8583 masih di tabel versi 1
# Berarti Log ISO8583 masih di tabel versi 1
self
.
base_q_log
=
None
self
.
base_q_log
=
None
self
.
base_q_iso_payment
=
self
.
prod_session
.
query
(
IsoPayment
)
try
:
self
.
base_q_iso_payment
.
first
()
except
ProgrammingError
:
self
.
prod_session
.
rollback
()
self
.
base_q_iso_payment
=
self
.
prod_session
.
query
(
AlternativeIsoPayment
)
def
set_default_models
(
self
):
def
set_default_models
(
self
):
self
.
base_q_inv
=
self
.
prod_session
.
query
(
Invoice
)
self
.
base_q_inv
=
self
.
prod_session
.
query
(
Invoice
)
...
@@ -288,7 +310,7 @@ class App(BaseApp):
...
@@ -288,7 +310,7 @@ class App(BaseApp):
return
q
.
order_by
(
self
.
Payment
.
tanggal
,
self
.
Payment
.
jam
)
return
q
.
order_by
(
self
.
Payment
.
tanggal
,
self
.
Payment
.
jam
)
def
get_iso_v1
(
self
,
pay
):
def
get_iso_v1
(
self
,
pay
):
q
=
self
.
prod_session
.
query
(
IsoPayment
)
.
filter_by
(
id
=
pay
.
id
)
q
=
self
.
base_q_iso_payment
.
filter_by
(
id
=
pay
.
id
)
row
=
q
.
first
()
row
=
q
.
first
()
if
not
row
:
if
not
row
:
return
return
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment