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

[FEATURE] Add Creditor ID to addDocumentPaymentMeanToDirectDebit()? #53

Closed
danielmarschall opened this issue May 21, 2024 · 3 comments · Fixed by #54
Closed

[FEATURE] Add Creditor ID to addDocumentPaymentMeanToDirectDebit()? #53

danielmarschall opened this issue May 21, 2024 · 3 comments · Fixed by #54
Assignees
Labels
enhancement New feature or request

Comments

@danielmarschall
Copy link
Contributor

The following code:
$document->addDocumentPaymentMeanToDirectDebit('DE02100500000054540402');

Produces (using XRechnung3 Profile):

      <ram:SpecifiedTradeSettlementPaymentMeans>
        <ram:TypeCode>59</ram:TypeCode>
        <ram:PayerPartyDebtorFinancialAccount>
          <ram:IBANID>DE02100500000054540402</ram:IBANID>
        </ram:PayerPartyDebtorFinancialAccount>
      </ram:SpecifiedTradeSettlementPaymentMeans>

The validator does reject the document, because Credit Identifier (Gläubiger ID) is missing:

val-sch.2.1	BR-DE-30	error	[BR-DE-30] Wenn "DIRECT DEBIT" BG-19 vorhanden ist, dann muss "Bank assigned creditor identifier" BT-90 übermittelt werden.
Pfad: /rsm:CrossIndustryInvoice

According to this article , these are the changes for XRechnung 2.3.1

  • BR-DE-29: Das Element „Mandate reference identifier“ (BT-89) muss übermittelt werden, wenn die Gruppe DIRECT DEBIT“ (BG-19) übermittelt wird.
  • BR-DE-30: Das Element „Bank assigned creditor identifier“ (BT-90) muss übermittelt werden, wenn die Gruppe „DIRECT DEBIT“ (BG-19) übermittelt wird.
  • BR-DE-31: Das Element „Debited account identifier“ (BT-91) muss übermittelt werden, wenn die Gruppe „DIRECT DEBIT“ (BG-19) übermittelt wird.
@danielmarschall
Copy link
Contributor Author

The missing information is:

  <ram:ApplicableHeaderTradeSettlement>
    <ram:CreditorReferenceID>xxx</ram:CreditorReferenceID>
  <ram:ApplicableHeaderTradeSettlement>

Looking at the code, it can be set using setDocumentGeneralPaymentInformation.

Since the Creditor Identifier is a mandatory information to direct debit, wouldn't it be better to (additionally) include it as paramter to addDocumentPaymentMeanToDirectDebit() ?

    public function addDocumentPaymentMeanToDirectDebit(string $buyerIban, string $creditorReferenceID): ZugferdDocumentBuilder
    {
        $paymentMeans = $this->getObjectHelper()->getTradeSettlementPaymentMeansType("59");
        $buyerfinancialaccount = $this->getObjectHelper()->getDebtorFinancialAccountType($buyerIban);

        $this->getObjectHelper()->tryCall($paymentMeans, "setPayerPartyDebtorFinancialAccount", $buyerfinancialaccount);

        $this->getObjectHelper()->tryCallAll($this->headerTradeSettlement, ["addToSpecifiedTradeSettlementPaymentMeans", "setSpecifiedTradeSettlementPaymentMeans"], $paymentMeans);


        // ADD THIS?
        $this->getObjectHelper()->tryCall($this->headerTradeSettlement, "setCreditorReferenceID", $this->getObjectHelper()->getIdType($creditorReferenceID));


        return $this;
    }


@danielmarschall danielmarschall changed the title [BUG] Direct Debit does not validate [FEATURE] Add Creditor ID to addDocumentPaymentMeanToDirectDebit()? May 21, 2024
@horstoeko
Copy link
Owner

Hi @danielmarschall,

Since the Creditor Identifier is a mandatory information to direct debit, wouldn't it be better to (additionally) include it as paramter to addDocumentPaymentMeanToDirectDebit() ?

Yes, this is a good idea. I would include that as an additional parameter. But please give me time, I have a normal job... :-) You are of course free to set a pull request.

Best regareds...

@danielmarschall
Copy link
Contributor Author

Sounds good! I also tested it, it works like expected.

(Regarding #52, I wanted to say that I am very sorry that I caused so much trouble. I was under the impression that the BankName exists if the XML validated. But I have now checked the schema, and indeed, this field does not exist in the specification; so I don't need it.)

Repository owner locked as resolved and limited conversation to collaborators May 23, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
2 participants