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

Public Access to Xml Data #42

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

Public Access to Xml Data #42

passchn opened this issue Dec 11, 2023 · 3 comments

Comments

@passchn
Copy link

passchn commented Dec 11, 2023

According to #21, direct access to the xml content is not useful due to missing validation etc.

I don't really understand the argument behind that. E.g. in my case, I just want to download/stream one generated xml file and upload it directly to my online banking. The file isn't too big and does not have to be compressed.

In the only current way possible, I would have to store the generated zip archive, download it, delete it from the server and unarchive it at my machine..

However, I could solve my issue by just extending the file like so (which I'm not the greatest fan of):

class MyDirectDebitFile extends SephpaDirectDebit
{
    public function convertToXmlString(): string
    {
        return $this->generateXml();
    }
}

But still, it would be nice to just have access to SephpaDirectDebit::generateXml() from outside the object..


Anyway, thank you so much for this library! I was struggling to generate valid PAIN00800102 for some time now and Sparkasse never accepted my xml files without any details or useful error messages.

After trying this lib it worked like a charm in no time at all 🤓

@passchn
Copy link
Author

passchn commented Dec 11, 2023

Just to add, I came from this doc from another lib which got me confused: https://github.com/nemiah/phpFinTS/blob/master/Samples/directDebit_Sephpa.php#L45

It seems that the method had been public in the past, I guess? It is documented like so:

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

@AbcAeffchen
Copy link
Owner

Have you tried generateOutput(['zipToOneFile' => false])? This should give you an array of the structure [[name, data]], where data is the file as a string. If you only export a xml file, the array will contain only one file an the sting is just the xml string.

Let me know if this is what you are looking for.

@passchn
Copy link
Author

passchn commented Dec 12, 2023

Oh, I did not find this solution. I can try it out so I can skip extending the object. But to be honest, direct access to generateXml would be a bit less quirky imo. 🤔

Thank you for your reply! :)

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