Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Send emails when claim approved #3410

Merged
merged 1 commit into from
Nov 20, 2024
Merged

Conversation

rjlynch
Copy link
Contributor

@rjlynch rjlynch commented Nov 14, 2024

When an EY claim is approved we want to send an email to the
practitioner and the provider.
Mailers don't let us send two email from one action, so the approve
method enqueues jobs to send each of the emails.
I think it would probably be better for policies to be told a claim has
been approved and handle policy specific actions like sending emails in
the polciy, so rather than:
@claimpolicy.mailer.approved(@claim).deliver_later
we'd do
@claim.policy.claim_approved(@claim)
and let the policy determine the action to take (sending emails).
However this is a bit different to how we do things now, so for the time
being we'll just call the mailer, even it it's a bit odd and sends two
emails.

@rjlynch rjlynch marked this pull request as draft November 14, 2024 16:30
@rjlynch rjlynch added the deploy Deploy a review app for this PR label Nov 14, 2024
@rjlynch rjlynch marked this pull request as ready for review November 14, 2024 17:19
@@ -25,7 +25,7 @@ def auto_approve!
claim.notes.create!(body: "This claim has been marked for a quality assurance review")
end

ClaimMailer.approved(claim).deliver_later unless claim.awaiting_qa?
claim.policy.mailer.approved(claim).deliver_later unless claim.awaiting_qa?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so will not call deliver_later on

self.class.provider_approved(claim).deliver_later

does it work as expected? I feel like we still need something in between the mailer and whatever calls the mailer to handle the events lifecycle. I was able to get away with not doing it in a recent change. maybe this just crosses the line? tbh i'm not sure what this thing would look like though

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The emails are sent to the provider and practitioner as expected.

I think what we really want to do is

claim.policy.claim_approved(claim)

(and claim.policy.claim_rejected(claim) etc)
and let the policy decide what emails to send / other actions to take when a claim is approved. Not sure if this should be part of this pr or in a separate pr.

When an EY claim is approved we want to send an email to the
practitioner and the provider.
Mailers don't let us send two email from one action, so the approve
method enqueues jobs to send each of the emails.
I think it would probably be better for policies to be told a claim has
been approved and handle policy specific actions like sending emails in
the polciy, so rather than:
`@claimpolicy.mailer.approved(@claim).deliver_later`
we'd do
`@claim.policy.claim_approved(@claim)`
and let the policy determine the action to take (sending emails).
However this is a bit different to how we do things now, so for the time
being we'll just call the mailer, even it it's a bit odd and sends two
emails.
@rjlynch rjlynch force-pushed the CAPT-1989/claim-approved-email branch from c618cd0 to 003707a Compare November 20, 2024 09:48
@rjlynch rjlynch merged commit 75d70db into master Nov 20, 2024
14 checks passed
@rjlynch rjlynch deleted the CAPT-1989/claim-approved-email branch November 20, 2024 10:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deploy Deploy a review app for this PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants