docs(ack-pay): document receipt evidence metadata#95
Conversation
WalkthroughThis PR documents optional receipt evidence metadata as a non-normative extension point in ACK payment receipts, allowing implementers to link receipts to policy, mandate, and execution references without modifying the core credential format. Includes test setup improvements and a new test confirming metadata preservation through signing and verification. ChangesReceipt Evidence Metadata Feature
🎯 2 (Simple) | ⏱️ ~12 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint skipped: no ESLint configuration detected in root package.json. To enable, add Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (2)
packages/ack-pay/src/verify-payment-receipt.test.ts (2)
117-120: ⚡ Quick winUse derived
paymentOptionIdinstead of a hardcoded literal.This test now bypasses the setup’s dynamic fixture derivation by pinning
"test-payment-option-id". Reusing a derived id keeps the round-trip test resilient to fixture changes.♻️ Proposed change
const receiptWithMetadata = createPaymentReceipt({ paymentRequestToken, - paymentOptionId: "test-payment-option-id", + paymentOptionId: unsignedReceipt.credentialSubject.paymentOptionId, issuer: receiptIssuerDid,🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/ack-pay/src/verify-payment-receipt.test.ts` around lines 117 - 120, The test uses a hardcoded paymentOptionId string when calling createPaymentReceipt; replace that literal with the dynamically derived id from the test fixture/setup (the variable used earlier in the test setup, e.g. paymentOption.id or derivedPaymentOptionId) so createPaymentReceipt({ paymentRequestToken, paymentOptionId: <use-derived-id>, issuer: receiptIssuerDid }) uses the actual fixture-derived id and preserves round-trip resilience.
105-105: ⚡ Quick winRename the test to match the required assertive naming pattern.
Use one of the approved prefixes (e.g.,
returns) for consistency with test conventions.✏️ Proposed rename
- it("preserves receipt metadata through JWT verification", async () => { + it("returns receipt metadata through JWT verification", async () => {As per coding guidelines, "Use assertive test names with patterns:
it(\"creates...\"),it(\"throws...\"),it(\"requires...\"),it(\"returns...\")".🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/ack-pay/src/verify-payment-receipt.test.ts` at line 105, The test currently named "preserves receipt metadata through JWT verification" should be renamed to follow the assertive naming convention (use an approved prefix such as "returns"); update the it(...) description string in the test definition so it begins with "returns" (for example: "returns receipt metadata after JWT verification") to match the project's required assertive test-name pattern and keep the same test body and assertions in verify-payment-receipt.test.ts.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@packages/ack-pay/src/verify-payment-receipt.test.ts`:
- Around line 117-120: The test uses a hardcoded paymentOptionId string when
calling createPaymentReceipt; replace that literal with the dynamically derived
id from the test fixture/setup (the variable used earlier in the test setup,
e.g. paymentOption.id or derivedPaymentOptionId) so createPaymentReceipt({
paymentRequestToken, paymentOptionId: <use-derived-id>, issuer: receiptIssuerDid
}) uses the actual fixture-derived id and preserves round-trip resilience.
- Line 105: The test currently named "preserves receipt metadata through JWT
verification" should be renamed to follow the assertive naming convention (use
an approved prefix such as "returns"); update the it(...) description string in
the test definition so it begins with "returns" (for example: "returns receipt
metadata after JWT verification") to match the project's required assertive
test-name pattern and keep the same test body and assertions in
verify-payment-receipt.test.ts.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 5eca1f7f-3435-4c22-9f47-c11fee350a36
📒 Files selected for processing (2)
docs/ack-pay/receipt-verification.mdxpackages/ack-pay/src/verify-payment-receipt.test.ts
Summary
Fixes #92
Verification
Summary by CodeRabbit
Documentation
Tests