1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-07-24 07:39:39 +02:00

Basic Plaid Integration (#1433)
Some checks are pending
Publish Docker image / ci (push) Waiting to run
Publish Docker image / Build docker image (push) Blocked by required conditions

* Basic plaid data model and linking

* Remove institutions, add plaid items

* Improve schema and Plaid provider

* Add webhook verification sketch

* Webhook verification

* Item accounts and balances sync setup

* Provide test encryption keys

* Fix test

* Only provide encryption keys in prod

* Try defining keys in test env

* Consolidate account sync logic

* Add back plaid account initialization

* Plaid transaction sync

* Sync UI overhaul for Plaid

* Add liability and investment syncing

* Handle investment webhooks and process current day holdings

* Remove logs

* Remove "all" period select for performance

* fix amount calc

* Remove todo comment

* Coming soon for investment historical data

* Document Plaid configuration

* Listen for holding updates
This commit is contained in:
Zach Gollwitzer 2024-11-15 13:49:37 -05:00 committed by GitHub
parent 3bc9da4105
commit cbba2ba675
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
127 changed files with 1537 additions and 841 deletions

View file

@ -4,6 +4,10 @@ module AccountableResourceInterfaceTest
extend ActiveSupport::Testing::Declarative
test "shows new form" do
Plaid::PlaidApi.any_instance.stubs(:link_token_create).returns(
Plaid::LinkTokenCreateResponse.new(link_token: "test-link-token")
)
get new_polymorphic_url(@account.accountable)
assert_response :success
end
@ -21,14 +25,14 @@ module AccountableResourceInterfaceTest
test "destroys account" do
delete account_url(@account)
assert_redirected_to accounts_path
assert_equal "#{@account.accountable_name.humanize} account deleted", flash[:notice]
assert_enqueued_with job: DestroyJob
assert_equal "#{@account.accountable_name.underscore.humanize} account scheduled for deletion", flash[:notice]
end
test "updates basic account balances" do
assert_no_difference [ "Account.count", "@account.accountable_class.count" ] do
patch account_url(@account), params: {
account: {
institution_id: institutions(:chase).id,
name: "Updated name",
balance: 10000,
currency: "USD"
@ -37,7 +41,7 @@ module AccountableResourceInterfaceTest
end
assert_redirected_to @account
assert_equal "#{@account.accountable_name.humanize} account updated", flash[:notice]
assert_equal "#{@account.accountable_name.underscore.humanize} account updated", flash[:notice]
end
test "creates with basic attributes" do
@ -45,7 +49,6 @@ module AccountableResourceInterfaceTest
post "/#{@account.accountable_name.pluralize}", params: {
account: {
accountable_type: @account.accountable_class,
institution_id: institutions(:chase).id,
name: "New accountable",
balance: 10000,
currency: "USD",
@ -68,7 +71,7 @@ module AccountableResourceInterfaceTest
end
assert_redirected_to @account
assert_enqueued_with job: AccountSyncJob
assert_enqueued_with job: SyncJob
assert_equal "#{@account.accountable_name.humanize} account updated", flash[:notice]
end
@ -84,7 +87,7 @@ module AccountableResourceInterfaceTest
end
assert_redirected_to @account
assert_enqueued_with job: AccountSyncJob
assert_enqueued_with job: SyncJob
assert_equal "#{@account.accountable_name.humanize} account updated", flash[:notice]
end
end

View file

@ -0,0 +1,24 @@
require "test_helper"
module SyncableInterfaceTest
extend ActiveSupport::Testing::Declarative
include ActiveJob::TestHelper
test "can sync later" do
assert_difference "@syncable.syncs.count", 1 do
assert_enqueued_with job: SyncJob do
@syncable.sync_later
end
end
end
test "can sync" do
assert_difference "@syncable.syncs.count", 1 do
@syncable.sync(start_date: 2.days.ago.to_date)
end
end
test "implements sync_data" do
assert_respond_to @syncable, :sync_data
end
end