Skip to content

Commit

Permalink
RUBY 3079 wcr renewal emails are sent to registraton contact email ad…
Browse files Browse the repository at this point in the history
…dress not renewal email address if different (#1533)

* [RUBY-3079] Use transient registration rather than registration when
sending emails to ensure most up to date email will receive email
communications

* [RUBY-3079] Actually refactor email service calls to pass self (the renewing_registration) instead of the registration

and edit specs
  • Loading branch information
jjromeo committed Apr 24, 2024
1 parent 71cf9ec commit 14f03b2
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
Expand Up @@ -316,19 +316,19 @@ def set_contact_address_as_registered_address
end

def send_renewal_pending_online_payment_email
WasteCarriersEngine::Notify::RenewalPendingOnlinePaymentEmailService.run(registration:)
WasteCarriersEngine::Notify::RenewalPendingOnlinePaymentEmailService.run(registration: self)
rescue StandardError => e
Airbrake.notify(e, registration_no: reg_identifier) if defined?(Airbrake)
end

def send_renewal_pending_checks_email
WasteCarriersEngine::Notify::RenewalPendingChecksEmailService.run(registration:)
WasteCarriersEngine::Notify::RenewalPendingChecksEmailService.run(registration: self)
rescue StandardError => e
Airbrake.notify(e, registration_no: reg_identifier) if defined?(Airbrake)
end

def send_renewal_pending_payment_email
WasteCarriersEngine::Notify::RenewalPendingPaymentEmailService.run(registration:)
WasteCarriersEngine::Notify::RenewalPendingPaymentEmailService.run(registration: self)
rescue StandardError => e
Airbrake.notify(e, registration_no: reg_identifier) if defined?(Airbrake)
end
Expand Down
Expand Up @@ -23,7 +23,7 @@ module WasteCarriersEngine

expect(Notify::RenewalPendingPaymentEmailService)
.to have_received(:run)
.with(registration: renewing_registration.registration)
.with(registration: renewing_registration)
.once
end
end
Expand Down
Expand Up @@ -49,7 +49,7 @@ module WasteCarriersEngine

expect(Notify::RenewalPendingOnlinePaymentEmailService)
.to have_received(:run)
.with(registration: renewing_registration.registration)
.with(registration: renewing_registration)
.once
end
end
Expand All @@ -68,7 +68,7 @@ module WasteCarriersEngine

expect(Notify::RenewalPendingChecksEmailService)
.to have_received(:run)
.with(registration: renewing_registration.registration)
.with(registration: renewing_registration)
.once
end
end
Expand Down

0 comments on commit 14f03b2

Please sign in to comment.