Refuse to send compliance letters to addresses without a postal code
This commit is contained in:
parent
e45e05f337
commit
797067ee38
2 changed files with 14 additions and 0 deletions
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue