Class: SynapsePayRest::SocialDocument

Inherits:
Document
  • Object
show all
Defined in:
lib/synapse_pay_rest/models/user/social_document.rb

Overview

Represents social documents that can be added to a base document.

Instance Attribute Summary

Attributes inherited from Document

#base_document, #document_value, #id, #last_updated, #meta, #status, #type, #value

Instance Method Summary collapse

Methods inherited from Document

#==, create, from_response, #initialize, #to_hash

Constructor Details

This class inherits a constructor from SynapsePayRest::Document

Instance Method Details

#verify_2fa(mfa_answer:, value:) ⇒ SynapsePayRest::SocialDocument

Verifies the pin sent via the user’s social doc either EMAIL_2FA or PHONE_NUMBER_2FA status is SUBMITTED|MFA_PENDING before verified

Parameters:

  • mfa_answer (String)
  • value (String)

Returns:

Raises:



17
18
19
20
21
22
23
# File 'lib/synapse_pay_rest/models/user/social_document.rb', line 17

def verify_2fa(mfa_answer:, value:)
  user = base_document.user
  payload = verify_social_doc_2fa_payload(mfa_answer: mfa_answer, type: type, value: value)
  response = user.client.users.update(user_id: user.id, payload: payload)
  user = User.from_response(user.client, response)
  social_doc = base_document.social_documents.find { |doc| doc.type == type }
end