Commit 87465ae3 by Tuomas Riihimäki

Make verkkomaksubuttons a component and fix xhtml part of payments

1 parent 2b81bca1
...@@ -28,38 +28,7 @@ ...@@ -28,38 +28,7 @@
<br /> <br />
<bill:showBill bill="#{billEditView.bill}" /> <bill:showBill bill="#{billEditView.bill}" />
<bill:verkkomaksubuttons rendered="#{!billEditView.bill.paid and !billEditView.bill.expired}"/>
<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>
<p:outputPanel rendered="#{billEditView.bill.foodwaveBill}"> <p:outputPanel rendered="#{billEditView.bill.foodwaveBill}">
......
<?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>
...@@ -106,7 +106,12 @@ ...@@ -106,7 +106,12 @@
</h:panelGroup> </h:panelGroup>
<br /> <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 @@ ...@@ -14,11 +14,15 @@
<ui:define name="title"> <ui:define name="title">
<h1>#{i18n['page.product.createBill.header']}</h1> <h1>#{i18n['page.product.createBill.header']}</h1>
</ui:define> </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"> <ui:define name="content">
<h:form id="billshopform"> <h:form id="billshopform">
<products:shop commitaction="#{productShopView.commitBillCart()}" items="#{productShopView.shoppingcart}" commitValue="#{i18n['productshop.commit']}" /> <products:shop commitaction="#{productShopView.commitBillCart()}" items="#{productShopView.shoppingcart}" commitValue="#{i18n['productshop.commit']}" />
</h:form> </h:form>
</ui:define> </ui:define>
</ui:composition> </ui:composition>
......
<!DOCTYPE html <!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> "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" <html xmlns="http://www.w3.org/1999/xhtml"
xmlns:bill="http://java.sun.com/jsf/composite/cditools/bills" xmlns:f="http://java.sun.com/jsf/core" 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"> xmlns:c="http://java.sun.com/jsp/jstl/core">
<h:body> <h:body>
...@@ -11,37 +15,16 @@ ...@@ -11,37 +15,16 @@
<ui:define name="title"> <ui:define name="title">
<h1>#{i18n['page.product.validateBillProducts.header']}</h1> <h1>#{i18n['page.product.validateBillProducts.header']}</h1>
</ui:define> </ui:define>
<ui:define name="content">
<bill:showBill bill="#{billEditView.bill}" />
<ui:define name="headerdata">
<ui:fragment rendered="#{billEditView.verkkomaksuFiAvailable}"> <ui:fragment rendered="#{billEditView.verkkomaksuFiAvailable}">
<div id="svm-payment"> <script type="text/javascript" src="//payment.paytrail.com/js/payment-widget-v1.0.min.js"></script>
<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>
<ui:fragment rendered="#{billEditView.checkoutFiAvailable}"> </ui:define>
<table border="0">
<tr>
<ui:repeat varStatus="idx" value="#{billEditView.checkoutFiToken}" var="bank"> <ui:define name="content">
<td> <bill:showBill bill="#{billEditView.bill}" />
<form action="#{bank.url}" method="post"> <bill:verkkomaksubuttons />
<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>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!