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

Samples / No public access to SephpaDirectDebit::generateXml() #418

Open
passchn opened this issue Dec 11, 2023 · 2 comments
Open

Samples / No public access to SephpaDirectDebit::generateXml() #418

passchn opened this issue Dec 11, 2023 · 2 comments

Comments

@passchn
Copy link

passchn commented Dec 11, 2023

The Code

$xml = $directDebitFile->generateXml(date("Y-m-d\TH:i:s", time()));

In the directDebit_Sephpa sample file does not work due to the fact that generateXml() is a protected method:

$xml = $directDebitFile->generateXml(date("Y-m-d\TH:i:s", time()));

https://github.com/AbcAeffchen/Sephpa/blob/1bd00f72fe9ffb937c49af9e0045e66f98074212/src/Sephpa.php#L152

I opened an issue in the other lib also:
AbcAeffchen/Sephpa#42

Maybe the sample should be updated or at least commented. I solved it by extending the other lib's file so I can expose the xml myself.

@fbett
Copy link
Contributor

fbett commented Dec 12, 2023

Your right. Additionally the method generateXML also does not have any parameters.

We are using $directDebitFile->generateOutput()[0]['data'] to receive the XML.

@passchn
Copy link
Author

passchn commented Dec 12, 2023

It seems that this is the way to go:
AbcAeffchen/Sephpa#42 (comment)

$xmlString = $file->generateOutput(['zipToOneFile' => false])[0]['data'];

If you call generateOutput without this options array, it will create zip files, see:
https://github.com/AbcAeffchen/Sephpa/blob/1bd00f72fe9ffb937c49af9e0045e66f98074212/src/Sephpa.php#L283

nemiah added a commit that referenced this issue Mar 1, 2024
fix(Direct Debit Sample): #418 Invalid protected method called
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants