Skip to content

Commit

Permalink
feat(dunning): Generate PDF files for payment request invoices
Browse files Browse the repository at this point in the history
  • Loading branch information
rsempe committed Aug 28, 2024
1 parent 7141f81 commit 21b7697
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions app/mailers/payment_request_mailer.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# frozen_string_literal: true

class PaymentRequestMailer < ApplicationMailer
before_action :ensure_invoices_pdf

def requested
@payment_request = params[:payment_request]
@organization = @payment_request.organization
Expand All @@ -19,4 +21,12 @@ def requested
)
end
end

private

def ensure_invoices_pdf
params[:payment_request].invoices.each do |invoice|
Invoices::GeneratePdfService.new(invoice:).call
end
end
end

0 comments on commit 21b7697

Please sign in to comment.