-
Notifications
You must be signed in to change notification settings - Fork 9
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
Refactor: enrollment with Backoffice API #1905
Conversation
Coverage reportClick to see where and how coverage changed
This report was generated by python-coverage-comment-action |
31e6ef1
to
c47e390
Compare
@thekaveman This is ready for review. I rebased and cleaned up the commits as much as I could. I think technically I could combine the two migration files into one, but that would require combining some changes that are currently in separate commits into one commit that might be a bit monstrous. |
benefits/core/migrations/0002_paymentprocessor_audience_paymentprocessor_client_id_and_more.py
Outdated
Show resolved
Hide resolved
I think how you have done it as a separate migration makes sense! We're now in the world of needing to migrate model changes, so I like it 👍 |
@angela-tran this is so exciting! Thank you for your hard work on this refactor!! 👏 I think we should wait to merge this so that it is not going out to prod at the same time as all our secrets / Admin changes scheduled for Friday 3/1 (that seems like a lot to release all at once / harder to diagnose any issues that come up). Let's plan for another release in the first week or two of March that includes this refactor. |
41b0783
to
304f645
Compare
I rebased one more time so that I could rename |
Looking at this now |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall this is looking really good 👍
I think the majority of the view changes and their tests are great.
Just a few more changes needed in the model / construction of the littlepay.api.Client
and some minor cleanup of migrations and fixtures.
benefits/core/migrations/0003_remove_paymentprocessor_api_access_token_endpoint_and_more.py
Outdated
Show resolved
Hide resolved
updates unit test for view function. some fields were needed on PaymentProcessor to represent Backoffice API config
change test so that getting API token is entirely mocked - I was not able to figure out how to mock the oauth object on Client
add handling for known case that should be treated as a success
the enrollment view tests have not been updated yet so there are some expected failures. they also need to be updated to add back coverage of cases that the deleted tests used to cover, e.g. HTTP errors from API requests. some cases from the old tests, e.g. invalid responses, do not apply with the new code.
remove Customer-API-related fields and add new Backoffice API fields
304f645
to
ed26642
Compare
I was able to make the requested changes and also tested the enrollment phase with those new code changes. Thanks for all the feedback @thekaveman. Let me know if you see anything else |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, one more requested change as I'm trying to get this running locally...
Can you please:
- remove existing sample payment processor secrets in
.env.sample
for the old API e.g.mst_payment_processor_client_cert
- add new sample payment processor secrets in
.env.sample
for the new API e.g.mst_payment_processor_client_secret
- update the sample fixture to reference these new sample secrets
For sure. I forgot about that |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fantastic!! 🎉
I got this to work locally and tested the following flows:
- ☑️ New enrollment in a group -- received the expected success response
- ☑️ Duplicate enrollment in a group -- received the expected
409
response, got the success page
We'll handle error flows in #1936
Post-merge in
|
Awesome! I'm working on merging / post-merge actions now |
I finished the post-merge steps for |
This PR refactors the enrollment phase to use the cal-itp/littlepay library rather than having its own implementation against an older API.
From the user's perspective, everything should work exactly the same.
For testing this, you'll need to configure the new fields on
PaymentProcessor
:client_id
,audience
, andclient_secret_name
. The values for the first two can be found in LastPass, and for the secret, you'll need to set the name of the secret and then set the actual value in your.env
file.Earlier notes