Commit e6667ec3 by yasir

update

1 parent e037e677
......@@ -81,7 +81,7 @@ class BillerSchema(colander.Schema):
email_biller = colander.SchemaNode(colander.String(), title = "Email")
address_biller = colander.SchemaNode(colander.String(), title = "Alamat", missing=colander.drop)
city_biller = colander.SchemaNode(colander.String(), title = "Kota")
state_biller = colander.SchemaNode(colander.Integer(), title = "Provinsi")
state_biller = colander.SchemaNode(colander.String(), title = "Provinsi")
post_code_biller = colander.SchemaNode(colander.Integer(), title = "Kode Pos")
country_biller = colander.SchemaNode(colander.String(), title = "Negara")
......@@ -91,13 +91,13 @@ class CustomerSchema(colander.Schema):
email_cust = colander.SchemaNode(colander.String(), title = "Email")
address_cust = colander.SchemaNode(colander.String(), title = "Alamat", missing=colander.drop)
city_cust = colander.SchemaNode(colander.String(), title = "Kota")
state_cust = colander.SchemaNode(colander.Integer(), title = "Provinsi")
state_cust = colander.SchemaNode(colander.String(), title = "Provinsi")
post_code_cust = colander.SchemaNode(colander.Integer(), title = "Kode Pos")
country_cust = colander.SchemaNode(colander.String(), title = "Negara")
ip_cust = colander.SchemaNode(colander.String(), oid="ip_cust", widget=widget.HiddenWidget(readonly=True))
session_id_cust = colander.SchemaNode(colander.Integer(), oid="session_id_cust", widget=widget.HiddenWidget(readonly=True))
agent_cust = colander.SchemaNode(colander.Integer(), oid="agent_cust", widget=widget.HiddenWidget(readonly=True))
agent_cust = colander.SchemaNode(colander.String(), oid="agent_cust", widget=widget.HiddenWidget(readonly=True))
language_cust = colander.SchemaNode(colander.String(), oid="language_cust", widget=widget.HiddenWidget(readonly=True))
class DeliverToSchema(colander.Schema):
......@@ -106,7 +106,7 @@ class DeliverToSchema(colander.Schema):
email_deliver = colander.SchemaNode(colander.String(), title = "Email", missing=colander.drop)
address_deliver = colander.SchemaNode(colander.String(), title = "Alamat", missing=colander.drop)
city_deliver = colander.SchemaNode(colander.String(), title = "Kota")
state_deliver = colander.SchemaNode(colander.Integer(), title = "Provinsi")
state_deliver = colander.SchemaNode(colander.String(), title = "Provinsi")
post_code_deliver = colander.SchemaNode(colander.Integer(), title = "Kode Pos")
country_deliver = colander.SchemaNode(colander.String(), title = "Negara")
......@@ -177,6 +177,10 @@ class view_pay(BaseView):
formServer.request = request
formServer = Form(formServer)
time_stamp = datetime.now().strftime('%Y%m%d%H%M%S')
req_dt = datetime.now().strftime('%Y%m%d')
req_tm = datetime.now().strftime('%H%M%S')
post_data = request.POST
if post_data:
......@@ -222,10 +226,6 @@ class view_pay(BaseView):
hostnya = settings['_host']
url = hostnya + "/api/merchant"
time_stamp = datetime.now().strftime('%Y%m%d%H%M%S')
req_dt = datetime.now().strftime('%Y%m%d')
req_tm = datetime.now().strftime('%H%M%S')
body = {
"jsonrpc": "2.0",
"id": "1",
......@@ -327,6 +327,113 @@ class view_pay(BaseView):
icikiwir.append(item)
params_def_data = {}
params_def_data['time_stamp'] = time_stamp
params_def_data['currency'] = 'IDR'
params_def_data['amount'] = 30000
params_def_data['invoice_no'] = 'COBA-0001'
params_def_data['response_url'] = 'https://devel.agratek.id/tangkap_response'
params_def_data['description'] = 'Testing Payment Request Form'
params_def_data['fee'] = 2000
params_def_data['vat'] = 200
params_def_data['notax_amt'] = 200
params_def_data['req_dt'] = req_dt
params_def_data['req_tm'] = req_tm
formParams.render(params_def_data)
biller_def_data = {}
biller_def_data['name_biller'] = 'Nama Biller'
biller_def_data['phone_biller'] = '08123456789'
biller_def_data['email_biller'] = 'email@biller.com'
biller_def_data['address_biller'] = 'Jl. Alamat no. 100'
biller_def_data['city_biller'] = 'Kota Biller'
biller_def_data['state_biller'] = 'State Biller'
biller_def_data['post_code_biller'] = '57154'
biller_def_data['country_biller'] = 'Indonesia'
formBiller.render(biller_def_data)
customer_def_data = {}
customer_def_data['name_cust'] = 'Nama Customer'
customer_def_data['phone_cust'] = '0888888888888'
customer_def_data['email_cust'] = 'email@customer.com'
customer_def_data['address_cust'] = 'Jl. Alamat no. 99'
customer_def_data['city_cust'] = 'Kota Customer'
customer_def_data['state_cust'] = 'State Customer'
customer_def_data['post_code_cust'] = '577777'
customer_def_data['country_cust'] = 'Indonesia'
customer_def_data['ip_cust'] = '127.0.0.1'
customer_def_data['session_id_cust'] = '11111111111111111111'
customer_def_data['agent_cust'] = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64)'
customer_def_data['language_cust'] = 'en-US'
formCustomer.render(customer_def_data)
deliver_def_data = {}
deliver_def_data['name_deliver'] = 'Nama Deliver To'
deliver_def_data['phone_deliver'] = '08000000000'
deliver_def_data['email_deliver'] = 'deliver_to@email.com'
deliver_def_data['address_deliver'] = 'Jl. Alamat no. 97'
deliver_def_data['city_deliver'] = 'Kota deliver to'
deliver_def_data['state_deliver'] = 'State Deliver To'
deliver_def_data['post_code_deliver'] = '5666666'
deliver_def_data['country_deliver'] = 'Indonesia'
formDeliver.render(deliver_def_data)
cart_def_data = {}
cart_def_data['count'] = 3
formCart.render(cart_def_data)
items_def_data = []
item_def_data = {}
item_def_data['img_url'] = 'https://blog.regopantes.com/wp-content/uploads/2019/02/apel-fuji-via-pixabay.jpg'
item_def_data['goods_name'] = 'Apel Fuji'
item_def_data['goods_detail'] = 'Apel Fuji Segar'
item_def_data['goods_amt'] = 10000
item_def_data['qty'] = 1
item_def_data['subtotal'] = 10000
items_def_data.append(item_def_data)
item_def_data = {}
item_def_data['img_url'] = 'https://static.independent.co.uk/s3fs-public/thumbnails/image/2019/08/02/16/istock-938742222.jpg'
item_def_data['goods_name'] = 'Pizza'
item_def_data['goods_detail'] = 'Pizza hangat'
item_def_data['goods_amt'] = 10000
item_def_data['qty'] = 1
item_def_data['subtotal'] = 10000
items_def_data.append(item_def_data)
item_def_data = {}
item_def_data['img_url'] = 'https://cdn.idntimes.com/content-images/community/2019/02/bakso-mercon-f68727c51ed0a1f0ef16bd632791918c_600x400.jpeg'
item_def_data['goods_name'] = 'Bakso'
item_def_data['goods_detail'] = 'Bakso hangat'
item_def_data['goods_amt'] = 10000
item_def_data['qty'] = 1
item_def_data['subtotal'] = 10000
items_def_data.append(item_def_data)
server_def_data = {}
server_def_data['domain_server'] = 'merchant.com'
server_def_data['ip_server'] = '127.0.0.1'
formServer.render(server_def_data);
return dict(
formParams = formParams,
......@@ -339,5 +446,8 @@ class view_pay(BaseView):
formItemCart = formItemCart,
params = form_params_view,
produks = get_products_e(),
itemDet = icikiwir
itemDet = icikiwir,
init_items_count = 3,
init_items = items_def_data,
)
\ No newline at end of file
......@@ -324,10 +324,97 @@
function getItemsCount(){
return $("#itemsnya #judul")['length'];
}
function get_init_items(){
var init_items_count = ${init_items_count};
var init_items = ${init_items};
var i;
for (i = 0; i < init_items.length; i++) {
cnt = Math.random().toString(36).substr(2, 5);
$("#itemsnya").append(
`<div class="col-md-12" id="pack-`+cnt+`">`+
`<legend id="judul"></legend>`+
`<button type="button" onclick="removeItem('pack-`+cnt+`')">Hapus</button> `+
`<br></br>`+
`<div tal:define="fieldItem formItemCart['goods_name']" id="item-${fieldItem.oid}">`+
`<label for="${fieldItem.oid}" class="control-label col-md-4 required" id="req-${fieldItem.oid}">`+
`${fieldItem.title}</label>`+
`<div class="col-md-8">`+
`<input type="text" class="form-control" id="${fieldItem.name}-`+cnt+`" name="${fieldItem.name}-`+cnt+`" value="`+ init_items[i]['goods_name'] +`" >`+
`<p id="error-${fieldItem.oid}" class="help-block" tal:condition="fieldItem.error" tal:repeat="error fieldItem.error.messages()">${error}</p>`+
`</div>`+
`</div>`+
`<br></br>`+
`<div tal:define="fieldItem formItemCart['goods_detail']" id="item-${fieldItem.oid}">`+
`<label for="${fieldItem.oid}" class="control-label col-md-4" id="req-${fieldItem.oid}">`+
`${fieldItem.title}</label>`+
`<div class="col-md-8">`+
`<input type="text" class="form-control" id="${fieldItem.name}-`+cnt+`" name="${fieldItem.name}-`+cnt+`" value="`+init_items[i]['goods_name']+`" >`+
`<p id="error-${fieldItem.oid}" class="help-block" tal:condition="fieldItem.error" tal:repeat="error fieldItem.error.messages()">${error}</p>`+
`</div>`+
`</div>`+
`<br></br>`+
`<div tal:define="fieldItem formItemCart['goods_amt']" id="item-${fieldItem.oid}">`+
`<label for="${fieldItem.oid}" class="control-label col-md-4" id="req-${fieldItem.oid}">`+
`${fieldItem.title}</label>`+
`<div class="col-md-8" >`+
`<input type="text" class="form-control" id="${fieldItem.name}-`+cnt+`" name="${fieldItem.name}-`+cnt+`" value="`+init_items[i]['goods_amt']+`" >`+
`<p id="error-${fieldItem.oid}" class="help-block" tal:condition="fieldItem.error" tal:repeat="error fieldItem.error.messages()">${error}</p>`+
`</div>`+
`</div>`+
`<br></br>`+
`<div tal:define="fieldItem formItemCart['img_url']" id="item-${fieldItem.oid}">`+
`<label for="${fieldItem.oid}" class="control-label col-md-4" id="req-${fieldItem.oid}">`+
`${fieldItem.title}</label>`+
`<div class="col-md-8" >`+
`<input type="text" class="form-control" id="${fieldItem.name}-`+cnt+`" name="${fieldItem.name}-`+cnt+`" value="`+init_items[i]['img_url']+`" >`+
`<p id="error-${fieldItem.oid}" class="help-block" tal:condition="fieldItem.error" tal:repeat="error fieldItem.error.messages()">${error}</p>`+
`</div>`+
`</div>`+
`<div tal:define="fieldItem formItemCart['qty']" id="item-${fieldItem.oid}">`+
`<label for="${fieldItem.oid}" class="control-label col-md-4" id="req-${fieldItem.oid}">`+
`${fieldItem.title}</label>`+
`<div class="col-md-8" >`+
`<input type="text" class="form-control" id="${fieldItem.name}-`+cnt+`" name="${fieldItem.name}-`+cnt+`" value="`+init_items[i]['qty']+`" >`+
`<p id="error-${fieldItem.oid}" class="help-block" tal:condition="fieldItem.error" tal:repeat="error fieldItem.error.messages()">${error}</p>`+
`</div>`+
`</div>`+
`<div tal:define="fieldItem formItemCart['subtotal']" id="item-${fieldItem.oid}">`+
`<label for="${fieldItem.oid}" class="control-label col-md-4" id="req-${fieldItem.oid}">`+
`${fieldItem.title}</label>`+
`<div class="col-md-8" >`+
`<input type="text" class="form-control" id="${fieldItem.name}-`+cnt+`" name="${fieldItem.name}-`+cnt+`" value="`+init_items[i]['subtotal']+`" >`+
`<p id="error-${fieldItem.oid}" class="help-block" tal:condition="fieldItem.error" tal:repeat="error fieldItem.error.messages()">${error}</p>`+
`</div>`+
`</div>`+
`</div>`
);
var itemControl = $("#${formItemCart['goods_name'].name}-" + cnt);
var detailControl = $("#${formItemCart['goods_detail'].name}-" + cnt);
var hargaControl = $("#${formItemCart['goods_amt'].name}-" + cnt);
$(itemControl).change(function () {
var selectedIndex = itemControl.find(":selected").index();
detailControl.val(${itemDet}[selectedIndex][1]);
hargaControl.val(${itemDet}[selectedIndex][2]);
});
}
console.log(init_items);
console.log(init_items_count);
}
function removeItem(idnya){
$("#" + idnya).remove();
$("[name=count]").val(getItemsCount());
}
function doAdditem(cnt = 0, jml = 0){
$("#itemsnya").append(
......@@ -406,7 +493,7 @@
$("[name=count]").val(getItemsCount());
})
get_init_items();
</script>
</div>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!