Skip to content

Commit

Permalink
feat(manual-payments): Fix refundable_amount_cents
Browse files Browse the repository at this point in the history
  • Loading branch information
ivannovosad authored and brunomiguelpinto committed Jan 31, 2025
1 parent e92d5f9 commit 2663a53
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/models/invoice.rb
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ def refundable_amount_cents
# total_paid_amount_cents - credit_notes.sum("refund_amount_cents + credit_amount_cents")
# end

amount = available_to_credit_amount_cents -
amount = total_paid_amount_cents - credit_notes.sum("refund_amount_cents + credit_amount_cents") -
credits.where(before_taxes: false).sum(:amount_cents) -
prepaid_credit_amount_cents
amount = amount.negative? ? 0 : amount
Expand Down
2 changes: 1 addition & 1 deletion app/services/payments/manual_create_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def invoice
def check_preconditions
return result.not_found_failure!(resource: "invoice") unless invoice
return if invoice.invoice_type == "advance_charges"
return result.forbidden_failure! if !License.premium? && !invoice.organization.premium_integrations.include?('manual_payments')
return result.forbidden_failure! if !License.premium? || !invoice.organization.premium_integrations.include?('manual_payments')
result.single_validation_failure!(error_code: "invalid_date", field: "paid_at") unless valid_paid_at?
end

Expand Down

0 comments on commit 2663a53

Please sign in to comment.