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 da9f1b08
authored
Dec 06, 2021
by
Owo Sugiana
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Cukup dari tabel log_iso
1 parent
b5002e12
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
135 additions
and
3 deletions
CHANGES.txt
payment_report/__init__.py
payment_report/scripts/common.py
payment_report/scripts/data/conf.csv
payment_report/scripts/pad.py
payment_report/scripts/pad2.py
setup.py
CHANGES.txt
View file @
da9f1b0
0.2 4-12-2021
-------------
- Tambah field jenis_pajak untuk PAD
- Script baru PAD yang tidak lagi membaca tabel pad_payment sebagai catatan
ISO8583 melainkan dari tabel log_iso dan log_pad.
- Penggunaan pkgutil agar fleksibel saat pip install -e
0.1.5 16-6-2021
---------------
- Bug fixed saat tabel pembayaran_sppt tidak memiliki field discount
...
...
payment_report/__init__.py
View file @
da9f1b0
__path__
=
__import__
(
'pkgutil'
)
.
extend_path
(
__path__
,
__name__
)
payment_report/scripts/common.py
View file @
da9f1b0
...
...
@@ -91,6 +91,8 @@ def get_iso(raw, iso_class, debug=False):
def
get_channel_name
(
bit_018
,
bit_041
,
bit_042
,
bit_043
):
if
not
bit_018
:
return
'LAINNYA'
bit_018
=
bit_018
.
strip
()
if
bit_018
==
'6025'
:
bit_041
=
bit_041
.
strip
()
...
...
payment_report/scripts/data/conf.csv
View file @
da9f1b0
nama,nilai,keterangan
pad payment last id,0,pad_payment.id terakhir yang diproses
pad reversal last date,1-1-2000 00:00:00,pad_reversal.tgl terakhir yang diproses
pad2 payment last id,0,log_iso.id terakhir yang diproses
pad2 reversal last id,0,log_iso.id terakhir yang diproses
bphtb payment last id,0,bphtb.bphtb_payment.id terakhir yang diproses
bphtb reversal last date,1-1-2000 00:00:00,bphtb.bphtb_reversal.tgl terakhir yang diproses
bphtb2 payment last id,0,log_iso.id terakhir yang diproses
...
...
payment_report/scripts/pad.py
View file @
da9f1b0
...
...
@@ -40,7 +40,8 @@ class App(BaseApp):
if
not
self
.
pid
:
return
self
.
base_q_pay
=
self
.
prod_session
.
query
(
Payment
)
self
.
base_q_inv
=
self
.
prod_session
.
query
(
Invoice
,
Pajak
,
Customer
,
Usaha
)
self
.
base_q_inv
=
self
.
prod_session
.
query
(
Invoice
,
Pajak
,
Customer
,
Usaha
)
self
.
base_q_inv
=
self
.
base_q_inv
.
filter
(
Invoice
.
pajak_id
==
Pajak
.
id
,
Invoice
.
customer_usaha_id
==
CustomerUsaha
.
id
,
...
...
payment_report/scripts/pad2.py
0 → 100644
View file @
da9f1b0
import
sys
import
transaction
from
opensipkd.waktu
import
dmyhms
from
opensipkd.pad.models.default
import
(
Payment
,
Invoice
,
Pajak
,
CustomerUsaha
,
Customer
,
Usaha
,
)
from
opensipkd.iso8583.bjb.pad.structure
import
PAYMENT_CODE
from
opensipkd.iso8583.bjb.pad.models
import
(
Log
,
PadLog
,
)
from
opensipkd.pad.services.base
import
get_db_session
from
iso8583_web.models.meta
import
Base
as
BaseConf
from
..models
import
(
Base
,
Pad
,
)
from
.common
import
(
App2
as
BaseApp
,
init_db
as
base_init_db
,
)
ERR_NOT_FOUND
=
'Tgl {tgl_bayar} nomor bayar {invoice_id} tidak ada'
class
App
(
BaseApp
):
field_invoice_id
=
'bit_061'
field_ntb
=
'bit_048'
report_orm
=
Pad
log_orm
=
Log
def
__init__
(
self
,
argv
):
super
()
.
__init__
(
argv
)
if
not
self
.
pid
:
return
self
.
base_q_iso_resp
=
self
.
prod_session
.
query
(
Log
)
.
filter_by
(
mti
=
'0210'
,
bit_003
=
PAYMENT_CODE
)
self
.
base_q_pay
=
self
.
prod_session
.
query
(
Payment
)
.
filter
(
PadLog
.
sspd_id
==
Payment
.
id
)
self
.
base_q_inv
=
self
.
prod_session
.
query
(
Invoice
,
Pajak
,
Customer
,
Usaha
)
self
.
base_q_inv
=
self
.
base_q_inv
.
filter
(
Invoice
.
pajak_id
==
Pajak
.
id
,
Invoice
.
customer_usaha_id
==
CustomerUsaha
.
id
,
CustomerUsaha
.
customer_id
==
Customer
.
id
,
Usaha
.
id
==
Pajak
.
usaha_id
,)
def
get_db_session
(
self
):
# Override
return
get_db_session
()
def
get_pay
(
self
,
iso_req
):
q_pay
=
self
.
base_q_pay
.
filter
(
PadLog
.
id
==
iso_req
.
id
)
return
q_pay
.
first
()
def
is_iso_resp_ok
(
self
,
iso_req
):
q
=
self
.
base_q_iso_resp
.
filter_by
(
bit_011
=
iso_req
.
bit_011
,
bit_048
=
iso_req
.
bit_048
)
iso_resp
=
q
.
order_by
(
Log
.
id
.
desc
())
.
first
()
return
iso_resp
and
iso_resp
.
bit_039
==
'00'
def
run_payment
(
self
):
last
=
self
.
get_last_id
(
'pad2 payment last id'
)
q_iso_req
=
self
.
prod_session
.
query
(
Log
)
.
filter_by
(
mti
=
'0200'
,
bit_003
=
PAYMENT_CODE
)
.
filter
(
Log
.
id
>
last
.
as_int
())
for
iso_req
in
q_iso_req
.
order_by
(
Log
.
id
):
if
self
.
get_report
(
iso_req
):
continue
if
not
self
.
is_iso_resp_ok
(
iso_req
):
continue
d
=
self
.
get_keys
(
iso_req
)
tgl_bayar
=
iso_req
.
created
.
date
()
pay
=
self
.
get_pay
(
iso_req
)
if
not
pay
:
msg
=
ERR_NOT_FOUND
.
format
(
tgl_bayar
=
tgl_bayar
,
invoice_id
=
d
[
'nomor_bayar'
])
self
.
log
.
error
(
msg
)
continue
s_tgl
=
dmyhms
(
iso_req
.
created
)
q_inv
=
self
.
base_q_inv
.
filter
(
Invoice
.
id
==
pay
.
spt_id
)
inv
,
pajak
,
cust
,
usaha
=
q_inv
.
first
()
self
.
log
.
info
(
f
'Tgl bayar {s_tgl}, Nomor bayar {d["nomor_bayar"]}, '
f
'Jenis Pajak {usaha.usahanm.strip()},'
f
'STAN {d["stan"]}, NTB {d["ntb"]}, Channel {d["channel"]}'
)
rpt
=
Pad
(
stan
=
d
[
'stan'
],
ntb
=
d
[
'ntb'
],
tgl
=
tgl_bayar
,
jam
=
iso_req
.
created
.
time
(),
sspd_id
=
pay
.
id
,
nomor_bayar
=
d
[
'nomor_bayar'
],
jenis_pajak
=
usaha
.
usahanm
.
strip
(),
masa_pajak
=
pajak
.
masapajak
,
npwpd
=
cust
.
npwpd
,
nama_wp
=
cust
.
customernm
,
pokok
=
pay
.
jml_bayar
-
pay
.
denda
,
denda
=
pay
.
denda
,
jml_bayar
=
pay
.
jml_bayar
,
channel_id
=
iso_req
.
bit_018
.
strip
(),
channel_name
=
d
[
'channel'
])
last
.
nilai
=
str
(
iso_req
.
id
)
with
transaction
.
manager
:
self
.
rpt_session
.
add
(
rpt
)
self
.
rpt_session
.
add
(
last
)
def
run_reversal
(
self
):
# Override
super
()
.
run_reversal
(
'pad reversal last date'
)
def
main
(
argv
=
sys
.
argv
[
1
:]):
app
=
App
(
argv
)
if
app
.
pid
:
app
.
run
()
def
init_db
(
argv
=
sys
.
argv
[
1
:]):
base_init_db
(
Base
.
metadata
,
BaseConf
.
metadata
,
argv
)
setup.py
View file @
da9f1b0
...
...
@@ -15,8 +15,8 @@ line = CHANGES.splitlines()[0]
version
=
line
.
split
()[
0
]
requires
=
[
#
'opensipkd-iso8583-bjb @ '
#
'git+https://git.opensipkd.com/sugiana/opensipkd-iso8583-bjb.git',
'opensipkd-iso8583-bjb @ '
'git+https://git.opensipkd.com/sugiana/opensipkd-iso8583-bjb.git'
,
]
...
...
@@ -41,6 +41,7 @@ setup(
'bphtb_report = payment_report.scripts.bphtb:main'
,
'bphtb2_report = payment_report.scripts.bphtb2:main'
,
'pad_report = payment_report.scripts.pad:main'
,
'pad2_report = payment_report.scripts.pad2:main'
,
],
}
)
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