Documentation, and edge case.
This commit is contained in:
parent
cbf3f5814b
commit
6c87b9d08a
1 changed files with 10 additions and 0 deletions
|
@ -30,6 +30,13 @@ def pubkey_script(request):
|
|||
|
||||
|
||||
def card(request, invoice_id):
|
||||
''' View that shows and processes a Stripe CreditCardForm to pay the given
|
||||
invoice. Redirects back to the invoice once the invoice is fully paid.
|
||||
|
||||
Arguments:
|
||||
invoice_id (castable to str): The invoice id for the invoice to pay.
|
||||
|
||||
'''
|
||||
|
||||
form = forms.CreditCardForm(request.POST or None)
|
||||
|
||||
|
@ -40,6 +47,9 @@ def card(request, invoice_id):
|
|||
|
||||
to_invoice = redirect("invoice", inv.invoice.id)
|
||||
|
||||
if inv.invoice.balance_due() <= 0:
|
||||
return to_invoice
|
||||
|
||||
if request.POST and form.is_valid():
|
||||
try:
|
||||
inv.validate_allowed_to_pay() # Verify that we're allowed to do this.
|
||||
|
|
Loading…
Reference in a new issue