Skip to content

Feature/pingpay phase 1#623

Merged
aunali8812 merged 5 commits into
stagingfrom
feature/pingpay-phase-1
Apr 27, 2026
Merged

Feature/pingpay phase 1#623
aunali8812 merged 5 commits into
stagingfrom
feature/pingpay-phase-1

Conversation

@aunali8812

@aunali8812 aunali8812 commented Apr 27, 2026

Copy link
Copy Markdown
Collaborator

Summary by CodeRabbit

  • New Features
    • PingPay payment integration enabling quick donations for campaigns and projects
    • New fast donation buttons for campaigns and projects
    • Visual indicators identifying donations made via PingPay
    • Automated payment status tracking and on-chain transaction verification

@aunali8812 aunali8812 requested a review from Ebube111 as a code owner April 27, 2026 17:09
@vercel

vercel Bot commented Apr 27, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
potlock-next-app Ready Ready Preview, Comment Apr 27, 2026 5:10pm

Request Review

@coderabbitai

coderabbitai Bot commented Apr 27, 2026

Copy link
Copy Markdown
Contributor

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 04bb0dab-daca-4001-bcd8-49560044ad2a

📥 Commits

Reviewing files that changed from the base of the PR and between 0101ffe and 209c068.

📒 Files selected for processing (17)
  • .env.example
  • src/app/api/pingpay/create-checkout/route.ts
  • src/app/api/pingpay/create-project-checkout/route.ts
  • src/app/api/pingpay/session-status/route.ts
  • src/app/api/pingpay/verify-tx/route.ts
  • src/app/layout.tsx
  • src/app/pingpay/callback/page.tsx
  • src/entities/campaign/components/CampaignBanner.tsx
  • src/entities/campaign/components/CampaignDonorsTable.tsx
  • src/features/pingpay/components/FastDonateButton.tsx
  • src/features/pingpay/components/FastDonateToProjectButton.tsx
  • src/features/pingpay/components/PingPayModal.tsx
  • src/features/pingpay/constants.ts
  • src/features/pingpay/index.ts
  • src/layout/profile/_deprecated/DonationItem.tsx
  • src/layout/profile/components/summary.tsx
  • src/pages/_app.tsx

Walkthrough

This PR integrates PingPay payment processing into the application, adding four API routes to create checkout sessions and verify transactions, UI components for fast donations to campaigns and projects, a payment callback handler, and cross-tab communication support. Integration points include campaign donation buttons, profile donation buttons, and PingPay donation badges.

Changes

Cohort / File(s) Summary
Environment & Configuration
.env.example
Added PINGPAY_API_KEY environment variable for server-side PingPay Hosted Checkout integration.
PingPay API Routes
src/app/api/pingpay/create-checkout/route.ts, src/app/api/pingpay/create-project-checkout/route.ts, src/app/api/pingpay/session-status/route.ts, src/app/api/pingpay/verify-tx/route.ts
Four new API endpoints: campaign/project checkout creation (POST with NEAR recipient routing and metadata), session status polling (GET fetching session/payment details via PingPay), and transaction verification (POST querying NEAR RPC for donation logs and amount validation).
PingPay UI Components
src/features/pingpay/components/FastDonateButton.tsx, src/features/pingpay/components/FastDonateToProjectButton.tsx, src/features/pingpay/components/PingPayModal.tsx
FastDonateButton and FastDonateToProjectButton trigger PingPayModal; modal collects donation amount via form, creates checkout sessions, stores session metadata in localStorage, and provides link-sharing/payment-redirect UX.
PingPay Feature Module
src/features/pingpay/index.ts, src/features/pingpay/constants.ts
Barrel exports for FastDonateButton and FastDonateToProjectButton; constants module stub for future expansion.
Campaign Integration
src/entities/campaign/components/CampaignBanner.tsx, src/entities/campaign/components/CampaignDonorsTable.tsx
FastDonateButton added to campaign donation section; CampaignDonorsTable detects PingPay donations via message prefix and displays "via PingPay" badge.
Profile Integration
src/layout/profile/components/summary.tsx, src/layout/profile/_deprecated/DonationItem.tsx
FastDonateToProjectButton added to profile summary; DonationItem displays "via PingPay" badge when detected in donation message.
App-Level Setup
src/app/layout.tsx, src/app/pingpay/callback/page.tsx, src/pages/_app.tsx
Root layout with metadata; PingPay callback page handles post-payment redirects, polls session status, syncs donations, and broadcasts completion; PingPayBroadcastListener in _app.tsx handles cross-tab messaging and cache invalidation.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Frontend
    participant Backend as Backend API
    participant PingPay as PingPay API
    participant NEAR as NEAR RPC
    participant Other as Other Tabs

    User->>Frontend: Click FastDonateButton
    Frontend->>Frontend: Open PingPayModal
    User->>Frontend: Enter amount & submit
    Frontend->>Backend: POST /api/pingpay/create-checkout<br/>(amount, campaignId)
    Backend->>PingPay: POST /checkout/sessions<br/>(NEAR recipient, amount, metadata)
    PingPay-->>Backend: Return sessionUrl & sessionId
    Backend-->>Frontend: Return session details
    Frontend->>Frontend: Store sessionId in localStorage
    Frontend->>Frontend: Display payment link, open in new tab
    User->>PingPay: Complete payment
    PingPay->>Frontend: Redirect to /pingpay/callback
    Frontend->>Backend: GET /api/pingpay/session-status<br/>(sessionId)
    Backend->>PingPay: Fetch session & payment details
    PingPay-->>Backend: Return txHash, payer
    Backend-->>Frontend: Return payment status
    Frontend->>Backend: POST /api/pingpay/verify-tx<br/>(txHash, senderId)
    Backend->>NEAR: Query tx_status, find donation log
    NEAR-->>Backend: Return on-chain donation data
    Backend-->>Frontend: Confirm transaction landed
    Frontend->>Frontend: Trigger syncApi (refresh donations)
    Frontend->>Other: BroadcastChannel: pingpay-complete
    Other->>Other: Show success toast, invalidate cache
    Frontend->>Frontend: Display confirmation, close window
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~50 minutes

Possibly related PRs

  • Feature/sync accounts lists #579 — Main PR triggers syncApi for NEAR donation synchronization after PingPay callbacks; retrieved PR implements and expands syncApi methods for campaign and project donations, directly supporting the integration flow.
  • Campaign Fixes #393 — Both PRs modify src/entities/campaign/components/CampaignBanner.tsx to add donation UI elements; likely conflicts or overlapping feature work.
  • Cross chain donation #475 — Both PRs modify src/entities/campaign/components/CampaignDonorsTable.tsx for donor rendering; main PR adds "via PingPay" badge while retrieved PR reworks donor-cell logic, indicating related UI changes.

Suggested reviewers

  • Ebube111
  • carina-akaia

Poem

🐰 A checkout in spring, where donations now flow,
PingPay brings speed to the gifts that we sow,
From campaigns to projects, the buttons align,
Cross-tab whispers confirm when the payments sign,
Hop on, dear friends—your donations take flight! 🌱✨

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/pingpay-phase-1

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

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

@aunali8812 aunali8812 merged commit 427fa2b into staging Apr 27, 2026
3 of 4 checks passed
@coderabbitai coderabbitai Bot mentioned this pull request Apr 29, 2026
@coderabbitai coderabbitai Bot mentioned this pull request May 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant