Skip to content

fix: unwrap payment payload in order_test update requests - #69

Merged
damaz91 merged 1 commit into
Universal-Commerce-Protocol:mainfrom
XiaolongZhang-TT:fix/order-test-payment-payload
Jul 30, 2026
Merged

fix: unwrap payment payload in order_test update requests#69
damaz91 merged 1 commit into
Universal-Commerce-Protocol:mainfrom
XiaolongZhang-TT:fix/order-test-payment-payload

Conversation

@XiaolongZhang-TT

Copy link
Copy Markdown
Contributor

Description

integration_test_utils.get_valid_payment_payload() returns the full request body {"payment": {...}, "risk_signals": {}}, not just the payment object. Two update_checkout payloads in order_test.py assigned this whole dict to the "payment" key, producing:

  • a double-nested payment.payment.instruments (the actual instruments buried one level too deep)
  • a stray risk_signals field inside the payment object

As a result the server would see an empty/missing instruments list on these updates. The tests currently pass only because the sample server tolerates a missing instruments list on a checkout update that doesn't change payment — a stricter server that validates the payment object on update would fail. Every other call site in the suite uses the helper correctly (as the whole body), so this is the inconsistency.

Fix: extract ["payment"] so the payload matches the contract used everywhere else.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected, including removal of schema files or fields)
  • Documentation update

Is this a Breaking Change or Removal?

N/A — test-only fix, no schema/field removal.

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation (N/A — test-only fix)
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

🤖 Generated with Claude Code

@google-cla

google-cla Bot commented Jul 29, 2026

Copy link
Copy Markdown

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.

@XiaolongZhang-TT
XiaolongZhang-TT force-pushed the fix/order-test-payment-payload branch from e320eea to 210def0 Compare July 29, 2026 13:31
get_valid_payment_payload() returns {"payment": {...}, "risk_signals": {}}
(the full request body), but two update_checkout payloads in order_test.py
assigned the whole dict to the "payment" key, producing a double-nested
payment.payment.instruments and a stray risk_signals field. This would fail
against a server that strictly validates the payment object on update.

Extract ["payment"] so the payload matches the contract used by every other
call site.
@XiaolongZhang-TT
XiaolongZhang-TT force-pushed the fix/order-test-payment-payload branch from 210def0 to db76911 Compare July 29, 2026 13:42
@XiaolongZhang-TT
XiaolongZhang-TT marked this pull request as ready for review July 29, 2026 13:53
@damaz91 damaz91 added the status:needs-triage Signal that the PR is ready for human triage label Jul 29, 2026

@damaz91 damaz91 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Reviewed the changes. The fix correctly prevents the double-nested payment payload on checkout update in the two order tests, matching the API schema contract. Confirmed conformance tests pass locally.

@damaz91 damaz91 added status:under-review and removed status:needs-triage Signal that the PR is ready for human triage labels Jul 30, 2026
@damaz91
damaz91 merged commit e25d2cb into Universal-Commerce-Protocol:main Jul 30, 2026
17 checks passed
@XiaolongZhang-TT
XiaolongZhang-TT deleted the fix/order-test-payment-payload branch July 31, 2026 04:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants