-
Notifications
You must be signed in to change notification settings - Fork 7
feat: integrate cross-chain payment into EasyInvoice #42
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
Merged
aimensahnoun
merged 20 commits into
main
from
36-easyinvoice---integrate-payment-routes-and-crosschain-payments
Mar 25, 2025
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
ecccfb0
feat: Add payment route selection component and associated logos
aimensahnoun cc4d7c1
fix: Set initial status to pending for new payment requests in webhook
aimensahnoun 9cced5f
feat: Allow decimal values for price input in invoice form
aimensahnoun f9a6c3e
refactor: Update price formatting to use string conversion for consis…
aimensahnoun 59ac7d0
feat: Add USDC-base currency to invoice and payment options
aimensahnoun be01eed
feat: Enhance payment route component with dynamic route types and ba…
aimensahnoun b2b1023
feat: Implement payment intent handling and network switching in paym…
aimensahnoun 8005847
feat: Add alert for mainnet currency selection in invoice form and im…
aimensahnoun b8967c9
feat: Add warning for real cryptocurrency transactions in payment sec…
aimensahnoun 36b72ad
Merge branch 'main' of github.com:RequestNetwork/easy-invoice into 36…
aimensahnoun 53214e9
feat: Update payment route component to include native token handling…
aimensahnoun bc16ae5
Merge branch 'main' into 36-easyinvoice---integrate-payment-routes-an…
aimensahnoun b8fe2ca
Merge branch '36-easyinvoice---integrate-payment-routes-and-crosschai…
aimensahnoun 34e1fdb
feat: Enhance payment processing flow with improved status handling a…
aimensahnoun b56659f
feat: Integrate invoice number generation and count retrieval in webh…
aimensahnoun 700fd7a
feat: Replace request logo with sepolia logo and update payment inten…
aimensahnoun 91d0bd4
Merge branch 'main' into 36-easyinvoice---integrate-payment-routes-an…
aimensahnoun 7c7a783
feat: Refactor payment handling by introducing separate functions for…
aimensahnoun ab17f7c
fix: Handle network switching errors in payment section with user not…
aimensahnoun 8f71889
Merge branch '36-easyinvoice---integrate-payment-routes-and-crosschai…
aimensahnoun File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,117 @@ | ||
| import type { PaymentRoute as PaymentRouteType } from "@/lib/types"; | ||
| import { ArrowRight, Globe, Zap } from "lucide-react"; | ||
| import Image from "next/image"; | ||
|
|
||
| interface RouteTypeInfo { | ||
| type: "direct" | "same-chain-erc20" | "cross-chain"; | ||
| label: string; | ||
| description: string; | ||
| } | ||
|
|
||
| interface PaymentRouteProps { | ||
| route: PaymentRouteType; | ||
| isSelected: boolean; | ||
| onClick?: () => void; | ||
| variant?: "default" | "selected"; | ||
| routeType?: RouteTypeInfo; | ||
| } | ||
|
|
||
| export function PaymentRoute({ | ||
| route, | ||
| isSelected, | ||
| onClick, | ||
| variant = "default", | ||
| routeType, | ||
| }: PaymentRouteProps) { | ||
| const isDirectPayment = | ||
| routeType?.type === "direct" || route.id === "REQUEST_NETWORK_PAYMENT"; | ||
| const isGasFreePayment = routeType?.type === "same-chain-erc20"; | ||
|
|
||
| const nativeToken = route.chain === "POLYGON" ? "POL" : "ETH"; | ||
|
|
||
| // Get the appropriate badge color and icon based on route type | ||
| const getBadgeStyles = () => { | ||
| if (isDirectPayment) { | ||
| return { | ||
| bgColor: "bg-blue-100", | ||
| textColor: "text-blue-700", | ||
| icon: <ArrowRight className="w-3 h-3 mr-1" />, | ||
| }; | ||
| } | ||
|
|
||
| if (isGasFreePayment) { | ||
| return { | ||
| bgColor: "bg-green-100", | ||
| textColor: "text-green-700", | ||
| icon: <Zap className="w-3 h-3 mr-1" />, | ||
| }; | ||
| } | ||
|
|
||
| return { | ||
| bgColor: "bg-purple-100", | ||
| textColor: "text-purple-700", | ||
| icon: <Globe className="w-3 h-3 mr-1" />, | ||
| }; | ||
| }; | ||
|
|
||
| const { bgColor, textColor, icon } = getBadgeStyles(); | ||
|
|
||
| return ( | ||
| <button | ||
| type="button" | ||
| onClick={onClick} | ||
| className={`w-full p-4 border rounded-lg transition-colors ${ | ||
| variant === "selected" | ||
| ? "border-2 border-black bg-zinc-50" | ||
| : isSelected | ||
| ? "bg-zinc-50 border-black" | ||
| : "bg-white hover:border-zinc-400" | ||
| }`} | ||
| > | ||
| <div className="flex items-center justify-between"> | ||
| <div className="flex items-center space-x-3"> | ||
| <div className="w-8 h-8 relative flex items-center justify-center"> | ||
| <Image | ||
| src={`/${route.chain.toLowerCase()}-logo.png`} | ||
| alt={`${route.chain} logo`} | ||
| width={32} | ||
| height={32} | ||
| className="object-contain" | ||
| /> | ||
| </div> | ||
| <div className="text-left"> | ||
| <div className="font-medium flex items-center gap-2"> | ||
| <span> | ||
| {route.chain} {route.token} | ||
| </span> | ||
| <span | ||
| className={`text-xs ${bgColor} ${textColor} px-2 py-0.5 rounded-full flex items-center`} | ||
| > | ||
| {icon} | ||
| {routeType?.label || | ||
| (isDirectPayment ? "Direct Payment" : "via Paygrid")} | ||
| </span> | ||
| </div> | ||
| <div className="text-sm text-zinc-600"> | ||
| {routeType?.description || `via ${route.token}`} | ||
| </div> | ||
| </div> | ||
| </div> | ||
| <div className="text-right"> | ||
| <div className="font-medium"> | ||
| {route.fee === 0 ? ( | ||
| "No fee" | ||
| ) : ( | ||
| <span className="text-amber-700"> | ||
| {route.fee} {isDirectPayment ? nativeToken : route.token} fee | ||
| </span> | ||
| )} | ||
| </div> | ||
| <div className="text-sm text-zinc-600"> | ||
| {typeof route.speed === "number" ? `~${route.speed}s` : "Fast"} | ||
| </div> | ||
| </div> | ||
| </div> | ||
| </button> | ||
| ); | ||
| } |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.