Skip to content

Commit

Permalink
PP-6079 Amend charge controller test
Browse files Browse the repository at this point in the history
Don't include an address in request for test to check we don't send a
billing address to connector to mimic real behaviour.
  • Loading branch information
stephencdaly committed Feb 5, 2020
1 parent 1c1fecf commit e8af858
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions test/controllers/charge_controller_create_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,17 @@ const chargeId = '42mdrsshtsk4chpeoifhlgf4lk'
const card = paymentFixtures.validCardDetails()
const chargeData = paymentFixtures.validChargeDetails({ emailCollectionMode: 'OFF' }).getPlain()

const paymentDetails = {
const paymentDetailsWithoutAddress = {
chargeId: chargeId,
cardNo: '4242424242424242',
expiryMonth: '01',
expiryYear: '20',
cardholderName: 'Joe Bloggs',
cvc: '111',
cvc: '111'
}

const paymentDetails = {
...paymentDetailsWithoutAddress,
addressCountry: 'GB',
addressLine1: '1 Horse Guards',
addressCity: 'London',
Expand Down Expand Up @@ -159,7 +163,7 @@ describe('POST /card_details/{chargeId} endpoint', function () {

const request = {
chargeData: chargeData,
body: paymentDetails,
body: paymentDetailsWithoutAddress,
chargeId: chargeId,
header: sinon.spy(),
headers: {
Expand All @@ -170,11 +174,11 @@ describe('POST /card_details/{chargeId} endpoint', function () {
await requireChargeController(mockedConnectorClient).create(request, response)

const payload = paymentFixtures.validAuthorisationRequest({
cardNumber: paymentDetails.cardNo,
cvc: paymentDetails.cvc,
cardNumber: paymentDetailsWithoutAddress.cardNo,
cvc: paymentDetailsWithoutAddress.cvc,
cardBrand: card.brand,
expiryDate: `${paymentDetails.expiryMonth}/${paymentDetails.expiryYear}`,
cardholderName: paymentDetails.cardholderName,
expiryDate: `${paymentDetailsWithoutAddress.expiryMonth}/${paymentDetailsWithoutAddress.expiryYear}`,
cardholderName: paymentDetailsWithoutAddress.cardholderName,
cardType: card.type,
corporateCard: card.corporate,
prepaid: card.prepaid,
Expand All @@ -184,8 +188,6 @@ describe('POST /card_details/{chargeId} endpoint', function () {
delete payload.accept_header
delete payload.user_agent_header

console.log('PAYLOAD ' + JSON.stringify(payload))

expect(chargeAuthStub.calledWith(sinon.match( // eslint-disable-line
{
chargeId: chargeId,
Expand Down

0 comments on commit e8af858

Please sign in to comment.