Skip to content

PTHMINT-101: Add dev-only custom base URL support#52

Open
zulquer wants to merge 1 commit intomasterfrom
PTHMINT-101
Open

PTHMINT-101: Add dev-only custom base URL support#52
zulquer wants to merge 1 commit intomasterfrom
PTHMINT-101

Conversation

@zulquer
Copy link
Copy Markdown
Collaborator

@zulquer zulquer commented Apr 1, 2026

Allow passing a custom API base_url for local development while preventing custom URLs in non-dev builds. Client now accepts base_url and resolves it via _resolve_base_url (uses MSP_SDK_BUILD_PROFILE, MSP_SDK_ALLOW_CUSTOM_BASE_URL, MSP_SDK_CUSTOM_BASE_URL); _normalize_base_url validates/normalizes the URL. Sdk forwards base_url to Client. Added unit tests covering default test/live URLs, dev-only custom URL acceptance, env-provided URL, and blocking in release/when flag disabled. README updated with usage and guardrails.

Allow passing a custom API base_url for local development while preventing custom URLs in non-dev builds. Client now accepts base_url and resolves it via _resolve_base_url (uses MSP_SDK_BUILD_PROFILE, MSP_SDK_ALLOW_CUSTOM_BASE_URL, MSP_SDK_CUSTOM_BASE_URL); _normalize_base_url validates/normalizes the URL. Sdk forwards base_url to Client. Added unit tests covering default test/live URLs, dev-only custom URL acceptance, env-provided URL, and blocking in release/when flag disabled. README updated with usage and guardrails.
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 1, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.89%. Comparing base (ee15a54) to head (a19c304).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master      #52      +/-   ##
==========================================
+ Coverage   90.81%   90.89%   +0.08%     
==========================================
  Files         147      147              
  Lines        2579     2603      +24     
==========================================
+ Hits         2342     2366      +24     
  Misses        237      237              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a development-only mechanism to override the API base URL (via constructor parameter or env var) while enforcing guardrails to block custom URLs outside a “dev” profile.

Changes:

  • Extend Client and Sdk to accept base_url and resolve it with environment-based guardrails.
  • Add unit tests for default URL selection and dev/release allow/block behavior.
  • Update README with guidance for enabling the dev-only override.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/multisafepay/client/client.py Implements base URL resolution/normalization with dev-only guardrails.
src/multisafepay/sdk.py Forwards base_url from Sdk to Client.
tests/multisafepay/unit/client/test_unit_client.py Adds unit tests for default URLs and guardrail behavior at the Client level.
tests/multisafepay/unit/test_unit_sdk.py Adds unit tests ensuring Sdk propagates URL behavior/guardrails.
README.md Documents dev-only configuration and usage for custom base URL.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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