[Main]Customer Direct Debit Payment Slip – SEPA File Generation Fails and Credit Memo Is Processed Incorrectly When Invoice and Credit Memo Exist for the Same Customer in the French version. - #11596
Draft
Shikhverma wants to merge 5 commits into
Draft
Shikhverma wants to merge 5 commits into
Shikhverma wants to merge 5 commits into
Conversation
…Bug-644993-main-Cust-Pmt-Slip-SEPA-File-Fails-Cr-Memo-Process-Incorrect
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes: AB#644993
Issue:
When a customer had an open invoice and an unapplied credit memo, the Customer Payment Slip (FR) handled them incorrectly:
SEPA Direct Debit export failed with errors such as "You cannot export a SEPA customer payment that is applied to multiple documents" and "unapplied lines not allowed" whenever a credit memo was collected alongside an invoice for the same customer.
Posting produced the wrong result — the credit memo was posted as a separate Refund entry instead of being netted against the invoice, so the customer was debited the gross invoice amount rather than the net balance, and entries were left open.
Root cause:
Posting side (Payment Management FR): settlement amounts were always taken as Abs(...) regardless of the applied document type, so a credit memo was never subtracted. There was no logic to net a credit memo into the invoice it shared collection with, so each document posted on its own line and the credit memo became a refund.
SEPA export side (PaymentMgt Subscribers FR): CheckPaymentLine required every collected line to resolve to a single invoice ledger entry. Credit-memo lines, and invoice+credit-memo combinations under one Applies-to ID, tripped the "multiple documents" / "unapplied lines" validations. The transfer amount also used the raw Credit Amount without deducting the credit memo, so the exported amount would have been wrong even if validation passed.
Solutions:
Fixed SEPA customer payment slip processing for credit memo scenarios by correcting posting document type and amount handling, validating invoice/credit memo applications, and ensuring the correct direct debit mandate and bank account are retrieved.