-
Notifications
You must be signed in to change notification settings - Fork 7
feat: add platform fee support to payment routes and sections #77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughThe changes introduce the handling and display of a platform fee in the payment flow. Platform fee information is retrieved from the backend, passed through server and client layers, and rendered in the UI within payment route components. Server-side payment endpoints are updated to include platform fee parameters in their requests. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant UI (PaymentSection)
participant UI (PaymentRoute)
participant Server (invoice/payment routers)
participant Payment API
User->>UI (PaymentSection): Initiate payment flow
UI (PaymentSection)->>Server (invoice router): getPaymentRoutes()
Server (invoice router)->>Payment API: GET /paymentRoutes?feePercentage&feeAddress
Payment API-->>Server (invoice router): { routes, platformFee }
Server (invoice router)-->>UI (PaymentSection): { routes, platformFee }
UI (PaymentSection)->>UI (PaymentRoute): Render route with platformFee prop
UI (PaymentRoute)-->>User: Display route info incl. platform fee
User->>UI (PaymentSection): Select and submit payment
UI (PaymentSection)->>Server (payment router): pay() or batchPay() with feePercentage & feeAddress
Server (payment router)->>Payment API: POST pay request with fee params
Payment API-->>Server (payment router): Payment result
Server (payment router)-->>UI (PaymentSection): Payment result
Suggested reviewers
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
⏰ Context from checks skipped due to timeout of 90000ms (1)
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 4
🧹 Nitpick comments (2)
src/components/payment-route.tsx (2)
17-20: Consider the usage of theaddressproperty.The
platformFee.addressproperty is defined in the interface but not used in the component's display logic. If this property is intended for future use, consider adding a comment explaining its purpose. Otherwise, consider removing it to keep the interface lean.
128-134: Simplify the conditional check and approve the display logic.The platform fee display implementation looks good overall. Consider simplifying the conditional check for better readability:
- {platformFee?.percentage && platformFee?.percentage > 0 && ( + {(platformFee?.percentage ?? 0) > 0 && (The styling with purple color is consistent with the existing design patterns, and the placement below the speed information maintains good UI hierarchy.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
src/components/payment-route.tsx(3 hunks)src/components/payment-section.tsx(4 hunks)src/lib/types/index.ts(1 hunks)src/server/routers/invoice.ts(3 hunks)src/server/routers/payment.ts(2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (2)
- GitHub Check: Build
- GitHub Check: Lint
🔇 Additional comments (7)
src/lib/types/index.ts (1)
9-9: LGTM! Clean type definition for platform fee support.The optional
platformFeeproperty is well-defined and maintains backward compatibility.src/components/payment-section.tsx (3)
124-124: Good variable naming improvement.Renaming to
paymentRoutesDatabetter reflects that this contains the full API response, not just the routes array.
137-138: Clean data extraction pattern.Properly destructures the API response to separate routes and platform fee data for downstream usage.
593-593: Consistent prop passing for platform fee display.The
platformFeeprop is consistently passed to both the selected route preview and the route options list.Also applies to: 610-610
src/server/routers/invoice.ts (2)
301-301: Good cleanup of redundant variable declaration.Removing the redundant
constdeclaration properly reuses the previously declared variable.
394-397: Well-structured return format for platform fee support.The updated return structure properly separates routes and platform fee data, maintaining backward compatibility while adding the new functionality.
src/components/payment-route.tsx (1)
29-29: LGTM!The prop destructuring is correctly implemented and consistent with the interface changes.
|
As discussed at the Tech Daily, make sure that the displayed fee includes Platform fee. It should be returned by the API, ideally. |
|
@MantisClone I am trying to implement the platform fee for easyinvoice in the api side but the Fee in the API is on ETH and platformFee can be on USDC for instance. I don’t think we should sum them up as it would require some external exchange rate. |
|
Please display the Crosschain and Platform fees separately.
|
It is already doing it. @MantisClone could you re-review it? |
bassgeta
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.

Changes
Summary by CodeRabbit