Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#63 delete obsolete additionalData from payment response which is store… #97

Merged
merged 2 commits into from
Dec 19, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions extension/src/paymentHandler/payment-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ function createAddInterfaceInteractionAction (
request, response, type, status
}
) {
// strip away sensitive data
delete response.additionalData

return {
action: 'addInterfaceInteraction',
type: { key: c.CTP_INTERFACE_INTERACTION },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,6 @@ describe('Cancel or refund', () => {

const adyenResponse = JSON.parse(interfaceInteractionFields.response)
expect(adyenResponse.response).to.equal('[cancelOrRefund-received]')
expect(adyenResponse.additionalData).to.not.exist
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ describe('credit card payment', () => {

const adyenResponse = JSON.parse(response.body.interfaceInteractions[0].fields.response)
expect(adyenResponse.resultCode).to.be.equal('Authorised')
expect(adyenResponse.additionalData).to.not.exist

const { transactions } = response.body
expect(transactions).to.have.lengthOf(1)
Expand Down Expand Up @@ -91,6 +92,7 @@ describe('credit card payment', () => {
expect(adyenResponse.redirect.data.MD).to.exist
expect(adyenResponse.redirect.method).to.exist
expect(adyenResponse.redirect.url).to.exist
expect(adyenResponse.additionalData).to.not.exist
})

it('on wrong credit card number, should log error to interface interaction', async () => {
Expand Down Expand Up @@ -128,6 +130,7 @@ describe('credit card payment', () => {
expect(transaction.interactionId).to.be.undefined
expect(transaction.type).to.equal('Authorization')
expect(transaction.state).to.equal('Initial')
expect(adyenResponse.additionalData).to.not.exist

const response2 = await ctpClient.update(ctpClient.builder.payments,
ctpPayment.id, ctpPayment.version, [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,6 @@ describe('fetch payment', () => {
const adyenResponse = JSON.parse(interfaceInteractionFields.response)
expect(adyenResponse.groups).to.be.an.instanceof(Array)
expect(adyenResponse.paymentMethods).to.be.an.instanceof(Array)
expect(adyenResponse.additionalData).to.not.exist
})
})
5 changes: 5 additions & 0 deletions extension/test/integration/kcp-make-payment.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,10 @@ describe('kcp make payment', () => {
expect(response.statusCode).to.equal(201)
expect(response.body.custom.fields.redirectMethod).to.equal('GET')
expect(response.body.custom.fields.redirectUrl).to.exist

const adyenResponse = JSON.parse(response.body.interfaceInteractions[0].fields.response)
expect(adyenResponse.redirect.method).to.exist
expect(adyenResponse.redirect.url).to.exist
expect(adyenResponse.additionalData).to.not.exist
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,10 @@ describe('Paypal payment', () => {
expect(response.statusCode).to.equal(201)
expect(response.body.custom.fields.redirectMethod).to.equal('GET')
expect(response.body.custom.fields.redirectUrl).to.exist

const adyenResponse = JSON.parse(response.body.interfaceInteractions[0].fields.response)
expect(adyenResponse.redirect.method).to.exist
expect(adyenResponse.redirect.url).to.exist
expect(adyenResponse.additionalData).to.not.exist
})
})