Skip to content

fix: validate payment handler structure from profile instead of hardcoded list#33

Open
sbeashwar wants to merge 1 commit intoUniversal-Commerce-Protocol:mainfrom
sbeashwar:pr2-handler-validation
Open

fix: validate payment handler structure from profile instead of hardcoded list#33
sbeashwar wants to merge 1 commit intoUniversal-Commerce-Protocol:mainfrom
sbeashwar:pr2-handler-validation

Conversation

@sbeashwar
Copy link
Copy Markdown

Description

Replaces hardcoded expected handler IDs (google_pay, mock_payment_handler, shop_pay) in protocol_test.py with structural validation that discovers handlers from the business profile.

The current test assumes the Flower Shop's specific handlers are present, which means any non-Flower-Shop merchant fails the protocol conformance test. This change makes the test server-agnostic.

Changes

  • Discovers payment handlers dynamically from the business profile
  • Validates required fields (id, version) are present on each handler
  • Validates handler group names follow reverse-DNS naming convention
  • Removes Shop Pay-specific config assertions

Depends on

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • My changes generate no new warnings
  • New and existing unit tests pass locally with my changes

@sbeashwar sbeashwar requested review from a team as code owners April 17, 2026 23:40
@google-cla
Copy link
Copy Markdown

google-cla Bot commented Apr 17, 2026

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@sbeashwar
Copy link
Copy Markdown
Author

@cusell-google gentle ping - this is a small, focused change ready for review when you have time.

Copy link
Copy Markdown
Contributor

@cusell-google cusell-google left a comment

Choose a reason for hiding this comment

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

Thanks @sbeashwar for the recent PRs and improvements!

Comment thread protocol_test.py Outdated
Comment thread protocol_test.py Outdated
…oded list

Replace hardcoded expected handler IDs (google_pay, mock_payment_handler,
shop_pay) with structural validation that:
- Discovers handlers from the business profile dynamically
- Validates required fields (id, version) are present
- Validates handler group names follow reverse-DNS convention
- Works against any UCP merchant, not just the Flower Shop

This makes the protocol conformance tests server-agnostic.

Addresses Universal-Commerce-Protocol#13
@sbeashwar sbeashwar force-pushed the pr2-handler-validation branch from f5f1357 to 4c32e19 Compare April 24, 2026 15:40
@cusell-google cusell-google self-requested a review April 24, 2026 16:28
@sbeashwar
Copy link
Copy Markdown
Author

@archrao friendly bump when you have a moment

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