-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add resend email actions for payers and providers
Includes addition of new mailers, services and updated test logic
- Loading branch information
Showing
24 changed files
with
301 additions
and
23 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,9 @@ | ||
class Claims::Support::Claims::ClaimActivityPolicy < Claims::ApplicationPolicy | ||
def resend_payer_email? | ||
true | ||
end | ||
|
||
def resend_provider_email? | ||
true | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
class Claims::Clawback::ResendEmail < ApplicationService | ||
def initialize(clawback:) | ||
@clawback = clawback | ||
end | ||
|
||
def call | ||
Claims::ESFAMailer.resend_claims_require_clawback(clawback).deliver_later | ||
end | ||
|
||
private | ||
|
||
attr_reader :clawback | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
class Claims::Payment::ResendEmail < ApplicationService | ||
def initialize(payment:) | ||
@payment = payment | ||
end | ||
|
||
def call | ||
Claims::PaymentMailer.resend_payment_created_notification(payment).deliver_later | ||
end | ||
|
||
private | ||
|
||
attr_reader :payment | ||
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,65 @@ | ||
require "rails_helper" | ||
|
||
RSpec.describe Claims::ESFAMailer, type: :mailer do | ||
let(:clawback) { create(:claims_clawback) } | ||
let(:url_for_csv) { claims_clawback_claims_url(token:, host: "claims.localhost") } | ||
let(:token) { Rails.application.message_verifier(:clawback).generate(clawback.id, expires_in: 7.days) } | ||
let(:esfa_emails) { %w[[email protected] [email protected]] } | ||
let(:service_name) { "Claim funding for mentor training" } | ||
let(:support_email) { "[email protected]" } | ||
|
||
before do | ||
allow(Rails.application.message_verifier(:clawback)).to receive(:generate).and_return("token") | ||
end | ||
|
||
describe "#claims_require_clawback" do | ||
subject(:claims_require_clawback_email) { described_class.claims_require_clawback(clawback) } | ||
|
||
let(:clawback) { create(:claims_clawback) } | ||
let(:url_for_csv) { claims_clawback_claims_url(token:, host: "claims.localhost") } | ||
let(:token) { Rails.application.message_verifier(:clawback).generate(clawback.id, expires_in: 7.days) } | ||
let(:esfa_emails) { %w[[email protected] [email protected]] } | ||
let(:service_name) { "Claim funding for mentor training" } | ||
let(:support_email) { "[email protected]" } | ||
it "sends the claims require clawback email" do | ||
ClimateControl.modify CLAIMS_ESFA_EMAIL_ADDRESSES: esfa_emails.join(",") do | ||
expect(claims_require_clawback_email.to).to match_array(esfa_emails) | ||
expect(claims_require_clawback_email.subject).to eq("Claims requiring clawback - Claim funding for mentor training") | ||
expect(claims_require_clawback_email.body.to_s.squish).to eq(<<~EMAIL.squish) | ||
To the payer, | ||
The claims in the CSV file link are ready for clawback— the link to the latest CSV file is valid for 7 days: | ||
#{url_for_csv} | ||
What you need to do: | ||
1. Check and validate the claims in the CSV file by marking them as ‘clawback_in_progress’ or ‘clawback_complete’ in the ‘claim_status’ column. | ||
2. If you mark a claim as ‘clawback_in_progress’, add the reason to the ‘clawback_unsuccessful_reason’ column. | ||
3. Reply to this email and attach the updated CSV file. | ||
The Claim Support team will follow up on the reasons for the claims that you could not claw back and email you an updated version. | ||
If you have a problem opening the link or it has expired, reply to this email and request that it be sent again. | ||
# Give feedback or report a problem | ||
If you have any questions or feedback, please contact the team at [#{support_email}](mailto:#{support_email}). | ||
before do | ||
allow(Rails.application.message_verifier(:clawback)).to receive(:generate).and_return("token") | ||
Regards | ||
#{service_name} team | ||
end | ||
end | ||
end | ||
|
||
it "sends the claims require clawback email" do | ||
describe "#resend_claims_require_clawback" do | ||
subject(:claims_require_clawback_email) { described_class.resend_claims_require_clawback(clawback) } | ||
|
||
it "sends the resend claims require clawback email" do | ||
ClimateControl.modify CLAIMS_ESFA_EMAIL_ADDRESSES: esfa_emails.join(",") do | ||
expect(claims_require_clawback_email.to).to match_array(esfa_emails) | ||
expect(claims_require_clawback_email.subject).to eq("Claims requiring clawback - Claim funding for mentor training") | ||
expect(claims_require_clawback_email.body.to_s.squish).to eq(<<~EMAIL.squish) | ||
To the payer, | ||
^ We are resending this email as requested. Please disregard any previous emails you may have received. | ||
The claims in the CSV file link are ready for clawback— the link to the latest CSV file is valid for 7 days: | ||
#{url_for_csv} | ||
|
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 |
---|---|---|
@@ -1,19 +1,56 @@ | ||
require "rails_helper" | ||
|
||
RSpec.describe Claims::PaymentMailer, freeze: "20 December 2024", type: :mailer do | ||
let(:payment) { create(:claims_payment) } | ||
let(:download_page_url) { claims_payments_claims_url(token:, host: "claims.localhost") } | ||
let(:token) { Rails.application.message_verifier(:payments).generate(payment.id, expires_in: 7.days) } | ||
|
||
describe "#payment_created_notification" do | ||
subject(:email) { described_class.payment_created_notification(payment) } | ||
|
||
let(:payment) { create(:claims_payment) } | ||
let(:download_page_url) { claims_payments_claims_url(token:, host: "claims.localhost") } | ||
let(:token) { Rails.application.message_verifier(:payments).generate(payment.id, expires_in: 7.days) } | ||
it "sends the sampling checks required email" do | ||
expect(email.to).to contain_exactly("[email protected]") | ||
expect(email.subject).to eq("Claims ready for payment - Claim funding for mentor training") | ||
expect(email.body.to_s.squish).to eq(<<~EMAIL.squish) | ||
To the payer, | ||
These claims from the Claim funding for mentor training service (Claim) are ready for payment — the link to the latest CSV file is valid for 7 days: | ||
[#{download_page_url}](#{download_page_url}) | ||
What you need to do: | ||
1. Check and validate the claims in the CSV file by marking them as ‘paid’ or ‘unpaid’ in the ‘claim_status’ column. | ||
2. If you mark a claim as ‘unpaid’, add the reason in the ‘claim_unpaid_reason’ column. | ||
3. Reply to this email and attach the updated CSV file. | ||
The Claim Support team will follow up on the reasons for unpaid claims and email back an updated version. | ||
If you have a problem opening the link or it has expired, reply to this email and request that it be sent again. | ||
# Give feedback or report a problem | ||
If you have any questions or feedback, please contact the team at [[email protected]]([email protected]). | ||
Regards | ||
Claim funding for mentor training team | ||
end | ||
end | ||
|
||
describe "#resend_payment_created_notification" do | ||
subject(:email) { described_class.resend_payment_created_notification(payment) } | ||
|
||
it "sends the sampling checks required email" do | ||
expect(email.to).to contain_exactly("[email protected]") | ||
expect(email.subject).to eq("Claims ready for payment - Claim funding for mentor training") | ||
expect(email.body.to_s.squish).to eq(<<~EMAIL.squish) | ||
To the payer, | ||
^ We are resending this email as requested. Please disregard any previous emails you may have received. | ||
These claims from the Claim funding for mentor training service (Claim) are ready for payment — the link to the latest CSV file is valid for 7 days: | ||
[#{download_page_url}](#{download_page_url}) | ||
|
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.