"""Logic for identity verification.""" import flask from owsresponse import response, status as ows_status from notifications.connectors import ses from notifications.constants.email import ( IDENTITY_VERIFICATION_SENDER, IDENTITY_VERIFICATION_SUBJECT, IDENTITY_VERIFICATION_TEMPLATE, ) def verify(email: str, full_name: str, verification_url: str, brand: str) -> response.Response: """Send an identity verification email. Args: email (str): e-mail address of the recipient. full_name (str): full name of the recipient. verification_url (str): Identity verification URL. brand (str): brand name e.g. "awal". """ text_body = flask.render_template( IDENTITY_VERIFICATION_TEMPLATE, full_name=full_name, verification_url=verification_url, default_brand=brand, ) ses.send_html_email( subject=IDENTITY_VERIFICATION_SUBJECT, body=text_body, recipient=email, source=IDENTITY_VERIFICATION_SENDER, ) return response.Response(status=ows_status.ACCEPTED)