Class: Sydecar::Plaid

Inherits:
Object
  • Object
show all
Defined in:
lib/sydecar/plaid.rb

Constant Summary collapse

'v1/plaid/create_link_token'
PLAID_INSTITUTIONS_URL =
'v1/plaid/plaid_institutions'
CREATE_PLAID_BANK_ACCOUNT_URL =
'v1/plaid/create_plaid_bank_account'

Class Method Summary collapse

Class Method Details

.create_bank_account(body:) ⇒ Object

body argument expects to have the following keys:

String

profile_id: required

String

public_token: required

Hash

metadata: PlaidLinkOnSuccessMetadata =>

[Hash or nil] institution: required
[Array of objects (PlaidAccount)] accounts: required
[String] link_session_id: required

See more for details: api-docs.sydecar.io/api/#tag/Plaid/operation/setPlaidAccessToken



24
25
26
27
# File 'lib/sydecar/plaid.rb', line 24

def (body:)
  url = 
  Connection.instance.post(url, body)
end

.create_bank_account_urlObject



10
11
12
# File 'lib/sydecar/plaid.rb', line 10

def 
  '/v1/plaid/link_plaid_bank_account'
end

This method creates a bank account using the specified body parameters.

Parameters:

Returns:

  • (Hash)
    • application/json -

    { link_token: [String], expiration: [String], request_id: [String] }

    RESPONSES: > '201'
    


40
41
42
# File 'lib/sydecar/plaid.rb', line 40

def create_link_token(body:)
  Connection.instance.post(CREATE_LINK_TOKEN_URL, body)
end

.create_plaid_account(body:) ⇒ Object

Create a Plaid account without using Plaid link (Sandbox only) Response sample (application/json) :

{
"id": "string",
"created_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z",
"bank_name": "string",
"account_name": "string",
"type": "STANDARD",
"account_type": "CHECKING",
"is_us_based": true,
"account_number": "string",
"routing_number": "string",
"street_1": "123 Maple Street",
"street_2": "Unit 2",
"city": "Maple Town",
"state": "CA",
"zip_code": "94033",
"country_code": "US",
"for_further_credit": "string",
"profile_ids": [
  "string"
],
"plaid_consent_expiration_time": "2022-10-12T07:30:50.52Z",
"plaid_account_number_mask": "1111",
"plaid_institution_id": "string"

}

Parameters:

Returns:

  • See example data [Hash] Responses : > ‘201’



121
122
123
# File 'lib/sydecar/plaid.rb', line 121

def (body:)
  Connection.instance.post(CREATE_PLAID_BANK_ACCOUNT_URL, body)
end

.fetch_plaid_institutions(query: {}) ⇒ Object

This method Fetch a list of all available Plaid institutions. Responses sample:

{
"data": [
  {
    "institution_id": "string",
    "name": "string",
    "products": [
      "assets"
    ],
    "country_codes": [
      "US"
    ],
    "url": "string",
    "primary_color": "string",
    "logo": "string",
    "routing_numbers": [
      "string"
    ],
    "oauth": true,
    "status": {},
    "payment_initiation_metadata": {},
    "auth_metadata": {}
  }
],
"pagination": {
  "limit": 0,
  "offset": 0,
  "total": 0
}

}

Parameters:

Returns:

  • See example data [Hash] Responses : > ‘200’



82
83
84
# File 'lib/sydecar/plaid.rb', line 82

def fetch_plaid_institutions(query: {})
  Connection.instance.get(PLAID_INSTITUTIONS_URL, query)
end

.reset_plaid_login(bank_account_id:) ⇒ Object

This method reset a Plaid account’s login (Sandbox only) Response sample (application/json) :

{
"id": "string",
"created_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z",
"bank_name": "string",
"account_name": "string",
"type": "STANDARD",
"account_type": "CHECKING",
"is_us_based": true,
"account_number": "string",
"routing_number": "string",
"street_1": "123 Maple Street",
"street_2": "Unit 2",
"city": "Maple Town",
"state": "CA",
"zip_code": "94033",
"country_code": "US",
"for_further_credit": "string",
"profile_ids": [
  "string"
],
"plaid_consent_expiration_time": "2022-10-12T07:30:50.52Z",
"plaid_account_number_mask": "1111",
"plaid_institution_id": "string"

}

Parameters:

  • -

    ‘bank_account_id’: [String] (required)

    Resets the Plaid account's login information forcing the user to reauthenticate. As part of the reset, the 'plaid_consent_expiration_time' attribute is set to yesterday's date. When plaid link is called in update mode the 'plaid_consent_expiration_time' gets set back to the item's value. This route is only available in sandbox.
    See https://api-docs.sydecar.io/api/#tag/Plaid/operation/resetPlaidLogin
    

Returns:

  • See example data [Hash] Responses : > ‘200’



159
160
161
# File 'lib/sydecar/plaid.rb', line 159

def (bank_account_id:)
  Connection.instance.post((bank_account_id: ), body:{})
end

.reset_plaid_login_url(bank_account_id:) ⇒ Object



7
8
9
# File 'lib/sydecar/plaid.rb', line 7

def (bank_account_id:)
  "v1/plaid/#{}/reset_plaid_login"
end