Skip to content

Coalesce implementations of Stripe payment forms #1761

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Oct 22, 2015
Merged

Conversation

agjohnson
Copy link
Contributor

This makes all of our implementations of payment forms use common bases, which
are also extendable into RTD.com. This implements several changes to how the
forms are used:

  • Duplicate code was reduced by making views into model views
  • Stripe functions were pushed into form processing to allow for better form
    validation error handling
  • Common fields were moved onto a base class, ensuring the implementations all
    match
  • The javascript interface was also cleaned up some, pushing more one-off
    pieces of code into the shared base
  • Payment forms will report more errors, and will interpret errors from Stripe
    on the Stripe fields they are associated with
  • A common field template for Knockout enabled forms is used on each form

The implementation for gold subscriptions changed slightly with this:

  • Gold subscription form was turned into model form
  • Views use model view create/update/delete views instead of manually
    duplicating that code
  • Subscription deletion triggers a delete on stripe through a signal, to ensure
    that the stripe subscription always matches
  • Redundant templates removed

The donation form implementation hasn't changed much, beside being updated to
use the base form and view classes.

Screenshots

screen shot 2015-10-15 at 10 59 20 am
Subscription Signup

screen shot 2015-10-15 at 10 59 37 am
Card rejection on subscription signup

screen shot 2015-10-15 at 10 59 52 am
Card rejection on CVV on subscription signup

screen shot 2015-10-15 at 11 06 47 am
Subscription details

screen shot 2015-10-15 at 11 00 15 am
Update subscription

screen shot 2015-10-15 at 11 00 23 am
Update subscription card showing

screen shot 2015-10-15 at 10 58 36 am
Confirm subscription deletion

screen shot 2015-10-15 at 10 58 51 am
Back to sign up, subscription cancelled

@ericholscher
Copy link
Member

Is the split between Gold & Donate that one is recurring and the other is one time?

import stripe
from django.conf import settings

stripe.api_key = getattr(settings, 'STRIPE_SECRET', None)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems weird we're setting this on the object directly at the top level in a util function?

Seems like it should go in the app config, or on the ready() function?

@agjohnson
Copy link
Contributor Author

Yeah, split between donate and gold is that gold is a subscription and donate is a charge on Stripe. On subscriptions we need to track at least the customer id, on charge we don't need to track any object id -- though could be if we had any use for it on the RTD side.

@ericholscher
Copy link
Member

Just seems weird to have 2 different places to give money, but I guess the "one time" vs "recurring" is different, but it seems odd to me as a user to have them in different places. I guess we could unify the UX while still having 2 diff forms.

@agjohnson
Copy link
Contributor Author

Well, the donation page is only really a concern when we do an explicit push towards donations, so it's very unlikely that users would be confused by that. I left the link to the donation page on the subscription form, but not convinced we need that there.

@ericholscher
Copy link
Member

Makes sense. We can just keep that as a backup, but Gold is the main thing.

This uses `textInput` for better handling of text field operations like pasting and
autofill. This should allow for card numbers to be pasted in on payment forms.
This eliminates the need to specify the api_key everywhere
agjohnson added a commit that referenced this pull request Oct 22, 2015
Coalesce implementations of Stripe payment forms
@agjohnson agjohnson merged commit 1392891 into master Oct 22, 2015
@agjohnson agjohnson deleted the payment-form branch October 22, 2015 23:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants