Skip to content
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

When a customer creates or updates a subscription, invoice is updated automatically #560

Open
wants to merge 1 commit into
base: original
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
When a customer creates or updates a subscription, invoice is updated…
… automatically
  • Loading branch information
Ghost8Recon committed Apr 26, 2018
commit c3367d90b221a16260120539bbbb72dee515dca8
4 changes: 3 additions & 1 deletion pinax/stripe/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

import stripe

from .actions import customers, events, exceptions, sources, subscriptions
from .actions import customers, events, exceptions, sources, subscriptions, invoices
from .conf import settings
from .forms import PaymentMethodForm, PlanForm
from .mixins import CustomerMixin, LoginRequiredMixin, PaymentsContextMixin
Expand Down Expand Up @@ -119,6 +119,7 @@ def set_customer(self):

def subscribe(self, customer, plan, token):
subscriptions.create(customer, plan, token=token, tax_percent=self.tax_percent)
invoices.sync_invoices_for_customer(customer)

def form_valid(self, form):
self.set_customer()
Expand Down Expand Up @@ -165,6 +166,7 @@ def get_context_data(self, **kwargs):

def update_subscription(self, plan_id):
subscriptions.update(self.object, plan_id)
invoices.sync_invoices_for_customer(customer)

def get_initial(self):
initial = super(SubscriptionUpdateView, self).get_initial()
Expand Down