John Boxall
unread,Oct 9, 2009, 5:39:33 PM10/9/09Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to django-paypal
I'm going to assume you're talking about a confirmation of payment
information.
To provide a confirmation page to people going through the Direct
Payment flow you going to need a way to propagate the data from the
payment form in one request to the next.
Naively, you could just re-populate the form with whatever you
received from the first post request and this time include a boolean
confirmation switch that will go ahead with the processing of the
payment. Ignoring the security issues behind serving a page that
contains someone's credit card information, here is a start:
class PayPalProWithConfirmation(PayPalPro):
def should_validate_payment_form(self):
return self.request.POST.get("confirm", False)
def render_payment_form(self):
self.context["confirm"] = bool(request.POST)
self.context[self.form_context_name] = self.payment_form_cls
(initial=request.POST)
return render_to_response(self.payment_template, self.context,
RequestContext(self.request))
...
In your template
...
<form>
{{ form }}
{% if confirm %}
<input type="hidden" name="confirm" value="1" />
<input type="submit" value="Confirm">
{% else %}
<input type="submit" value="Submit">
</form>
John