Skip to content

Fix/dead payment module security issues - #279

Merged
martinzhames merged 4 commits into
dupdab:mainfrom
celina005:fix/dead-payment-module-security-issues
Sep 1, 2026
Merged

Fix/dead payment module security issues#279
martinzhames merged 4 commits into
dupdab:mainfrom
celina005:fix/dead-payment-module-security-issues

Conversation

@celina005

Copy link
Copy Markdown
Contributor

Closes #160
Closes #159
Closes #157
Closes #158

src/payment/payment.controller.ts imported MerchantGuard from
../auth/guards/merchant.guard, but the file never existed in the repo,
breaking any full-source tsc/Nest build. Add the guard, mirroring the
existing AdminGuard pattern, so it rejects requests lacking a
merchantId on the authenticated user.
main.ts already applies the global api/v1 prefix to every controller.
PaymentController additionally hardcoded api/v1/payments, which would
double the prefix to /api/v1/api/v1/payments/... if this module were
ever wired into AppModule. Use 'payments' to match every other
controller in the codebase.
PaymentController's getPaymentById/ByReference/Status/QrCode/Receipt
and cancelPayment never threaded a merchantId through to
PaymentService, so any authenticated merchant could access or cancel
another merchant's payment by guessing/incrementing a UUID or
reference. Thread req.user.merchantId through every controller
handler and scope every corresponding PaymentService query/mutation
by merchantId, mirroring src/payments/payments.service.ts.
PaymentModule was never imported by AppModule (or anything else) and
duplicated src/payments/, which is the actually-wired, more complete
implementation (batch creation, refunds, webhook listener, tests).
Keeping two competing implementations of the payment domain around
was misleading to maintainers and hid the bugs fixed earlier on this
branch from ever being caught by integration testing. Delete
src/payment/ entirely per the suggested dead-code fix.
@drips-wave

drips-wave Bot commented Aug 31, 2026

Copy link
Copy Markdown

@celina005 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@martinzhames
martinzhames merged commit c987eb8 into dupdab:main Sep 1, 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

2 participants