Commit 87465ae3 by Tuomas Riihimäki

Make verkkomaksubuttons a component and fix xhtml part of payments

1 parent 2b81bca1
......@@ -28,39 +28,8 @@
<br />
<bill:showBill bill="#{billEditView.bill}" />
<ui:fragment rendered="#{!billEditView.bill.paid and !billEditView.bill.expired and billEditView.verkkomaksuFiAvailable}">
<div id="svm-payment">
<a href="#{billEditView.verkkomaksuFiToken.url}"> </a>
</div>
<script type="text/javascript" src="//payment.verkkomaksut.fi/js/sv-widget.min.js"></script>
<script type="text/javascript">
SV.widget.initWithToken('svm-payment',
'#{billEditView.verkkomaksuToken.token}', {
width : '800'
});
</script>
</ui:fragment>
<ui:fragment rendered="#{!billEditView.bill.paid and !billEditView.bill.expired and billEditView.checkoutFiAvailable}">
<table border="0">
<tr>
<ui:repeat varStatus="idx" value="#{billEditView.checkoutFiToken}" var="bank">
<td>
<form action="#{bank.url}" method="post">
<ui:repeat value="#{bank.postParams}" var="valp">
<input type="hidden" name="#{valp.key}" value="#{valp.value}" />
</ui:repeat>
<input type='image' src='#{bank.icon}' />
</form>
</td>
<h:outputText escape="false" value="&lt;/tr>&lt;tr>" rendered="#{idx.index % 4 == 3}" />
</ui:repeat>
</tr>
</table>
</ui:fragment>
<bill:verkkomaksubuttons rendered="#{!billEditView.bill.paid and !billEditView.bill.expired}"/>
<p:outputPanel rendered="#{billEditView.bill.foodwaveBill}">
<span class="notify"><h:outputText value="#{i18n['foodshop.canBuyToCounter']}" /></span>
......
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:composite="http://java.sun.com/jsf/composite"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:tools="http://java.sun.com/jsf/composite/tools">
<composite:interface>
</composite:interface>
<composite:implementation>
<ui:fragment rendered="#{billEditView.verkkomaksuFiAvailable}">
<p id="svmpayment">
<a href="#{billEditView.verkkomaksuFiToken.url}">Go to payments</a>
</p>
<!-- When called via ajax this needs to be already loaded!
-->
<script type="text/javascript" src="//payment.paytrail.com/js/payment-widget-v1.0.min.js"></script>
<script type="text/javascript">
function initPaymentButtons() {
SV.widget.initWithToken('svmpayment',
'#{billEditView.verkkomaksuFiToken.token}', {
width : '800'
});
}
</script>
</ui:fragment>
<ui:fragment rendered="#{billEditView.checkoutFiAvailable}">
<table border="0">
<tr>
<ui:repeat varStatus="idx" value="#{billEditView.checkoutFiToken}"
var="bank">
<td>
<form action="#{bank.url}" method="post">
<ui:repeat value="#{bank.postParams}" var="valp">
<input type="hidden" name="#{valp.key}" value="#{valp.value}" />
</ui:repeat>
<input type='image' src='#{bank.icon}' />
</form>
</td>
<h:outputText escape="false" value="&lt;/tr>&lt;tr>"
rendered="#{idx.index % 4 == 3}" />
</ui:repeat>
</tr>
</table>
</ui:fragment>
</composite:implementation>
</html>
......@@ -15,7 +15,7 @@
<!-- <h:outputScript target="head" library="script" name="jquery.min.js" /> -->
<!-- <h:outputScript target="head" library="script" name="shopscript.js" /> -->
<h:outputScript library="primefaces" name="jquery/jquery.js" />
<p:dataTable columnClasses="nowrap,numalign,numalign,numalign,nowrap" id="billcart" value="#{cc.attrs.items}" var="cart">
<p:column>
<f:facet name="header">
......@@ -106,7 +106,12 @@
</h:panelGroup>
<br />
<p:commandButton onerror="location.reload(true);" action="#{cc.attrs.commitaction}" id="commitbutton-botton" value="#{cc.attrs.commitValue}" />
<!-- Paytrail needs to initialize after the ajax call is complete -->
<!-- This function is to be override by the paytrail init function -->
<script type="text/javascript">
function initPaymentButtons(){};
</script>
<p:commandButton oncomplete="initPaymentButtons()" onerror="location.reload(true);" action="#{cc.attrs.commitaction}" id="commitbutton-botton" value="#{cc.attrs.commitValue}" />
......
......@@ -14,11 +14,15 @@
<ui:define name="title">
<h1>#{i18n['page.product.createBill.header']}</h1>
</ui:define>
<ui:define name="headerdata">
<ui:fragment rendered="#{billEditView.verkkomaksuFiAvailable}">
<script type="text/javascript" src="//payment.paytrail.com/js/payment-widget-v1.0.min.js"></script>
</ui:fragment>
</ui:define>
<ui:define name="content">
<h:form id="billshopform">
<products:shop commitaction="#{productShopView.commitBillCart()}" items="#{productShopView.shoppingcart}" commitValue="#{i18n['productshop.commit']}" />
</h:form>
</ui:define>
</ui:composition>
......
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" xmlns:tools="http://java.sun.com/jsf/composite/tools"
xmlns:bill="http://java.sun.com/jsf/composite/cditools/bills" xmlns:f="http://java.sun.com/jsf/core"
xmlns:c="http://java.sun.com/jsp/jstl/core">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:tools="http://java.sun.com/jsf/composite/tools"
xmlns:bill="http://java.sun.com/jsf/composite/cditools/bills"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:c="http://java.sun.com/jsp/jstl/core">
<h:body>
......@@ -11,38 +15,17 @@
<ui:define name="title">
<h1>#{i18n['page.product.validateBillProducts.header']}</h1>
</ui:define>
<ui:define name="content">
<bill:showBill bill="#{billEditView.bill}" />
<ui:define name="headerdata">
<ui:fragment rendered="#{billEditView.verkkomaksuFiAvailable}">
<div id="svm-payment">
<a href="#{billEditView.verkkomaksuFiToken.url}"> </a>
</div>
<script type="text/javascript" src="//payment.verkkomaksut.fi/js/sv-widget.min.js"></script>
<script type="text/javascript">
SV.widget.initWithToken('svm-payment', '#{billEditView.verkkomaksuToken.token}', {width: '800'});
</script>
<script type="text/javascript" src="//payment.paytrail.com/js/payment-widget-v1.0.min.js"></script>
</ui:fragment>
<ui:fragment rendered="#{billEditView.checkoutFiAvailable}">
<table border="0">
<tr>
<ui:repeat varStatus="idx" value="#{billEditView.checkoutFiToken}" var="bank">
<td>
<form action="#{bank.url}" method="post">
<ui:repeat value="#{bank.postParams}" var="valp" >
<input type="hidden" name="#{valp.key}" value="#{valp.value}" />
</ui:repeat>
<input type='image' src='#{bank.icon}' />
</form>
</td>
<h:outputText escape="false" value="&lt;/tr>&lt;tr>" rendered="#{idx.index % 4 == 3}"/>
</ui:repeat>
</tr>
</table>
</ui:fragment>
</ui:define>
<ui:define name="content">
<bill:showBill bill="#{billEditView.bill}" />
<bill:verkkomaksubuttons />
</ui:define>
</ui:composition>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!