Skip to content

Commit 735e077

Browse files
fix: check payments.enabled in callback route middleware
1 parent 6c8e29a commit 735e077

4 files changed

Lines changed: 8 additions & 2 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"nostream": patch
3+
---
4+
5+
fix: check payments.enabled in callback route middleware

src/routes/callbacks/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const router: Router = Router()
1212
const requireProcessor = (name: string) =>
1313
(_req: Request, res: Response, next: NextFunction) => {
1414
const settings = createSettings()
15-
if (settings.payments?.processor !== name) {
15+
if (!settings.payments?.enabled || settings.payments.processor !== name) {
1616
res.status(403).send('Forbidden')
1717
return
1818
}

test/integration/features/callbacks/opennode-callback.feature.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ Given('OpenNode callback processing is enabled', function () {
3636
...settings,
3737
payments: {
3838
...(settings?.payments ?? {}),
39+
enabled: true,
3940
processor: 'opennode',
4041
},
4142
}

test/unit/routes/callbacks.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ describe('callbacks router', () => {
1616
receivedBody = undefined
1717

1818
createSettingsStub = Sinon.stub(settingsFactory, 'createSettings').returns({
19-
payments: { processor: 'opennode' },
19+
payments: { enabled: true, processor: 'opennode' },
2020
} as any)
2121

2222
createOpenNodeCallbackControllerStub = Sinon.stub(openNodeControllerFactory, 'createOpenNodeCallbackController').returns({

0 commit comments

Comments
 (0)