<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
  xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
  layout:decorator="/templates/layout">
  <head>
  	<title>Payment in process</title>
  	<script src="//code.jquery.com/jquery-1.11.2.min.js"></script>
  	<script th:inline="javascript">
  	/*<![CDATA[*/
	$(document).ready(function() {
		
		// Check The Status Every 2 Seconds
		var timer = setInterval(function() {
			
			$.ajax({
				  url: /*[[@{'/payment/status'}]]*/,
				  success: function(data) {
					
					if(data !== 'WORKING') {
						window.location = data;
						clearInterval(timer);
					}
				  }
			});
			
		}, 2000);
	});
	/*]]>*/	
</script>
  </head>
<body>
<div layout:fragment="content">
	<div th:if="${!errors.isEmpty()}" class="alert alert-error">
		<div th:each="error : ${errors}" th:text="${error}">
		</div>
	</div>
	<div th:unless="${!errors.isEmpty()}">
		Payment in progress. This may take a while...
	</div>
</div>
</body>
</html>