-
-
Notifications
You must be signed in to change notification settings - Fork 484
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Send in app notification to volunteer and supervisor on reimbursement…
… complete checkbox selection (#5121) --------- Co-authored-by: Sam Williams <[email protected]>
- Loading branch information
Showing
11 changed files
with
175 additions
and
1 deletion.
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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
class ReimbursementCompleteNotification < BaseNotification | ||
deliver_by :database | ||
|
||
param :case_contact | ||
|
||
def title | ||
"Reimbursement Approved" | ||
end | ||
|
||
def message | ||
case_contact = params[:case_contact] | ||
msg = "Volunteer #{case_contact.creator.display_name}'s request for reimbursement for #{case_contact.miles_driven}mi " | ||
msg += " for $#{case_contact.reimbursement_amount} " if case_contact.reimbursement_amount | ||
msg += "on #{case_contact.occurred_at_display} has been processed and is en route." | ||
msg | ||
end | ||
|
||
def url | ||
case_contacts_path(casa_case_id: params[:case_contact].casa_case_id) | ||
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
23 changes: 23 additions & 0 deletions
23
spec/notifications/reimbursement_complete_notification_spec.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,23 @@ | ||
require "rails_helper" | ||
|
||
RSpec.describe ReimbursementCompleteNotification, type: :model do | ||
describe "message" do | ||
let(:case_contact) { build(:case_contact, :wants_reimbursement) } | ||
|
||
describe "with case org with nil mileage rate" do | ||
it "does not include reimbursement amount" do | ||
notification = ReimbursementCompleteNotification.with(case_contact: case_contact) | ||
expect(notification.message).not_to include "$" | ||
end | ||
end | ||
|
||
describe "with casa org with active mileage rate" do | ||
let!(:mileage_rate) { create(:mileage_rate, casa_org: case_contact.casa_case.casa_org, amount: 6.50, effective_date: 3.days.ago) } | ||
|
||
it "does include reimbursement amount" do | ||
notification = ReimbursementCompleteNotification.with(case_contact: case_contact) | ||
expect(notification.message).to include "$2964" | ||
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