mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-11 17:38:50 -04:00
merge main
This commit is contained in:
@@ -684,5 +684,5 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"generated_at": "2025-01-17T02:22:09Z"
|
||||
"generated_at": "2025-01-16T16:38:48Z"
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
width: 100%;
|
||||
max-width: 464px;
|
||||
box-sizing: border-box;
|
||||
padding: units(1);
|
||||
padding: units(2);
|
||||
background: color('gray-cool-10');
|
||||
border: 1px solid color('gray-cool-10');
|
||||
border-radius: 5px;
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
import json
|
||||
|
||||
from app.extensions import redis_client
|
||||
from app.notify_client import NotifyAdminAPIClient
|
||||
|
||||
|
||||
@@ -15,10 +18,19 @@ class BillingAPIClient(NotifyAdminAPIClient):
|
||||
)
|
||||
|
||||
def get_free_sms_fragment_limit_for_year(self, service_id, year=None):
|
||||
frag_limit = redis_client.get(f"free-sms-fragment-limit-{service_id}-{year}")
|
||||
if frag_limit is not None:
|
||||
return json.loads(frag_limit.decode("utf-8"))
|
||||
result = self.get(
|
||||
"/service/{0}/billing/free-sms-fragment-limit".format(service_id),
|
||||
params=dict(financial_year_start=year),
|
||||
)
|
||||
|
||||
redis_client.set(
|
||||
f"free-sms-fragment-limit-{service_id}-{year}",
|
||||
json.dumps(result["free_sms_fragment_limit"]),
|
||||
ex=30,
|
||||
)
|
||||
return result["free_sms_fragment_limit"]
|
||||
|
||||
def create_or_update_free_sms_fragment_limit(
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import json
|
||||
from datetime import datetime, timezone
|
||||
|
||||
from app.extensions import redis_client
|
||||
@@ -517,7 +518,18 @@ class ServiceAPIClient(NotifyAdminAPIClient):
|
||||
return int(count)
|
||||
|
||||
def get_global_notification_count(self, service_id):
|
||||
return self.get("/service/{}/notification-count".format(service_id))
|
||||
notification_count = redis_client.get(f"notification-count-{service_id}")
|
||||
if notification_count is not None:
|
||||
return json.loads(notification_count.decode("utf-8"))
|
||||
|
||||
notification_count = self.get(
|
||||
"/service/{}/notification-count".format(service_id)
|
||||
)
|
||||
redis_client.set(
|
||||
f"notification-count-{service_id}", json.dumps(notification_count), ex=30
|
||||
)
|
||||
|
||||
return notification_count
|
||||
|
||||
def get_service_invite_data(self, redis_key):
|
||||
"""
|
||||
|
||||
@@ -51,35 +51,37 @@
|
||||
{
|
||||
"image_src": asset_url('images/calendar.svg'),
|
||||
"card_heading": "Reminders",
|
||||
"p_text": "In a text bubble // Your Quality Control food phone interview is on ((date)) at ((time)). Failure to
|
||||
"p_text": "Your Quality Control food phone interview is on ((date)) at ((time)). Failure to
|
||||
attend may lead to closure of your benefits. Call 1-800-222-3333 with questions.",
|
||||
"alt_text": "reminder text example"
|
||||
},
|
||||
{
|
||||
"image_src": asset_url('images/alert.svg'),
|
||||
"card_heading": "Alerts to take action",
|
||||
"p_text": "In a text bubble // Your household's Medicaid coverage is expiring. To keep getting Medicaid, you must
|
||||
"p_text": "Your household's Medicaid coverage is expiring. To keep getting Medicaid, you must
|
||||
complete your renewal by ((date)). You can renew online at dhs.state.gov…",
|
||||
"alt_text": "alerts text example"
|
||||
},
|
||||
{
|
||||
"image_src": asset_url('images/alarm.svg'),
|
||||
"card_heading": "Important status updates",
|
||||
"p_text": "In a text bubble // Your passport has been issued at the Los Angeles Passport Agency. Please come to the
|
||||
"p_text": "Your passport has been issued at the Los Angeles Passport Agency. Please come to the
|
||||
desk between 1:30pm and 2:30pm today to pick up your passport…",
|
||||
"alt_text": "status update text example"
|
||||
},
|
||||
] %}
|
||||
{% for item in card_contents %}
|
||||
<div class="radius-lg border-2px maxw-tablet">
|
||||
<div class="grid-row grid-gap-4 padding-2 padding-x-3 flex-align-center">
|
||||
<div class="grid-col flex-3">
|
||||
<p><b>{{item.card_heading}}</b></p>
|
||||
<p>{{item.p_text}}</p>
|
||||
<div class="grid-container-tablet padding-3 radius-lg border-2px margin-left-0 ">
|
||||
<h3 class="usa-card__heading padding-y-2">{{item.card_heading}}</h3>
|
||||
<div class="grid-row grid-gap-3 flex-align-center">
|
||||
<div class="grid-col-auto ">
|
||||
<p class="sms-message-wrapper">{{item.p_text}}</p>
|
||||
</div>
|
||||
<div class="grid-col-fill">
|
||||
{% if item.image_src %}
|
||||
<img src="{{ item.image_src }}" alt="{{ item.alt_text }}" class="height-15" />
|
||||
{% endif %}
|
||||
</div>
|
||||
{% if item.image_src %}
|
||||
<img src="{{item.image_src}}" alt="{{ item.alt_text }}" class="height-15" />
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
|
||||
@@ -10,7 +10,15 @@ def test_get_free_sms_fragment_limit_for_year_correct_endpoint(mocker, api_user_
|
||||
expected_url = "/service/{}/billing/free-sms-fragment-limit".format(service_id)
|
||||
client = BillingAPIClient()
|
||||
|
||||
mock_get = mocker.patch("app.notify_client.billing_api_client.BillingAPIClient.get")
|
||||
mock_get = mocker.patch(
|
||||
"app.notify_client.billing_api_client.BillingAPIClient.get",
|
||||
return_value={"free_sms_fragment_limit": 0},
|
||||
)
|
||||
mocker.patch(
|
||||
"app.notify_client.billing_api_client.redis_client.get", return_value=None
|
||||
)
|
||||
|
||||
mocker.patch("app.notify_client.billing_api_client.redis_client.set")
|
||||
|
||||
client.get_free_sms_fragment_limit_for_year(service_id, year=1999)
|
||||
mock_get.assert_called_once_with(
|
||||
@@ -28,6 +36,11 @@ def test_post_free_sms_fragment_limit_for_current_year_endpoint(
|
||||
)
|
||||
client = BillingAPIClient()
|
||||
|
||||
mocker.patch(
|
||||
"app.notify_client.billing_api_client.redis_client.get", return_value=None
|
||||
)
|
||||
|
||||
mocker.patch("app.notify_client.billing_api_client.redis_client.set")
|
||||
client.create_or_update_free_sms_fragment_limit(
|
||||
service_id=service_id, free_sms_fragment_limit=1111
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user