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

Require upstream item removal to delete plaid item
Some checks are pending
Publish Docker image / ci (push) Waiting to run
Publish Docker image / Build docker image (push) Blocked by required conditions

This commit is contained in:
Zach Gollwitzer 2025-05-24 19:23:36 -04:00
parent 43a403e431
commit c701755b02
3 changed files with 2 additions and 11 deletions

View file

@ -108,11 +108,8 @@ class PlaidItem < ApplicationRecord
end end
private private
# Silently swallow and report error so that we don't block the user from deleting the item
def remove_plaid_item def remove_plaid_item
plaid_provider.remove_item(access_token) plaid_provider.remove_item(access_token)
rescue StandardError => e
Sentry.capture_exception(e)
end end
# Plaid returns mutually exclusive arrays here. If the item has made a request for a product, # Plaid returns mutually exclusive arrays here. If the item has made a request for a product,

View file

@ -40,6 +40,8 @@ class UsersControllerTest < ActionDispatch::IntegrationTest
budget = budgets(:one) budget = budgets(:one)
plaid_item = plaid_items(:one) plaid_item = plaid_items(:one)
Provider::Plaid.any_instance.expects(:remove_item).with(plaid_item.access_token).once
perform_enqueued_jobs(only: FamilyResetJob) do perform_enqueued_jobs(only: FamilyResetJob) do
delete reset_user_url(@user) delete reset_user_url(@user)
end end

View file

@ -16,12 +16,4 @@ class PlaidItemTest < ActiveSupport::TestCase
@plaid_item.destroy @plaid_item.destroy
end end
end end
test "if plaid item not found, silently continues with deletion" do
@plaid_provider.expects(:remove_item).with(@plaid_item.access_token).raises(Plaid::ApiError.new("Item not found"))
assert_difference "PlaidItem.count", -1 do
@plaid_item.destroy
end
end
end end