Closed hanneskod closed 7 years ago
I'll start working on this after the file hashes, I think. I'm still not 100% sure about the file specs. I'm thinking I should get in touch with Autogiro customer support and see if I can get any better specs from there...
Maybe it would be useful to keep the verificationCodes in a spearate database. They are legally important, and should be saved very carefully.
If we store them in the donor database, would that increase the risk that a user accidentally deletes the donor database, and looses all of their verification codes? Would it be easier to discover you're about to delete the codes if they are in a separate database? (I stick to my habit of wearing the tinfoil hat and being the voice of paranoia here)
Specs would be awesome!
All data associated with a mandate should be saved in the same location imho. The signature key is of of course important. But it's up to the user to keep it safe. I would definitely file my .xml
files in some safe and durable way outside the giroapp db (as I do with my printed paper mandates)...
True. Along with the xml files, a user also has the option to download pdf files. These contain the same files. Proper usage would be to download both, print the pdf, import the xml. As this code is related to a specific mandate the same way that an ID/account combo is, it should be in an optional field in Donor. The customfield is tricky, as these could contain fields like telephone number. Maybe we could add them in the comment field? It would then be up to the user to move them to the correct field.
Donor
can be Attributable
in the sense that we can allow
$donor->setAttribute('custom_field_one', $myCustomValue);
// and
$donor->getAttribute('custom_field_one');
This can be used to save all custom fields in an attributes
array in the database.
As extra suggar we can let the user specify that a custom field contans for example a phone number (and should be written to the phone number field instead of an attribute) by letting them speficy a XmlMandateMigrationMap
under .giroapp/xml
or similar. Something like
class MyCustomMap implements XmlMandateMigrationMap
{
public function getXmlMigrationMap()
{
return [
'custom_field_one' => self::PHONE_NUMBER,
'custom_field_two' => self::MAIL_ADDRESS
];
}
}
And this can be used to find the correct database field for each custom value..
But this can maybe be a feature for alpha-3 ??
Yes, sounds like a good approach. I'd say we start with attributes now, and implement the MigrationMap for alpha-3. I have contacted bank customer support, am awaiting answer on the specs. I have been waiting for quite some time. I think I need another approach.
I'm kind of have misgivings about this. I'm currently working on a web-frontend to the giroapp. It has a form for new paper donors, which is saved in a file. The information in this file will then be added to the donor database somehow. It also has a file upload space. Xml files in this directory should be added as new donors.
The only difference between how these two mandate forms are handled is the source. It seemed logical to me to save the paper donors in xml form, similar to the webpage mandates. I'll have some backend scripts that parse these files.
If the giroapp can handle the xml files, I don't need to handle these with my own backend scripts. But then I still need to handle the paper donors.
It would seem logical to me, in my situation, if giroapp either didn't handle the xml webpage donors, or if paper donors could be added in the same way as webpage donors...
Btw, the bank still hasn't answered about the xml formats. I'll try the bankgiro customer support instead.
Why not save the "paper mandates" as shell commands in simple one line script files.
giroapp add -n --name "$name" ...
Then if we let import read from stdin you could follow the same pattern with xml files.
echo "$raw_xml_content" | giroapp import
This way you'll have a unified way of processing queued actions. And you don't need to invent a custom xml file format.
That would make the system execute files that are uploaded through the web interface, and that breaks security in bad ways. An attacker could upload a shell script that could wreak havoc on the server. But yes, I get the idea. I'll likely dump it in a way that my python script can read, like YAML or JSON,
Yeah you are probably right. I thought there were some well definied way of aplying input filters on xml content though...
Importing should be possible using simply:
The first thing I want is an
XmlMandateParser
to be used like so:Donor
might need new fields (verificationCode
,customFields
, ...).AddCommand
should support these new fields and the new mandate source etc..