From c13ec18a27524289aca7bafac80087f725b7e928 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?P=C4=93teris=20Caune?= <cuu508@gmail.com>
Date: Wed, 30 Oct 2019 18:31:10 +0200
Subject: [PATCH] 5 SMS & WhatsApp sends/mo for free plans

---
 hc/accounts/models.py                     |  4 ++--
 templates/emails/sms-limit-body-html.html |  2 +-
 templates/emails/sms-limit-body-text.html |  5 ++---
 templates/front/channels.html             |  6 +++---
 templates/payments/pricing.html           | 22 +++++++++++-----------
 5 files changed, 19 insertions(+), 20 deletions(-)

diff --git a/hc/accounts/models.py b/hc/accounts/models.py
index 57f00aa0..9fab58ae 100644
--- a/hc/accounts/models.py
+++ b/hc/accounts/models.py
@@ -55,7 +55,7 @@ class Profile(models.Model):
     token = models.CharField(max_length=128, blank=True)
     current_project = models.ForeignKey("Project", models.SET_NULL, null=True)
     last_sms_date = models.DateTimeField(null=True, blank=True)
-    sms_limit = models.IntegerField(default=0)
+    sms_limit = models.IntegerField(default=5)
     sms_sent = models.IntegerField(default=0)
     team_limit = models.IntegerField(default=2)
     sort = models.CharField(max_length=20, default="created")
@@ -112,7 +112,7 @@ class Profile(models.Model):
     def send_sms_limit_notice(self, transport):
         ctx = {"transport": transport, "limit": self.sms_limit}
         if self.sms_limit != 500 and settings.USE_PAYMENTS:
-            ctx["url"] = settings.SITE_ROOT + reverse("hc-billing")
+            ctx["url"] = settings.SITE_ROOT + reverse("hc-pricing")
 
         emails.sms_limit(self.user.email, ctx)
 
diff --git a/templates/emails/sms-limit-body-html.html b/templates/emails/sms-limit-body-html.html
index 37710bec..61288aad 100644
--- a/templates/emails/sms-limit-body-html.html
+++ b/templates/emails/sms-limit-body-html.html
@@ -11,7 +11,7 @@ each month.
 </p>
 
 {% if url %}
-<p>You can increase the monthly sending limit by <a href="{{ url }}">upgrading your billing plan</a>.</p>
+<p>You can increase the monthly sending limit by upgrading your billing plan. <a href="{{ url }}">See Pricing</a>.</p>
 {% endif %}
 
 {% endblock %}
diff --git a/templates/emails/sms-limit-body-text.html b/templates/emails/sms-limit-body-text.html
index 54236e44..9b6c6d69 100644
--- a/templates/emails/sms-limit-body-text.html
+++ b/templates/emails/sms-limit-body-text.html
@@ -1,9 +1,8 @@
 {% load hc_extras %}Hello,
 
 We could not deliver a {{ transport }} notification because your {% site_name %} account has reached its monthly sending limit of {{ limit }} sends per month. The limit resets at the start of each month.
-{% if url %}You can increase the monthly sending limit by upgrading your billing plan:
-
-{{ url }}{% endif %}
+{% if url %}You can increase the monthly sending limit by upgrading your billing plan.
+{% endif %}
 
 --
 Regards,
diff --git a/templates/front/channels.html b/templates/front/channels.html
index 11b970f3..5cc4635c 100644
--- a/templates/front/channels.html
+++ b/templates/front/channels.html
@@ -249,7 +249,7 @@
             <p>High Trust Messaging for the Enterprise.</p>
 
             <a href="{% url 'hc-add-mattermost' %}" class="btn btn-primary">Add Integration</a>
-        </li>        
+        </li>
 
         <li>
             <img src="{% static 'img/integrations/opsgenie.png' %}"
@@ -322,7 +322,7 @@
             <img src="{% static 'img/integrations/sms.png' %}"
                 class="icon" alt="SMS icon" />
 
-            <h2>SMS {% if use_payments %}<small>(paid plans)</small>{% endif %}</h2>
+            <h2>SMS</h2>
             <p>Get a text message to your phone when a check goes down.</p>
 
             <a href="{% url 'hc-add-sms' %}" class="btn btn-primary">Add Integration</a>
@@ -368,7 +368,7 @@
             <img src="{% static 'img/integrations/whatsapp.png' %}"
                 class="icon" alt="WhatsApp icon" />
 
-            <h2>WhatsApp {% if use_payments %}<small>(paid plans)</small>{% endif %}</h2>
+            <h2>WhatsApp</h2>
             <p>Get a WhatsApp message when a check goes up or down.</p>
 
             <a href="{% url 'hc-add-whatsapp' %}" class="btn btn-primary">Add Integration</a>
diff --git a/templates/payments/pricing.html b/templates/payments/pricing.html
index aba47891..53a898f1 100644
--- a/templates/payments/pricing.html
+++ b/templates/payments/pricing.html
@@ -51,19 +51,19 @@
         <div class="row">
             <div class="col-sm-12" id="period-controls">
                 <div class="btn-group" data-toggle="buttons">
-                    <label class="btn btn-default">
-                        <input
-                            type="radio"
-                            name="period"
-                            value="monthly"
-                            autocomplete="off"> Monthly
-                    </label>
                     <label class="btn btn-default active">
                         <input
                             type="radio"
                             name="period"
-                            value="annual"
+                            value="monthly"
                             checked
+                            autocomplete="off"> Monthly
+                    </label>
+                    <label class="btn btn-default">
+                        <input
+                            type="radio"
+                            name="period"
+                            value="annual"
                             autocomplete="off"> Annual
                     </label>
                 </div>
@@ -83,7 +83,7 @@
                     <li class="list-group-item">3 Team Members</li>
                     <li class="list-group-item">100 Log Entries per Check</li>
                     <li class="list-group-item">API Access</li>
-                    <li class="list-group-item">&nbsp;</li>
+                    <li class="list-group-item">5 SMS {% if enable_whatsapp %}&amp; WhatsApp{% endif %} Alerts per Month</li>
                     <li class="list-group-item">&nbsp;</li>
                 </ul>
                 {% if not request.user.is_authenticated %}
@@ -101,7 +101,7 @@
                 <div class="panel-body text-center">
                     <h1>Business</h1>
                     <h2>
-                        <span id="s-price">$16</span><span class="mo">/mo</span>
+                        <span id="s-price">$20</span><span class="mo">/mo</span>
                     </h2>
                 </div>
 
@@ -130,7 +130,7 @@
                 <div class="panel-body text-center">
                     <h1>Business Plus</h1>
                     <h2>
-                        <span id="p-price">$64</span><span class="mo">/mo</span>
+                        <span id="p-price">$80</span><span class="mo">/mo</span>
                     </h2>
                 </div>