invoice: Added an API endpoint for showing a user's service credit, make sure you receive a number by POST when someone adds service credit, allow people to pay using Stripe, using credit cards.

Merged
#4 · Created  · Last updated

Merged pull request

Merged in nasonfish/panel2 (pull request #4)

5de873d·Author: ·Closed by: ·2013-12-26

Description

Feel free to cherry pick and such.


I might be missing something obvious somewhere else, but I couldn't find a way to grab a user's total service credit from the API.

So, now:

GET /invoice/service_credit.json:

{ "total": 7.50, "username": "nasonfish" }

When a user adds service credit, they can enter any number they want into the form that asks for the value of it. When they enter in something that can't be cast to a float, a blank invoice is created and they receive a 500 error page.

Now, it checks if the user has entered in a valid number, and delays creating the invoice until after all the checks on the number have passed.


For stripe support, you can edit the config to add two values, STRIPE_PUBLIC_KEY and STRIPE_PRIVATE_KEY, which correspond to the keys you should have in your Stripe.. panel, thing.

Install the stripe module using the command found on https://stripe.com/docs/libraries:

pip install --index-url https://code.stripe.com --upgrade stripe

And if there's anything else you need to edit regarding what information Stripe gathers, feel free to check out /panel2/mod_invoice/templates/invoice/invoice-view.html, line 59 or so.

0 attachments

0 comments

Loading commits...