From 14f03b2309b95e4e435621180c34e115cf26a35a Mon Sep 17 00:00:00 2001 From: Jerome Pratt Date: Wed, 24 Apr 2024 17:55:39 +0100 Subject: [PATCH] RUBY 3079 wcr renewal emails are sent to registraton contact email address 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 --- .../can_use_renewing_registration_workflow.rb | 6 +++--- .../confirm_bank_transfer_form_spec.rb | 2 +- .../renewing_registration_workflow/govpay_form_spec.rb | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/models/concerns/waste_carriers_engine/can_use_renewing_registration_workflow.rb b/app/models/concerns/waste_carriers_engine/can_use_renewing_registration_workflow.rb index 9bb5c06fb..3d0fe504f 100644 --- a/app/models/concerns/waste_carriers_engine/can_use_renewing_registration_workflow.rb +++ b/app/models/concerns/waste_carriers_engine/can_use_renewing_registration_workflow.rb @@ -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 diff --git a/spec/models/waste_carriers_engine/renewing_registration_workflow/confirm_bank_transfer_form_spec.rb b/spec/models/waste_carriers_engine/renewing_registration_workflow/confirm_bank_transfer_form_spec.rb index 0fb3ff868..842759a61 100644 --- a/spec/models/waste_carriers_engine/renewing_registration_workflow/confirm_bank_transfer_form_spec.rb +++ b/spec/models/waste_carriers_engine/renewing_registration_workflow/confirm_bank_transfer_form_spec.rb @@ -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 diff --git a/spec/models/waste_carriers_engine/renewing_registration_workflow/govpay_form_spec.rb b/spec/models/waste_carriers_engine/renewing_registration_workflow/govpay_form_spec.rb index da9c642bd..f98a3520f 100644 --- a/spec/models/waste_carriers_engine/renewing_registration_workflow/govpay_form_spec.rb +++ b/spec/models/waste_carriers_engine/renewing_registration_workflow/govpay_form_spec.rb @@ -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 @@ -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