From 8ef69f0c6b8ebb30fadba6de9c7d9df56ea34de7 Mon Sep 17 00:00:00 2001 From: James Kasten Date: Thu, 1 Nov 2012 02:20:05 -0400 Subject: [PATCH] rough skeleton of the client payment challenge class --- trustify/client/challenge.py | 2 +- trustify/client/payment_challenge.py | 34 ++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 trustify/client/payment_challenge.py diff --git a/trustify/client/challenge.py b/trustify/client/challenge.py index 1ee304488..a4ccfd5a1 100644 --- a/trustify/client/challenge.py +++ b/trustify/client/challenge.py @@ -3,7 +3,7 @@ from trustify.client import logger class Challenge(object): def __init__(self, configurator): self.config = configurator - def perform(self): + def perform(self, quiet=True): logger.error("Error - base class challenge.perform()") def clean(self): logger.error("Error - base class challenge.clean()") diff --git a/trustify/client/payment_challenge.py b/trustify/client/payment_challenge.py new file mode 100644 index 000000000..b006bc9e1 --- /dev/null +++ b/trustify/client/payment_challenge.py @@ -0,0 +1,34 @@ +from trustify.client.challenge import Challenge +from trustify.client import logger + +# TODO: How is this determined? +curses = True; + +############################################################ +# Possible addition to challenge structure: priority parameter +# If only DVSNI and Payment are required, the user might want +# to be validated before submitting payment, allowing the user +# to gain confidence in the system. If things do go poorly the +# user has less invested in that particular session/transaction. +############################################################# + +class Payment_Challenge(Challenge): + # Possible reasons: Wildcard Certificates, EV certificates + # Malware scanning services, Organization or Identity validated certs + def __init__(self, url, reason="Specialty Certificate"): + self.url = url + def perform(self, quiet=True): + if curses: + dialog.Dialog().msgbox("You are buying " + formatted_reasons() + " You will need to visit " + self.url + " to submit your payment\nPlease click continue once your payment has been submitted", width=70) + return True + + def redo(self, quiet=True): + """ + Some other message called when challenge verification wasn't successful + This should probably be a standard challenge function for all failed + challenge attempts + """ + if curses: + dialog.Dialog().msgbox("The CA did not record your payment, please visit " + self.url + " for more information or to finish processing your transaction.", width=70) + + return True