Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FFS-2490 Wrap Argyle Data Fetch API's #496

Open
wants to merge 28 commits into
base: main
Choose a base branch
from

Conversation

jeffcatania-usds
Copy link
Contributor

@jeffcatania-usds jeffcatania-usds commented Mar 10, 2025

Ticket

Resolves FFS-2490.

Changes

  • Implemented wrappers around Argyle SDK methods: "/users", "/identities", "/accounts", "/paystubs", "/employments"
  • Implemented convenience methods fetch_paystubs, fetch_employment, fetch_income, fetch_employment that call the underlying SDK functions and return normalized ResponseObjects.
  • Mock data added for the three mock Argyle sandbox users: Bob, Sarah, and Joe available in app/spec/support/fixtures/argyle.
  • Test cases provided to validate returned ResponseObjects in fetch_paystubs, fetch_employment, fetch_income, fetch_employment

Context for reviewers

  • This PR sets up for FFS-2562 to refactor PinwheelDataHelper and associated views to be able to pull data from the ArgyleService

Acceptance testing

  • No acceptance testing needed
    • This change will not affect the user experience (bugfix, dependency updates, etc.)
  • Acceptance testing prior to merge
    • This change can be verified visually via screenshots attached below or by sending a link to a local development environment to the acceptance tester
    • Acceptance testing should be done by design for visual changes, product for behavior/logic changes, or both for changes that impact both.
  • Acceptance testing after merge
    • This change is hard to test locally, so we'll test it in the demo environment (deployed automatically after merge.)
    • Make sure to notify the team once this PR is merged so we don't inadvertently deploy the unaccepted change to production. (e.g. :alert: Deploy block! @ffs-eng I just merged PR [#123] and will be doing acceptance testing in demo - please don't deploy until I'm finished!)

@jeffcatania-usds jeffcatania-usds self-assigned this Mar 10, 2025
@jeffcatania-usds jeffcatania-usds marked this pull request as draft March 10, 2025 20:39
@jeffcatania-usds jeffcatania-usds marked this pull request as ready for review March 11, 2025 01:18
Copy link
Contributor

@tdooner tdooner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Just a bunch of style nitpicks.

@@ -0,0 +1,32 @@
module ResponseObjects::FormatMethods::Argyle
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whew, the module name is a bit of a mouthful, but scoping it here makes the intention clear so it seems good to me.

# todo: paginate
json = fetch_identities_api(**params)
json["results"].map { |identity_json| ResponseObjects::Identity.from_argyle(identity_json) }
end
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hopefully we can rework this when we do the AggregatorDataHelper method so that we're not making the same API call three times in succession.

@http.build_url(endpoint).to_s
end

def store_mock_response(responsePayload:, folderName: "other", fileName:)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

idiomatic ruby would have these as snake_case. I'm going to follow up with a Rubocop rule to enforce this automatically.

FileUtils.mkdir_p "spec/support/fixtures/argyle/#{folderName}"

File.open("spec/support/fixtures/argyle/#{folderName}/#{fileName}.json", "wb") do
|f| f.puts(JSON.pretty_generate(responsePayload))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style nitpick - generally the block's argument is on the same line as the do, i.e.

File.open(...) do |f|      # <--- |f| goes on this line
  f.puts(...)
end

I couldn't find a rubocop rule for this.

})
expect(employment).to have_attributes(
status: "terminated",
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's still some very strange indenting in here. Maybe installing some kind of ruby plugin to do indenting will allow it to autoformat correctly? Rubocop does not seem to have a linter for this one either (not 100% sure, but I tried the obvious ones to no avail).

store_mock_response(
folderName: folderName,
fileName: "request_paystubs",
responsePayload: fetch_paystubs_api(user: argyle_user_id))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, maybe at some point we should move these methods into a helper module of some sort so they're not chilling on ArgyleService for the future.

@tdooner tdooner mentioned this pull request Mar 11, 2025
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants