Skip to content

fix: correct v2 receipt parsing and trim trailing zeros in confirm dialog#104

Open
samarthpatel24 wants to merge 1 commit into
stripe:mainfrom
samarthpatel24:fix/cli-payment-display
Open

fix: correct v2 receipt parsing and trim trailing zeros in confirm dialog#104
samarthpatel24 wants to merge 1 commit into
stripe:mainfrom
samarthpatel24:fix/cli-payment-display

Conversation

@samarthpatel24

Copy link
Copy Markdown

Summary

  • Pass actual x402_version to display_settlement_info instead of hardcoded 1, so v2 receipts are found in
    the correct header
  • Trim trailing zeros in --confirm dialog ("0.010000 USDC" → "0.01 USDC")
// receipt fix
-  protocol.parse_receipt_json(response, 1)
+  protocol.parse_receipt_json(response, version)

// trailing zeros fix
-  format!("{whole}.{frac:0>width$} {symbol}", ...)
+  let trimmed = frac_str.trim_end_matches('0');
+  format!("{whole}.{trimmed} {symbol}")

Test plan

  • cargo check passes

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