Skip to content

Commit

Permalink
Merge pull request #306 from open-contracting/304-fi-default-preaprov…
Browse files Browse the repository at this point in the history
…al-message

feat: add default_pre_approval_message to lender
  • Loading branch information
yolile authored Jul 8, 2024
2 parents b1ef8a3 + 296f8c5 commit 93135cf
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 4 deletions.
6 changes: 4 additions & 2 deletions app/mail.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,13 +211,15 @@ def send_application_approved_email(ses: SESClient, application: Application) ->
"UPLOAD_CONTRACT_IMAGE_LINK": f"{images_base_url}/uploadContract.png",
}

if (
if application.lender.default_pre_approval_message:
html_data["ADDITIONAL_COMMENTS"] = application.lender.default_pre_approval_message
elif (
"additional_comments" in application.lender_approved_data
and application.lender_approved_data["additional_comments"]
):
html_data["ADDITIONAL_COMMENTS"] = application.lender_approved_data["additional_comments"]
else:
html_data["ADDITIONAL_COMMENTS"] = ""
html_data["ADDITIONAL_COMMENTS"] = "Ninguno"

return send_email(ses, application.primary_email, prepare_html("Application_approved", html_data))

Expand Down
1 change: 1 addition & 0 deletions app/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -597,6 +597,7 @@ class LenderBase(SQLModel):
type: str = Field(default="")
sla_days: int | None
logo_filename: str = Field(default="", nullable=True)
default_pre_approval_message: str = Field(default="", nullable=True)


class Lender(LenderBase, ActiveRecordMixin, table=True):
Expand Down
4 changes: 2 additions & 2 deletions email_templates/Application_approved_es.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@
</div>
<div>
<p>
El siguiente paso completar el on-boarding con la entidad financiera, para lo cual te estarán contactando próximamente.
El siguiente paso completar el on-boarding con la entidad financiera.
Así también, te pedimos que luego de firmar tu contrato con {{BUYER_NAME}} lo cargues en Credere.
</p>
</div>
<div>
<p>
<p style="font-weight: bold">
Comentarios adicionales de {{FI}}: {{ADDITIONAL_COMMENTS}}
</p>
</div>
Expand Down
33 changes: 33 additions & 0 deletions migrations/versions/1d633984e7c1_lender_default_message.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
"""lender default message
Revision ID: 1d633984e7c1
Revises: 63f2125bb242
Create Date: 2024-07-08 14:41:07.483650
"""

from alembic import op
import sqlalchemy as sa
import sqlmodel # added

# revision identifiers, used by Alembic.
revision = "1d633984e7c1"
down_revision = "63f2125bb242"
branch_labels = None
depends_on = None


def upgrade() -> None:
op.add_column(
"lender",
sa.Column(
"default_pre_approval_message",
sqlmodel.sql.sqltypes.AutoString(),
nullable=True,
server_default="",
),
)


def downgrade() -> None:
op.drop_column("lender", "default_pre_approval_message")

0 comments on commit 93135cf

Please sign in to comment.