Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Kunto
/
backoffice
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 a33e5ae3
authored
Nov 07, 2019
by
yasir
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
perbaikan untuk nominal PLN voucher/pra bayar
1 parent
4ce7d60d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
4 deletions
src/agratek/api/merchant/views/mkm/__init__.py
src/agratek/api/merchant/views/mkm/__init__.py
View file @
a33e5ae
...
@@ -23,6 +23,14 @@ timeout = 30
...
@@ -23,6 +23,14 @@ timeout = 30
class
Vendor
(
VendorClass
):
class
Vendor
(
VendorClass
):
def
__init__
(
self
,
vendor_produk
,
invoice_det
):
def
__init__
(
self
,
vendor_produk
,
invoice_det
):
VendorClass
.
__init__
(
self
,
vendor_produk
,
invoice_det
=
invoice_det
)
VendorClass
.
__init__
(
self
,
vendor_produk
,
invoice_det
=
invoice_det
)
# an = Animal()
# print('isi vendor_produk >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>')
# attrs = vars(vendor_produk.produk)
# {'kids': 0, 'name': 'Dog', 'color': 'Spotted', 'age': 10, 'legs': 2, 'smell': 'Alot'}
# now dump this in some way or another
# print(', '.join("%s: %s" % item for item in attrs.items()))
# id_pel, customer_id, cust_trx, row
# id_pel, customer_id, cust_trx, row
settings
=
get_settings
()
settings
=
get_settings
()
# self.mid = 'odeo_mid' in settings and settings['odeo_mid'] or None
# self.mid = 'odeo_mid' in settings and settings['odeo_mid'] or None
...
@@ -30,6 +38,7 @@ class Vendor(VendorClass):
...
@@ -30,6 +38,7 @@ class Vendor(VendorClass):
self
.
url
=
'mkm_url'
in
settings
and
settings
[
'mkm_url'
]
or
None
self
.
url
=
'mkm_url'
in
settings
and
settings
[
'mkm_url'
]
or
None
self
.
userid
=
'mkm_userid'
in
settings
and
settings
[
'mkm_userid'
]
or
None
self
.
userid
=
'mkm_userid'
in
settings
and
settings
[
'mkm_userid'
]
or
None
self
.
internal_kode_produk
=
vendor_produk
.
produk
.
kode
# key = ":".join([self.mid, self.key]).encode()
# key = ":".join([self.mid, self.key]).encode()
# self.auth = base64.b64encode(key).decode()
# self.auth = base64.b64encode(key).decode()
...
@@ -46,6 +55,7 @@ class Vendor(VendorClass):
...
@@ -46,6 +55,7 @@ class Vendor(VendorClass):
params
[
'MCC'
]
=
6025
params
[
'MCC'
]
=
6025
params
[
'KodeProduk'
]
=
self
.
v_produk_kd
params
[
'KodeProduk'
]
=
self
.
v_produk_kd
params
[
'NomorPelanggan'
]
=
self
.
id_pel
params
[
'NomorPelanggan'
]
=
self
.
id_pel
params
=
json
.
dumps
(
params
)
params
=
json
.
dumps
(
params
)
self
.
request
=
params
self
.
request
=
params
...
@@ -156,13 +166,27 @@ class Vendor(VendorClass):
...
@@ -156,13 +166,27 @@ class Vendor(VendorClass):
tagihan_list_inq
=
result_inquiry
[
'Tagihan'
]
tagihan_list_inq
=
result_inquiry
[
'Tagihan'
]
tagihan_list_pay
=
[]
tagihan_list_pay
=
[]
total_admin
=
0
# total_admin = 0
total_admin
=
int
(
self
.
vendor_produk
.
produk
.
harga
*
len
(
tagihan_list_inq
))
voucher_nominal
=
None
if
self
.
v_produk_kd
==
'522'
:
nominal
=
self
.
internal_kode_produk
nominal
=
nominal
.
replace
(
'PLN'
,
''
)
nominal
=
int
(
nominal
)
*
1000
voucher_nominal
=
nominal
for
item
in
tagihan_list_inq
:
for
item
in
tagihan_list_inq
:
tagihan_pay
=
{}
tagihan_pay
=
{}
tagihan_pay
[
'Periode'
]
=
item
[
'Periode'
]
tagihan_pay
[
'Periode'
]
=
item
[
'Periode'
]
tagihan_pay
[
'Total'
]
=
item
[
'Total'
]
total_admin
=
total_admin
+
item
[
'Total'
]
if
voucher_nominal
:
tagihan_pay
[
'Total'
]
=
voucher_nominal
else
:
tagihan_pay
[
'Total'
]
=
item
[
'Total'
]
# total_admin = total_admin + item['Total']
tagihan_list_pay
.
append
(
tagihan_pay
)
tagihan_list_pay
.
append
(
tagihan_pay
)
...
@@ -244,10 +268,22 @@ class Vendor(VendorClass):
...
@@ -244,10 +268,22 @@ class Vendor(VendorClass):
# total_admin = 0
# total_admin = 0
total_admin
=
int
(
self
.
vendor_produk
.
produk
.
harga
*
len
(
tagihan_list_inq
))
total_admin
=
int
(
self
.
vendor_produk
.
produk
.
harga
*
len
(
tagihan_list_inq
))
voucher_nominal
=
None
if
self
.
v_produk_kd
==
'522'
:
nominal
=
self
.
internal_kode_produk
nominal
=
nominal
.
replace
(
'PLN'
,
''
)
nominal
=
int
(
nominal
)
*
1000
voucher_nominal
=
nominal
for
item
in
tagihan_list_inq
:
for
item
in
tagihan_list_inq
:
tagihan_pay
=
{}
tagihan_pay
=
{}
tagihan_pay
[
'Periode'
]
=
item
[
'Periode'
]
tagihan_pay
[
'Periode'
]
=
item
[
'Periode'
]
tagihan_pay
[
'Total'
]
=
item
[
'Total'
]
if
voucher_nominal
:
tagihan_pay
[
'Total'
]
=
voucher_nominal
else
:
tagihan_pay
[
'Total'
]
=
item
[
'Total'
]
# total_admin = total_admin + item['Total']
# total_admin = total_admin + item['Total']
...
...
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