Skip to content

Commit 6b25ba7

Browse files
authored
Merge branch 'main' into test/app-worker-unit-tests
2 parents 2fd39dd + f9f6d64 commit 6b25ba7

4 files changed

Lines changed: 16 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: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,17 @@ Given('OpenNode callback processing is enabled', function () {
3636
...settings,
3737
payments: {
3838
...(settings?.payments ?? {}),
39+
enabled: true,
3940
processor: 'opennode',
4041
},
42+
paymentsProcessors: {
43+
...(settings?.paymentsProcessors ?? {}),
44+
opennode: {
45+
...(settings?.paymentsProcessors?.opennode ?? {}),
46+
baseURL: 'api.opennode.com',
47+
callbackBaseURL: 'http://localhost:18808/callbacks/opennode',
48+
},
49+
},
4150
}
4251

4352
process.env.OPENNODE_API_KEY = OPENNODE_TEST_API_KEY

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)