mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-20 22:40:31 -04:00
use new letter branding instead of dvla organisation id
new code is copied stylistically from the email branding patterns. Instead of `service.dvla_organisation`, there's now `service.letter_branding` and `service.letter_branding_id`. However, unlike email branding we're not currently showing a preview of the logo. That can come later when we work out how we want to do it.
This commit is contained in:
@@ -1,10 +1,24 @@
|
||||
from app.notify_client import NotifyAdminAPIClient
|
||||
from app.notify_client import NotifyAdminAPIClient, cache
|
||||
|
||||
|
||||
class LetterBrandingClient(NotifyAdminAPIClient):
|
||||
|
||||
def get_letter_branding(self):
|
||||
return self.get(url='/dvla_organisations')
|
||||
@cache.set('letter_branding-{branding_id}')
|
||||
def get_letter_branding(self, branding_id):
|
||||
return self.get(url='/letter-branding/{}'.format(branding_id))
|
||||
|
||||
@cache.set('letter_branding')
|
||||
def get_all_letter_branding(self, sort_key=None):
|
||||
brandings = self.get(url='/letter-branding')
|
||||
if sort_key and sort_key in brandings[0]:
|
||||
brandings.sort(key=lambda branding: branding[sort_key].lower())
|
||||
return brandings
|
||||
|
||||
def get_letter_branding_id_for_domain(self, domain):
|
||||
for branding in self.get_all_letter_branding():
|
||||
if domain and branding.get('domain') == domain:
|
||||
return branding['id']
|
||||
return None
|
||||
|
||||
def create_letter_branding(self, filename, name, domain):
|
||||
data = {
|
||||
|
||||
@@ -75,6 +75,7 @@ class ServiceAPIClient(NotifyAdminAPIClient):
|
||||
'sms_sender',
|
||||
'created_by',
|
||||
'branding',
|
||||
'letter_branding',
|
||||
'email_branding',
|
||||
'letter_contact_block',
|
||||
'dvla_organisation',
|
||||
|
||||
Reference in New Issue
Block a user