-
Notifications
You must be signed in to change notification settings - Fork 4
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
Recurring payments #1816
Conversation
* Initial setup RP job https://eaflood.atlassian.net/browse/IWTF-3381 Setup recurring payment job * initial setup * Update docker/README.md Co-authored-by: Iris Faraway <[email protected]> * update readme * update license * add console log for when rp running * setup docker so picks up commands run tomprove running * LICENSE --------- Co-authored-by: Iris Faraway <[email protected]>
https://eaflood.atlassian.net/browse/IWTF-3617 Recurring Payments Job to retrieve the recurring payments due on the current day
There was a problem hiding this 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/dynamics-lib/src/entities/__tests__/recurring-payment.entity.spec.js
Outdated
Show resolved
Hide resolved
packages/sales-api-service/src/services/recurring-payments.service.js
Outdated
Show resolved
Hide resolved
} | ||
|
||
return recurringPaymentsWithPermission | ||
} |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
packages/sales-api-service/src/services/transactions/process-transaction-queue.js
Outdated
Show resolved
Hide resolved
packages/sales-api-service/src/services/transactions/process-transaction-queue.js
Outdated
Show resolved
Hide resolved
packages/sales-api-service/src/services/transactions/process-transaction-queue.js
Show resolved
Hide resolved
There was a problem hiding this 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
packages/dynamics-lib/src/entities/__tests__/recurring-payment.entity.spec.js
Show resolved
Hide resolved
} | ||
|
||
expect(recurringPayment).toBeInstanceOf(RecurringPayment) | ||
expect(recurringPayment).toMatchObject(expect.objectContaining({ etag: 'W/"53585133"', ...expectedFields })) | ||
expect(recurringPayment).toMatchObject(expect.objectContaining({ etag: 'W/"11528905"', ...expectedFields })) |
There was a problem hiding this comment.
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' |
There was a problem hiding this comment.
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 | ||
} |
There was a problem hiding this comment.
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.
h, plus filter just on date when retrieving recurring payments
* Remove phone from content in text message option https://eaflood.atlassian.net/browse/IWTF-3861 Remove the word phone from the content for a text message option * added welsh
There was a problem hiding this 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
packages/recurring-payments-job/src/__tests__/recurring-payments-processor.spec.js
Outdated
Show resolved
Hide resolved
Quality Gate passedKudos, no new issues were introduced! 0 New issues |
https://eaflood.atlassian.net/browse/IWTF-3617
Recurring Payments Job to retrieve the recurring payments due on the current day