Skip to content

Commit

Permalink
#323 - add free of charge handler
Browse files Browse the repository at this point in the history
  • Loading branch information
cbellone committed Nov 21, 2018
1 parent d97c304 commit 0ab01c5
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/main/webapp/WEB-INF/templates/event/overview.ms
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,10 @@
{{/activePaymentMethods}}

{{/orderSummary.free}}

{{#orderSummary.free}}
<input type="hidden" name="paymentMethod" value="NONE">
<script src="{{request.contextPath}}/resources/js/payment/free-of-charge.js" defer async></script>
{{/orderSummary.free}}



Expand Down
27 changes: 27 additions & 0 deletions src/main/webapp/resources/js/payment/free-of-charge.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
(function(w) {

'use strict';

var setup = function() {
if(w.alfio && w.alfio.registerPaymentHandler) {
w.alfio.registerPaymentHandler({
paymentMethod: 'NONE',
id: 'NONE',
pay: function(confirmHandler) {
confirmHandler(true);
},
init: function() {
},
active: function() {
return true;
}
});
} else {
w.setTimeout(setup, 50);
}
};


setup();

})(window, document);

0 comments on commit 0ab01c5

Please sign in to comment.