Commit 6bc4ad89 by Tuomas Riihimäki

Paytrail fix

1 parent bab9eed7
<!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" xmlns:bill="http://java.sun.com/jsf/composite/cditools/bills" xmlns:p="http://primefaces.org/ui" xmlns:f="http://java.sun.com/jsf/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:p="http://primefaces.org/ui"
xmlns:f="http://java.sun.com/jsf/core">
<h:body> <h:body>
...@@ -14,39 +20,51 @@ ...@@ -14,39 +20,51 @@
<h1>#{i18n['page.bill.show.header']}</h1> <h1>#{i18n['page.bill.show.header']}</h1>
</ui:define> </ui:define>
<ui:define name="content"> <ui:define name="content">
<p:outputPanel id="billPanel"> <p:outputPanel id="billPanel">
<ui:fragment rendered="#{billEditView.bill.paid}"> <ui:fragment rendered="#{billEditView.bill.paid}">
<h:outputText value="#{i18n['bill.billIsPaid']}" /> <h:outputText value="#{i18n['bill.billIsPaid']}" />
<br /> <br />
<h:outputText value="#{i18n['bill.billPaidDate']}" />: <h:outputText value="#{i18n['bill.billPaidDate']}" />:
<h:outputText value="#{billEditView.bill.paidDate}"> <h:outputText value="#{billEditView.bill.paidDate}">
<f:convertDateTime pattern="#{sessionHandler.datetimeFormat}" timeZone="#{sessionHandler.timezone}" /> <f:convertDateTime pattern="#{sessionHandler.datetimeFormat}"
</h:outputText> timeZone="#{sessionHandler.timezone}" />
</ui:fragment> </h:outputText>
<br /> </ui:fragment>
<br />
<bill:showBill bill="#{billEditView.bill}" /> <bill:showBill bill="#{billEditView.bill}" />
<bill:verkkomaksubuttons rendered="#{!billEditView.bill.paid and !billEditView.bill.expired}"/> <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> <p:outputPanel rendered="#{billEditView.bill.foodwaveBill}">
</p:outputPanel> <span class="notify"><h:outputText
<br /> value="#{i18n['foodshop.canBuyToCounter']}" /></span>
<p:outputPanel rendered="#{!billEditView.bill.paid and !billEditView.bill.expired}"> </p:outputPanel>
<br />
<p:outputPanel
rendered="#{!billEditView.bill.paid and !billEditView.bill.expired}">
<h:form> <h:form>
<p:commandButton id="cancelbtn" actionListener="#{billEditView.expireBill()}" onerror="location.reload(true);" value="#{i18n['bill.cancel']}" update=":billPanel"> <p:commandButton id="cancelbtn"
<p:confirm header="Confirmation" message="Are you sure?" icon="ui-icon-alert" /> actionListener="#{billEditView.expireBill()}"
onerror="location.reload(true);" value="#{i18n['bill.cancel']}"
update=":billPanel">
<p:confirm header="Confirmation" message="Are you sure?"
icon="ui-icon-alert" />
</p:commandButton> </p:commandButton>
</h:form> </h:form>
</p:outputPanel> </p:outputPanel>
<p:outputPanel rendered="#{billEditView.bill.user.accountBalance ge billEditView.bill.totalPrice}"> <p:outputPanel
rendered="#{billEditView.bill.user.accountBalance ge billEditView.bill.totalPrice}">
<h:form> <h:form>
<p:commandButton id="buyCreditsButton" actionListener="#{billEditView.buyWithCredits()}" onerror="location.reload(true);" value="#{i18n['bill.markPaid.credits']}" update=":billPanel"> <p:commandButton id="buyCreditsButton"
<p:confirm header="Confirmation" message="Are you sure?" icon="ui-icon-alert" /> actionListener="#{billEditView.buyWithCredits()}"
onerror="location.reload(true);"
value="#{i18n['bill.markPaid.credits']}" update=":billPanel">
<p:confirm header="Confirmation" message="Are you sure?"
icon="ui-icon-alert" />
</p:commandButton> </p:commandButton>
</h:form> </h:form>
</p:outputPanel> </p:outputPanel>
......
...@@ -22,13 +22,12 @@ ...@@ -22,13 +22,12 @@
<!-- When called via ajax this needs to be already loaded! <!-- 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" src="//payment.paytrail.com/js/payment-widget-v1.0.min.js"></script>
<script type="text/javascript"> <script type="text/javascript">
function initPaymentButtons() {
SV.widget.initWithToken('svmpayment', SV.widget.initWithToken('svmpayment',
'#{billEditView.verkkomaksuFiToken.token}', { '#{billEditView.verkkomaksuFiToken.token}', {
width : '800' width : '800'
}); });
}
</script> </script>
</ui:fragment> </ui:fragment>
<ui:fragment rendered="#{billEditView.checkoutFiAvailable}"> <ui:fragment rendered="#{billEditView.checkoutFiAvailable}">
......
<?xml version='1.0' encoding='UTF-8' ?> <?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> "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" <html xmlns="http://www.w3.org/1999/xhtml"
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" xmlns:p="http://primefaces.org/ui"> 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"
xmlns:p="http://primefaces.org/ui">
<composite:interface> <composite:interface>
<composite:attribute name="items" required="true" /> <composite:attribute name="items" required="true" />
<composite:attribute name="commitValue" required="true" /> <composite:attribute name="commitValue" required="true" />
<composite:attribute name="commitaction" method-signature="java.lang.String action()" required="true" /> <composite:attribute name="commitaction"
method-signature="java.lang.String action()" required="true" />
</composite:interface> </composite:interface>
<composite:implementation> <composite:implementation>
<!-- <h:outputScript target="head" library="script" name="jquery.min.js" /> --> <!-- <h:outputScript target="head" library="script" name="jquery.min.js" /> -->
<!-- <h:outputScript target="head" library="script" name="shopscript.js" /> --> <!-- <h:outputScript target="head" library="script" name="shopscript.js" /> -->
<h:outputScript library="primefaces" name="jquery/jquery.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:dataTable columnClasses="nowrap,numalign,numalign,numalign,nowrap"
id="billcart" value="#{cc.attrs.items}" var="cart">
<p:column> <p:column>
<f:facet name="header"> <f:facet name="header">
<h:outputText id="name" value="${i18n['product.name']}" /> <h:outputText id="name" value="${i18n['product.name']}" />
...@@ -37,14 +45,18 @@ ...@@ -37,14 +45,18 @@
<h:outputText id="count" value="${i18n['product.cart.count']}" /> <h:outputText id="count" value="${i18n['product.cart.count']}" />
</f:facet> </f:facet>
<h:commandButton action="#{productShopView.addMinusOne}" value="#{i18n['productshop.minusOne']}"> <h:commandButton action="#{productShopView.addMinusOne}"
value="#{i18n['productshop.minusOne']}">
<f:ajax render="@form" /> <f:ajax render="@form" />
</h:commandButton> </h:commandButton>
<p:inputText size="2" id="cartcount" escape="false" value="#{cart.count}"> <p:inputText size="2" id="cartcount" escape="false"
<f:ajax render="@form" listener="#{productShopView.countChangeListener}" /> value="#{cart.count}">
<f:ajax render="@form"
listener="#{productShopView.countChangeListener}" />
<f:convertNumber maxFractionDigits="2" minFractionDigits="0" /> <f:convertNumber maxFractionDigits="2" minFractionDigits="0" />
</p:inputText> </p:inputText>
<h:commandButton action="#{productShopView.addOne}" value="#{i18n['productshop.plusOne']}"> <h:commandButton action="#{productShopView.addOne}"
value="#{i18n['productshop.plusOne']}">
<f:ajax render="@form" /> <f:ajax render="@form" />
</h:commandButton> </h:commandButton>
</p:column> </p:column>
...@@ -57,7 +69,8 @@ ...@@ -57,7 +69,8 @@
</h:outputText> </h:outputText>
</p:column> </p:column>
<p:column headerText="#{i18n['productshop.discounts']}"> <p:column headerText="#{i18n['productshop.discounts']}">
<h:dataTable styleClass="noborderTable" border="0" var="disc" value="#{cart.discounts}"> <h:dataTable styleClass="noborderTable" border="0" var="disc"
value="#{cart.discounts}">
<p:column> <p:column>
<h:outputText value="#{disc.shortdesc}" /> <h:outputText value="#{disc.shortdesc}" />
</p:column> </p:column>
...@@ -79,7 +92,9 @@ ...@@ -79,7 +92,9 @@
</p:column> </p:column>
<p:columnGroup type="footer"> <p:columnGroup type="footer">
<p:row> <p:row>
<p:column style="text-align: right;" colspan="#{productShopView.hasLimits?5:4}" footerText="#{i18n['productshop.total']}" /> <p:column style="text-align: right;"
colspan="#{productShopView.hasLimits?5:4}"
footerText="#{i18n['productshop.total']}" />
<p:column> <p:column>
<f:facet name="footer"> <f:facet name="footer">
<h:outputText value="#{productShopView.cartPrice}"> <h:outputText value="#{productShopView.cartPrice}">
...@@ -95,23 +110,30 @@ ...@@ -95,23 +110,30 @@
<br /> <br />
<h:panelGrid columns="3" rendered="#{productShopView.checkAllowStats}"> <h:panelGrid columns="3" rendered="#{productShopView.checkAllowStats}">
<h:outputText for="allowStats" value="#{i18n['bill.allowStatistics']}" /> <h:outputText for="allowStats" value="#{i18n['bill.allowStatistics']}" />
<h:selectBooleanCheckbox id="allowStats" value="#{productShopView.allowStatistics}" /> <h:selectBooleanCheckbox id="allowStats"
value="#{productShopView.allowStatistics}" />
<h:message for="allowStats" /> <h:message for="allowStats" />
</h:panelGrid> </h:panelGrid>
<br /> <br />
<h:panelGroup rendered="#{productShopView.gatherBillInfo}"> <h:panelGroup rendered="#{productShopView.gatherBillInfo}">
<h2><p:outputLabel value="#{i18n['bill.notes.title']}" /> </h2> <h2>
<p:inputTextarea cols="50" value="#{productShopView.otherInfo}" label="#{i18n['otherInfo']}" /> <p:outputLabel value="#{i18n['bill.notes.title']}" />
</h2>
<p:inputTextarea cols="50" value="#{productShopView.otherInfo}"
label="#{i18n['otherInfo']}" />
</h:panelGroup> </h:panelGroup>
<br /> <br />
<!-- Paytrail needs to initialize after the ajax call is complete --> <!-- Paytrail needs to initialize after the ajax call is complete -->
<!-- This function is to be override by the paytrail init function --> <!-- This function is to be override by the paytrail init function -->
<script type="text/javascript"> <script type="text/javascript">
function initPaymentButtons(){}; function initPaymentButtons() {
</script> };
<p:commandButton oncomplete="initPaymentButtons()" onerror="location.reload(true);" action="#{cc.attrs.commitaction}" id="commitbutton-botton" value="#{cc.attrs.commitValue}" /> </script>
<p:commandButton ajax="false" onerror="location.reload(true);"
action="#{cc.attrs.commitaction}" id="commitbutton-botton"
value="#{cc.attrs.commitValue}" />
......
...@@ -14,12 +14,7 @@ ...@@ -14,12 +14,7 @@
<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:define name="content">
<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"> <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']}" />
......
...@@ -15,12 +15,7 @@ ...@@ -15,12 +15,7 @@
<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="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">
<bill:showBill bill="#{billEditView.bill}" /> <bill:showBill bill="#{billEditView.bill}" />
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!