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

Recurring payments #1816

Merged
merged 47 commits into from
Jan 3, 2024

Conversation

ScottDormand96
Copy link
Collaborator

https://eaflood.atlassian.net/browse/IWTF-3617

Recurring Payments Job to retrieve the recurring payments due on the current day

@ScottDormand96 ScottDormand96 added the enhancement New feature or request label Nov 2, 2023
Copy link
Collaborator

@jaucourt jaucourt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great progress here, and much closer to what we're after, but there's still work to do I'm afraid.

Additionally, I think you might be going beyond the initial scope of the ticket you're working on. You've got code in here amending the transaction queue processing that I don't think is necessary to delivering the ticket you're working on. Focus in on delivering the acceptance criteria for that ticket.

packages/recurring-payments-job/README.md Outdated Show resolved Hide resolved
}

return recurringPaymentsWithPermission
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't the way you should be getting related entities. Have a look at permission.queries.js in dynamics-lib, particularly the expand property of PredefinedQuery.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand why you're still retrieving Contact and Permission individually; the additional work you've done to retrieve related entities in dynamics-lib should mean you don't have to do this.

Copy link
Collaborator

@jaucourt jaucourt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, still a handful of things to resolve

}

expect(recurringPayment).toBeInstanceOf(RecurringPayment)
expect(recurringPayment).toMatchObject(expect.objectContaining({ etag: 'W/"53585133"', ...expectedFields }))
expect(recurringPayment).toMatchObject(expect.objectContaining({ etag: 'W/"11528905"', ...expectedFields }))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, here we have four assertions in a single test - see my comments further down

defra_publicid: '649-213',
statecode: 1,
_defra_contact_value: 'b3d33cln-2e83-ea11-a811-000d3a649213',
_defra_activepermission_value: 'a5b24adf-2e83-ea11-a811-000d3a649213'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This identical response is copied and pasted throughout this test - the only variation is when you set the cancelled date and reason. Therefore, it should be a function, where it's possible to pass in overrides, i.e.

const getRecurringPaymentResponse = overrides => ({
     '@odata.etag': 'W/"11528905"',
     defra_recurringpaymentid: 'b5b24adf-2e83-ea11-a811-000d3a649213',
     defra_name: '18569ba8-094e-4e8c-9911-bfedd5ccc17a',
     defra_nextduedate: '2019-12-14T00:00:00Z',
     defra_cancelleddate: '2019-12-14T00:00:00Z',
     defra_cancelledreason: 910400195,
     defra_enddate: '2019-12-15T00:00:00Z',
     defra_agreementid: 'c9267c6e-573d-488b-99ab-ea18431fc472',
     defra_publicid: '649-213',
     statecode: 1,
     _defra_contact_value: 'b3d33cln-2e83-ea11-a811-000d3a649213',
     _defra_activepermission_value: 'a5b24adf-2e83-ea11-a811-000d3a649213',
    ...overrides
})

}

return recurringPaymentsWithPermission
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand why you're still retrieving Contact and Permission individually; the additional work you've done to retrieve related entities in dynamics-lib should mean you don't have to do this.

Copy link
Member

@irisfaraway irisfaraway left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a question about testing

Copy link

@ScottDormand96 ScottDormand96 merged commit 2d02548 into develop Jan 3, 2024
3 checks passed
@jaucourt jaucourt deleted the feature/iwtf-3617-retrieve-recurring-payments branch January 16, 2024 09:11
@ScottDormand96 ScottDormand96 restored the feature/iwtf-3617-retrieve-recurring-payments branch January 19, 2024 12:40
@ScottDormand96 ScottDormand96 deleted the feature/iwtf-3617-retrieve-recurring-payments branch January 19, 2024 12:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants