-
Notifications
You must be signed in to change notification settings - Fork 5
feat: google wallet #313
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
base: main
Are you sure you want to change the base?
feat: google wallet #313
Conversation
… removed console output and harded .gitignore credentials
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
Greptile Summary
This PR implements Google Wallet integration for DeltaHacks XII, enabling Android users to save their event tickets to Google Wallet alongside the existing Apple Wallet functionality. The changes introduce a new API endpoint at /api/wallet/google/[id] that generates digital wallet passes with QR codes for event check-in.
The implementation follows Google's Wallet API pattern by creating event ticket classes (templates) and individual ticket objects for each user. The system dynamically pulls user data from DH11Application records to populate pass information including names and creates QR codes that link to user profiles. The integration requires three new environment variables for Google Cloud service account authentication and wallet configuration.
On the frontend, the profile page now displays both Apple and Google Wallet "Add to Wallet" buttons, providing a complete mobile wallet experience across platforms. The backend leverages the googleapis library for API interactions and jsonwebtoken for generating the JWT tokens required by Google's "Save to Google Pay" flow.
The changes maintain the existing application architecture while extending wallet functionality to support both major mobile platforms, ensuring DeltaHacks attendees can use their preferred digital wallet solution.
Important Files Changed
Changed Files
| Filename | Score | Overview |
|---|---|---|
| src/app/api/wallet/google/[id]/route.ts | 2/5 | New Google Wallet API endpoint with security and data accuracy issues |
| src/pages/profile/[[...slug]].tsx | 3/5 | Added Google Wallet button to profile page with potential UI layout issues |
| package.json | 3/5 | Added Google APIs and JWT dependencies for wallet integration |
| src/env/schema.mjs | 5/5 | Added three optional environment variables for Google Wallet configuration |
| src/utils/assert.ts | 5/5 | New TypeScript assertion utility for runtime validation with type safety |
| .gitignore | 5/5 | Added exclusions for Google service key files and temporary directories |
Confidence score: 2/5
- This PR requires careful review due to security vulnerabilities and data accuracy issues in the core Google Wallet endpoint
- Score lowered due to missing authentication checks, hardcoded venue coordinates, potential race conditions, and lack of input validation
- Pay close attention to src/app/api/wallet/google/[id]/route.ts for security fixes and data corrections before merging
6 files reviewed, 3 comments
| <Link | ||
| className="relative block aspect-[110/35] w-full" | ||
| href={`/api/wallet/google/${qrCodeId}`} | ||
| > | ||
| <Image | ||
| src="/wallet/google-badge-en.svg" | ||
| alt="Add to Google Wallet" | ||
| fill | ||
| className="pointer-events-none" | ||
| /> | ||
| </Link> |
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.
style: The Google Wallet button is placed inside the same flex container as Apple Wallet, causing them to stack vertically. Consider placing them as siblings in the flex container for horizontal layout.
| <Link | |
| className="relative block aspect-[110/35] w-full" | |
| href={`/api/wallet/google/${qrCodeId}`} | |
| > | |
| <Image | |
| src="/wallet/google-badge-en.svg" | |
| alt="Add to Google Wallet" | |
| fill | |
| className="pointer-events-none" | |
| /> | |
| </Link> | |
| </div> | |
| <div className="flex-1 relative"> | |
| <Link | |
| className="relative block aspect-[110/35] w-full" | |
| href={`/api/wallet/google/${qrCodeId}`} | |
| > | |
| <Image | |
| src="/wallet/google-badge-en.svg" | |
| alt="Add to Google Wallet" | |
| fill | |
| className="pointer-events-none" | |
| /> | |
| </Link> |
| export async function GET( | ||
| _: Request, | ||
| { params }: { params: Promise<{ id: string }> } | ||
| ) { |
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.
logic: Missing authentication check - anyone can generate wallet passes for any user ID.
FEAT:
TODO: