Repository navigation
fix(shopping): preserve API payment descriptions - #347
Merged
Merged
Conversation
sswaminathan-godaddy
requested review from
axburgess-godaddy,
jpage-godaddy,
jpearlman-godaddy,
mguerrero3-godaddy,
qcai-godaddy and
rts1-godaddy
as code owners
October 22, 2026 18:14
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The focused changes match the documented behavior, include relevant regression coverage, and have no unresolved findings.
No open issues 🎉
What changed in this PR
Preserves API-provided payment descriptions in the Shopping client so checkout JSON and human output retain saved-payment labels without exposing additional card or expiry fields.
Changes:
- Adds
rich_text_descriptionto schema normalization and the vendored payment-instrument schema. - Shows the selected payment in human completion output only when the completion response explicitly marks an instrument as selected.
- Keeps descriptions out of checkout update requests and adds regression coverage for preservation, rendering, and omission behavior.
| File | Description |
|---|---|
rust/tools/generate-api-catalog/src/shopping_spec.rs |
Preserves payment descriptions during schema normalization and tests the schema fields. |
rust/src/shopping/human.rs |
Renders selected completion payments and tests typed responses and fallback behavior. |
rust/src/shopping/common.rs |
Excludes display descriptions from rebuilt payment update bodies and verifies omission. |
rust/shopping-client/openapi/shopping.oas3.json |
Adds the payment description field to the vendored schema. |
Review effort: Balanced
jpage-godaddy
approved these changes
Oct 22, 2026
jpage-godaddy
left a comment
Collaborator
There was a problem hiding this comment.
Approved if rich_text_description isn't actually some encoded "rich text" format and it's actually something we can legitimately serve up from the CLI.
Collaborator
|
Sounds like we have some non-user-friendly display for the credit card; that can be fixed at the API level. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Checkout payment labels returned by the API were discarded by the generated client, leaving JSON without descriptions and human output showing "Saved payment method". Preserve
rich_text_descriptionin the Shopping schema normalization and vendored client schema so checkout create/get/update display the API-provided label. No additional card or expiry fields are exposed.The human completion summary now reads the completion API response's
payment.instrumentsarray and uses the first entry whoseselectedfield istrue. Itsrich_text_descriptionsupplies the label and itsididentifies the instrument. For example:{ "payment": { "instruments": [ { "id": "payment-1", "selected": true, "rich_text_description": "CREDIT_CARD/VISA 4242" } ] } }This produces
Selected payment: CREDIT_CARD/VISA 4242 (ID: payment-1)in human completion output. If the selected instrument has no description, the label falls back toSaved payment method. If the response has no instrument marked selected, the completion summary omits the payment line. It does not infer which method was charged from the earlier checkout. JSON output retains the API's nestedpayment.instruments[].rich_text_description; the human summary'sselected_paymentfield does not change the JSON response shape.In
common.rs, the rebuilt payment instrument uses defaults for the new description field so display text is not echoed into checkout update requests. Instrument ID, selection, billing address, handler ID, and type continue to be preserved. The existing request test now verifies that an API-supplied description is omitted from the update body.Validation:
cargo check --workspacecargo clippy --workspace -- -D warningscargo test --workspace(passed after allowing localhost mock sockets)cargo fmt --check./rust/scripts/check-module-size.shcargo run -- --helpshopping order get --waitreturned the order with its item processing.Known limitation: the live completion output did not include the selected payment. This change renders it only when
payment.instruments[]in the completion response contains an entry withselected: true.