Skip to content

Commit

Permalink
fix: Generate invoice for paid instant charges on subscription termin…
Browse files Browse the repository at this point in the history
…ation (#2675)

## Context

Currently if an invoice with paid in advance charges is terminated,
there are edge cases where paid fees are not invoiced because of a time
boundaries issues.

## Description

This change ensure all not already invoiced paid fees are included in a
new invoice when the subscription is terminating ignoring time
boundaries.
  • Loading branch information
ancorcruz authored Oct 11, 2024
1 parent c4fed78 commit 5bd05d5
Showing 1 changed file with 0 additions and 1 deletion.
1 change: 0 additions & 1 deletion app/services/invoices/advance_charges_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ def create_group_invoice
invoice.invoice_subscriptions.each do |is|
is.subscription.fees
.where(invoice: nil, payment_status: :succeeded)
.where("CAST(fees.properties->>'timestamp' AS timestamp) <= ?", is.charges_to_datetime)
.update_all(invoice_id: invoice.id) # rubocop:disable Rails/SkipsModelValidations
end

Expand Down

0 comments on commit 5bd05d5

Please sign in to comment.