-
Notifications
You must be signed in to change notification settings - Fork 7
feat: integrate Request API with Easy Invoice #2
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 34 commits into
main
from
1-request-api---integrate-request-api-into-easyinvoice
Feb 12, 2025
Merged
Changes from all commits
Commits
Show all changes
34 commits
Select commit
Hold shift + click to select a range
e1e07b8
fix: update docker-compose
aimensahnoun 2afcaed
feat: update invoice schema and add creation logic
aimensahnoun c705656
feat: update invoice schema and connect Request API
aimensahnoun 11d7d4d
refactor: update logo letters
aimensahnoun 1256700
feat: query invoices and display them in dashboard
aimensahnoun 083e818
feat: improve invoice creation flow
aimensahnoun 2f04256
refactor: optimize date and status display
aimensahnoun 5aa389b
feat: update invoice flow to use tokne-list currencies and support co…
aimensahnoun 4417d1c
feat: update payment page to use live data
aimensahnoun f84d0ce
feat: add appKit wallet to the app
aimensahnoun ada26ac
feat: add flow to make payment
aimensahnoun 73c4749
refactor: update invoice preview
aimensahnoun 8eda5c8
refactor: drop payer address
aimensahnoun 693eedf
Merge branch 'main' of github.com:RequestNetwork/easy-invoice into 1-…
aimensahnoun a7279dd
fix: resolve check errors
aimensahnoun 6b96f8d
fix: build error
aimensahnoun ca7a4e4
feat: implement webhook for updating payment status
aimensahnoun 0116989
refactor: fix dates to international format
aimensahnoun 41187f8
refactor: move invoice table to client
aimensahnoun ca86470
fix: missing await in transaction
aimensahnoun a99e1bd
chore: add metadata
aimensahnoun 27d1add
fix: update initialData
aimensahnoun 62b3ef8
refactor: update invoice-table to also include summary cards
aimensahnoun c9e07f9
refactor: mention Request Network instead of blockchain
aimensahnoun b8a5a5f
refactor: forward to dashboard instead of invoice details
aimensahnoun 2bc3827
refactor: show "invoice created" when invoice is done
aimensahnoun 810b525
docs: update README
aimensahnoun 6575304
fix: coderabbit fixes
aimensahnoun 3540840
refactor: remove unnecessary check
aimensahnoun 9860d98
refactor: update error to be more clear
aimensahnoun 77a0ead
fix: throw error if invoice not found
aimensahnoun 45bd210
chore: add database migration and generation scripts to package.json
aimensahnoun 09e626c
refactor: update local to use user's locale
aimensahnoun a2f1844
refactor: update FAU label
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
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,21 @@ | ||
| MIT License | ||
|
|
||
| Copyright (c) 2025 Request Network | ||
|
|
||
| Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| of this software and associated documentation files (the "Software"), to deal | ||
| in the Software without restriction, including without limitation the rights | ||
| to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| copies of the Software, and to permit persons to whom the Software is | ||
| furnished to do so, subject to the following conditions: | ||
|
|
||
| The above copyright notice and this permission notice shall be included in all | ||
| copies or substantial portions of the Software. | ||
|
|
||
| THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
| SOFTWARE. |
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 |
|---|---|---|
| @@ -1,36 +1,107 @@ | ||
| This is a [Next.js](https://nextjs.org) project bootstrapped with [`create-next-app`](https://nextjs.org/docs/app/api-reference/cli/create-next-app). | ||
| # Easy Invoice - Streamlined Invoice Management with Request Network | ||
|
|
||
| ## Getting Started | ||
| Easy Invoice is a modern, user-friendly web application that demonstrates the power and simplicity of creating and managing invoices using the Request Network API. Built with Next.js and modern web technologies, this application showcases how easy it is to implement crypto-powered payment solutions in your applications. | ||
|
|
||
| First, run the development server: | ||
| ## ✨ Features | ||
|
|
||
| - 🧾 **Simple Invoice Creation**: Create professional invoices in minutes | ||
| - 💰 **Crypto Payments**: Accept payments in various cryptocurrencies | ||
| - 🔄 **Real-time Updates**: Track payment status in real-time | ||
| - 🌐 **Web3 Integration**: Seamless integration with blockchain technology | ||
|
|
||
| ## 🚀 Getting Started | ||
|
|
||
| ### Prerequisites | ||
|
|
||
| - Node.js 18+ | ||
| - PostgreSQL database | ||
| - Google OAuth credentials (for authentication) | ||
| - Request Network API key | ||
| - Reown Project ID | ||
|
|
||
| ### Environment Setup | ||
|
|
||
| 1. Clone the repository: | ||
|
|
||
| ```bash | ||
| npm run dev | ||
| git clone git@github.com:RequestNetwork/easy-invoice.git | ||
| cd easy-invoice | ||
| ``` | ||
|
|
||
| 2. Copy the environment variables file: | ||
|
|
||
| ```bash | ||
| cp .env.example .env | ||
| ``` | ||
|
|
||
| 3. Fill in the required environment variables in `.env`: | ||
|
|
||
| - `DATABASE_URL`: Your PostgreSQL connection string | ||
| - `GOOGLE_CLIENT_ID` and `GOOGLE_CLIENT_SECRET`: Google OAuth credentials | ||
| - `REQUEST_API_KEY`: Your Request Network API key | ||
| - `REQUEST_API_URL`: Request Network API URL | ||
| - `NEXT_PUBLIC_REOWN_PROJECT_ID`: Your Reown project ID | ||
| - Other required environment variables as specified in `.env.example` | ||
|
|
||
| ### Installation | ||
|
|
||
| 1. Install dependencies: | ||
|
|
||
| ```bash | ||
| npm install | ||
| # or | ||
| yarn dev | ||
| yarn install | ||
| ``` | ||
|
|
||
| 2. Set up the database: | ||
|
|
||
| ```bash | ||
| # For development: | ||
| npm run db:push # Pushes schema changes directly to the database | ||
| # or | ||
| pnpm dev | ||
| yarn db:push | ||
|
|
||
| # For production: | ||
| npm run db:generate # Generates migration files based on schema changes | ||
| npm run db:migrate # Applies the generated migrations to the database | ||
| # or | ||
| bun dev | ||
| yarn db:generate | ||
| yarn db:migrate | ||
| ``` | ||
|
|
||
| 3. Start the development server: | ||
|
|
||
| ```bash | ||
| npm run dev | ||
| # or | ||
| yarn dev | ||
| ``` | ||
|
|
||
| Open [http://localhost:3000](http://localhost:3000) with your browser to see the result. | ||
| The application will be available at [http://localhost:3000](http://localhost:3000). | ||
|
|
||
| You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file. | ||
| ## 🏗️ Tech Stack | ||
|
|
||
| This project uses [`next/font`](https://nextjs.org/docs/app/building-your-application/optimizing/fonts) to automatically optimize and load [Geist](https://vercel.com/font), a new font family for Vercel. | ||
| - **Framework**: Next.js 14 with App Router | ||
| - **Authentication**: Google OAuth | ||
| - **Database**: PostgreSQL with Drizzle ORM | ||
| - **Styling**: Tailwind CSS | ||
| - **State Management**: React Query & tRPC | ||
| - **Payment Integration**: Request Network API | ||
| - **Web3**: Ethers.js & Viem | ||
|
|
||
| ## Learn More | ||
| ## 📖 Documentation | ||
|
|
||
| To learn more about Next.js, take a look at the following resources: | ||
| For more information about the technologies used: | ||
|
|
||
| - [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API. | ||
| - [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial. | ||
| - [Request Network Documentation](https://docs.request.network/) | ||
| - [Next.js Documentation](https://nextjs.org/docs) | ||
| - [tRPC Documentation](https://trpc.io/) | ||
| - [Drizzle ORM Documentation](https://orm.drizzle.team/) | ||
|
|
||
| You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js) - your feedback and contributions are welcome! | ||
| ## 🤝 Contributing | ||
|
|
||
| ## Deploy on Vercel | ||
| Contributions are welcome! Please feel free to submit a Pull Request. | ||
|
|
||
| The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js. | ||
| ## 📝 License | ||
|
|
||
| Check out our [Next.js deployment documentation](https://nextjs.org/docs/app/building-your-application/deploying) for more details. | ||
| This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. |
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 |
|---|---|---|
| @@ -1,10 +1,10 @@ | ||
| import { type Config } from "drizzle-kit"; | ||
|
|
||
| export default { | ||
| schema: "./src/server/db/schema.ts", | ||
| dialect: "postgresql", | ||
| dbCredentials: { | ||
| url: process.env.DATABASE_URL as string, | ||
| }, | ||
| tablesFilter: ["invoicepro_*"], | ||
| schema: "./src/server/db/schema.ts", | ||
| dialect: "postgresql", | ||
| dbCredentials: { | ||
| url: process.env.DATABASE_URL as string, | ||
| }, | ||
| tablesFilter: ["easyinvoice_*"], | ||
| } satisfies Config; |
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,45 @@ | ||
| CREATE TABLE IF NOT EXISTS "easyinvoice_request" ( | ||
| "id" text PRIMARY KEY NOT NULL, | ||
| "type" text NOT NULL, | ||
| "dueDate" text NOT NULL, | ||
| "issuedDate" text NOT NULL, | ||
| "clientName" text NOT NULL, | ||
| "clientEmail" text NOT NULL, | ||
| "invoiceNumber" text NOT NULL, | ||
| "items" json NOT NULL, | ||
| "notes" text, | ||
| "amount" text NOT NULL, | ||
| "invoiceCurrency" text NOT NULL, | ||
aimensahnoun marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| "paymentCurrency" text NOT NULL, | ||
| "status" text NOT NULL, | ||
| "payee" text NOT NULL, | ||
| "requestId" text NOT NULL, | ||
| "paymentReference" text NOT NULL, | ||
| "created_at" timestamp DEFAULT now(), | ||
| "userId" text NOT NULL | ||
| ); | ||
| --> statement-breakpoint | ||
| CREATE TABLE IF NOT EXISTS "easyinvoice_session" ( | ||
| "id" text PRIMARY KEY NOT NULL, | ||
| "userId" text NOT NULL, | ||
| "expires_at" timestamp with time zone NOT NULL | ||
| ); | ||
| --> statement-breakpoint | ||
| CREATE TABLE IF NOT EXISTS "easyinvoice_user" ( | ||
| "id" text PRIMARY KEY NOT NULL, | ||
| "googleId" text, | ||
| "name" text, | ||
| CONSTRAINT "easyinvoice_user_googleId_unique" UNIQUE("googleId") | ||
| ); | ||
| --> statement-breakpoint | ||
| DO $$ BEGIN | ||
| ALTER TABLE "easyinvoice_request" ADD CONSTRAINT "easyinvoice_request_userId_easyinvoice_user_id_fk" FOREIGN KEY ("userId") REFERENCES "public"."easyinvoice_user"("id") ON DELETE cascade ON UPDATE no action; | ||
| EXCEPTION | ||
| WHEN duplicate_object THEN null; | ||
| END $$; | ||
| --> statement-breakpoint | ||
| DO $$ BEGIN | ||
| ALTER TABLE "easyinvoice_session" ADD CONSTRAINT "easyinvoice_session_userId_easyinvoice_user_id_fk" FOREIGN KEY ("userId") REFERENCES "public"."easyinvoice_user"("id") ON DELETE cascade ON UPDATE no action; | ||
| EXCEPTION | ||
| WHEN duplicate_object THEN null; | ||
| END $$; | ||
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.