-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into LUPEYALPHA-877-practitioner-notify-email
- Loading branch information
Showing
35 changed files
with
493 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
app/jobs/further_education_payments/provider_verification_chase_email_job.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
module FurtherEducationPayments | ||
class ProviderVerificationChaseEmailJob < CronJob | ||
# Daily 8am | ||
self.cron_expression = "0 8 * * *" | ||
|
||
queue_as :user_data | ||
|
||
def perform | ||
Rails.logger.info "ProviderVerificationChaseEmailJob sending chase emails..." | ||
|
||
unverified_claims_with_provider_email_sent_over_3_weeks_ago.each do |claim| | ||
claim.notes.create!( | ||
label: "provider_verification", | ||
body: "Verification chaser email sent to #{claim.school.name}" | ||
) | ||
|
||
Policies::FurtherEducationPayments::ProviderVerificationEmails.new(claim) | ||
.send_further_education_payment_provider_verification_chase_email | ||
end | ||
end | ||
|
||
private | ||
|
||
def unverified_claims_with_provider_email_sent_over_3_weeks_ago | ||
Policies::FurtherEducationPayments::Eligibility | ||
.includes(:claim) | ||
.unverified | ||
.provider_verification_email_last_sent_over(3.weeks.ago) | ||
.provider_verification_chase_email_not_sent | ||
.map(&:claim) | ||
.reject { |claim| claim.held? || claim.latest_decision&.rejected? } | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
app/models/policies/further_education_payments/provider_verification_emails.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
module Policies | ||
module FurtherEducationPayments | ||
class ProviderVerificationEmails | ||
def initialize(claim) | ||
@claim = claim | ||
end | ||
|
||
# First provider email | ||
def send_further_education_payment_provider_verification_email | ||
@claim.eligibility.update!(provider_verification_email_last_sent_at: Time.now) | ||
ClaimMailer.further_education_payment_provider_verification_email(@claim).deliver_later | ||
end | ||
|
||
# Second automated provider chase email | ||
def send_further_education_payment_provider_verification_chase_email | ||
@claim.eligibility.update!(provider_verification_chase_email_last_sent_at: Time.now) | ||
ClaimMailer.further_education_payment_provider_verification_chase_email(@claim).deliver_later | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 7 additions & 2 deletions
9
app/views/admin/tasks/_provider_verification_unsubmitted.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
...d_provider_verification_email_last_sent_at_to_further_education_payments_eligibilities.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
class AddProviderVerificationEmailLastSentAtToFurtherEducationPaymentsEligibilities < ActiveRecord::Migration[7.0] | ||
def change | ||
add_column :further_education_payments_eligibilities, :provider_verification_email_last_sent_at, :datetime | ||
end | ||
end |
5 changes: 5 additions & 0 deletions
5
...ider_verification_chase_email_last_sent_at_to_further_education_payments_eligibilities.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
class AddProviderVerificationChaseEmailLastSentAtToFurtherEducationPaymentsEligibilities < ActiveRecord::Migration[7.0] | ||
def change | ||
add_column :further_education_payments_eligibilities, :provider_verification_chase_email_last_sent_at, :datetime | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.