Commit 5edaf1b8 by Tuomas Riihimäki

Add property to enable v2 checkout

1 parent acaa0805
Pipeline #173 failed
in 0 seconds
/* /*
* Copyright Codecrew Ry * Copyright Codecrew Ry
* *
* All rights reserved. * All rights reserved.
* *
* This license applies to any software containing a notice placed by the * This license applies to any software containing a notice placed by the
* copyright holder. Such software is herein referred to as the Software. * copyright holder. Such software is herein referred to as the Software.
* This license covers modification, distribution and use of the Software. * This license covers modification, distribution and use of the Software.
* *
* Any distribution and use in source and binary forms, with or without * Any distribution and use in source and binary forms, with or without
* modification is not permitted without explicit written permission from the * modification is not permitted without explicit written permission from the
* copyright owner. * copyright owner.
* *
* A non-exclusive royalty-free right is granted to the copyright owner of the * A non-exclusive royalty-free right is granted to the copyright owner of the
* Software to use, modify and distribute all modifications to the Software in * Software to use, modify and distribute all modifications to the Software in
* future versions of the Software. * future versions of the Software.
* *
*/ */
package fi.codecrew.moya.model; package fi.codecrew.moya.model;
...@@ -62,6 +62,7 @@ public enum LanEventPropertyKey { ...@@ -62,6 +62,7 @@ public enum LanEventPropertyKey {
*/ */
EVENT_CURRENCY_CODE(Type.TEXT, "EUR"), EVENT_CURRENCY_CODE(Type.TEXT, "EUR"),
ALLOW_FREE_BILLS(Type.BOOL), ALLOW_FREE_BILLS(Type.BOOL),
KEYCHECKOUT_V2_ENABLED(Type.BOOL)
; ;
public enum Type { public enum Type {
......
...@@ -30,9 +30,7 @@ ...@@ -30,9 +30,7 @@
}); });
</script> </script>
</ui:fragment> </ui:fragment>
<!--
<ui:fragment rendered="#{billEditView.checkoutFiAvailable}"> <ui:fragment rendered="#{billEditView.checkoutFiAvailable}">
LEGACY checkout
<table border="0"> <table border="0">
<tr> <tr>
...@@ -52,7 +50,6 @@ ...@@ -52,7 +50,6 @@
</tr> </tr>
</table> </table>
</ui:fragment> </ui:fragment>
-->
<ui:fragment rendered="#{billEditView.checkoutFiV2Available}"> <ui:fragment rendered="#{billEditView.checkoutFiV2Available}">
<table border="0"> <table border="0">
......
...@@ -26,7 +26,10 @@ import javax.enterprise.context.ConversationScoped; ...@@ -26,7 +26,10 @@ import javax.enterprise.context.ConversationScoped;
import javax.inject.Named; import javax.inject.Named;
import fi.codecrew.moya.beans.CheckoutFiV2BeanLocal; import fi.codecrew.moya.beans.CheckoutFiV2BeanLocal;
import fi.codecrew.moya.beans.EventBeanLocal;
import fi.codecrew.moya.beans.checkout.CheckoutCreateResponsePojo; import fi.codecrew.moya.beans.checkout.CheckoutCreateResponsePojo;
import fi.codecrew.moya.model.LanEventProperty;
import fi.codecrew.moya.model.LanEventPropertyKey;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
...@@ -60,6 +63,8 @@ public class BillEditView extends GenericCDIView { ...@@ -60,6 +63,8 @@ public class BillEditView extends GenericCDIView {
private transient CheckoutFiV2BeanLocal checkoutV2Bean; private transient CheckoutFiV2BeanLocal checkoutV2Bean;
@EJB @EJB
private transient BillBeanLocal billbean; private transient BillBeanLocal billbean;
@EJB
private transient EventBeanLocal eventbean;
private List<CheckoutBank> checkoutFiToken; private List<CheckoutBank> checkoutFiToken;
private CheckoutCreateResponsePojo checkoutFiV2Token; private CheckoutCreateResponsePojo checkoutFiV2Token;
...@@ -82,12 +87,14 @@ public class BillEditView extends GenericCDIView { ...@@ -82,12 +87,14 @@ public class BillEditView extends GenericCDIView {
} }
public boolean getCheckoutFiV2Available() { public boolean getCheckoutFiV2Available() {
return bill != null && !bill.isPaid() && checkoutbean.isPaymentEnabled(); boolean v2Enabled = eventbean.getPropertyBoolean(LanEventPropertyKey.KEYCHECKOUT_V2_ENABLED);
return v2Enabled && bill != null && !bill.isPaid() && checkoutbean.isPaymentEnabled();
} }
public boolean isCheckoutFiAvailable() public boolean isCheckoutFiAvailable()
{ {
return bill != null && !bill.isPaid() && checkoutbean.isPaymentEnabled(); boolean v2Enabled = eventbean.getPropertyBoolean(LanEventPropertyKey.KEYCHECKOUT_V2_ENABLED);
return !v2Enabled && bill != null && !bill.isPaid() && checkoutbean.isPaymentEnabled();
} }
public boolean isVerkkomaksuFiAvailable() public boolean isVerkkomaksuFiAvailable()
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!