Commit 7838c681 by Solo Group
2 parents 26bda6ec 156fcfb1
...@@ -41,6 +41,7 @@ api-produk-vendor-delete,/api/produk/vendor/{id}/delete,Delete Produk Vendor,1,0 ...@@ -41,6 +41,7 @@ api-produk-vendor-delete,/api/produk/vendor/{id}/delete,Delete Produk Vendor,1,0
api-payment-list,/api/payment/list,Test Api Payment,1,0 api-payment-list,/api/payment/list,Test Api Payment,1,0
api-payment-act,/api/payment/{act}/act,Test Api Payment,1,0
api-payment-add,/api/payment/add,Add Api Payment,1,0 api-payment-add,/api/payment/add,Add Api Payment,1,0
api-payment-edit,/api/payment/{id}/edit,Edit Api Payment,1,0 api-payment-edit,/api/payment/{id}/edit,Edit Api Payment,1,0
api-payment-delete,/api/payment/{id}/delete,Delete Api Payment,1,0 api-payment-delete,/api/payment/{id}/delete,Delete Api Payment,1,0
......
...@@ -80,6 +80,8 @@ def get_vendor_produk(produk_kd, vendor_kd=None, harga=None): ...@@ -80,6 +80,8 @@ def get_vendor_produk(produk_kd, vendor_kd=None, harga=None):
qry = qry.filter(Partner.kode == vendor_kd) qry = qry.filter(Partner.kode == vendor_kd)
else: else:
qry = qry.filter(PartnerProduk.status == 1) qry = qry.filter(PartnerProduk.status == 1)
# by tatang
qry = qry.order_by(PartnerProduk.harga)
row = qry.first() row = qry.first()
return row return row
......
...@@ -101,6 +101,7 @@ def set_register_values(dat, customer): ...@@ -101,6 +101,7 @@ def set_register_values(dat, customer):
delivery_phone=deliver_to['phone'], delivery_phone=deliver_to['phone'],
delivery_pos=deliver_to['post_code'], delivery_pos=deliver_to['post_code'],
delivery_state=deliver_to['state'], delivery_state=deliver_to['state'],
# delivery_email=deliver_to['email'],
fee=dat['fee'], fee=dat['fee'],
vat=dat['vat'], vat=dat['vat'],
...@@ -214,6 +215,7 @@ def form_result(request, values): ...@@ -214,6 +215,7 @@ def form_result(request, values):
form.render(values) form.render(values)
return dict(form=form, params=dict(scripts="")) return dict(form=form, params=dict(scripts=""))
class ViewData(BaseView): class ViewData(BaseView):
@view_config(route_name='api-merchant-payment', @view_config(route_name='api-merchant-payment',
renderer='templates/form-clean.pt') renderer='templates/form-clean.pt')
...@@ -268,10 +270,11 @@ class ViewData(BaseView): ...@@ -268,10 +270,11 @@ class ViewData(BaseView):
message="Parameter Expected") message="Parameter Expected")
return form_result(request, values) return form_result(request, values)
@view_config(route_name='api-vendor-callback', renderer="templates/form-clean.pt") @view_config(route_name='api-vendor-callback', renderer="templates/form-clean.pt")
def api_vendor_callback(request): def api_vendor_callback(request):
data = request.POST and dict(request.POST.items()) or dict(request.GET.items()) data = request.POST and dict(request.POST.items()) or dict(request.GET.items())
print(data) # print(data)
vendor_nm = request.matchdict['name'] vendor_nm = request.matchdict['name']
modul = '.callback' modul = '.callback'
pckgs = 'agratek.api.merchant.views.{}'.format(vendor_nm) pckgs = 'agratek.api.merchant.views.{}'.format(vendor_nm)
...@@ -279,11 +282,11 @@ def api_vendor_callback(request): ...@@ -279,11 +282,11 @@ def api_vendor_callback(request):
typ = 'proses' typ = 'proses'
log.info("Pckgs: {} Modul:{} typ {}".format(pckgs, modul, typ)) log.info("Pckgs: {} Modul:{} typ {}".format(pckgs, modul, typ))
cls = hasattr(moduls, typ) and getattr(moduls, typ) or None cls = hasattr(moduls, typ) and getattr(moduls, typ) or None
print(dir(cls)) # print(dir(cls))
if cls: if cls:
result = cls(data) result = cls(data)
if result: if result:
return dict(form=result["form"]) return dict(form=result["form"])
qs =get_qs(data) qs = get_qs(data)
return HTTPFound(location=request.route_url("api-merchant-register-callback", _query=qs)) return HTTPFound(location=request.route_url("api-merchant-register-callback", _query=qs))
return dict(form="<h1>ERROR</h1>")
\ No newline at end of file \ No newline at end of file
# return dict(form="<h1>ERROR</h1>")
...@@ -307,6 +307,11 @@ class RegisterSchema(colander.Schema): ...@@ -307,6 +307,11 @@ class RegisterSchema(colander.Schema):
missing=colander.drop, missing=colander.drop,
widget=widget.TextInputWidget(attributes={'maxlength': 50}) widget=widget.TextInputWidget(attributes={'maxlength': 50})
) )
# delivery_email = colander.SchemaNode(
# colander.String(),
# missing=colander.drop,
# widget=widget.TextInputWidget(attributes={'maxlength': 128})
# )
vat = colander.SchemaNode( vat = colander.SchemaNode(
colander.Integer(), colander.Integer(),
default=0, default=0,
...@@ -424,7 +429,7 @@ class CCardPayment(colander.Schema): ...@@ -424,7 +429,7 @@ class CCardPayment(colander.Schema):
callback_url = colander.SchemaNode( callback_url = colander.SchemaNode(
colander.String(), colander.String(),
default="{}/api/merchant/register/callback".format("https://server"), # default="{}/api/merchant/register/callback".format("https://server"),
widget=widget.TextInputWidget(max_len=255) widget=widget.TextInputWidget(max_len=255)
) )
......
...@@ -104,7 +104,12 @@ def proses_np(data): ...@@ -104,7 +104,12 @@ def proses_np(data):
@view_config(route_name='api-vendor-notify', renderer='json') @view_config(route_name='api-vendor-notify', renderer='json')
def api_vendor_notify(request): def api_vendor_notify(request):
vendor_nm = request.matchdict['name'] vendor_nm = request.matchdict['name']
data = json.loads(request.text)
try:
data = json.loads(request.text)
except:
data = request.POST and dict(request.POST.items()) or dict(request.GET.items())
modul = '.notify' modul = '.notify'
pckgs = 'agratek.api.merchant.views.{}'.format(vendor_nm) pckgs = 'agratek.api.merchant.views.{}'.format(vendor_nm)
moduls = import_module(modul, pckgs) moduls = import_module(modul, pckgs)
......
...@@ -90,46 +90,46 @@ def userIp(): ...@@ -90,46 +90,46 @@ def userIp():
def niceRegister(): def niceRegister():
requestDataJson = json.dumps(requestData) requestDataJson = json.dumps(requestData)
apiUrl = "https://api.nicepay.co.id/nicepay/direct/v2/registration" apiUrl = "https://www.nicepay.co.id/nicepay/direct/v2/registration"
resultData = sendDataJson(requestDataJson, apiUrl) resultData = sendDataJson(requestDataJson, apiUrl)
return resultData return resultData
def niceInquiry(): def niceInquiry():
requestDataJson = json.dumps(requestData) requestDataJson = json.dumps(requestData)
apiUrl = "https://api.nicepay.co.id/nicepay/direct/v2/inquiry" apiUrl = "https://www.nicepay.co.id/nicepay/direct/v2/inquiry"
resultData = sendDataJson(requestDataJson, apiUrl) resultData = sendDataJson(requestDataJson, apiUrl)
return resultData return resultData
def niceCancel(): def niceCancel():
requestDataJson = json.dumps(requestData) requestDataJson = json.dumps(requestData)
apiUrl = "https://api.nicepay.co.id/nicepay/direct/v2/cancel" apiUrl = "https://www.nicepay.co.id/nicepay/direct/v2/cancel"
resultData = sendDataJson(requestDataJson, apiUrl) resultData = sendDataJson(requestDataJson, apiUrl)
return resultData return resultData
def nicePayment(): def nicePayment():
apiUrl = "https://api.nicepay.co.id/nicepay/direct/v2/payment" apiUrl = "https://www.nicepay.co.id/nicepay/direct/v2/payment"
resultData = sendData(requestData, apiUrl) resultData = sendData(requestData, apiUrl)
return resultData return resultData
def niceVacctInquiry(): def niceVacctInquiry():
apiUrl = "https://api.nicepay.co.id/nicepay/api/vacctInquiry.do" apiUrl = "https://www.nicepay.co.id/nicepay/api/vacctInquiry.do"
resultData = sendData(requestData, apiUrl) resultData = sendData(requestData, apiUrl)
return resultData return resultData
def niceCustomerIdInquiry(): def niceCustomerIdInquiry():
apiUrl = "https://api.nicepay.co.id/nicepay/api/vacctCustomerIdInquiry.do" apiUrl = "https://www.nicepay.co.id/nicepay/api/vacctCustomerIdInquiry.do"
resultData = sendData(requestData, apiUrl) resultData = sendData(requestData, apiUrl)
return resultData return resultData
def niceInstallmentInfo(): def niceInstallmentInfo():
requestDataJson = json.dumps(requestData) requestDataJson = json.dumps(requestData)
apiUrl = "https://api.nicepay.co.id/nicepay/direct/v2/instInfoInquiry" apiUrl = "https://www.nicepay.co.id/nicepay/direct/v2/instInfoInquiry"
resp = sendDataJson(requestDataJson, apiUrl) resp = sendDataJson(requestDataJson, apiUrl)
resultData = sendDataJson(requestDataJson, apiUrl) resultData = sendDataJson(requestDataJson, apiUrl)
return resultData return resultData
......
...@@ -111,6 +111,7 @@ class Vendor(VendorClass): # VendorClass ...@@ -111,6 +111,7 @@ class Vendor(VendorClass): # VendorClass
Nicepay.set('deliveryState', self.invoice_det.delivery_state) Nicepay.set('deliveryState', self.invoice_det.delivery_state)
Nicepay.set('deliveryPostCd', self.invoice_det.delivery_pos) Nicepay.set('deliveryPostCd', self.invoice_det.delivery_pos)
Nicepay.set('deliveryCountry', self.invoice_det.delivery_country) Nicepay.set('deliveryCountry', self.invoice_det.delivery_country)
# Nicepay.set('deliveryEmail', self.invoice_det.delivery_email)
# print('>>> INVOICE DET:', self.invoice_det.vat, type(self.invoice_det.vat), # print('>>> INVOICE DET:', self.invoice_det.vat, type(self.invoice_det.vat),
# self.invoice_det.fee, type(self.invoice_det.fee), # self.invoice_det.fee, type(self.invoice_det.fee),
...@@ -460,7 +461,7 @@ class Vendor(VendorClass): # VendorClass ...@@ -460,7 +461,7 @@ class Vendor(VendorClass): # VendorClass
self.response = data self.response = data
log.info("Payment Result: {}".format(data)) log.info("Payment Result: {}".format(data))
self.result = get_result(self.response, self.pay_method) self.result = get_result(self.response, self.pay_method)
self.save_log("payment")
script = """ script = """
function submit_form(){ function submit_form(){
$("form[name='callback']").submit(); $("form[name='callback']").submit();
...@@ -472,6 +473,11 @@ class Vendor(VendorClass): # VendorClass ...@@ -472,6 +473,11 @@ class Vendor(VendorClass): # VendorClass
# /api/merchant/payment # /api/merchant/payment
f = "" f = ""
result = self.result result = self.result
self.request = 'request' in self.invoice_det.payment and \
self.invoice_det.payment['request'] or ""
self.save_log("payment")
for r in result: for r in result:
if r and type(result[r])==dict: if r and type(result[r])==dict:
rs = result[r] rs = result[r]
...@@ -514,39 +520,70 @@ class Vendor(VendorClass): # VendorClass ...@@ -514,39 +520,70 @@ class Vendor(VendorClass): # VendorClass
signature = sha256("{mid}{vend_inv_no}{amount}{key}" \ signature = sha256("{mid}{vend_inv_no}{amount}{key}" \
.format(mid=self.mid, key=self.key, amount=str(amount), .format(mid=self.mid, key=self.key, amount=str(amount),
vend_inv_no=vend_inv_no)) vend_inv_no=vend_inv_no))
# print('>>>>', signature)
if merchant_token != signature: if merchant_token != signature:
return return
status = int(data['status'])
if status == 0:
# pembayaran sukses
self.status = 1
elif status == 1:
# pembayaran gagal / reversal
self.status = 2
self.response = data self.response = data
self.result = get_result(self.response, self.pay_method) self.result = get_result(self.response, self.pay_method)
self.save_log("notify") self.save_log("notify")
return self.result return self.result
def get_result(response, pay_method): def get_result(response, pay_method):
status = "status" in response and response['status'] and int(response["status"]) + 1 or 1
try:
code = int(response["resultCd"])
except:
code = 0
try:
message = response["resultMsg"]
except:
message = ''
result = dict( result = dict(
code=int(response["resultCd"]), code=code,
message=response["resultMsg"], message=message,
# cancel_amt=response["cancelAmt"], # cancel_amt="cancelAmt" in response and int(response["cancelAmt"]) or 0,
# deposit_date=response["depositDt"], # deposit_date="depositDt" in response and response["depositDt"] or "",
# deposit_time=response["depositTm"], # deposit_time="depositTm" in response and response["depositTm"] or "",
# tx_id=response[''], # <=
invoice_no="referenceNo" in response and response["referenceNo"] or "",
amount="amt" in response and int(response["amt"]) or 0,
match_cl="matchCl" in response and int(response["matchCl"]) or 0,
status=status,
trans_date="transDt" in response and response["transDt"] or "",
trans_time="transTm" in response and response["transTm"] or "",
currency="currency" in response and response["currency"] or "",
description="goodsNm" in response and response["goodsNm"] or "",
customer_nm="billingNm" in response and response["billingNm"] or "",
) )
if pay_method == "01": if pay_method == "01":
result.update(dict( result.update(dict(
cc=dict( credit_card=dict(
auth_no=response["authNo"], auth_no=response["authNo"],
issue_bank=response["issuBankCd"], issue_bank=response["issuBankCd"],
issue_bank_nm='issuBankNm' in response and response["issuBankNm"] or "", issue_bank_nm='issuBankNm' in response and response["issuBankNm"] or "",
acqu_bank=response["acquBankCd"], acqu_bank=response["acquBankCd"],
acqu_bank_nm='acquBankNm' in response and response["acquBankNm"] or "", acqu_bank_nm='acquBankNm' in response and response["acquBankNm"] or "",
acqu_status='acquStatus' in response and response["acquStatus"] or "", acqu_status='acquStatus' in response and response["acquStatus"] or "",
card_no=response["cardNo"], card_no='cardNo' in response and response["cardNo"] or "",
card_exp=response["cardExpYymm"], card_exp='cardExpYymm' in response and response["cardExpYymm"] or "",
instmnt_mon=response["instmntMon"], instmnt_mon='instmntMon' in response and response["instmntMon"] or "",
instmnt_tpe=response["instmntType"], instmnt_tpe='instmntType' in response and response["instmntType"] or "",
preauth_token=response["preauthToken"], preauth_token='preauthToken' in response and response["preauthToken"] or "",
recurring_token=response["recurringToken"], recurring_token='recurringToken' in response and response["recurringToken"] or "",
cc_trans_type=response["ccTransType"], cc_trans_type='ccTransType' in response and response["ccTransType"] or "",
vat="vat" in response and int(response["vat"]) or 0, vat="vat" in response and int(response["vat"]) or 0,
fee="fee" in response and int(response["fee"]) or 0, fee="fee" in response and int(response["fee"]) or 0,
no_tax_amt="notaxAmt" in response and int(response["notaxAmt"]) or 0, no_tax_amt="notaxAmt" in response and int(response["notaxAmt"]) or 0,
...@@ -589,7 +626,9 @@ def get_result(response, pay_method): ...@@ -589,7 +626,9 @@ def get_result(response, pay_method):
va=dict( va=dict(
vaacct_no=response["vacctNo"], vaacct_no=response["vacctNo"],
valid_date=response["vacctValidDt"], valid_date=response["vacctValidDt"],
valid_time=response["vacctValidTm"] valid_time=response["vacctValidTm"],
deposit_date="depositDt" in response and response["depositDt"] or "",
deposit_time="depositTm" in response and response["depositTm"] or "",
) )
)) ))
else: else:
...@@ -609,16 +648,18 @@ def get_result(response, pay_method): ...@@ -609,16 +648,18 @@ def get_result(response, pay_method):
valid_date="payValidDt" in response and response["payValidDt"] or "", valid_date="payValidDt" in response and response["payValidDt"] or "",
valid_time="payValidTm" in response and response["payValidTm"] or "", valid_time="payValidTm" in response and response["payValidTm"] or "",
m_ref_no="mRefNo" in response and response["mRefNo"] or "", m_ref_no="mRefNo" in response and response["mRefNo"] or "",
receipt_code="receiptCode" in response and response["receiptCode"] or "" receipt_code="receiptCode" in response and response["receiptCode"] or "",
deposit_date="depositDt" in response and response["depositDt"] or "",
deposit_time="depositTm" in response and response["depositTm"] or "",
) )
if pay_method == "03": if pay_method == "03":
result.update({"cvs": other}) result.update({"cvs": other})
elif pay_method == "04": elif pay_method == "04":
result.update({"cp": other}) result.update({"cp": other})
elif pay_method == "05": elif pay_method == "05":
result.update({"wl": other}) result.update({"wallet": other})
else: else:
result.update({"pl": other}) result.update({"loan": other})
return result return result
......
...@@ -10,10 +10,19 @@ def proses(data): ...@@ -10,10 +10,19 @@ def proses(data):
vend_inv_no = data["tXid"] vend_inv_no = data["tXid"]
cus_inv_no = data["referenceNo"] cus_inv_no = data["referenceNo"]
invoice_det = PartnerPay.query_vend_inv_no(vend_inv_no)\ invoice_det = PartnerPay.query_vend_inv_no(vend_inv_no)\
.filter(cust_inv_no=cus_inv_no) .filter_by(cust_inv_no=cus_inv_no)\
.first()
# by tatang
if not invoice_det:
return
vendor_produk = PartnerProduk.query()\ vendor_produk = PartnerProduk.query()\
.filter_by(partner_id=invoice_det.vendor_id, .filter_by(partner_id=invoice_det.vendor_id,
produk_id=invoice_det.produk_id) produk_id=invoice_det.produk_id)\
.first()
# by tatang
if not vendor_produk:
return
vendor = Vendor(vendor_produk, invoice_det) vendor = Vendor(vendor_produk, invoice_det)
vendor.notify(data) vendor.notify(data)
......
import colander
from datatables import ColumnDT
from deform import widget, Form, ValidationFailure
from opensipkd.base.views import DataTables
from pyramid.httpexceptions import HTTPFound
from pyramid.view import view_config
from sqlalchemy.orm import aliased
from . import BaseView
from ..models import (DBSession, PartnerPay, Partner)
from opensipkd.base.tools import format_json
from opensipkd.base.tools.db import column_concat
status_payment = (
(-1, '--Semua--'),
(0, 'Pending'),
(1, 'Sukses / Selesai'),
(2, 'Batal / Reversal'),
)
def form_validator(form, value):
pass
class ViewData(BaseView):
@view_config(route_name='api-payment-list',
permission="api-payment-list",
renderer='templates/payment/list.pt')
def view_list(self):
class ToolbarSchema(colander.Schema):
status = colander.SchemaNode(
colander.String(),
oid="status", widget=widget.SelectWidget(values=status_payment, css_class='form-toolbar')
)
toolbar = ToolbarSchema(Validator=form_validator)
toolbar.request = self.req
form = Form(schema=toolbar)
params = {
'form': form,
'status_payment': [s for k, s in status_payment if k > -1],
'columns': [
dict(title="ID"),
dict(title="No. Invoice"),
dict(title="Customer"),
dict(title="Vendor"),
dict(title="Amount"),
dict(title="Status"),
],
'column_data': [
dict(data="id", width="0px"),
dict(data="nomor", width="150px"),
dict(data="customer"),
dict(data="vendor"),
dict(data="amount", width="100px"),
dict(data="status", width="100px"),
],
'buttons': [
dict(id="btn_view", cls="btn btn btn-primary", title="View"),
dict(id="btn_close", cls="btn btn-danger", title="Tutup"),
],
'route': "/api/payment",
'scripts': """
$("#btn_close").click(function() {
window.location = '/api/merchant';
return false;
});
"""}
return dict(params=params)
@view_config(route_name='api-payment-act', renderer='json',
permission="api-payment-list"
)
def view_act(self):
request = self.req
url_dict = request.matchdict
act = url_dict['act']
if act == "grid":
status = -1
if 'status' in request.params:
status = int(request.params['status'])
vendor = aliased(Partner, name='vendor')
customer = aliased(Partner, name='customer')
columns = [
ColumnDT(PartnerPay.id, mData='id'),
ColumnDT(PartnerPay.cust_inv_no, mData='nomor'),
ColumnDT(
column_concat([
PartnerPay.inv_cust_nm,
' - (',
customer.nama,
')'
]),
mData='customer'
),
ColumnDT(vendor.nama, mData='vendor'),
ColumnDT(PartnerPay.amt_sell, mData='amount'),
ColumnDT(PartnerPay.status, mData='status'),
]
query = DBSession.query().select_from(PartnerPay)\
.join(vendor, vendor.id == PartnerPay.vendor_id)\
.join(customer, customer.id == PartnerPay.customer_id)
if status > -1:
query = query.filter(PartnerPay.status == status)
row_table = DataTables(request.GET, query, columns)
return row_table.output_result()
@view_config(route_name='api-payment-view',
permission="api-payment-list",
renderer='templates/payment/view.pt')
def view_detail(self):
request = self.req
url_dict = request.matchdict
view_id = url_dict['id']
data = PartnerPay.query_id(id=view_id).first()
params = dict(
form=None
)
if data:
customer = '{cust} - ({merc})'.format(cust=data.inv_cust_nm, merc=data.customer.nama)
form_list = (
('vend_inv_no', data.vend_inv_no or '', 'text'),
('cust_inv_no', data.cust_inv_no or '', 'text'),
# ('tx_id', data.tx_id or '', 'text'),
('vendor', data.vendor.nama, 'text'),
('produk', data.produk.nama, 'text'),
# ('id_pel', data.id_pel or '', 'text'),
('customer', customer, 'text'),
('cust_addr', data.inv_cust_addr or '', 'text'),
('cust_phone', data.inv_cust_phone or '', 'text'),
('cust_email', data.inv_cust_email or '', 'text'),
('cust_city', data.inv_cust_city or '', 'text'),
('cust_state', data.inv_cust_state or '', 'text'),
('cust_pos', data.inv_cust_pos or '', 'text'),
('cust_country', data.inv_cust_country or '', 'text'),
# ('inv_valid_date', data.description, 'text'),
# ('inv_valid_time', data.description, 'text'),
# ('inv_time_stamp', data.description, 'text'),
# ('inv_cust_va', data.description, 'text'),
#
# ('delivery_addr', data.description, 'text'),
# ('delivery_city', data.description, 'text'),
# ('delivery_country', data.description, 'text'),
# ('delivery_nm', data.description, 'text'),
# ('delivery_phone', data.description, 'text'),
# ('delivery_pos', data.description, 'text'),
# ('delivery_state', data.description, 'text'),
# ('delivery_email', data.description, 'text'),
# ('subtotal', data.subtotal, 'text'),
# ('discount', data.discount, 'text'),
# ('amt_sell', data.amt_sell, 'text'),
('inquiry', format_json(data.inquiry), 'area'),
('payment', format_json(data.payment), 'area'),
('advice', format_json(data.advice), 'area'),
('notify', format_json(data.notify), 'area'),
('cart', format_json(data.cart), 'area'),
# ('notes', data.notes, 'text'),
# ('description', data.description, 'text'),
# ('fee', data.description, 'text'),
# ('instmnt_mon', data.description, 'text'),
# ('instmnt_type', data.description, 'text'),
# ('recurr_opt', data.description, 'text'),
# ('m_ref_no', data.description, 'text'),
# ('notax_amt', data.description, 'text'),
# ('pay_valid_dt', data.description, 'text'),
# ('pay_valid_tm', data.description, 'text'),
#
# ('req_dt', data.description, 'text'),
# ('req_tm', data.description, 'text'),
#
# ('vat', data.description, 'text'),
# ('trans_dt', data.description, 'text'),
# ('trans_tm', data.description, 'text'),
# ('card_no', data.description, 'text'),
# ('callback_url', data.description, 'text'),
)
sm = colander.Schema()
values = {}
for f in form_list:
k = f[0]
v = f[1]
wg = f[2] == 'area' and widget.TextAreaWidget(style='height:120px') or\
widget.TextInputWidget(readonly=True)
sm.add(colander.SchemaNode(
colander.String(),
name=k,
oid=k,
widget=wg
))
values.update({k: v})
form = Form(sm)
form.render(values)
params['form'] = form
return dict(params=params)
...@@ -34,13 +34,13 @@ ...@@ -34,13 +34,13 @@
</a> </a>
</li> </li>
-->
<li> <li>
<a href="${request._host}/api/payment/list"> <a href="${request._host}/api/payment/list">
<i class="fa fa-lg fa-fw fa-home"></i> <i class="fa fa-lg fa-fw fa-home"></i>
<span class="menu-item-parent">List Payment</span> <span class="menu-item-parent">List Payment</span>
</a> </a>
</li> </li>
-->
<li> <li>
<a href="${request._host}/api/merchant/register"> <a href="${request._host}/api/merchant/register">
<i class="fa fa-lg fa-fw fa-home"></i> <i class="fa fa-lg fa-fw fa-home"></i>
......
<div metal:use-macro="load: ../base.pt">
<!-- content -->
<div metal:fill-slot="content">
<style type="text/css">
#content-payment-view {
max-height: 100vw;
overflow-y: auto;
}
</style>
<div id="tmp-toolbar">
<span tal:repeat="f params.form" tal:omit-tag="">
${structure:f.serialize()}
</span>
</div>
<div class="jarviswidget" style="border-top:1px solid #ccc!important">
<div role="content">
<table id="table1" class="table table-bordered table-hover table-condensed">
<thead>
<tr>
<th tal:repeat="f params.columns">${f.title}</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
<!-- Modal -->
<div id="payment-view" class="modal fade" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 class="modal-title">
View Detail
<span style="margin-left: 10px" id="payment-view-title"></span>
</h4>
</div>
<div class="modal-body" id="content-payment-view">
&nbps;
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">OK</button>
</div>
</div>
</div>
</div>
</div>
<!-- end content -->
<script type="text/javascript" metal:fill-slot="scripts">
var mID;
var oTable;
var oTableUri = "${request._host}${params.route}"
var oTableUrl = oTableUri + "/grid/act";
function getDataUrl() {
var opt = $('select#status').val();
return oTableUrl + '?status=' + opt.toString();
}
function getViewUrl(vid) {
return oTableUri + "/" + vid.toString() + "/view";
}
$(document).ready(function() {
oTable = $('#table1').DataTable({
dom: '<"row"<"col-md-8"<"toolbar">l><"col-md-4"f>>rtip',
processing: true,
serverSide: true,
ajax: getDataUrl(),
stateSave: true,
//scrollCollapse: true,
//sort: true,
//info: false,
filter: true,
autoWidth: false,
paginate: true,
paginationType: "full_numbers",
lengthMenu: [
[10, 25, 50, 100],
[10, 25, 50, 100]
],
// columns: [
// {'data': 'id', 'width': '0px'},
// {'data': 'nomor', 'width': '150px'},
// {'data': 'customer'},
// {'data': 'vendor'},
// {'data': 'amount', 'width': '100px'},
// {'data': 'status', 'width': '100px',
// 'render': function(data, type, full, meta) {
// var st = ${params.status_payment};
// return st[data];
// }
// }
// ],
columns: ${params.column_data},
columnDefs: [{
searchable: false,
visible: false,
targets: [0]
}],
"language": {
"search": "Cari : ",
"paginate": {
"first": "Pertama ",
"last": "Akhir ",
"previous": "",
"next": "",
},
"lengthMenu": "Tampil _MENU_ baris "
},
});
var buttons=${params.buttons};
var tb_array=[];
tb_array.push('<div class="btn-group pull-left">');
for (i=0; i<buttons.length; i++){
tb_array.push('<button id="'+buttons[i].id+'" class="' +buttons[i].cls+
'" type="button">'+buttons[i].title+'</button>')
}
tb_array.push(' &nbsp;');
tb_array.push('</div>');
var tb = tb_array.join(' ');
$("div.toolbar").html(tb)
.attr('style', 'display:block; float: left; margin-bottom:6px; line-height:16px;');
$('select.form-toolbar').appendTo($("div.toolbar"));
$('tmp-toolbar').hide();
//events
$('#table1 tbody').on('click', 'tr', function() {
if ($(this).hasClass('selected')) {
$(this).removeClass('selected');
} else {
var aData = oTable.row(this).data();
oTable.$('tr.selected').removeClass('selected');
$(this).addClass('selected');
mID = aData.id;
// console.log(mID);
oTable.$('tr.row_selected').removeClass('row_selected');
$(this).addClass('row_selected');
}
});
${params.scripts}
$('#btn_view').click(function() {
if (mID) {
//window.location = oTableUri + '/' + mID + '/view';
$('#payment-view').modal('show');
} else {
$.SmartMessageBox({
title : "View",
content : "Pilih Baris yang akan di lihat...",
buttons : '[Oke]'
});
}
});
$("#payment-view").on('show.bs.modal', function(){
var content = '';
var view_container = $('#content-payment-view');
view_container.empty();
if (mID) {
var vUrl = getViewUrl(mID);
view_container.load(vUrl, function() {
$('textarea').attr('readonly', true);
});
}
});
$('select#status').on('change', function() {
mID = 0;
oTable.ajax.url(getDataUrl()).load();
});
});
</script>
</div>
<div tal:condition="params.form" tal:omit-tag="">
<div class="form-horizontal">
<div tal:repeat="f params.form" class="row">
<div class="form-group">
<label for="${f.oid}" class="control-label col-md-3" id="req-${f.oid}">
${f.title}
</label>
<div class="col-md-9">
${structure:f.serialize()}
</div>
</div>
</div>
</div>
</div>
\ No newline at end of file \ No newline at end of file
...@@ -167,6 +167,11 @@ class VendorClass(object): ...@@ -167,6 +167,11 @@ class VendorClass(object):
self.invoice_det.info = dict(request=self.request, self.invoice_det.info = dict(request=self.request,
response=self.response, response=self.response,
result=self.result) result=self.result)
elif typ == 'notify':
# by tatang
self.invoice_det.notify = dict(request=self.request,
response=self.response,
result=self.result)
flush_row(self.invoice_det) flush_row(self.invoice_det)
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!