Skip to content

Feat: Switchio registration module #2936

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

Closed
wants to merge 16 commits into from

Conversation

angela-tran
Copy link
Member

Closes #2903

@angela-tran angela-tran self-assigned this May 21, 2025
@github-actions github-actions bot added back-end Django views, sessions, middleware, models, migrations etc. deployment-dev [auto] Changes that will trigger a deploy if merged to dev labels May 21, 2025
Copy link

github-actions bot commented May 21, 2025

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  benefits
  settings.py
  benefits/enrollment_littlepay
  views.py
  benefits/enrollment_switchio
  api.py 113-126
Project Total  

This report was generated by python-coverage-comment-action

@angela-tran angela-tran force-pushed the feat/switchio-registration-module branch 2 times, most recently from c6e45d5 to 0d47234 Compare May 27, 2025 22:13
assuming you have the correct values for the referenced env variables,
this code will successfully connect to the Switchio registration API.

this is the code used during research / prototyping.
replace the API-related global variables with function parameters
@angela-tran angela-tran force-pushed the feat/switchio-registration-module branch from d87fd1d to 1c4b36f Compare May 27, 2025 22:33
headers=self._get_headers(method="POST", request_path=registration_path, request_body=request_body),
cert=cert,
verify=self.ca_certificate,
timeout=timeout,
Copy link
Member

Choose a reason for hiding this comment

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

We have settings.REQUESTS_TIMEOUT for this purpose.

Copy link
Member

Choose a reason for hiding this comment

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

Ah, I think this is eventually intended to move out into its own package, right? 👍

Copy link
Member Author

Choose a reason for hiding this comment

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

Right, this is meant to be used by Benefits code which would be responsible for passing in settings.REQUEST_TIMEOUT.

response.raise_for_status()

registration_id = response.json()["regId"]
gateway_url = response.json()["gtwUrl"]
Copy link
Member

Choose a reason for hiding this comment

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

Nit: feels a little strange to parse the response to JSON twice. Maybe not.

@angela-tran angela-tran force-pushed the feat/switchio-registration-module branch from 1c4b36f to 8720aff Compare May 28, 2025 20:23
@angela-tran
Copy link
Member Author

Closing this PR to keep it as documentation of prior research work. Will open a new PR with less granular commits

@angela-tran
Copy link
Member Author

Superseded by #2946

@angela-tran angela-tran deleted the feat/switchio-registration-module branch May 29, 2025 16:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
back-end Django views, sessions, middleware, models, migrations etc. deployment-dev [auto] Changes that will trigger a deploy if merged to dev
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add module to enrollment_switchio app for working with Switchio registration API
2 participants