Commit cc8c6a5d by Kunto Bregananta Adi

init

1 parent ada1fdd9
Showing 113 changed files with 62 additions and 64 deletions
......@@ -29,11 +29,11 @@ if sys.argv[1:] and sys.argv[1] == 'develop-use-pip':
sys.exit()
setup(
name='agratek.api.merchant',
name='agratek.backoffice',
version='0.1.0',
url='',
license='',
description='Api Merhant PasarQu',
description='AgraTek Backoffice for merchants',
long_description=README + '\n\n' + CHANGES,
author='',
author_email='',
......@@ -56,9 +56,9 @@ setup(
'dev': dev_requires,
},
test_suite="agratek.api.merchant.test",
test_suite="agratek.backoffice.test",
entry_points="""\
[console_scripts]
initialize_agratek_api_merchant_db = agratek.api.merchant.scripts.initializedb:main
initialize_agratek_api_merchant_db = agratek.api.backoffice.scripts.initializedb:main
""",
)
__path__ = __import__('pkgutil').extend_path(__path__, __name__)
\ No newline at end of file
__path__ = __import__('pkgutil').extend_path(__path__, __name__)
\ No newline at end of file
......@@ -3,7 +3,7 @@ from opensipkd.pasar.models.views import deferred_vendor, deferred_customer, def
from pyramid.view import view_config
@view_config(route_name='api-merchant-home',
@view_config(route_name='api-backoffice-home',
permission="view",
renderer='templates/home.pt')
def view_home(request):
......
......@@ -34,7 +34,7 @@ def build_request(typ, vendor_produk, partner_log=None, **kwargs):
# bill_no = values['destination']
# customer_id = 'customer_id' in values and values['customer_id'] or None
# cust_trx_id = 'cust_trx_id' in values and values['cust_trx_id'] or None
pckgs = 'agratek.api.merchant.views'
pckgs = 'agratek.api.backoffice.views'
moduls = vendor_produk.modules.split('.')
if len(moduls) > 1:
pckg = ".".join(moduls[:-1])
......@@ -86,7 +86,7 @@ def get_vendor_produk(produk_kd, vendor_kd=None, harga=None):
return row
@jsonrpc_method(method='inquiry', endpoint='api-merchant')
@jsonrpc_method(method='inquiry', endpoint='api-backoffice')
def inquiry(request, data, **kwargs):
"""
Digunakan untuk mendapatkan data tagihan
......@@ -96,7 +96,7 @@ def inquiry(request, data, **kwargs):
denom: string,
id_pel:string
}
:param token: (jika merchant wajib menggunakan token)
:param token: (jika backoffice wajib menggunakan token)
user_token
:return:
{
......@@ -162,7 +162,7 @@ def build_purchase(vendor_produk, partner_log=None):
return build_request('payment', vendor_produk, partner_log)
@jsonrpc_method(method='purchase', endpoint='api-merchant')
@jsonrpc_method(method='purchase', endpoint='api-backoffice')
def purchase(request, data, **kwargs):
"""
Digunakan untuk mendapatkan daftar produk
......@@ -270,7 +270,7 @@ def payment_advice(dat):
vendor_nm = vend_produk.modules
modul = '.advice'
pckgs = 'agratek.api.merchant.views.{}'.format(vendor_nm)
pckgs = 'agratek.api.backoffice.views.{}'.format(vendor_nm)
moduls = import_module(modul, pckgs)
typ = 'proses'
cls = hasattr(moduls, typ) and getattr(moduls, typ) or None
......@@ -334,7 +334,7 @@ def purchase_advice(customer, dat):
return dat
@jsonrpc_method(method='advice', endpoint='api-merchant')
@jsonrpc_method(method='advice', endpoint='api-backoffice')
def advice(request, data):
"""
Digunakan untuk mendapatkan daftar produk
......@@ -413,7 +413,7 @@ def cancel_tx(dat):
vendor_nm = vend_produk.modules
modul = '.cancel_tx'
pckgs = 'agratek.api.merchant.views.{}'.format(vendor_nm)
pckgs = 'agratek.api.backoffice.views.{}'.format(vendor_nm)
moduls = import_module(modul, pckgs)
typ = 'proses'
cls = hasattr(moduls, typ) and getattr(moduls, typ) or None
......@@ -424,7 +424,7 @@ def cancel_tx(dat):
return dict()
@jsonrpc_method(method='cancel', endpoint='api-merchant')
@jsonrpc_method(method='cancel', endpoint='api-backoffice')
def cancel_rpc(request, data):
user = auth_from_rpc(request)
i = 0
......
......@@ -25,7 +25,7 @@ def build_request(typ, vendor_produk, partner_log=None, **kwargs):
# bill_no = values['destination']
# customer_id = 'customer_id' in values and values['customer_id'] or None
# cust_trx_id = 'cust_trx_id' in values and values['cust_trx_id'] or None
pckgs = 'agratek.api.merchant.views'
pckgs = 'agratek.api.backoffice.views'
moduls = vendor_produk.modules.split('.')
if len(moduls) > 1:
pckg = ".".join(moduls[:-1])
......@@ -135,7 +135,7 @@ def set_register_values(dat, customer):
return values
@jsonrpc_method(method='register', endpoint='api-merchant')
@jsonrpc_method(method='register', endpoint='api-backoffice')
def register(request, data, **kwargs):
user = auth_from_rpc(request)
i = 0
......@@ -226,7 +226,7 @@ def form_result(request, values):
class ViewData(BaseView):
@view_config(route_name='api-merchant-payment',
@view_config(route_name='api-backoffice-payment',
renderer='templates/form-clean.pt')
def view_api_merchant_payment(self):
request = self.req
......@@ -244,7 +244,7 @@ class ViewData(BaseView):
vendor_produk = PartnerProduk.get_produk(invoice_det.vendor_id,
invoice_det.produk_id).first()
pckgs = 'agratek.api.merchant.views'
pckgs = 'agratek.api.backoffice.views'
moduls = vendor_produk.modules.split('.')
if len(moduls) > 1:
pckg = ".".join(moduls[:-1])
......@@ -286,7 +286,7 @@ def api_vendor_callback(request):
# print(data)
vendor_nm = request.matchdict['name']
modul = '.callback'
pckgs = 'agratek.api.merchant.views.{}'.format(vendor_nm)
pckgs = 'agratek.api.backoffice.views.{}'.format(vendor_nm)
moduls = import_module(modul, pckgs)
typ = 'proses'
log.info("Pckgs: {} Modul:{} typ {}".format(pckgs, modul, typ))
......@@ -297,5 +297,5 @@ def api_vendor_callback(request):
if result:
return dict(form=result["form"])
qs = get_qs(data)
return HTTPFound(location=request.route_url("api-merchant-register-callback", _query=qs))
return HTTPFound(location=request.route_url("api-backoffice-register-callback", _query=qs))
# return dict(form="<h1>ERROR</h1>")
......@@ -209,7 +209,7 @@ class ViewData(BaseView):
});
$("#btn_close").click(function() {
window.location = '/api/merchant';
window.location = '/api/backoffice';
return false;
});
"""}
......
......@@ -127,7 +127,7 @@ class ViewData(BaseView):
'route': "/api/purchase",
'scripts': """
$("#btn_close").click(function() {
window.location = '/api/merchant';
window.location = '/api/backoffice';
return false;
});
"""}
......
......@@ -105,7 +105,7 @@ class ViewData(BaseView):
});
$("#btn_close").click(function() {
window.location = '/api/merchant';
window.location = '/api/backoffice';
return false;
});
"""}
......
......@@ -25,7 +25,7 @@ iMid Y AN 10 Merchant Id
payMethod Y AN 2 Payment Method
currency Y AN 3 currency
amt Y N 12 Payment Amount
referenceNo Y ANS 40 Merchant Order No (Key from merchant)
referenceNo Y ANS 40 Merchant Order No (Key from backoffice)
goodsNm Y AN 100 Goods Name
billingNm Y A 30 Buyer name
billingPhone Y N 40 Buyer Phone Number
......@@ -81,7 +81,7 @@ payValidTm Y N 6 135959 expiry time (HH24MISS)
# merchant_token Y AN 255 merchantToken
pay_method Y AN 2 Payment Method
amount Y N 12 Payment Amount
invoice_no Y ANS 40 Merchant Order No (Key from merchant)
invoice_no Y ANS 40 Merchant Order No (Key from backoffice)
goods_nm Y AN 100 Goods Name
billing_nm Y A 30 Buyer name
billing_phone Y N 40 Buyer Phone Number
......@@ -421,7 +421,7 @@ class CCardPayment(colander.Schema):
callback_url = colander.SchemaNode(
colander.String(),
# default="{}/api/merchant/register/callback".format("https://server"),
# default="{}/api/backoffice/register/callback".format("https://server"),
widget=widget.TextInputWidget(max_len=255)
)
......@@ -487,7 +487,7 @@ class CPPayment(colander.Schema):
)
callback_url = colander.SchemaNode(
colander.String(),
default="{}/api/merchant/register/callback".format("https://server"),
default="{}/api/backoffice/register/callback".format("https://server"),
widget=widget.TextInputWidget(max_len=255)
)
......@@ -500,7 +500,7 @@ class WLPayment(colander.Schema):
)
callback_url = colander.SchemaNode(
colander.String(),
default="{}/api/merchant/register/callback".format("https://server"),
default="{}/api/backoffice/register/callback".format("https://server"),
widget=widget.TextInputWidget(max_len=255)
)
......@@ -536,7 +536,7 @@ class CVSResult(colander.Schema):
class PLPayment(colander.Schema):
callback_url = colander.SchemaNode(
colander.String(),
default="{}/api/merchant/register/callback".format("https://server"),
default="{}/api/backoffice/register/callback".format("https://server"),
widget=widget.TextInputWidget(max_len=255)
)
......@@ -557,7 +557,7 @@ def get_form(request, class_form, buttons=None, row=None):
def route_register(request):
return HTTPFound(location=request.route_url('api-merchant-register'))
return HTTPFound(location=request.route_url('api-backoffice-register'))
btn_proses = Button('proses', title='Proses', css_class="btn-warning")
......@@ -669,7 +669,7 @@ def proses(request):
("callback_url", values["callback_url"]),
)
url = request.route_url("api-merchant-payment", _query=_query)
url = request.route_url("api-backoffice-payment", _query=_query)
return HTTPFound(url)
elif denom[:2] in ["WL","PL"]:
result = register(request, data=data)
......@@ -683,8 +683,8 @@ def proses(request):
("invoice_no",dat["invoice_no"]),
("callback_url",values["callback_url"]),
)
url = request.route_url("api-merchant-payment", _query=_query)
# url = request.route_url("api-merchant-payment", _query=_query)
url = request.route_url("api-backoffice-payment", _query=_query)
# url = request.route_url("api-backoffice-payment", _query=_query)
return HTTPFound(url)
elif denom[:2] == "CP":
data.update(dict(va=dict(
......@@ -706,8 +706,8 @@ def proses(request):
("cp_token",values["cp_token"]),
("callback_url",values["callback_url"]),
)
url = request.route_url("api-merchant-payment", _query=_query)
# url = request.route_url("api-merchant-payment", _query=_query)
url = request.route_url("api-backoffice-payment", _query=_query)
# url = request.route_url("api-backoffice-payment", _query=_query)
return HTTPFound(url)
elif denom[:2] == "VA":
......@@ -752,8 +752,8 @@ def proses(request):
class ViewHome(BaseView):
@view_config(route_name='api-merchant-register',
permission="api-merchant-register",
@view_config(route_name='api-backoffice-register',
permission="api-backoffice-register",
renderer='templates/form.pt')
def form_merchant_register(self):
request = self.req
......@@ -775,7 +775,7 @@ class ViewHome(BaseView):
log.info("Data Requested server: {}".format(data))
session['payment'] = data
form = payment(request, data, form)
values = dict(callback_url="{}/api/merchant/register/callback".format(request._host))
values = dict(callback_url="{}/api/backoffice/register/callback".format(request._host))
form.render(values)
return dict(form=form, params=dict(scripts=""))
......@@ -798,8 +798,8 @@ class ViewHome(BaseView):
form.render(values)
return dict(form=form, params=dict(scripts=""))
@view_config(route_name='api-merchant-register-callback',
# permission="api-merchant-register-callback",
@view_config(route_name='api-backoffice-register-callback',
# permission="api-backoffice-register-callback",
renderer='templates/form.pt')
def form_merchant_register_callback(self):
request = self.req
......
......@@ -34,7 +34,7 @@ def update_harga(p, k, v):
def purchase_notify(order):
print('purchase_notify >>')
# Callback to merchant
# Callback to backoffice
if hasattr(order, "customer_id"):
customer = order.customer
invoice = order
......@@ -95,7 +95,7 @@ def payment_notify(order):
key = order.cust_inv_no + users.user_name + users.api_key + typ
signature = sha256(key)
data = order.notify["result"]
# tx_id merchant harus dikirim
# tx_id backoffice harus dikirim
tx_id = order.tx_id
if not tx_id:
pay_request = 'request' in order.payment \
......@@ -136,7 +136,7 @@ def api_vendor_notify(request):
return
modul = '.notify'
pckgs = 'agratek.api.merchant.views.{}'.format(vendor_nm)
pckgs = 'agratek.api.backoffice.views.{}'.format(vendor_nm)
moduls = import_module(modul, pckgs)
typ = 'proses'
cls = hasattr(moduls, typ) and getattr(moduls, typ) or None
......
......@@ -272,7 +272,7 @@ class Vendor(VendorClass): # VendorClass
submit_form();
});
"""
# /api/merchant/payment
# /api/backoffice/payment
form = """
<form action="{url}" method="post" name="payment">
<input type="hidden" name="timeStamp" value="{time_stamp}">
......@@ -320,7 +320,7 @@ class Vendor(VendorClass): # VendorClass
submit_form();
});
"""
# /api/merchant/payment
# /api/backoffice/payment
form = """
<form action="{url}" method="post" name="payment">
<input type="hidden" name="timeStamp" value="{time_stamp}">
......@@ -363,7 +363,7 @@ class Vendor(VendorClass): # VendorClass
submit_form();
});
"""
# /api/merchant/payment
# /api/backoffice/payment
form = """
<form action="{url}" method="post" name="payment">
<input type="hidden" name="timeStamp" value="{time_stamp}">
......@@ -406,7 +406,7 @@ class Vendor(VendorClass): # VendorClass
submit_form();
});
"""
# /api/merchant/payment
# /api/backoffice/payment
f = ""
result = self.result
......@@ -531,7 +531,7 @@ def get_result(response, pay_method):
# cancel_amt="cancelAmt" in response and int(response["cancelAmt"]) or 0,
# deposit_date="depositDt" in response and response["depositDt"] or "",
# deposit_time="depositTm" in response and response["depositTm"] or "",
# tx_id= "", # <= diisi tx_id merchant saat request register
# tx_id= "", # <= diisi tx_id backoffice saat request register
)
if code!=0:
......
......@@ -127,7 +127,7 @@ class Vendor(object): #VendorClass
# Nicepay.set('description', 'Description')
# Nicepay.set('reqDt', '20160301') # Format (YYYYMMDD)
# Nicepay.set('reqTm', '135959') # Format (HHiiss)
# Nicepay.set('reqDomain', 'merchant.com')
# Nicepay.set('reqDomain', 'backoffice.com')
# Nicepay.set('reqServerIP', '127.0.0.1')
# Nicepay.set('reqClientVer', '1.0')
# Nicepay.set('userSessionID', 'userSessionID')
......
......@@ -120,9 +120,9 @@ class view_pay(BaseView):
row_pay = DBSession.query(PartnerPay).filter(PartnerPay.token_pay_req == url_dict['pay_token']).first()
#target to send the register response
merchant_url = row_pay.response_url
#getting the merchant data
#getting the backoffice data
customer = Partner.query().filter(Partner.id == row_pay.customer_id).first()
#getting the merchant authentication data
#getting the backoffice authentication data
registered_user = customer.users
produk_kd = ''
......@@ -302,7 +302,7 @@ class view_pay(BaseView):
# return HTTPFound(route_to)
elif 'batal' in post_data:
return HTTPFound(location=request.route_url('api-merchant-home'))
return HTTPFound(location=request.route_url('api-backoffice-home'))
formSchema = FormSchema()
......@@ -382,7 +382,7 @@ def get_api_url():
settings = get_settings()
hostnya = settings['_host']
# hostnya = 'https://devel.agratek.id'
url = hostnya + "/api/merchant"
url = hostnya + "/api/backoffice"
return url
......@@ -523,7 +523,7 @@ def build_request_json(denom, row, produks):
# "invoice_no": "300bssx5t",
# "server": {
# "ip": "127.0.0.1",
# "domain": "merchant.com"
# "domain": "backoffice.com"
# },
# "vat": 0,
# "cart": {
......
......@@ -224,7 +224,7 @@ class view_pay(BaseView):
settings = get_settings()
hostnya = settings['_host']
url = hostnya + "/api/merchant"
url = hostnya + "/api/backoffice"
body = {
"jsonrpc": "2.0",
......@@ -282,7 +282,7 @@ class view_pay(BaseView):
"item": produks
},
"server": {
"domain": "merchant.com",
"domain": "backoffice.com",
"ip": "127.0.0.1"
}
}
......@@ -430,7 +430,7 @@ class view_pay(BaseView):
server_def_data = {}
server_def_data['domain_server'] = 'merchant.com'
server_def_data['domain_server'] = 'backoffice.com'
server_def_data['ip_server'] = '127.0.0.1'
formServer.render(server_def_data);
......
......@@ -133,7 +133,7 @@ def get_input_error(data):
@jsonrpc_method(method='pay_request', endpoint='api-merchant')
@jsonrpc_method(method='pay_request', endpoint='api-backoffice')
def pay_request(request, data, **kwargs):
user = auth_from_rpc(request)
# user = DBSession.query(User).filter(User.id == 1).first()
......
......@@ -176,7 +176,7 @@ class ViewData(BaseView):
'route': "/api/payment",
'scripts': """
$("#btn_close").click(function() {
window.location = '/api/merchant';
window.location = '/api/backoffice';
return false;
});
"""}
......
......@@ -185,7 +185,7 @@ class ViewData(BaseView):
});
$("#btn_close").click(function() {
window.location = '/api/merchant';
window.location = '/api/backoffice';
return false;
});
"""}
......
......@@ -186,7 +186,7 @@ class ViewData(BaseView):
});
$("#btn_close").click(function() {
window.location = '/api/merchant';
window.location = '/api/backoffice';
return false;
});
"""}
......
......@@ -133,7 +133,7 @@ class ViewData(BaseView):
'route': "/api/purchase",
'scripts': """
$("#btn_close").click(function() {
window.location = '/api/merchant';
window.location = '/api/backoffice';
return false;
});
"""}
......
......@@ -67,7 +67,7 @@ class VendorClass(object):
func = self.vendor_produk.produk.kategori.module
if not func:
func = "Result"
pckgs = 'agratek.api.merchant.views.vendor'
pckgs = 'agratek.api.backoffice.views.vendor'
log.info("Module: %s Pckgs: %s" % (func, pckgs))
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!