Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Send 'renewal received pending payment' emails from Notify #989

Merged
merged 2 commits into from
May 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 0 additions & 28 deletions app/mailers/waste_carriers_engine/renewal_mailer.rb

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,7 @@ def send_renewal_pending_checks_email
end

def send_renewal_received_pending_payment_email
RenewalMailer.send_renewal_received_email(self).deliver_now
WasteCarriersEngine::Notify::RenewalPendingPaymentEmailService.run(registration: self)
rescue StandardError => e
Airbrake.notify(e, registration_no: reg_identifier) if defined?(Airbrake)
end
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# frozen_string_literal: true

module WasteCarriersEngine
module Notify
class RenewalPendingPaymentEmailService < BaseSendEmailService
private

def notify_options
{
email_address: @registration.contact_email,
template_id: "25a54b31-cdb0-4139-9ffe-50add03d572e",
personalisation: {
reg_identifier: @registration.reg_identifier,
first_name: @registration.first_name,
last_name: @registration.last_name,
sort_code: payment_details(:sort_code),
account_number: payment_details(:account_number),
payment_due: payment_due,
iban: payment_details(:iban),
swiftbic: payment_details(:swiftbic),
currency: payment_details(:currency)
}
}
end

def payment_details(key)
I18n.t("waste_carriers_engine.payment_details.#{key}")
end

def payment_due
display_pence_as_pounds(@registration.finance_details.balance)
end
end
end
end

This file was deleted.

83 changes: 0 additions & 83 deletions config/locales/mailers/renewal_mailer.en.yml

This file was deleted.

72 changes: 72 additions & 0 deletions spec/cassettes/notify_renewal_pending_payment_sends_an_email.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading