Pēteris Caune
6 years ago
14 changed files with 187 additions and 29 deletions
-
12hc/lib/emails.py
-
5hc/payments/forms.py
-
2hc/payments/invoices.py
-
20hc/payments/migrations/0004_subscription_send_invoices.py
-
9hc/payments/models.py
-
16hc/payments/tests/test_billing.py
-
9hc/payments/tests/test_pdf_invoice.py
-
1hc/payments/urls.py
-
66hc/payments/views.py
-
49templates/accounts/billing.html
-
2templates/accounts/profile.html
-
15templates/emails/invoice-body-html.html
-
8templates/emails/invoice-body-text.html
-
2templates/emails/invoice-subject.html
@ -1,5 +0,0 @@ |
|||
from django import forms |
|||
|
|||
|
|||
class BillToForm(forms.Form): |
|||
bill_to = forms.CharField(max_length=500, required=False) |
@ -0,0 +1,20 @@ |
|||
# -*- coding: utf-8 -*- |
|||
# Generated by Django 1.11.6 on 2018-01-09 12:52 |
|||
from __future__ import unicode_literals |
|||
|
|||
from django.db import migrations, models |
|||
|
|||
|
|||
class Migration(migrations.Migration): |
|||
|
|||
dependencies = [ |
|||
('payments', '0003_subscription_address_id'), |
|||
] |
|||
|
|||
operations = [ |
|||
migrations.AddField( |
|||
model_name='subscription', |
|||
name='send_invoices', |
|||
field=models.BooleanField(default=True), |
|||
), |
|||
] |
@ -0,0 +1,16 @@ |
|||
from mock import patch |
|||
|
|||
from hc.payments.models import Subscription |
|||
from hc.test import BaseTestCase |
|||
|
|||
|
|||
class SetPlanTestCase(BaseTestCase): |
|||
|
|||
@patch("hc.payments.models.braintree") |
|||
def test_it_saves_send_invoices_flag(self, mock): |
|||
self.client.login(username="alice@example.org", password="password") |
|||
|
|||
form = {"save_send_invoices": True} |
|||
self.client.post("/accounts/profile/billing/", form) |
|||
sub = Subscription.objects.get() |
|||
self.assertFalse(sub.send_invoices) |
@ -0,0 +1,15 @@ |
|||
{% extends "emails/base.html" %} |
|||
{% load hc_extras %} |
|||
|
|||
{% block content %} |
|||
Hello,<br /> |
|||
Here's your invoice from {% site_name %} for |
|||
{{ tx.subscription_details.billing_period_start_date }} - {{ tx.subscription_details.billing_period_end_date }} |
|||
.</p> |
|||
|
|||
{% endblock %} |
|||
|
|||
{% block content_more %} |
|||
Thanks,<br /> |
|||
The {% escaped_site_name %} Team |
|||
{% endblock %} |
@ -0,0 +1,8 @@ |
|||
{% load hc_extras %} |
|||
Hello, |
|||
|
|||
Here's your invoice from {% site_name %}. |
|||
|
|||
-- |
|||
Regards, |
|||
{% site_name %} |
@ -0,0 +1,2 @@ |
|||
{% load hc_extras %} |
|||
Invoice from {% site_name %} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue