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

Include email address when taking RP job payments #2117

Closed
wants to merge 1 commit into from
Closed
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
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ jest.mock('@defra-fish/connectors-lib', () => ({
licensee: { countryCode: 'GB-ENG' }
})),
createTransaction: jest.fn(() => ({
cost: 30
cost: 30,
permissions: [{ licensee: {} }]
}))
}
}))
Expand Down Expand Up @@ -77,6 +78,7 @@ describe('recurring-payments-processor', () => {
const permitId = Symbol('permitId')
const firstName = Symbol('firstName')
const lastName = Symbol('lastName')
const email = Symbol('email')

salesApi.preparePermissionDataForRenewal.mockReturnValueOnce({
isLicenceForYou,
Expand All @@ -85,7 +87,8 @@ describe('recurring-payments-processor', () => {
firstName,
lastName,
country,
countryCode: 'GB-ENG'
countryCode: 'GB-ENG',
email
},
licenceStartDate: '2020-01-01',
licenceStartTime: 3,
Expand All @@ -102,7 +105,8 @@ describe('recurring-payments-processor', () => {
licensee: {
firstName,
lastName,
country
country,
email
},
permitId,
startDate: '2020-01-01T03:00:00.000Z'
Expand Down Expand Up @@ -208,6 +212,7 @@ describe('recurring-payments-processor', () => {
it('prepares and sends the payment request', async () => {
const agreementId = Symbol('agreementId')
const transactionId = Symbol('transactionId')
const email = Symbol('email')

salesApi.getDueRecurringPayments.mockReturnValueOnce([getMockDueRecurringPayment('foo', agreementId)])

Expand All @@ -217,7 +222,8 @@ describe('recurring-payments-processor', () => {

salesApi.createTransaction.mockReturnValueOnce({
cost: 50,
id: transactionId
id: transactionId,
permissions: [{ licensee: { email } }]
})

const mockPaymentResponse = { payment_id: 'test-payment-id' }
Expand All @@ -228,7 +234,8 @@ describe('recurring-payments-processor', () => {
description: 'The recurring card payment for your rod fishing licence',
reference: transactionId,
authorisation_mode: 'agreement',
agreement_id: agreementId
agreement_id: agreementId,
email
}

await processRecurringPayments()
Expand Down Expand Up @@ -317,7 +324,8 @@ describe('recurring-payments-processor', () => {

salesApi.createTransaction.mockReturnValueOnce({
cost: i,
id: permit
id: permit,
permissions: [{ licensee: {} }]
})
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ const preparePayment = (agreementId, transaction) => {
description: 'The recurring card payment for your rod fishing licence',
reference: transaction.id,
authorisation_mode: 'agreement',
agreement_id: agreementId
agreement_id: agreementId,
email: transaction.permissions[0].licensee.email
}

return result
Expand Down
Loading