Skip to content

[TASK-15250] feat(manteca): add receipts to all manteca transactions#1257

Merged
jjramirezn merged 3 commits intofeat/manteca-integrationfrom
feat/manteca-receipts
Sep 29, 2025
Merged

[TASK-15250] feat(manteca): add receipts to all manteca transactions#1257
jjramirezn merged 3 commits intofeat/manteca-integrationfrom
feat/manteca-receipts

Conversation

@jjramirezn
Copy link
Contributor

WhatsApp.Video.2025-09-27.at.01.09.27.mp4

@vercel
Copy link

vercel bot commented Sep 27, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
peanut-wallet Ready Ready Preview Comment Sep 29, 2025 5:44pm

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 27, 2025

Walkthrough

Adds centralized history types and normalization, a server action to fetch single history entries, a receipt page with public view support, MantEca deposit UI and cancellation flow, MantEca constants, and related hooks, transformers, utils, and a NotFound page.

Changes

Cohort / File(s) Summary
History utils & fetching
src/utils/history.utils.ts, src/app/actions/history.ts, src/hooks/useTransactionHistory.ts
Add typed history enums/types, FINAL_STATES, getReceiptUrl, completeHistoryEntry; add server action getHistoryEntry(entryId, entryType) with error handling; refactor hook to re-export and use centralized types and completeHistoryEntry.
Receipt routing & 404
src/app/receipt/[entryId]/page.tsx, src/app/not-found.tsx
Add server component receipt page that validates params/searchParams, fetches history entry, awaits connection for non-final entries, maps transaction data and renders receipt; add NotFound page component.
Transaction details & transformer
src/components/TransactionDetails/TransactionDetailsReceipt.tsx, src/components/TransactionDetails/transaction-details.utils.ts, src/components/TransactionDetails/transactionTransformer.ts
Add isPublic?: boolean prop; switch avatar resolution to getAvatarUrl; unify currency formatting; add MantEca-specific UI (deposit rows, QR/share visibility, cancellation flow) and new mantecaDepositInfo row key; extend TransactionDetails.extraDataForDrawer.receipt with optional depositDetails.
MantEca constants, UI & API
src/constants/manteca.consts.ts, src/components/AddMoney/components/MantecaDepositShareDetails.tsx, src/services/manteca.ts
Add MANTECA_ARG_DEPOSIT_NAME, MANTECA_ARG_DEPOSIT_CUIT, add depositAddressLabel to country config entries; use config/constants in share details component; add mantecaApi.cancelDeposit(depositId) API method with error handling.
General utilities
src/utils/general.utils.ts
Add formatCurrency(valueStr?: string): string delegating to standardized number formatting.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

Suggested reviewers

  • Zishan-7

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Description Check ❓ Inconclusive The PR description contains only a GitHub asset URL (a video/image attachment) and lacks any textual explanation of the changes. While the video may demonstrate the receipt functionality being added, the description itself is extremely minimal. However, since this is a lenient check that passes as long as the description is not completely off-topic, and the video attachment is likely related to demonstrating the Manteca receipt feature (as suggested by the PR title), the description can be considered tangentially related to the changeset rather than completely unrelated or off-topic. The description would benefit from adding textual context explaining what the receipts feature does, which Manteca transaction types are affected, and what the video demonstrates. Consider adding a brief summary such as "Adds public receipt pages for Manteca deposit transactions with support for sharing, QR codes, and country-specific deposit information display" to provide reviewers with immediate context without requiring them to watch the video.
✅ Passed checks (1 passed)
Check name Status Explanation
Title Check ✅ Passed The PR title "[TASK-15250] feat(manteca): add receipts to all manteca transactions" accurately describes the main change in this pull request. The changeset introduces a comprehensive receipt system for Manteca transactions, including a new receipt page route (src/app/receipt/[entryId]/page.tsx), a getHistoryEntry server action to fetch individual transactions, enhanced TransactionDetailsReceipt component with public receipt support, MantEca-specific deposit information display, receipt URL generation via getReceiptUrl, and extensive refactoring of history utilities to support the receipt feature. The title clearly conveys that receipts are being added to Manteca transactions, which is the primary objective of these changes.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/manteca-receipts

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between cd4e5ab and bea193a.

📒 Files selected for processing (2)
  • src/app/receipt/[entryId]/page.tsx (1 hunks)
  • src/components/AddMoney/components/MantecaDepositShareDetails.tsx (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/app/receipt/[entryId]/page.tsx
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-08-14T14:42:54.411Z
Learnt from: Zishan-7
PR: peanutprotocol/peanut-ui#1094
File: src/utils/withdraw.utils.ts:181-191
Timestamp: 2025-08-14T14:42:54.411Z
Learning: The countryCodeMap in src/components/AddMoney/consts/index.ts uses uppercase 3-letter country codes as keys (like 'AUT', 'BEL', 'CZE') that map to 2-letter country codes, requiring input normalization to uppercase for proper lookups.

Applied to files:

  • src/components/AddMoney/components/MantecaDepositShareDetails.tsx
🧬 Code graph analysis (1)
src/components/AddMoney/components/MantecaDepositShareDetails.tsx (1)
src/constants/manteca.consts.ts (3)
  • MANTECA_COUNTRIES_CONFIG (67-118)
  • MANTECA_ARG_DEPOSIT_NAME (3-3)
  • MANTECA_ARG_DEPOSIT_CUIT (4-4)
🔇 Additional comments (3)
src/components/AddMoney/components/MantecaDepositShareDetails.tsx (3)

13-17: LGTM!

The new imports cleanly centralize MantEca configuration, improving maintainability.


48-49: Good defensive guard.

The null check for currentCountryDetails prevents runtime errors if the country lookup fails, and the config-based lookup with fallback ensures a sensible default label is always returned.


121-122: LGTM!

Replacing hardcoded AR-specific values with constants improves maintainability and ensures consistency across the codebase.


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.

❤️ Share

Tip

🧪 Early access (models): enabled

We are currently testing Sonnet 4.5 code review models, which should lead to better review quality. However, this model may result in higher noise levels in the review comments. Please disable the early access features if the noise level causes any inconvenience.

Note:

  • Public repositories are always opted into early access features.
  • You can enable or disable early access features from the CodeRabbit UI or by updating the CodeRabbit configuration file.

Comment @coderabbitai help to get the list of available commands and usage tips.

@jjramirezn jjramirezn changed the title feat(manteca): add receipts to all manteca transactions [TASK-15250] feat(manteca): add receipts to all manteca transactions Sep 27, 2025
@notion-workspace
Copy link

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/components/TransactionDetails/transaction-details.utils.ts (1)

22-39: Insert mantecaDepositInfo into the render order

TransactionDetailsReceipt.tsx iterates over transactionDetailsRowKeys to decide which rows to render and in which order. Because the newly added 'mantecaDepositInfo' key isn’t part of this array, that row will never appear, so the MantEca deposit details you surface elsewhere won’t show up in the receipt. Please add the new key to the array (wherever it should render relative to the other rows).

     'transferId',
     'depositInstructions',
+    'mantecaDepositInfo',
     'peanutFee',
🧹 Nitpick comments (2)
src/app/receipt/[entryId]/page.tsx (1)

12-17: Drop the promise wrapper around route params/searchParams.

App Router hands these in as plain objects, so typing them as Promise<...> and await‑ing only obscures the real shape and forces extra async churn.

-}: {
-    params: Promise<{ entryId: string }>
-    searchParams: Promise<Record<string, string | string[] | undefined>>
-}) {
-    const { entryId } = await params
-    let entryTypeId = (await searchParams).t
+}: {
+    params: { entryId: string }
+    searchParams: Record<string, string | string[] | undefined>
+}) {
+    const { entryId } = params
+    const entryTypeId = searchParams.t
src/components/TransactionDetails/TransactionDetailsReceipt.tsx (1)

33-38: Avoid pulling the full AddMoney country dataset into the receipt drawer.
Importing countryData brings the entire AddMoney catalog (hundreds of entries) into a component that renders for every transaction drawer, just to derive labels for three MantEca currencies. That extra payload hits every client bundle. Please keep the MantEca currency→country mapping local (e.g., extend MANTECA_COUNTRIES_CONFIG with currency metadata or define a tiny map here) and drop this heavyweight import.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7d2cf63 and cd4e5ab.

📒 Files selected for processing (12)
  • src/app/actions/history.ts (1 hunks)
  • src/app/not-found.tsx (1 hunks)
  • src/app/receipt/[entryId]/page.tsx (1 hunks)
  • src/components/AddMoney/components/MantecaDepositShareDetails.tsx (3 hunks)
  • src/components/TransactionDetails/TransactionDetailsReceipt.tsx (11 hunks)
  • src/components/TransactionDetails/transaction-details.utils.ts (1 hunks)
  • src/components/TransactionDetails/transactionTransformer.ts (1 hunks)
  • src/constants/manteca.consts.ts (3 hunks)
  • src/hooks/useTransactionHistory.ts (2 hunks)
  • src/services/manteca.ts (1 hunks)
  • src/utils/general.utils.ts (1 hunks)
  • src/utils/history.utils.ts (2 hunks)
🧰 Additional context used
🧠 Learnings (3)
📚 Learning: 2025-08-14T14:42:54.411Z
Learnt from: Zishan-7
PR: peanutprotocol/peanut-ui#1094
File: src/utils/withdraw.utils.ts:181-191
Timestamp: 2025-08-14T14:42:54.411Z
Learning: The countryCodeMap in src/components/AddMoney/consts/index.ts uses uppercase 3-letter country codes as keys (like 'AUT', 'BEL', 'CZE') that map to 2-letter country codes, requiring input normalization to uppercase for proper lookups.

Applied to files:

  • src/constants/manteca.consts.ts
  • src/components/AddMoney/components/MantecaDepositShareDetails.tsx
📚 Learning: 2024-10-22T18:11:36.864Z
Learnt from: jjramirezn
PR: peanutprotocol/peanut-ui#469
File: src/app/request/pay/page.tsx:32-49
Timestamp: 2024-10-22T18:11:36.864Z
Learning: In `src/app/request/pay/page.tsx`, the `id` parameter is accessed via `searchParams.id` in the `generateMetadata` function.

Applied to files:

  • src/app/receipt/[entryId]/page.tsx
📚 Learning: 2025-05-15T14:47:26.891Z
Learnt from: jjramirezn
PR: peanutprotocol/peanut-ui#857
File: src/hooks/useWebSocket.ts:77-82
Timestamp: 2025-05-15T14:47:26.891Z
Learning: The useWebSocket hook in src/hooks/useWebSocket.ts is designed to provide raw history entries, while the components using it (such as HomeHistory.tsx) are responsible for implementing deduplication logic based on UUID to prevent duplicate entries when combining WebSocket data with other data sources.

Applied to files:

  • src/hooks/useTransactionHistory.ts
🧬 Code graph analysis (7)
src/app/actions/history.ts (3)
src/utils/history.utils.ts (2)
  • HistoryEntry (81-122)
  • completeHistoryEntry (186-259)
src/utils/sentry.utils.ts (1)
  • fetchWithSentry (26-104)
src/constants/general.consts.ts (1)
  • PEANUT_API_URL (43-47)
src/components/AddMoney/components/MantecaDepositShareDetails.tsx (1)
src/constants/manteca.consts.ts (3)
  • MANTECA_COUNTRIES_CONFIG (67-118)
  • MANTECA_ARG_DEPOSIT_NAME (3-3)
  • MANTECA_ARG_DEPOSIT_CUIT (4-4)
src/utils/history.utils.ts (3)
src/components/TransactionDetails/transactionTransformer.ts (1)
  • TransactionDetails (34-121)
src/utils/general.utils.ts (3)
  • getFromLocalStorage (112-134)
  • getTokenDetails (997-1009)
  • formatAmount (390-430)
src/constants/zerodev.consts.ts (1)
  • PEANUT_WALLET_TOKEN_DECIMALS (19-19)
src/services/manteca.ts (3)
src/types/manteca.types.ts (1)
  • MantecaDepositResponseData (3-56)
src/utils/sentry.utils.ts (1)
  • fetchWithSentry (26-104)
src/constants/general.consts.ts (1)
  • PEANUT_API_URL (43-47)
src/app/receipt/[entryId]/page.tsx (4)
src/utils/history.utils.ts (2)
  • historyTypeFromNumber (26-28)
  • isFinalState (124-126)
src/app/actions/history.ts (1)
  • getHistoryEntry (20-42)
src/components/TransactionDetails/transactionTransformer.ts (1)
  • mapTransactionDataForDrawer (140-506)
src/components/TransactionDetails/TransactionDetailsReceipt.tsx (1)
  • TransactionDetailsReceipt (42-1153)
src/components/TransactionDetails/TransactionDetailsReceipt.tsx (7)
src/components/AddMoney/consts/index.ts (1)
  • countryData (288-2456)
src/utils/general.utils.ts (1)
  • formatCurrency (378-380)
src/utils/history.utils.ts (2)
  • getAvatarUrl (146-160)
  • getReceiptUrl (128-144)
src/components/Payment/PaymentInfoRow.tsx (1)
  • PaymentInfoRow (17-83)
src/constants/manteca.consts.ts (3)
  • MANTECA_COUNTRIES_CONFIG (67-118)
  • MANTECA_ARG_DEPOSIT_NAME (3-3)
  • MANTECA_ARG_DEPOSIT_CUIT (4-4)
src/services/manteca.ts (1)
  • mantecaApi (95-261)
src/constants/query.consts.ts (1)
  • TRANSACTIONS (2-2)
src/hooks/useTransactionHistory.ts (1)
src/utils/history.utils.ts (1)
  • completeHistoryEntry (186-259)
🔇 Additional comments (1)
src/components/AddMoney/components/MantecaDepositShareDetails.tsx (1)

47-50: Solid reuse of the country config for the deposit label.

Pulling the label from MANTECA_COUNTRIES_CONFIG keeps every locale aligned and gives us a safe fallback. Nice touch.

Copy link
Contributor

@kushagrasarathe kushagrasarathe left a comment

Choose a reason for hiding this comment

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

@jjramirezn left qn, one blocking change, and also resolve cr comment please

Copy link
Contributor

@kushagrasarathe kushagrasarathe left a comment

Choose a reason for hiding this comment

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

lesss gooooo

@jjramirezn jjramirezn merged commit 0724b07 into feat/manteca-integration Sep 29, 2025
4 checks passed
This was referenced Oct 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants