<%

include("../model/paymentQuery.jag");
response.contentType = 'text/javascript';

var verb = request.getMethod();
var orderid = request.getParameter('orderid');
var data = request.getContent();

var log = new Log();
var uri = request.getRequestURI();
uri = uri.substring(request.getContextPath().length);
var uriMatcher = new URIMatcher(uri);
if(uriMatcher.match("/payments/{orderid}/")) {
	orderid = uriMatcher.elements().orderid;
}
if(data != "") {
	data = parse(data);
	if(data.id) {
		orderid = data.id;
	}
}
if(verb == "GET" && orderid != null){
	//is paid for order	
	isPaid(orderid);
	
}else if (verb == "PUT" && orderid != null){
	pay(orderid);
}


%>