75 votesJosh commented
I'm going to add this in here as we sent ApproveMe pretty much a playbook as to how to do this, and they didn't even give us the courtesy of a call to discuss it.
The bottom line, from Hayley, was:
"I spoke with my Founder to see if this is something that we're interested in exploring together, and at this time it's not something that we can commit to"
Except of Initial Email To Kevin:
I need to be able to dynamically generate a document between two parties. For example, I am a broker and I’m selling a house. I have a document that I wish the buyer and seller to sign. I need to design a code snippet to generate this for me. I am fully aware someone can do this from the back end and assign a signing order, but I need to fully automate this process. From speaking with Haley, there are some crude work arounds with Ninja forms but none really fit the bill. I need to do it in PHP.
From tracing the execution flow, when a request is sent to create a new Basic document it hits view() in documentsController.php. This creates a draft document using create_draft_document in Document.php. It then progresses through view() and the draft is ready (Triggering a page refresh to the end user). When the draft is edited, or saved to send, then edit() in documentsController.php is used.
From typing up some quick scripts, we can get the basics working but I'm far from anything usable.
The fundamental roadblock to making this work is how ApproveMe actually creates documents. It relies heavily on screen refreshes and POST variables which means you have to actually load a screen to generate a document, you can't do it programmatically. If you could, this problem is solved in a snap.
HOWEVER, this also exposes a gap in ApproveMe's testing as you need to write Unit tests to check new code. This means this functionality isn't mocked up by ApproveMe, as if it was, the only difference in creating a document with 1 or 100 signatures is the array that is used to create it. So either ApproveMe is not testing their code programmatically, or they don't have full coverage of their codebase in tests.
If anyone wants to pick up the torch on this, I'd be happy to chat with you.