Refuse to send compliance letters to addresses without a postal code

This commit is contained in:
Eli Ribble 2026-04-30 03:09:42 +00:00
parent e45e05f337
commit 797067ee38
No known key found for this signature in database
2 changed files with 14 additions and 0 deletions

View file

@ -17,6 +17,9 @@ import (
"github.com/rs/zerolog/log"
)
// This is the entrypoint for the backend job of sending a compliance mailer
// It should only return errors for programmer-level errors we want retried on restart
// Not for normal issues
func ComplianceSend(ctx context.Context, row_id int32) error {
bxn := db.PGInstance.BobDB
compliance_req, err := models.FindComplianceReportRequest(ctx, bxn, row_id)
@ -47,6 +50,10 @@ func ComplianceSend(ctx context.Context, row_id int32) error {
if err != nil {
return fmt.Errorf("find address: %w", err)
}
if address.PostalCode == "" {
log.Warn().Int32("id", address.ID).Msg("dropping mailer job because the address has no postal code")
return nil
}
organization, err := models.FindOrganization(ctx, bxn, site.OrganizationID)
if err != nil {