diff --git a/app/controllers/web-payments/apple-pay/merchant-validation.controller.js b/app/controllers/web-payments/apple-pay/merchant-validation.controller.js index 2b0fe418a..21f20ab6d 100644 --- a/app/controllers/web-payments/apple-pay/merchant-validation.controller.js +++ b/app/controllers/web-payments/apple-pay/merchant-validation.controller.js @@ -108,19 +108,20 @@ module.exports = async (req, res) => { } const alternativeOptions = { - headers: { 'Content-Type': 'application/json' }, + headers: { 'Content-Type': 'application/json; charset=utf-8' }, httpsAgent: proxyAgent } try { const response = await axios.post(url, data, alternativeOptions) - logger.info('Apple Pay session successfully generated via axios') + logger.info('Apple Pay session successfully generated via axios and https proxy agent') res.status(200).send(response.data) } catch (error) { logger.info('Error generating Apple Pay session', { ...getLoggingFields(req), - error: error.message + error: error.message, + status: error.response ? error.response.status : 'No status' }) logger.info('Apple Pay session via axios and https proxy agent failed', 'Apple Pay Error') res.status(500).send('Apple Pay Error') diff --git a/test/controllers/web-payments/apple-pay/merchant-validation.controller.test.js b/test/controllers/web-payments/apple-pay/merchant-validation.controller.test.js index 3e0a67beb..e9a0c17cf 100644 --- a/test/controllers/web-payments/apple-pay/merchant-validation.controller.test.js +++ b/test/controllers/web-payments/apple-pay/merchant-validation.controller.test.js @@ -108,7 +108,7 @@ describe('Validate with Apple the merchant is legitimate', () => { initiativeContext: merchantDomain }), sinon.match({ - headers: { 'Content-Type': 'application/json' }, + headers: { 'Content-Type': 'application/json; charset=utf-8' }, httpsAgent: sinon.match.instanceOf(HttpsProxyAgent) }) ) @@ -145,7 +145,7 @@ describe('Validate with Apple the merchant is legitimate', () => { initiativeContext: merchantDomain }), sinon.match({ - headers: { 'Content-Type': 'application/json' }, + headers: { 'Content-Type': 'application/json; charset=utf-8' }, httpsAgent: sinon.match.instanceOf(HttpsProxyAgent) }) ) @@ -197,7 +197,7 @@ describe('Validate with Apple the merchant is legitimate', () => { initiativeContext: merchantDomain }), sinon.match({ - headers: { 'Content-Type': 'application/json' }, + headers: { 'Content-Type': 'application/json; charset=utf-8' }, httpsAgent: sinon.match.instanceOf(HttpsProxyAgent) }) )