SynapseFI/SynapseFI-Ruby

Unable to update document without having a document instance

Opened this issue · 3 comments

Same issue in relation to verifying MFA for a bank login. I would need to create an instance of the object directly with an ID to update the document at a later point. I figure the BaseDocument object creation is meant to be private as it has a comment suggesting it shouldn't be initialized directly.

    # @note It should not be necessary to call this method directly.
    def initialize(**args)

Keep in mind this SDK is being used on the backend, it is Ruby after all. Most of these actions need to be able to happen in isolation so you need some easy way to start from where you left off at. Its simply not feasible that you'd be doing bank login and answering MFA in the same session as the samples suggest. I would have to save a users' login credentials to do that!

You can get the most updated BaseDocument by fetching a User and checking User.base_documents. If you want to instantiate a BaseDocument without fetching the user, then yes, you would have to use BaseDocument.initialize. I think it would be safer to pull the most recent user data in this case though.

Its simply not feasible that you'd be doing bank login and answering MFA in the same session as the samples suggest.

I'm not sure I follow... if the user attempts to use bank login and there are MFA questions, the questions are often knowledge-based (KBA) and could be answered immediately. If the MFA question involves entering a PIN sent to email/sms (2FA), then I can see the need for the user to return later, though it should still be feasible to enter at that time if they want to.

How can they be answered immediately? Using this on the backend, we have clients (e.g. mobile app) that hits a Ruby based API where we use a library like this to do bank login, I need to return that info to a client so the user can provide the actual answer (e.g. the PIN number, the correct routing number for TD Bank). That information can't be answered immediately. That's information I don't know what it is. It needs to work individually/separately/asynchronously (sorry struggling to find the right term to use here).

In that case, you could fetch the user object and get the base document that way, or you could just build the PATCH request using the library's API user endpoint wrapper.

Edit: (my wires got crossed) POST request using the nodes endpoint wrapper