Repository navigation
fix(upi): M4.3.2 financial integrity remediation for PR #31 - #32
Open
Satelink-Protocol wants to merge 1 commit into
Open
Satelink-Protocol wants to merge 1 commit into
Satelink-Protocol wants to merge 1 commit into
Conversation
…nt identity, secure manual refund reconciliation & state transition verification
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Open
7 tasks done
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 Changes — NIGHTLIFEZ M4.3.2 Final Independent Review Corrections for PR #31
This pull request implements the financial-integrity corrections required by the independent owner review of PR #31 (
feature/m4-3-1-review-remediation), addressing merchant identity fail-closed enforcement, secure manual refund reconciliation authorization, and refund state transition integrity.1. Fail-Closed Merchant Identity & Currency Invariance
!merchantId || !payment.merchant_id || merchantId === payment.merchant_idwith strict fail-closed checks acrosslib/services/upi-payments.js.applySuccessfulUpiPaymentstrictly enforces that:merchantIdis non-empty.payment.merchant_idis non-empty.adapter.merchantIdis non-empty.merchantId === payment.merchant_id && merchantId === expectedConfiguredMerchantId).missing_verified_merchant_id,missing_stored_merchant_id,missing_configured_merchant_id, ormerchant_mismatch.currencyand storedpayment.currencymust both strictly equal'INR'.PhonePeAdapter: Constructor assertsmerchantId.getPaymentStatusvalidates and returns verifiedmerchantIdandcurrency: 'INR'.verifyWebhookrejects missing configuredmerchantId, missing payloadmerchantId, and mismatchedmerchantId(WebhookSignatureError).MockUpiAdapter: Constructor acceptsmerchantId.getPaymentStatusreturnsmerchantIdandcurrency: 'INR'.verifyWebhookstrictly requires matching configuredmerchantId.createUpiPaymentIntentasserts server-configured adapter merchant identity exists before inserting payment intent row.2. Secure Manual Refund Reconciliation
MANUAL-...placeholder references.verifyFinanceAuthorizationvalidates against the authenticated server-side session (admin_userstable). Only activesuper_adminorfinanceroles may perform manual reconciliation. Caller-supplied actor strings or unauthorized roles (e.g.support) are rejected (403 unauthorized_finance_role).isValidExternalRefundRef(ref):MANUAL,DUMMY,TEST,PLACEHOLDER,NONE,NULL,NA,TEMP,REFUND,PENDING,UNKNOWN,SAMPLE,VOID,XXX).000000,XXXXXX) and trivial sequences (123456,abcdef).isValidEvidenceRef(evidenceRef)requires verified ticket/receipt reference (min 4 characters, non-placeholder).isValidReconciliationReason(reason)requires documented justification (min 10 characters, non-placeholder).SELECT ... FOR UPDATE) prevents concurrent operator race conditions or double reconciliation. Repeated reconciliation on already-refunded payment returns existing state safely.payment_auditsandaudit_log.docs/UPI_SECURITY_AUDIT.mdanddocs/UPI_PROVIDER_READINESS.mdthat minimal reference-based reconciliation does not interface with Core Banking System (CBS) host-to-host APIs.3. Refund State Transitions & Side Effects
succeededandrefund_pendingenter refund workflow.refund_pendingwithout marking refunded.failedstatus.refunded, Telegram invite link revocation, chat kicks, and member notifications execute strictly upon confirmed refund (status === 'refunded'). Pending or failed refunds trigger no side effects.Verification Results
TEST_DATABASE_URL=postgres://localhost:5432/sm_test node --test test/upi-checkout.test.js→ 33/33 tests passed (100%).TEST_DATABASE_URL=postgres://localhost:5432/sm_test npm test→ 466 passed, 2 skipped, 0 failed across all 26 test files.npm run lint→ 140/140 files clean (0 errors).npx playwright test→ 157 passed, 11 skipped, 0 failed across 168 tests (100% clean).Absolute Compliance Confirmation
feature/m4-3-1-review-remediation(PR fix(upi): M4.3.1 remediation of independent review findings REV-01 through REV-07 on PR #30 #31 head:03bf5186f1db78d0f1e177aabeb606555a35501e).ENABLE_LIVE_PAYMENTS=falseis strictly preserved everywhere.