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 d91b2923
authored
Dec 23, 2021
by
Owo Sugiana
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Tambah WEBR
1 parent
da9f1b08
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
151 additions
and
4 deletions
.gitignore
CHANGES.txt
payment_report/models.py
payment_report/scripts/data/conf.csv
payment_report/scripts/pad2.py
payment_report/scripts/webr.py
setup.py
.gitignore
View file @
d91b292
...
...
@@ -2,3 +2,4 @@ test*
*egg-info
*__pycache__
build
dist
CHANGES.txt
View file @
d91b292
0.2.1 23-12-2021
----------------
- Tambah WEBR
0.2 4-12-2021
-------------
- Tambah field jenis_pajak untuk PAD
...
...
payment_report/models.py
View file @
d91b292
...
...
@@ -10,6 +10,7 @@ from sqlalchemy import (
UniqueConstraint
,
)
from
sqlalchemy.ext.declarative
import
declarative_base
from
opensipkd.iso8583.bjb.webr.models
import
LogMixin
Base
=
declarative_base
()
...
...
@@ -29,9 +30,9 @@ class Pad(Base, Common):
stan
=
Column
(
String
(
6
),
nullable
=
False
)
# Bit 48
ntb
=
Column
(
String
(
32
),
nullable
=
False
)
# pad.pad_sspd.create_date
# pad.pad_sspd.create_date
/ log_iso.created
tgl
=
Column
(
Date
,
nullable
=
False
)
# pad.pad_sspd.sspdjam
# pad.pad_sspd.sspdjam
/ log_iso.created
jam
=
Column
(
Time
,
nullable
=
False
)
# pad.pad_sspd.id
sspd_id
=
Column
(
Integer
,
nullable
=
False
)
...
...
@@ -41,7 +42,7 @@ class Pad(Base, Common):
jenis_pajak
=
Column
(
String
(
32
),
nullable
=
False
)
# pad.pad_pajak.masapajak
masa_pajak
=
Column
(
Integer
,
nullable
=
False
)
# pad.pad_customer
# pad.pad_customer
.npwpd
npwpd
=
Column
(
String
(
17
),
nullable
=
False
)
# pad.pad_customer.customernm
nama_wp
=
Column
(
String
(
150
),
nullable
=
False
)
...
...
@@ -62,6 +63,44 @@ class Pad(Base, Common):
)
class
Webr
(
Base
,
Common
):
__tablename__
=
'webr_report'
id
=
Column
(
Integer
,
primary_key
=
True
)
# Bit 11
stan
=
Column
(
String
(
6
),
nullable
=
False
)
# Bit 48
ntb
=
Column
(
String
(
32
),
nullable
=
False
)
# log_iso.created
tgl
=
Column
(
Date
,
nullable
=
False
)
# log_iso.created
jam
=
Column
(
Time
,
nullable
=
False
)
# webr.ar_payment.id
payment_id
=
Column
(
Integer
,
nullable
=
False
)
# Bit 61
nomor_bayar
=
Column
(
String
(
16
),
nullable
=
False
)
# webr.ar_invoice.subjek_nama
nama_wp
=
Column
(
String
(
150
),
nullable
=
False
)
# webr.ar_invoice.jumlah - webr.ar_invoice.bunga
pokok
=
Column
(
Float
,
nullable
=
False
)
# webr.ar_payment.bunga
denda
=
Column
(
Float
,
nullable
=
False
)
# webr.ar_payment.bayar
jml_bayar
=
Column
(
Float
,
nullable
=
False
)
# Bit 18
channel_id
=
Column
(
String
(
4
),
nullable
=
False
)
# Bit 41 / 42 / 43
channel_name
=
Column
(
String
(
32
),
nullable
=
False
)
# pad_reversal.tgl
tgl_batal
=
Column
(
DateTime
(
timezone
=
True
))
__table_args__
=
(
UniqueConstraint
(
'stan'
,
'ntb'
),
)
class
Log
(
Base
,
LogMixin
):
__table_args__
=
dict
(
schema
=
'webr'
)
class
Bphtb
(
Base
,
Common
):
__tablename__
=
'bphtb_report'
id
=
Column
(
Integer
,
primary_key
=
True
)
...
...
payment_report/scripts/data/conf.csv
View file @
d91b292
...
...
@@ -3,6 +3,8 @@ 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
webr payment last id,0,log_iso.id terakhir yang diproses
webr 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/pad2.py
View file @
d91b292
...
...
@@ -105,7 +105,7 @@ class App(BaseApp):
self
.
rpt_session
.
add
(
last
)
def
run_reversal
(
self
):
# Override
super
()
.
run_reversal
(
'pad
reversal last date
'
)
super
()
.
run_reversal
(
'pad
2 reversal last id
'
)
def
main
(
argv
=
sys
.
argv
[
1
:]):
...
...
payment_report/scripts/webr.py
0 → 100644
View file @
d91b292
import
sys
import
transaction
from
opensipkd.waktu
import
dmyhms
from
opensipkd.webr.models.default
import
(
Payment
,
Invoice
,
)
from
opensipkd.iso8583.bjb.webr.structure
import
PAYMENT_CODE
from
opensipkd.webr.services.base
import
get_db_session
from
iso8583_web.models.meta
import
Base
as
BaseConf
from
..models
import
(
Base
,
Webr
,
Log
,
)
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
=
Webr
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
,
Invoice
)
.
filter
(
Payment
.
ar_invoice_id
==
Invoice
.
id
)
def
get_db_session
(
self
):
# Override
return
get_db_session
()
def
get_pay
(
self
,
d
):
q_pay
=
self
.
base_q_pay
.
filter
(
Invoice
.
kode
==
d
[
'nomor_bayar'
])
return
q_pay
.
order_by
(
Payment
.
id
.
desc
())
.
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
(
'webr 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
(
d
)
if
not
pay
:
msg
=
ERR_NOT_FOUND
.
format
(
tgl_bayar
=
tgl_bayar
,
invoice_id
=
d
[
'nomor_bayar'
])
self
.
log
.
error
(
msg
)
continue
pay
,
inv
=
pay
s_tgl
=
dmyhms
(
iso_req
.
created
)
self
.
log
.
info
(
f
'Tgl bayar {s_tgl}, Nomor bayar {d["nomor_bayar"]}, '
f
'STAN {d["stan"]}, NTB {d["ntb"]}, Channel {d["channel"]}'
)
rpt
=
Webr
(
stan
=
d
[
'stan'
],
ntb
=
d
[
'ntb'
],
tgl
=
tgl_bayar
,
jam
=
iso_req
.
created
.
time
(),
payment_id
=
pay
.
id
,
nomor_bayar
=
d
[
'nomor_bayar'
],
nama_wp
=
inv
.
subjek_nama
,
pokok
=
inv
.
jumlah
-
inv
.
bunga
,
denda
=
pay
.
bunga
,
jml_bayar
=
pay
.
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
(
'webr reversal last id'
)
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 @
d91b292
...
...
@@ -42,6 +42,7 @@ setup(
'bphtb2_report = payment_report.scripts.bphtb2:main'
,
'pad_report = payment_report.scripts.pad:main'
,
'pad2_report = payment_report.scripts.pad2:main'
,
'webr_report = payment_report.scripts.webr: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