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 a6bb3bc4
authored
Jul 24, 2019
by
Solo Group
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
pars odeo
1 parent
337c853b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
93 additions
and
257 deletions
src/agratek/api/merchant/views/odeo.py
src/agratek/api/merchant/views/odeo.py
View file @
a6bb3bc
...
...
@@ -143,261 +143,97 @@ class Vendor(VendorClass):
return
self
.
pars_data
(
result
)
def
pars_data
(
self
,
data
):
# https://api.odeo.co.id/v1/affiliate/prepaid/purchase
"""
{
"data": {
"denom": "TSEL5",
"number": "0812121212"
}
}
Response
{
"status": "SUCCESS",
"data": {
"order_id": 1,
"price": 5675
},
"message": ""
}
{
"status": "BAD_REQUEST",
"data": {
"errors": [
"ERROR_MESSAGE_1",
"ERROR_MESSAGE_2",
"ERROR_MESSAGE_ETC"
]
},
"message": ""
}
{
"status": "UNAUTHORIZED",
"data": {
"errors": [
"Unauthorized"
]
},
"message": ""
}
"""
# GET https://api.odeo.co.id/v1/affiliate/prepaid/pln/inquiry
"""
Request
{
"data": {
"number": "0812121212"
}
}
Response
{
"status": "SUCCESS",
"data": {
"number": "XXX",
"subscriber_id": "XXX",
"name": "XXX",
"tariff": "XXX",
"power": "XXX"
},
"message": ""
}
"""
# GET https://api.odeo.co.id/v1/affiliate/postpaid/inquiry?denom=BPJSKES1&number=XXXX
"""
{
"status": "SUCCESS",
"data": {
"subscriber_id": "XXX",
"subscriber_name": "XXX",
"ref_id": "XXX",
"inquiries": {
"branch_code": "-",
"branch_name": "XXX",
"month_counts": 1,
"participant_counts": 3,
"base_price": 154200,
"bill_rest": 0,
"admin": 2500
},
"subtotal": 156700,
"discount": 600,
"total": 156100
},
"message": ""
}
"""
# GET https://api.odeo.co.id/v1/affiliate/postpaid/inquiry?denom=PLNPASCA&number=XXXX
"""
{
"status": "SUCCESS",
"data": {
"subscriber_id": "XXX",
"subscriber_name": "XXX",
"ref_id": "XXX",
"tariff": "R1/1300VA",
"inquiries": [
{
"period": "2016-08",
"base_price": 300000,
"fine": 0,
"admin_fee": 2500
}
],
"subtotal": 302500,
"discount": 900,
"total": 301600
},
"message": ""
}
"""
# GET https://api.odeo.co.id/v1/affiliate/postpaid/inquiry?denom=PAM...&number=XXXX
"""
{
"status": "SUCCESS",
"data": {
"subscriber_id": "XXX",
"subscriber_name": "XXX",
"ref_id": "XXX",
"inquiries": [
{
"period": "XXX",
"base_price": 300000,
"fine": 0,
"admin_fee": 2500,
"meter_changes": "XXX"
}
],
"subtotal": 302500,
"discount": 900,
"total": 301600
},
"message": ""
}
"""
# GET https://api.odeo.co.id/v1/affiliate/postpaid/inquiry?denom=PGN&number=XXXX
"""
{
"status": "SUCCESS",
"data": {
"subscriber_id": "XXX",
"subscriber_name": "XXX",
"ref_id": "XXX",
"inquiries": {
"period": "XXX",
"meter_changes": "XXX",
"usages": "XXX",
"base_price": 300000,
"admin_fee": 2500
},
"subtotal": 302500,
"discount": 900,
"total": 301600
},
"message": ""
}
"""
# Multi Finance
# GET https://api.odeo.co.id/v1/affiliate/postpaid/inquiry?denom=XXX&number=XXXX
"""
{
"status": "SUCCESS",
"data": {
"subscriber_id": "XXX",
"subscriber_name": "XXX",
"ref_id": "XXX",
"inquiries": {
"installment": "XXX",
"due_date": "XXX",
"platform": "XXX",
"base_price": 300000,
"coll_fee": 0,
"fine": 75000,
"admin": 2000
},
"subtotal": 377000,
"discount": 900,
"total": 376100
},
"message": ""
}
"""
# PLN Pasca
# GET https://api.odeo.co.id/v1/affiliate/postpaid/inquiry?denom=XXXX&number=XXXX
"""
{
"status": "SUCCESS",
"data": {
"subscriber_id": "XXX",
"subscriber_name": "XXX",
"ref_id": "XXX",
"inquiries": {
"period": "XXX",
"base_price": 300000,
"admin_fee": 1500
},
"subtotal": 301500,
"discount": 900,
"total": 300600
},
"message": ""
}
"""
"""
POST https://api.odeo.co.id/affiliate_url
{
"order_id": 1,
"status": "COMPLETED",
"message": "XXX"
"signature": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
}
sha256({order_id} + {MID} + {SECRET_KEY} + {status}) [COMPLETED/REFUNDED]
sha256({MID} + {SECRET_KEY} + {status}) [BROADCAST_NEW_PRICE]
{
"new_prices": {
"TSEL5": 5000
},
"status": "BROADCAST_NEW_PRICE",
"message": "XXX",
"signature": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
}
"""
# GET https://api.odeo.co.id/v1/affiliate/order/order_id (Cek status)
"""
{
"order_id": 123,
"name": "Telkomsel 5",
"msisdn": "08xx",
"serial_number": "XXX",
"status": "COMPLETED",
"price": 5000
}
"""
return
{
"trx_id"
:
self
.
partner_log_id
,
"bill_no"
:
self
.
bill_no
,
"cust_trx"
:
self
.
cust_trx
,
"vend_trx"
:
"order_id"
in
data
and
data
[
"order_id"
]
or
self
.
vend_trx
,
"nama"
:
"nama"
in
data
and
data
[
"nama"
]
or
"NO-NAME"
,
"pokok"
:
"tagihan"
in
data
and
data
[
"tagihan"
]
or
0
,
"denda"
:
"denda"
in
data
and
data
[
"denda"
]
or
0
,
"admin"
:
"admin"
in
data
and
data
[
"admin"
]
or
0
,
"total"
:
"total"
in
data
and
data
[
"total"
]
or
0
,
"ppn"
:
"ppn"
in
data
and
data
[
"ppn"
]
or
0
,
"ref_no"
:
"refnum"
in
data
and
data
[
"refnum"
]
or
""
,
"jml_bulan"
:
"bulan"
in
data
and
data
[
"bulan"
]
or
""
,
"tgh_bulan"
:
"blth"
in
data
and
data
[
"blth"
]
or
""
,
"tarif"
:
"tarif"
in
data
and
data
[
"tarif"
]
or
""
,
"tgl_bayar"
:
"date"
in
data
and
data
[
"date"
]
or
""
,
"info"
:
"info1"
in
data
and
data
[
"info1"
]
or
""
,
"stand_meter"
:
"standmeter"
in
data
and
data
[
"standmeter"
]
or
""
,
}
result
=
{}
result
[
"trx_id"
]
=
self
.
partner_log_id
result
[
"bill_no"
]
=
self
.
bill_no
result
[
"cust_trx"
]
=
self
.
cust_trx
if
"order_id"
in
data
:
result
[
"vend_trx"
]
=
data
[
"order_id"
]
or
self
.
partner_log_id
if
"subscriber_id"
in
data
and
data
[
"subscriber_id"
]:
result
[
'nopel'
]
=
data
[
"subscriber_id"
]
if
"subscriber_id"
in
data
and
data
[
"subscriber_id"
]:
result
[
'nopel'
]
=
data
[
"subscriber_id"
]
if
"name"
in
data
and
data
[
"name"
]:
result
[
'nama'
]
=
data
[
"name"
]
if
"subscriber_name"
in
data
and
data
[
"subscriber_name"
]:
result
[
'nama'
]
=
data
[
"subscriber_name"
]
if
"ref_id"
in
data
and
data
[
"ref_id"
]:
result
[
'ref_no'
]
=
data
[
"ref_id"
]
if
"subtotal"
in
data
and
data
[
"subtotal"
]:
result
[
'subtotal'
]
=
data
[
"subtotal"
]
if
"discount"
in
data
and
data
[
"discount"
]:
result
[
'discount'
]
=
data
[
"discount"
]
if
"total"
in
data
and
data
[
"total"
]:
result
[
'total'
]
=
data
[
"total"
]
if
"tariff"
in
data
and
data
[
"tariff"
]:
result
[
'tarif'
]
=
data
[
"tariff"
]
if
"number"
in
data
and
data
[
"number"
]:
result
[
'no_meter'
]
=
data
[
"number"
]
if
"power"
in
data
and
data
[
"power"
]:
result
[
'daya'
]
=
data
[
"power"
]
if
"inquiries"
not
in
data
:
return
result
inquiries
=
data
[
'inquiries'
]
if
self
.
v_produk_kd
==
"PLNPASCA"
or
self
.
v_produk_kd
[:
3
]
==
"PAM"
:
pokok
=
denda
=
admin
=
0
period
=
meter
=
""
jml_period
=
0
for
inq
in
inquiries
:
pokok
+=
inq
[
"base_price"
]
denda
+=
inq
[
"fine"
]
admin
+=
inq
[
"admin"
]
period
+=
inq
[
"period"
]
+
" "
jml_period
+=
1
if
"meter_changes"
in
inq
:
meter
+=
inq
[
"meter_changes"
]
result
[
"pokok"
]
=
pokok
result
[
"denda"
]
=
denda
result
[
"admin"
]
=
admin
result
[
"period"
]
=
period
result
[
"jml_bulan"
]
=
jml_period
if
meter
:
result
[
"meter"
]
=
meter
else
:
if
"base_price"
in
inquiries
:
result
[
'pokok'
]
=
inquiries
[
"subscriber_id"
]
if
"fine"
in
inquiries
:
result
[
'fine'
]
=
inquiries
[
"fine"
]
if
"coll_fee"
in
inquiries
:
result
[
'coll_fee'
]
=
inquiries
[
"coll_fee"
]
if
"bill_rest"
in
inquiries
:
result
[
'restitusi'
]
=
inquiries
[
"bill_rest"
]
if
"coll_fee"
in
inquiries
:
result
[
'coll_fee'
]
=
inquiries
[
"coll_fee"
]
if
"admin"
in
inquiries
:
result
[
'admin'
]
=
inquiries
[
"admin"
]
if
"admin_fee"
in
inquiries
:
result
[
'admin'
]
=
inquiries
[
"admin_fee"
]
if
"period"
in
inquiries
:
result
[
'period'
]
=
inquiries
[
"period"
]
if
"admin_fee"
in
inquiries
:
result
[
'admin'
]
=
inquiries
[
"admin_fee"
]
if
"meter_changes"
in
inquiries
:
result
[
'meter'
]
=
inquiries
[
"meter_changes"
]
if
"usages"
in
inquiries
:
result
[
'penggunaan'
]
=
inquiries
[
"usages"
]
if
"installment"
in
inquiries
:
result
[
'periode'
]
=
inquiries
[
"installment"
]
if
"due_date"
in
inquiries
:
result
[
'jth_tempo'
]
=
inquiries
[
"due_date"
]
if
"branch_code"
in
inquiries
:
result
[
'kd_cabang'
]
=
inquiries
[
"branch_code"
]
if
"branch_name"
in
inquiries
:
result
[
'nm_cabang'
]
=
inquiries
[
"branch_name"
]
if
"month_counts"
in
inquiries
:
result
[
'jml_bulan'
]
=
inquiries
[
"month_counts"
]
if
"participant_counts"
in
inquiries
:
result
[
'anggota'
]
=
inquiries
[
"participant_counts"
]
return
result
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