Skip to content

feat(api): describe every installed gateway for settings screens - #27

Open
ishad05 wants to merge 3 commits into
bwhtech:v1-stablefrom
ishad05:feat/gateway-info
Open

ishad05 wants to merge 3 commits into
bwhtech:v1-stablefrom
ishad05:feat/gateway-info

Conversation

@ishad05

@ishad05 ishad05 commented Oct 14, 2026 •

Copy link
Copy Markdown

Summary

A consumer that builds a gateway settings screen had to keep its own list of gateways, with each one's description, docs link and settings DocType. Every new gateway meant a change in each consumer.

api.get_gateways() returns a GatewayInfo for every gateway Settings Single on the site, enabled or not, including another app's gateways. bwh_payments stays independent of any one consumer.

Split out of #7 on review. #7 (PayPal) is stacked on this PR.

Changes

  • api.get_gateways() returns GatewayInfo: name, settings_doctype, description, docs_url, reusable_checkout and logos
  • description, docs_url and reusable_checkout class attributes on PaymentGatewayBase. Razorpay, Stripe, Telr and Tabby describe themselves
  • reusable_checkout: bool says the checkout link stays payable after the shopper leaves it. It replaces the capabilities tuple and REUSABLE_CHECKOUT constant from the first version of feat: add PayPal gateway #7, which carried only this one flag
  • utils.get_gateway_settings_doctypes() finds every Single whose controller implements PaymentGatewayBase. A DocType whose controller cannot be imported (its app was removed, or its code is on another branch) is skipped and logged, so it cannot break every screen that lists gateways

Testing

bwh_payments.tests.test_api checks that every installed gateway is listed, set up or not, names its settings DocType, and carries a description, docs link, logo and reusable_checkout. Full suite passes locally.

🤖 Generated with Claude Code

ishad05 and others added 2 commits October 12, 2026 22:34
A consumer building a gateway settings screen had to keep its own list of
gateways, with each one's description, docs link and settings DocType, so
every new gateway meant a change in each consumer.

- api.get_gateways() returns a GatewayInfo (name, settings_doctype,
  description, docs_url, capabilities, logos) for every gateway Settings
  Single on the site, enabled or not, including another app's gateways.
- The contract gains description, docs_url and capabilities class
  attributes. REUSABLE_CHECKOUT says the checkout link stays payable after
  the shopper leaves it.
- Razorpay, Stripe, Telr and Tabby describe themselves.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A tuple of capability strings and a constant carried one flag that nothing
in this app reads. reusable_checkout: bool says the same on the contract
and on GatewayInfo.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ishad05 ishad05 mentioned this pull request Oct 14, 2026
7 tasks done
get_gateways imported every `% Gateway Settings` controller, so one
DocType left behind by a removed app, or by code on another branch,
raised ImportError and broke every screen that lists gateways, such as
a storefront checkout. It is now skipped and logged to the file log.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

1 participant