Skip to content

Commit

Permalink
Rendering the confirm form if order is already processed (#1052)
Browse files Browse the repository at this point in the history
  • Loading branch information
zenit2001 authored Feb 26, 2024
1 parent f9473ea commit ef352d4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,13 @@ describe('Show Confirmation', () => {
})

it('should not continue processing when order is not open or failed', () => {
const URLUtils = require('dw/web/URLUtils');
const adyenCheckout = require('*/cartridge/scripts/adyenCheckout');
req.querystring.merchantReference = 4;
const adyenHelper = require('*/cartridge/scripts/util/adyenHelper');
adyenHelper.getOrderMainPaymentInstrumentType.mockReturnValue('AdyenComponent');
showConfirmation(req, res, jest.fn());
expect(URLUtils.url.mock.calls[0][0]).toEqual('Cart-Show');
expect(res.render.mock.calls[0][0]).toEqual('orderConfirmForm');
expect(adyenCheckout.doPaymentsDetailsCall).not.toBeCalled();
})

test.each(['Authorised', 'Pending', 'Received'])(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,10 @@ function showConfirmation(req, res, next) {
AdyenLogs.info_log(
'ShowConfirmation called for an order which has already been processed. This is likely to be caused by shoppers using the back button after order confirmation',
);
res.redirect(URLUtils.url('Cart-Show'));
res.render('orderConfirmForm', {
orderID: order.orderNo,
orderToken: order.orderToken,
});
return next();
}

Expand Down

0 comments on commit ef352d4

Please sign in to comment.