Skip to content

Commit

Permalink
fix: setting 403 when notification fails (#1232)
Browse files Browse the repository at this point in the history
  • Loading branch information
zenit2001 authored Jan 7, 2025
1 parent 7f28013 commit b6bba05
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ beforeEach(() => {
notify = adyen.notify;
jest.clearAllMocks();
req = {};
res = { render: jest.fn() };
res = { render: jest.fn(), status: jest.fn(() => res)};
});

afterEach(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function notify(req, res, next) {
const hmacKey = AdyenConfigs.getAdyenHmacKey();
const isHmacValid = handleHmacVerification(hmacKey, req);
if (!status || !isHmacValid) {
res.render('/adyen/error');
res.status(403).render('/adyen/error');
return {};
}
Transaction.begin();
Expand All @@ -28,7 +28,7 @@ function notify(req, res, next) {
Transaction.commit();
res.render('/notify');
} else {
res.render('/notifyError', {
res.status(403).render('/notifyError', {
errorMessage: notificationResult.errorMessage,
});
Transaction.rollback();
Expand Down

0 comments on commit b6bba05

Please sign in to comment.