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

PAIN format "pain.008.001.02 without BIC and CdtrSchmId:Nm" doesn't work for Switzerland #639

Closed
Detsieber opened this issue Jul 21, 2022 · 9 comments
Labels
question status:fixed The issue has been resolved (usually by committing/merging code)

Comments

@Detsieber
Copy link
Member

SEPA is supporting direct debits from debitor accounts in Switzerland. However, in these cases, other than in any other country, the postal address of the debitor has to be added.

This was already implemented in "pain.008.003.02 (EBICS-3.0 RCUR/CH)".

Therefore, in "pain.008.001.02 without BIC and CdtrSchmId:Nm", directly after

<Nm>{$contribution.display_name}</Nm>

the following code has to be inserted

{if $contribution.ctry eq 'CH'}
          <PstlAdr>
            <Ctry>{$contribution.ctry}</Ctry>
            <AdrLine>{$contribution.street_address}</AdrLine>
            <AdrLine>{$contribution.postal_code} {$contribution.city}</AdrLine>
          </PstlAdr>
{/if}

After our ongoing test is completed, I will add a pull request.

@bjendres
Copy link
Member

bjendres commented Jul 21, 2022

This structure is already implemented in the pain.008.003.02 with Address (EBICS-3.0) and pain.008.001.02.CH.03 (CH-DD) (in addition pain.008.003.02 (EBICS-3.0 RCUR/CH)) formats. Have you tried those?

@bjendres
Copy link
Member

But I understand that you want a mixed mode format, which we have tried to avoid. Our approach was mostly to have different creditors for Swiss people, and/or generally people from abroad.

@Detsieber
Copy link
Member Author

In all use cases I can imagine, we won't have different contribution pages for people from Switzerland. Therefore, all SEPA mandates have to be processed by the same sepa creditor, using the same PAIN format.

I don't see any reason why we shouldn't do so?

@bjendres
Copy link
Member

I don't see any reason why we shouldn't do so?

One of the reasons we wanted to separate, is that you then have to force all donors to give an address, even though it's just needed for the swiss donors.

@bjendres
Copy link
Member

bjendres commented Jul 21, 2022

...and I'm not sure that your mixed file would be valid XML (according to the XSD), but I might be wrong....

@Detsieber
Copy link
Member Author

The address will be generated only, if $contribution.ctry eq 'CH'.

Anyhow, I just patched the affected production system, and we will see...

@jensschuppe
Copy link
Collaborator

@Detsieber Could you please file your patch as a PR for a new separate format.

@Detsieber
Copy link
Member Author

@jensschuppe I still don't think it would be necessary to create a new format, for the following reasons:

  1. The current format is disfunctional, since it is not possible to process sepa mandates from switzerland without adding the contributor's address (which is required for Switzerland). The proposed change will only add the contributor's address if the contributor is from Switzerland.
  2. We have tested my PR in a pretty large production environment for2,5 months, everything works well.
  3. Looking deeper into my PR, it would have been better to use an if-statement based on the first two letters of the IBAN instead of contribution.ctry. I can change the PR accordingly.
  4. Most important: Adding a new Format in sepa/templates/Sepa/Formats/ is not enough - there also has to be inserted the according option_value, and maybe other things. Could you please give me a hint which parts of the code I will have to update for adding a new separate format?

@Detsieber Detsieber reopened this Oct 20, 2022
@jensschuppe
Copy link
Collaborator

Re 4. You may refer to 1e79bdc for hints on what needs to be done for adding new formats, in short:

  • Add a directory for the new format in templates/Sepa/Formats/ with an appropriate name
  • Add the files Format.php, transaction-details.tpl, transaction-header.tpl and transaction-footer.tpl inside that directory (possibly copying from the existing format you wanted to adjust - make sure to adjust the class name in Format.php)
  • Add the format to the option group resource file
  • Add an upgrade task that synchronises that option group with the corresponding resource file

I'm closing this question issue as fixed, please continue commenting in your PR (#654), if necessary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question status:fixed The issue has been resolved (usually by committing/merging code)
Projects
None yet
Development

No branches or pull requests

3 participants