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

Support additional recovery data #4

Merged
merged 2 commits into from
Oct 31, 2023
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
2 changes: 2 additions & 0 deletions app/processing/get-payment-requests.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ const getPaymentRequests = (csv) => {
ledger: values[10] || AP,
debtType: values[11] || undefined,
recoveryDate: values[12] || undefined,
originalInvoiceNumber: values[13] || undefined,
originalSettlementDate: values[14] || undefined,
pillar: schemeValues[1],
invoiceLines: [],
value: 0
Expand Down
1 change: 1 addition & 0 deletions app/processing/parse-payment-file.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const parsePaymentFile = async (data, filename, transaction) => {
paymentRequest.batch = filename
paymentRequest.dueDate = paymentRequest.dueDate ? moment(paymentRequest.dueDate, ['DD/MM/YYYY', 'YYYY-MM-DD', 'DD-MM-YYYY']).format('YYYY-MM-DD') : undefined
paymentRequest.recoveryDate = paymentRequest.recoveryDate ? moment(paymentRequest.recoveryDate, ['DD/MM/YYYY', 'YYYY-MM-DD', 'DD-MM-YYYY']).format('YYYY-MM-DD') : undefined
paymentRequest.originalSettlementDate = paymentRequest.originalSettlementDate ? moment(paymentRequest.originalSettlementDate, ['DD/MM/YYYY', 'YYYY-MM-DD', 'DD-MM-YYYY']).format('YYYY-MM-DD') : undefined
paymentRequest.debtType = paymentRequest.debtType?.toLowerCase()
paymentRequest.value = convertToPounds(paymentRequest.value)
paymentRequest.invoiceNumber = await createInvoiceNumber(paymentRequest, transaction)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ffc-pay-injection",
"version": "1.1.3",
"version": "1.1.4",
"description": "Inject payments",
"homepage": "https://github.com/DEFRA/ffc-pay-injection",
"main": "app/index.js",
Expand Down
2 changes: 1 addition & 1 deletion test/files/manual-ledger-recovery.csv
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Manual_SFI,1000000001,2023,Z00000001,80201,G00,250.00,2023-10-01,Q4,SOS270,AR,ADM,2023-10-01
Manual_SFI,1000000001,2023,Z00000001,80201,G00,250.00,2023-10-01,Q4,SOS270,AR,ADM,2023-10-01,S123456789C123456V001,2023-10-01
18 changes: 18 additions & 0 deletions test/integration/processing.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,24 @@ describe('process files', () => {
expect(mockSendBatchMessages.mock.calls[0][0][0].body.recoveryDate).toBe('2023-10-01')
})

test('sends payment request with original invoice number for manual', async () => {
const blockBlobClient = container.getBlockBlobClient(`${storageConfig.inboundFolder}/${filename}`)
await blockBlobClient.uploadFile(manualLedgerRecoveryFilepath)

await start()

expect(mockSendBatchMessages.mock.calls[0][0][0].body.originalInvoiceNumber).toBe('S123456789C123456V001')
})

test('sends payment request with original settlement date for manual', async () => {
const blockBlobClient = container.getBlockBlobClient(`${storageConfig.inboundFolder}/${filename}`)
await blockBlobClient.uploadFile(manualLedgerRecoveryFilepath)

await start()

expect(mockSendBatchMessages.mock.calls[0][0][0].body.originalSettlementDate).toBe('2023-10-01')
})

test('sends payment request for file with quotes', async () => {
const blockBlobClient = container.getBlockBlobClient(`${storageConfig.inboundFolder}/${filename}`)
await blockBlobClient.uploadFile(quotesFilepath)
Expand Down