Merge branch 'master' of github.com:research/chocolate

This commit is contained in:
James Kasten 2012-11-18 22:53:55 -05:00
commit 8a795cbc32
4 changed files with 68 additions and 4 deletions

View file

@ -39,8 +39,8 @@
<section>
<h2>Payment Form</h2>
<form method="get" accept-charset="UTF-8" action="/payment.py/submit=%s">
<p><label for="card-type">Credit card type</i></label> <select name=""><option>Vista</option><option>MisterCard</option><option>Discovery</option></select></p>
<p><label for="credit-card">Credit card number</label>: <input name="" type="text" autocomplete="off" id="credit-card" size="20" maxlength="16" /></p>
<p><label for="card-type">Credit card type:</label> <select name=""><option>Vista</option><option>MisterCard</option><option>Discovery</option></select></p>
<p><label for="credit-card">Credit card number:</label> <input name="" type="text" autocomplete="off" id="credit-card" size="20" style="font-family:monospace" maxlength="16" /></p>
<p><input type="submit" value="Submit" /></p>
</form>
</p>

View file

@ -36,7 +36,10 @@ class payment(object):
if r.hget(session, "state") != "payment":
return "Attempt to process payment for session not expecting it."
r.publish("payments", session)
return "<h1>Thank you!</h1> Processed a payment for session ID %s." % session
names = r.lrange("%s:names" % session, 0, -1)
names_list = '<ul style="font-family:monospace">' + "\n".join("<li>%s</li>" % n for n in names) + '</ul>'
with open("thanks.html","r") as f:
return f.read() % (session, names_list)
if __name__ == "__main__":
app = web.application(urls, globals())

61
server-ca/thanks.html Normal file
View file

@ -0,0 +1,61 @@
<!DOCTYPE html>
<html class="no-js">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Project Chocolate</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width">
<link rel="stylesheet" href="/css/normalize.min.css">
<link rel="stylesheet" href="/css/main.css">
<!--[if lt IE 9]>
<script src="/js/vendor/html5.js"></script>
<script>window.html5 || document.write('<script src="/js/vendor/html5shiv.js"><\/script>')</script>
<![endif]-->
</head>
<body>
<div class="header-container">
<header class="wrapper clearfix">
<h1 class="title">Thank you</h1>
</header>
</div>
<div class="main-container">
<div class="main wrapper clearfix">
<article>
<header>
</header>
<section>
<h2>Thanks for your payment!</h2>
<p>
You successfully processed a credit card payment of <b>17.00 simoleons</b> for the
issuance of a digital certificate.</p><p>This payment relates to session ID %s, which
requested a certificate for the following names:</p>
</p>
%s
</p>
</section>
<footer>
</footer>
</article>
<aside>
<p>Following this successful payment, the requested certificate will be issued to you. Please tell your Trustify client application to continue at this time.</p>
</aside>
</div> <!-- #main -->
</div> <!-- #main-container -->
<div class="footer-container">
<footer class="wrapper">
</footer>
</div>
<script src="/js/main.js"></script>
</body>
</html>

View file

@ -35,7 +35,7 @@ class Payment_Challenge(Challenge):
def get_display_string(self):
if self.times_performed == 0:
return "You are buying " + self.formatted_reasons() + " You will need to visit " + self.url + " to submit your payment\nPlease press enter once your payment has been submitted"
return "You are buying " + self.formatted_reasons() + "You will need to visit\n " + self.url + "\nto submit your payment.\nPlease press Enter once your payment has been submitted."
# The user has tried at least once... display a different message
else: