Repository navigation
feat(payments): M4.1 UPI-first checkout, dynamic QR, and verified payments - #28
Merged
Merged
Conversation
…rified payments - Add additive migration 015_upi_payment_integration.sql extending payment types and introducing immutable payment_audits ledger - Implement zero-dependency pure SVG QR code generator (Model 2, Reed-Solomon EC) in lib/upi/qr.js - Implement provider-neutral payment adapter interface with PhonePe PG primary and MockUpi sandbox adapter in lib/upi/adapter.js - Support mobile generic upi://pay intent and deep links for Google Pay, PhonePe, Paytm, CRED, and BHIM - Support desktop scannable dynamic QR with live 15m countdown timer and 3.5s status polling - Implement strict deterministic payment state machine with atomic booking confirmation in lib/services/upi-payments.js - Add constant-time SHA256 webhook signature verification with replay protection and idempotency - Maintain strict safety boundary: ENABLE_LIVE_PAYMENTS=false across all environments - Add comprehensive test suite in test/upi-checkout.test.js (13/13 passing) - Author docs/arch/UPI_PAYMENT_INTEGRATION.md and docs/launch/UPI_READINESS_REPORT.md
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary of Milestone M4.1
This PR delivers Milestone M4.1 (UPI-First Checkout, Dynamic QR & Verified Payment Integration) for NIGHTLIFEZ.
1. Key Capabilities Implemented
lib/upi/adapter.js): Standardized interface (createPaymentIntent,getPaymentStatus,verifyWebhook,initiateRefund). Primary implementation: PhonePe Payment Gateway. Test sandbox:MockUpiAdapter. PayU fallback ready.lib/upi/qr.js): Standalone ECMAScript ISO/IEC 18004 Model 2 QR generator with Byte mode encoding and Reed-Solomon Error Correction Level M. Generates lightweight, crisp SVG elements with NPCI UPI formatting (upi://pay?pa=...).lib/views/checkout-upi.js,lib/handlers/upi-checkout.js):upi://pay) plus app-specific deep links (Google Pay, PhonePe, Paytm, CRED, BHIM).lib/services/upi-payments.js): Enforces states (created,pending,processing,succeeded,failed,expired,cancelled,refund_pending,refunded,disputed). All state mutations are recorded in the newpayment_auditsledger.migrations/015_upi_payment_integration.sql): Extends enums andpaymentstable with order reference, merchant ID, method, device type, UPI URIs, and audit columns. Createspayment_auditstable.crypto.timingSafeEqual) of PhonePe SHA256 checksums. Webhook replay defense and atomic database transactions (db.tx).ENABLE_LIVE_PAYMENTS=falsestrictly enforced across all environments.2. Deliverables
docs/arch/UPI_PAYMENT_INTEGRATION.md: Complete architectural specification, provider evaluation matrix, dynamic QR/intent specs, state transition tables, and RBI compliance notes.docs/launch/UPI_READINESS_REPORT.md: Operational readiness checklist, safety boundary verification, and owner activation gates.docs/PROJECT_STATE.md(Sections 10 and 11).3. Automated Test Verification
test/upi-checkout.test.jspass 100%.npm test).140/140 files OK).