1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-08-08 15:05:22 +02:00

Basic plaid VCR tests

This commit is contained in:
Zach Gollwitzer 2025-05-19 11:43:22 -04:00
parent 0a1d4fca3d
commit b970a6b41d
12 changed files with 96575 additions and 158 deletions

View file

@ -106,8 +106,8 @@ class Provider::Plaid
client.item_remove(request)
end
def get_item_accounts(item)
request = Plaid::AccountsGetRequest.new(access_token: item.access_token)
def get_item_accounts(access_token)
request = Plaid::AccountsGetRequest.new(access_token: access_token)
client.accounts_get(request)
end

View file

@ -6,15 +6,13 @@ class Provider::PlaidSandbox < Provider::Plaid
@region = :us
end
def create_public_token(institution_id: nil, products: nil, user: nil)
def create_public_token(username: nil)
client.sandbox_public_token_create(
Plaid::SandboxPublicTokenCreateRequest.new(
institution_id: institution_id || "ins_56", # Chase
initial_products: products || [ "transactions", "investments", "liabilities" ],
institution_id: "ins_109508", # "First Platypus Bank" (Plaid's sandbox institution that works with all products)
initial_products: [ "transactions", "investments", "liabilities" ],
options: {
# This is a custom user we created in Plaid Dashboard
# See https://dashboard.plaid.com/developers/sandbox
override_username: user || "custom_test"
override_username: username || "custom_test"
}
)
).public_token

2
db/schema.rb generated
View file

@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema[7.2].define(version: 2025_05_18_133020) do
ActiveRecord::Schema[7.2].define(version: 2025_05_18_181619) do
# These are extensions that must be enabled in order to support this database
enable_extension "pgcrypto"
enable_extension "plpgsql"

View file

@ -35,20 +35,34 @@ class Provider::PlaidTest < ActiveSupport::TestCase
access_token = get_access_token
item = @plaid.get_item(access_token).item
assert_equal "ins_56", item.institution_id
assert_equal "Chase", item.institution_name
assert_equal "ins_109508", item.institution_id
assert_equal "First Platypus Bank", item.institution_name
end
end
test "gets item accounts" do
VCR.use_cassette("plaid/get_item_accounts") do
access_token = get_access_token
accounts_response = @plaid.get_item_accounts(access_token)
assert_equal 4, accounts_response.accounts.size
end
end
# NOTE: This one is a bit tricky because when the item is originally created,
# no transactions will be available yet (Plaid gives no way to pre-populate txns in sandbox).
#
# To get this working on a VCR refresh:
# 1. Run this test once to create the item
# 2. Wait a minute
# 3. Turn on `record: :all` and run the test again (txns should be populated now)
# 4. Turn off `record: :all`
test "gets item transactions with optional cursor for partial syncs" do
VCR.use_cassette("plaid/get_transactions_with_next_cursor", record: :all) do
VCR.use_cassette("plaid/get_transactions_with_next_cursor") do
access_token = get_access_token
# First call, we get everything
transactions_response = @plaid.get_transactions(access_token: access_token)
puts transactions_response.to_json
assert transactions_response.added.size > 0
# Second call, we get only the latest transactions
@ -64,20 +78,30 @@ class Provider::PlaidTest < ActiveSupport::TestCase
end
test "gets item investments" do
VCR.use_cassette("plaid/get_item_investments", record: :all) do
VCR.use_cassette("plaid/get_item_investments") do
access_token = get_access_token
investments_response = @plaid.get_item_investments(access_token: access_token)
puts investments_response.to_json
assert_equal 3, investments_response.holdings.size
assert_equal 4, investments_response.transactions.size
end
end
test "gets item liabilities" do
VCR.use_cassette("plaid/get_item_liabilities") do
access_token = get_access_token
liabilities_response = @plaid.get_item_liabilities(access_token: access_token)
assert liabilities_response.credit.count > 0
assert liabilities_response.student.count > 0
end
end
private
def get_access_token
VCR.use_cassette("plaid/exchange_public_token", record: :all) do
VCR.use_cassette("plaid/access_token") do
public_token = @plaid.create_public_token
exchange_response = @plaid.exchange_public_token(public_token)
exchange_response.access_token
end
end

View file

@ -0,0 +1,124 @@
---
http_interactions:
- request:
method: post
uri: https://sandbox.plaid.com/sandbox/public_token/create
body:
encoding: UTF-8
string: '{"institution_id":"ins_109508","initial_products":["transactions","investments","liabilities"],"options":{"override_username":"custom_test"}}'
headers:
Content-Type:
- application/json
User-Agent:
- Plaid Ruby v38.0.0
Accept:
- application/json
Plaid-Client-Id:
- "<PLAID_CLIENT_ID>"
Plaid-Version:
- '2020-09-14'
Plaid-Secret:
- "<PLAID_SECRET>"
Accept-Encoding:
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
response:
status:
code: 200
message: OK
headers:
Server:
- nginx
Date:
- Mon, 19 May 2025 15:34:39 GMT
Content-Type:
- application/json; charset=utf-8
Content-Length:
- '110'
Connection:
- keep-alive
Plaid-Version:
- '2020-09-14'
Vary:
- Accept-Encoding
X-Envoy-Upstream-Service-Time:
- '4991'
X-Envoy-Decorator-Operation:
- default.svc-apiv2:8080/*
Strict-Transport-Security:
- max-age=31536000; includeSubDomains; preload
X-Content-Type-Options:
- nosniff
X-Frame-Options:
- DENY
X-Xss-Protection:
- 1; mode=block
body:
encoding: ASCII-8BIT
string: |-
{
"public_token": "public-sandbox-cd9e5fdc-bb09-4648-a453-c3debb681883",
"request_id": "mf8QVG1msqNmNs7"
}
recorded_at: Mon, 19 May 2025 15:34:39 GMT
- request:
method: post
uri: https://sandbox.plaid.com/item/public_token/exchange
body:
encoding: UTF-8
string: '{"public_token":"public-sandbox-cd9e5fdc-bb09-4648-a453-c3debb681883"}'
headers:
Content-Type:
- application/json
User-Agent:
- Plaid Ruby v38.0.0
Accept:
- application/json
Plaid-Client-Id:
- "<PLAID_CLIENT_ID>"
Plaid-Version:
- '2020-09-14'
Plaid-Secret:
- "<PLAID_SECRET>"
Accept-Encoding:
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
response:
status:
code: 200
message: OK
headers:
Server:
- nginx
Date:
- Mon, 19 May 2025 15:34:39 GMT
Content-Type:
- application/json; charset=utf-8
Content-Length:
- '164'
Connection:
- keep-alive
Plaid-Version:
- '2020-09-14'
Vary:
- Accept-Encoding
X-Envoy-Upstream-Service-Time:
- '165'
X-Envoy-Decorator-Operation:
- default.svc-apiv2:8080/*
Strict-Transport-Security:
- max-age=31536000; includeSubDomains; preload
X-Content-Type-Options:
- nosniff
X-Frame-Options:
- DENY
X-Xss-Protection:
- 1; mode=block
body:
encoding: ASCII-8BIT
string: |-
{
"access_token": "access-sandbox-d531d3c9-8520-43ca-9e58-5b70b79fd1d4",
"item_id": "ZvlBL5eMPQtnXDV6QrR9sRedKePzMaFgzeVqA",
"request_id": "PfP9W8bCgpIdD2G"
}
recorded_at: Mon, 19 May 2025 15:34:39 GMT
recorded_with: VCR 6.3.1

View file

@ -5,7 +5,7 @@ http_interactions:
uri: https://sandbox.plaid.com/sandbox/public_token/create
body:
encoding: UTF-8
string: '{"institution_id":"ins_56","initial_products":["transactions","investments","liabilities"],"options":{"override_username":"custom_test"}}'
string: '{"institution_id":"ins_109508","initial_products":["transactions","investments","liabilities"],"options":{"override_username":"custom_test"}}'
headers:
Content-Type:
- application/json
@ -29,7 +29,7 @@ http_interactions:
Server:
- nginx
Date:
- Mon, 19 May 2025 13:54:31 GMT
- Mon, 19 May 2025 15:34:33 GMT
Content-Type:
- application/json; charset=utf-8
Content-Length:
@ -41,7 +41,7 @@ http_interactions:
Vary:
- Accept-Encoding
X-Envoy-Upstream-Service-Time:
- '2776'
- '3399'
X-Envoy-Decorator-Operation:
- default.svc-apiv2:8080/*
Strict-Transport-Security:
@ -56,16 +56,16 @@ http_interactions:
encoding: ASCII-8BIT
string: |-
{
"public_token": "public-sandbox-10b2d144-5203-4b0a-93f6-9ce25af4b052",
"request_id": "6zPegA0EukTP72O"
"public_token": "public-sandbox-701c57cf-4a49-44b8-a254-9c3bda72cd66",
"request_id": "kQ07S8tBwKOrExd"
}
recorded_at: Mon, 19 May 2025 13:54:31 GMT
recorded_at: Mon, 19 May 2025 15:34:33 GMT
- request:
method: post
uri: https://sandbox.plaid.com/item/public_token/exchange
body:
encoding: UTF-8
string: '{"public_token":"public-sandbox-10b2d144-5203-4b0a-93f6-9ce25af4b052"}'
string: '{"public_token":"public-sandbox-701c57cf-4a49-44b8-a254-9c3bda72cd66"}'
headers:
Content-Type:
- application/json
@ -89,7 +89,7 @@ http_interactions:
Server:
- nginx
Date:
- Mon, 19 May 2025 13:54:31 GMT
- Mon, 19 May 2025 15:34:34 GMT
Content-Type:
- application/json; charset=utf-8
Content-Length:
@ -101,7 +101,7 @@ http_interactions:
Vary:
- Accept-Encoding
X-Envoy-Upstream-Service-Time:
- '151'
- '156'
X-Envoy-Decorator-Operation:
- default.svc-apiv2:8080/*
Strict-Transport-Security:
@ -116,9 +116,9 @@ http_interactions:
encoding: ASCII-8BIT
string: |-
{
"access_token": "access-sandbox-7dd1d7be-e7de-43bd-bdce-5e2d3d757cb2",
"item_id": "PaKznRKQV9TnKx98J5mEhVE33r3MVZC7Xkv73",
"request_id": "SVKjsbMsaqdHLBJ"
"access_token": "access-sandbox-951ad956-da38-4a99-a8fd-c5b945502da8",
"item_id": "5Z6pw4gd9dTA9A6ADx9WhqZBvWgPdofZkJn4z",
"request_id": "JLgpp0qLgiJUeWT"
}
recorded_at: Mon, 19 May 2025 13:54:31 GMT
recorded_at: Mon, 19 May 2025 15:34:34 GMT
recorded_with: VCR 6.3.1

View file

@ -5,7 +5,7 @@ http_interactions:
uri: https://sandbox.plaid.com/item/get
body:
encoding: UTF-8
string: '{"access_token":"access-sandbox-60ea96d0-fe6c-41aa-a3ab-c88c33bd2f7e"}'
string: '{"access_token":"access-sandbox-d531d3c9-8520-43ca-9e58-5b70b79fd1d4"}'
headers:
Content-Type:
- application/json
@ -29,11 +29,11 @@ http_interactions:
Server:
- nginx
Date:
- Mon, 19 May 2025 13:53:41 GMT
- Mon, 19 May 2025 15:34:42 GMT
Content-Type:
- application/json; charset=utf-8
Content-Length:
- '972'
- '1071'
Connection:
- keep-alive
Plaid-Version:
@ -41,7 +41,7 @@ http_interactions:
Vary:
- Accept-Encoding
X-Envoy-Upstream-Service-Time:
- '142'
- '148'
X-Envoy-Decorator-Operation:
- default.svc-apiv2:8080/*
Strict-Transport-Security:
@ -61,11 +61,14 @@ http_interactions:
"assets",
"auth",
"balance",
"credit_details",
"identity",
"identity_match",
"income",
"income_verification",
"recurring_transactions",
"signal"
"signal",
"statements"
],
"billed_products": [
"investments",
@ -73,11 +76,11 @@ http_interactions:
"transactions"
],
"consent_expiration_time": null,
"created_at": "2025-05-19T13:53:38Z",
"created_at": "2025-05-19T15:34:34Z",
"error": null,
"institution_id": "ins_56",
"institution_name": "Chase",
"item_id": "RmaB9v7w3jTVJ6JLllAnSWVzwxvQxJCRw4RRe",
"institution_id": "ins_109508",
"institution_name": "First Platypus Bank",
"item_id": "ZvlBL5eMPQtnXDV6QrR9sRedKePzMaFgzeVqA",
"products": [
"investments",
"liabilities",
@ -86,18 +89,18 @@ http_interactions:
"update_type": "background",
"webhook": ""
},
"request_id": "OkYR6qCP5vc6iEk",
"request_id": "dP15rNDzgSoFSjz",
"status": {
"investments": {
"last_failed_update": null,
"last_successful_update": "2025-05-19T13:53:39.616Z"
"last_successful_update": "2025-05-19T15:34:36.251Z"
},
"last_webhook": null,
"transactions": {
"last_failed_update": null,
"last_successful_update": null
"last_successful_update": "2025-05-19T15:34:41.33Z"
}
}
}
recorded_at: Mon, 19 May 2025 13:53:41 GMT
recorded_at: Mon, 19 May 2025 15:34:42 GMT
recorded_with: VCR 6.3.1

View file

@ -0,0 +1,160 @@
---
http_interactions:
- request:
method: post
uri: https://sandbox.plaid.com/accounts/get
body:
encoding: UTF-8
string: '{"access_token":"access-sandbox-d531d3c9-8520-43ca-9e58-5b70b79fd1d4"}'
headers:
Content-Type:
- application/json
User-Agent:
- Plaid Ruby v38.0.0
Accept:
- application/json
Plaid-Client-Id:
- "<PLAID_CLIENT_ID>"
Plaid-Version:
- '2020-09-14'
Plaid-Secret:
- "<PLAID_SECRET>"
Accept-Encoding:
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
response:
status:
code: 200
message: OK
headers:
Server:
- nginx
Date:
- Mon, 19 May 2025 15:34:41 GMT
Content-Type:
- application/json; charset=utf-8
Content-Length:
- '2579'
Connection:
- keep-alive
Plaid-Version:
- '2020-09-14'
Vary:
- Accept-Encoding
X-Envoy-Upstream-Service-Time:
- '187'
X-Envoy-Decorator-Operation:
- default.svc-apiv2:8080/*
Strict-Transport-Security:
- max-age=31536000; includeSubDomains; preload
X-Content-Type-Options:
- nosniff
X-Frame-Options:
- DENY
X-Xss-Protection:
- 1; mode=block
body:
encoding: ASCII-8BIT
string: |-
{
"accounts": [
{
"account_id": "MpWPx5o4yrcpZvwQrdbMuwX699pjDRCLX98NN",
"balances": {
"available": 15000,
"current": 15000,
"iso_currency_code": "USD",
"limit": null,
"unofficial_currency_code": null
},
"holder_category": "personal",
"mask": "1119",
"name": "Test Student Loan Account",
"official_name": "Plaid student",
"subtype": "student",
"type": "loan"
},
{
"account_id": "ZvlBL5eMPQtnXDV6QrR9sReNVVz1XAieagDPz",
"balances": {
"available": 11065.71,
"current": 1000,
"iso_currency_code": "USD",
"limit": 12200,
"unofficial_currency_code": null
},
"holder_category": "personal",
"mask": "3053",
"name": "Test Credit Card Account",
"official_name": "Plaid credit card",
"subtype": "credit card",
"type": "credit"
},
{
"account_id": "QEbZN5mMrxTnJ4XRxba9s9pKBBx4bnuwPpWZa",
"balances": {
"available": 8000,
"current": 10000,
"iso_currency_code": "USD",
"limit": null,
"unofficial_currency_code": null
},
"holder_category": "personal",
"mask": "7330",
"name": "Test Brokerage Account",
"official_name": "Plaid brokerage",
"subtype": "brokerage",
"type": "investment"
},
{
"account_id": "edNwr51XgAcoARVZP68vsdREvv56jafrvLlJ7",
"balances": {
"available": 10000,
"current": 10000,
"iso_currency_code": "USD",
"limit": null,
"unofficial_currency_code": null
},
"holder_category": "personal",
"mask": "8957",
"name": "Test Depository Account",
"official_name": "Plaid checking",
"subtype": "checking",
"type": "depository"
}
],
"item": {
"available_products": [
"assets",
"auth",
"balance",
"credit_details",
"identity",
"identity_match",
"income",
"income_verification",
"recurring_transactions",
"signal",
"statements"
],
"billed_products": [
"investments",
"liabilities",
"transactions"
],
"consent_expiration_time": null,
"error": null,
"institution_id": "ins_109508",
"institution_name": "First Platypus Bank",
"item_id": "ZvlBL5eMPQtnXDV6QrR9sRedKePzMaFgzeVqA",
"products": [
"investments",
"liabilities",
"transactions"
],
"update_type": "background",
"webhook": ""
},
"request_id": "kiCPz2eRTH2DTbA"
}
recorded_at: Mon, 19 May 2025 15:34:41 GMT
recorded_with: VCR 6.3.1

View file

@ -5,7 +5,7 @@ http_interactions:
uri: https://sandbox.plaid.com/investments/holdings/get
body:
encoding: UTF-8
string: '{"access_token":"access-sandbox-01f5e5d8-b1f0-47b4-933a-6664c0064173"}'
string: '{"access_token":"access-sandbox-d531d3c9-8520-43ca-9e58-5b70b79fd1d4"}'
headers:
Content-Type:
- application/json
@ -29,11 +29,11 @@ http_interactions:
Server:
- nginx
Date:
- Mon, 19 May 2025 13:53:33 GMT
- Mon, 19 May 2025 15:34:41 GMT
Content-Type:
- application/json; charset=utf-8
Content-Length:
- '6483'
- '6200'
Connection:
- keep-alive
Plaid-Version:
@ -58,24 +58,7 @@ http_interactions:
{
"accounts": [
{
"account_id": "9AokBkPa5BfWEVAe7XPqswvgkq5V6kh4J5BG7",
"balances": {
"available": 10000,
"current": 10000,
"iso_currency_code": "USD",
"limit": null,
"unofficial_currency_code": null
},
"holder_category": "personal",
"mask": "1511",
"name": "Test Depository Account",
"official_name": "Plaid checking",
"persistent_account_id": "efe6f4d74b96154ebd8e40efafd36d8d43682c3f5cecdba620385593",
"subtype": "checking",
"type": "depository"
},
{
"account_id": "ye6dBd4XDBTgZPB7EJwpUQqAKob31KS4vlM3L",
"account_id": "MpWPx5o4yrcpZvwQrdbMuwX699pjDRCLX98NN",
"balances": {
"available": 15000,
"current": 15000,
@ -84,32 +67,30 @@ http_interactions:
"unofficial_currency_code": null
},
"holder_category": "personal",
"mask": "2471",
"mask": "1119",
"name": "Test Student Loan Account",
"official_name": "Plaid student",
"persistent_account_id": "75962201bbe945642e0f2cc9cb45bf6ad3fb70c1109ddac39affd9cc",
"subtype": "student",
"type": "loan"
},
{
"account_id": "mk6JEJmGaEFB5d6Zoevbu5xnW8MmeWig3Wkm3",
"account_id": "ZvlBL5eMPQtnXDV6QrR9sReNVVz1XAieagDPz",
"balances": {
"available": 11900,
"available": 11065.71,
"current": 1000,
"iso_currency_code": "USD",
"limit": 12900,
"limit": 12200,
"unofficial_currency_code": null
},
"holder_category": "personal",
"mask": "7144",
"mask": "3053",
"name": "Test Credit Card Account",
"official_name": "Plaid credit card",
"persistent_account_id": "43c7fc22e70c7ba9bdac1ec02ee445107d2f166703760a4dc149fdbf",
"subtype": "credit card",
"type": "credit"
},
{
"account_id": "vP6BKBxw3KuwDNKy16v7TDvrWdnzmWiq7EJz9",
"account_id": "QEbZN5mMrxTnJ4XRxba9s9pKBBx4bnuwPpWZa",
"balances": {
"available": 8000,
"current": 10000,
@ -118,17 +99,32 @@ http_interactions:
"unofficial_currency_code": null
},
"holder_category": "personal",
"mask": "8749",
"mask": "7330",
"name": "Test Brokerage Account",
"official_name": "Plaid brokerage",
"persistent_account_id": "28933ba7cec01ee3a8823c13aa091fada6fc38a08872dd1e12b76023",
"subtype": "brokerage",
"type": "investment"
},
{
"account_id": "edNwr51XgAcoARVZP68vsdREvv56jafrvLlJ7",
"balances": {
"available": 10000,
"current": 10000,
"iso_currency_code": "USD",
"limit": null,
"unofficial_currency_code": null
},
"holder_category": "personal",
"mask": "8957",
"name": "Test Depository Account",
"official_name": "Plaid checking",
"subtype": "checking",
"type": "depository"
}
],
"holdings": [
{
"account_id": "vP6BKBxw3KuwDNKy16v7TDvrWdnzmWiq7EJz9",
"account_id": "QEbZN5mMrxTnJ4XRxba9s9pKBBx4bnuwPpWZa",
"cost_basis": 2000,
"institution_price": 100,
"institution_price_as_of": "2025-05-08",
@ -142,7 +138,7 @@ http_interactions:
"vested_value": null
},
{
"account_id": "vP6BKBxw3KuwDNKy16v7TDvrWdnzmWiq7EJz9",
"account_id": "QEbZN5mMrxTnJ4XRxba9s9pKBBx4bnuwPpWZa",
"cost_basis": 3000,
"institution_price": 1,
"institution_price_as_of": "2025-05-08",
@ -156,7 +152,7 @@ http_interactions:
"vested_value": null
},
{
"account_id": "vP6BKBxw3KuwDNKy16v7TDvrWdnzmWiq7EJz9",
"account_id": "QEbZN5mMrxTnJ4XRxba9s9pKBBx4bnuwPpWZa",
"cost_basis": 5000,
"institution_price": 1,
"institution_price_as_of": "2025-05-08",
@ -175,11 +171,14 @@ http_interactions:
"assets",
"auth",
"balance",
"credit_details",
"identity",
"identity_match",
"income",
"income_verification",
"recurring_transactions",
"signal"
"signal",
"statements"
],
"billed_products": [
"investments",
@ -188,9 +187,9 @@ http_interactions:
],
"consent_expiration_time": null,
"error": null,
"institution_id": "ins_56",
"institution_name": "Chase",
"item_id": "oB6bAblGWACoJlk9Ex8bIJg33domK6uR1yRRv",
"institution_id": "ins_109508",
"institution_name": "First Platypus Bank",
"item_id": "ZvlBL5eMPQtnXDV6QrR9sRedKePzMaFgzeVqA",
"products": [
"investments",
"liabilities",
@ -199,7 +198,7 @@ http_interactions:
"update_type": "background",
"webhook": ""
},
"request_id": "ARlPzgbuVxL6rjp",
"request_id": "He6QRKK2d3ujE2q",
"securities": [
{
"close_price": 1,
@ -272,13 +271,13 @@ http_interactions:
}
]
}
recorded_at: Mon, 19 May 2025 13:53:33 GMT
recorded_at: Mon, 19 May 2025 15:34:41 GMT
- request:
method: post
uri: https://sandbox.plaid.com/investments/transactions/get
body:
encoding: UTF-8
string: '{"access_token":"access-sandbox-01f5e5d8-b1f0-47b4-933a-6664c0064173","start_date":"2023-05-20","end_date":"2025-05-19","options":{"offset":0}}'
string: '{"access_token":"access-sandbox-d531d3c9-8520-43ca-9e58-5b70b79fd1d4","start_date":"2023-05-20","end_date":"2025-05-19","options":{"offset":0}}'
headers:
Content-Type:
- application/json
@ -302,11 +301,11 @@ http_interactions:
Server:
- nginx
Date:
- Mon, 19 May 2025 13:53:33 GMT
- Mon, 19 May 2025 15:34:42 GMT
Content-Type:
- application/json; charset=utf-8
Content-Length:
- '7248'
- '6965'
Connection:
- keep-alive
Plaid-Version:
@ -314,7 +313,7 @@ http_interactions:
Vary:
- Accept-Encoding
X-Envoy-Upstream-Service-Time:
- '378'
- '341'
X-Envoy-Decorator-Operation:
- default.svc-apiv2:8080/*
Strict-Transport-Security:
@ -331,24 +330,7 @@ http_interactions:
{
"accounts": [
{
"account_id": "9AokBkPa5BfWEVAe7XPqswvgkq5V6kh4J5BG7",
"balances": {
"available": 10000,
"current": 10000,
"iso_currency_code": "USD",
"limit": null,
"unofficial_currency_code": null
},
"holder_category": "personal",
"mask": "1511",
"name": "Test Depository Account",
"official_name": "Plaid checking",
"persistent_account_id": "efe6f4d74b96154ebd8e40efafd36d8d43682c3f5cecdba620385593",
"subtype": "checking",
"type": "depository"
},
{
"account_id": "ye6dBd4XDBTgZPB7EJwpUQqAKob31KS4vlM3L",
"account_id": "MpWPx5o4yrcpZvwQrdbMuwX699pjDRCLX98NN",
"balances": {
"available": 15000,
"current": 15000,
@ -357,32 +339,30 @@ http_interactions:
"unofficial_currency_code": null
},
"holder_category": "personal",
"mask": "2471",
"mask": "1119",
"name": "Test Student Loan Account",
"official_name": "Plaid student",
"persistent_account_id": "75962201bbe945642e0f2cc9cb45bf6ad3fb70c1109ddac39affd9cc",
"subtype": "student",
"type": "loan"
},
{
"account_id": "mk6JEJmGaEFB5d6Zoevbu5xnW8MmeWig3Wkm3",
"account_id": "ZvlBL5eMPQtnXDV6QrR9sReNVVz1XAieagDPz",
"balances": {
"available": 11900,
"available": 11065.71,
"current": 1000,
"iso_currency_code": "USD",
"limit": 12900,
"limit": 12200,
"unofficial_currency_code": null
},
"holder_category": "personal",
"mask": "7144",
"mask": "3053",
"name": "Test Credit Card Account",
"official_name": "Plaid credit card",
"persistent_account_id": "43c7fc22e70c7ba9bdac1ec02ee445107d2f166703760a4dc149fdbf",
"subtype": "credit card",
"type": "credit"
},
{
"account_id": "vP6BKBxw3KuwDNKy16v7TDvrWdnzmWiq7EJz9",
"account_id": "QEbZN5mMrxTnJ4XRxba9s9pKBBx4bnuwPpWZa",
"balances": {
"available": 8000,
"current": 10000,
@ -391,22 +371,37 @@ http_interactions:
"unofficial_currency_code": null
},
"holder_category": "personal",
"mask": "8749",
"mask": "7330",
"name": "Test Brokerage Account",
"official_name": "Plaid brokerage",
"persistent_account_id": "28933ba7cec01ee3a8823c13aa091fada6fc38a08872dd1e12b76023",
"subtype": "brokerage",
"type": "investment"
},
{
"account_id": "edNwr51XgAcoARVZP68vsdREvv56jafrvLlJ7",
"balances": {
"available": 10000,
"current": 10000,
"iso_currency_code": "USD",
"limit": null,
"unofficial_currency_code": null
},
"holder_category": "personal",
"mask": "8957",
"name": "Test Depository Account",
"official_name": "Plaid checking",
"subtype": "checking",
"type": "depository"
}
],
"investment_transactions": [
{
"account_id": "vP6BKBxw3KuwDNKy16v7TDvrWdnzmWiq7EJz9",
"account_id": "QEbZN5mMrxTnJ4XRxba9s9pKBBx4bnuwPpWZa",
"amount": -5000,
"cancel_transaction_id": null,
"date": "2025-05-03",
"fees": 0,
"investment_transaction_id": "X53oko4eQkUkKN78A5GmhN9lvl6wdeF1awWEz",
"investment_transaction_id": "oMpyjB9Dlqhb4v8gkyn6tbz4GxgR39iowXK7g",
"iso_currency_code": "USD",
"name": "retirement contribution",
"price": 1,
@ -417,12 +412,12 @@ http_interactions:
"unofficial_currency_code": null
},
{
"account_id": "vP6BKBxw3KuwDNKy16v7TDvrWdnzmWiq7EJz9",
"account_id": "QEbZN5mMrxTnJ4XRxba9s9pKBBx4bnuwPpWZa",
"amount": 5000,
"cancel_transaction_id": null,
"date": "2025-05-03",
"fees": 0,
"investment_transaction_id": "D5EoQogL4QUnaZbVWg4PhB9pLpvl3bc4MKPQA",
"investment_transaction_id": "g4j7B5kXEnCwdLV7NzQPHV5l87zaWeuEklMnW",
"iso_currency_code": "USD",
"name": "buy money market shares with contribution cash",
"price": 1,
@ -433,12 +428,12 @@ http_interactions:
"unofficial_currency_code": null
},
{
"account_id": "vP6BKBxw3KuwDNKy16v7TDvrWdnzmWiq7EJz9",
"account_id": "QEbZN5mMrxTnJ4XRxba9s9pKBBx4bnuwPpWZa",
"amount": 2000,
"cancel_transaction_id": null,
"date": "2025-05-02",
"fees": 0,
"investment_transaction_id": "V5zpKpdjwKUvNGPgAzqnIbgAKAXM3Ecqr38d3",
"investment_transaction_id": "8lBZ7kqmNMflM6N1rBb8udzR5Vp7MXiWExrLG",
"iso_currency_code": "USD",
"name": "buy AAPL stock",
"price": 100,
@ -449,12 +444,12 @@ http_interactions:
"unofficial_currency_code": null
},
{
"account_id": "vP6BKBxw3KuwDNKy16v7TDvrWdnzmWiq7EJz9",
"account_id": "QEbZN5mMrxTnJ4XRxba9s9pKBBx4bnuwPpWZa",
"amount": -5000,
"cancel_transaction_id": null,
"date": "2025-05-01",
"fees": 0,
"investment_transaction_id": "wj63r3dGxrCB6LyZo8vQu68WpWKnE9cE8B7Vn",
"investment_transaction_id": "EjM3A5vK8mCjLea1GE3mCyoKvAE3kjF4djEkP",
"iso_currency_code": "USD",
"name": "Deposit cash into brokerage account",
"price": 1,
@ -470,11 +465,14 @@ http_interactions:
"assets",
"auth",
"balance",
"credit_details",
"identity",
"identity_match",
"income",
"income_verification",
"recurring_transactions",
"signal"
"signal",
"statements"
],
"billed_products": [
"investments",
@ -483,9 +481,9 @@ http_interactions:
],
"consent_expiration_time": null,
"error": null,
"institution_id": "ins_56",
"institution_name": "Chase",
"item_id": "oB6bAblGWACoJlk9Ex8bIJg33domK6uR1yRRv",
"institution_id": "ins_109508",
"institution_name": "First Platypus Bank",
"item_id": "ZvlBL5eMPQtnXDV6QrR9sRedKePzMaFgzeVqA",
"products": [
"investments",
"liabilities",
@ -494,7 +492,7 @@ http_interactions:
"update_type": "background",
"webhook": ""
},
"request_id": "3PLgnDkJ1iTVixr",
"request_id": "CqfMA8GOfEA1GhG",
"securities": [
{
"close_price": 1,
@ -568,5 +566,5 @@ http_interactions:
],
"total_investment_transactions": 4
}
recorded_at: Mon, 19 May 2025 13:53:33 GMT
recorded_at: Mon, 19 May 2025 15:34:42 GMT
recorded_with: VCR 6.3.1

View file

@ -0,0 +1,236 @@
---
http_interactions:
- request:
method: post
uri: https://sandbox.plaid.com/liabilities/get
body:
encoding: UTF-8
string: '{"access_token":"access-sandbox-d531d3c9-8520-43ca-9e58-5b70b79fd1d4"}'
headers:
Content-Type:
- application/json
User-Agent:
- Plaid Ruby v38.0.0
Accept:
- application/json
Plaid-Client-Id:
- "<PLAID_CLIENT_ID>"
Plaid-Version:
- '2020-09-14'
Plaid-Secret:
- "<PLAID_SECRET>"
Accept-Encoding:
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
response:
status:
code: 200
message: OK
headers:
Server:
- nginx
Date:
- Mon, 19 May 2025 15:34:40 GMT
Content-Type:
- application/json; charset=utf-8
Content-Length:
- '4910'
Connection:
- keep-alive
Plaid-Version:
- '2020-09-14'
Vary:
- Accept-Encoding
X-Envoy-Upstream-Service-Time:
- '239'
X-Envoy-Decorator-Operation:
- default.svc-apiv2:8080/*
Strict-Transport-Security:
- max-age=31536000; includeSubDomains; preload
X-Content-Type-Options:
- nosniff
X-Frame-Options:
- DENY
X-Xss-Protection:
- 1; mode=block
body:
encoding: ASCII-8BIT
string: |-
{
"accounts": [
{
"account_id": "MpWPx5o4yrcpZvwQrdbMuwX699pjDRCLX98NN",
"balances": {
"available": 15000,
"current": 15000,
"iso_currency_code": "USD",
"limit": null,
"unofficial_currency_code": null
},
"holder_category": "personal",
"mask": "1119",
"name": "Test Student Loan Account",
"official_name": "Plaid student",
"subtype": "student",
"type": "loan"
},
{
"account_id": "ZvlBL5eMPQtnXDV6QrR9sReNVVz1XAieagDPz",
"balances": {
"available": 11065.71,
"current": 1000,
"iso_currency_code": "USD",
"limit": 12200,
"unofficial_currency_code": null
},
"holder_category": "personal",
"mask": "3053",
"name": "Test Credit Card Account",
"official_name": "Plaid credit card",
"subtype": "credit card",
"type": "credit"
},
{
"account_id": "QEbZN5mMrxTnJ4XRxba9s9pKBBx4bnuwPpWZa",
"balances": {
"available": 8000,
"current": 10000,
"iso_currency_code": "USD",
"limit": null,
"unofficial_currency_code": null
},
"holder_category": "personal",
"mask": "7330",
"name": "Test Brokerage Account",
"official_name": "Plaid brokerage",
"subtype": "brokerage",
"type": "investment"
},
{
"account_id": "edNwr51XgAcoARVZP68vsdREvv56jafrvLlJ7",
"balances": {
"available": 10000,
"current": 10000,
"iso_currency_code": "USD",
"limit": null,
"unofficial_currency_code": null
},
"holder_category": "personal",
"mask": "8957",
"name": "Test Depository Account",
"official_name": "Plaid checking",
"subtype": "checking",
"type": "depository"
}
],
"item": {
"available_products": [
"assets",
"auth",
"balance",
"credit_details",
"identity",
"identity_match",
"income",
"income_verification",
"recurring_transactions",
"signal",
"statements"
],
"billed_products": [
"investments",
"liabilities",
"transactions"
],
"consent_expiration_time": null,
"error": null,
"institution_id": "ins_109508",
"institution_name": "First Platypus Bank",
"item_id": "ZvlBL5eMPQtnXDV6QrR9sRedKePzMaFgzeVqA",
"products": [
"investments",
"liabilities",
"transactions"
],
"update_type": "background",
"webhook": ""
},
"liabilities": {
"credit": [
{
"account_id": "ZvlBL5eMPQtnXDV6QrR9sReNVVz1XAieagDPz",
"aprs": [
{
"apr_percentage": 12.5,
"apr_type": "purchase_apr",
"balance_subject_to_apr": null,
"interest_charge_amount": null
},
{
"apr_percentage": 27.95,
"apr_type": "cash_apr",
"balance_subject_to_apr": null,
"interest_charge_amount": null
}
],
"is_overdue": false,
"last_payment_amount": null,
"last_payment_date": "2025-04-24",
"last_statement_balance": 1000,
"last_statement_issue_date": "2025-05-19",
"minimum_payment_amount": 50,
"next_payment_due_date": "2025-06-19"
}
],
"mortgage": null,
"student": [
{
"account_id": "MpWPx5o4yrcpZvwQrdbMuwX699pjDRCLX98NN",
"account_number": "52810251119",
"disbursement_dates": [
"2023-05-01"
],
"expected_payoff_date": "2036-05-01",
"guarantor": "DEPT OF ED",
"interest_rate_percentage": 5.25,
"is_overdue": false,
"last_payment_amount": null,
"last_payment_date": null,
"last_statement_balance": 16577.16,
"last_statement_issue_date": "2025-05-01",
"loan_name": "Consolidation",
"loan_status": {
"end_date": null,
"type": "in school"
},
"minimum_payment_amount": 25,
"next_payment_due_date": "2025-06-01",
"origination_date": "2023-05-01",
"origination_principal_amount": 15000,
"outstanding_interest_amount": 1577.16,
"payment_reference_number": "52810251119",
"pslf_status": {
"estimated_eligibility_date": null,
"payments_made": null,
"payments_remaining": null
},
"repayment_plan": {
"description": "Standard Repayment",
"type": "standard"
},
"sequence_number": "1",
"servicer_address": {
"city": "San Matias",
"country": "US",
"postal_code": "99415",
"region": "CA",
"street": "123 Relaxation Road"
},
"ytd_interest_paid": 0,
"ytd_principal_paid": 0
}
]
},
"request_id": "WJhrfTcUFBSLw9j"
}
recorded_at: Mon, 19 May 2025 15:34:40 GMT
recorded_with: VCR 6.3.1

File diff suppressed because one or more lines are too long

View file

@ -29,7 +29,7 @@ http_interactions:
Server:
- nginx
Date:
- Mon, 19 May 2025 12:22:57 GMT
- Mon, 19 May 2025 15:34:40 GMT
Content-Type:
- application/json; charset=utf-8
Content-Length:
@ -41,7 +41,7 @@ http_interactions:
Vary:
- Accept-Encoding
X-Envoy-Upstream-Service-Time:
- '51'
- '74'
X-Envoy-Decorator-Operation:
- default.svc-apiv2:8080/*
Strict-Transport-Security:
@ -56,9 +56,9 @@ http_interactions:
encoding: ASCII-8BIT
string: |-
{
"expiration": "2025-05-19T16:22:58Z",
"link_token": "link-sandbox-f8d1c8ab-86c9-4f6e-9136-8e8fce0b078a",
"request_id": "JOT5vEl1srPSLI4"
"expiration": "2025-05-19T19:34:40Z",
"link_token": "link-sandbox-3b445f38-abc0-4781-b6d5-271a7b1089d4",
"request_id": "QtzDCRM39QhsuHF"
}
recorded_at: Mon, 19 May 2025 12:22:57 GMT
recorded_at: Mon, 19 May 2025 15:34:40 GMT
recorded_with: VCR 6.3.1