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

Fix issues with reissue post The Great Rename #664

Merged
merged 2 commits into from
Jan 17, 2024

Conversation

Cruikshanks
Copy link
Member

https://eaflood.atlassian.net/browse/WATER-4336

Whilst working on updating our acceptance tests due to changes in the view bill run and view bill screens we found even after accounting for the changes, the SROC reissue test still failed.

After investigation, we were able to identify changes made during the The Great Rename had broken the reissue engine.

Before the rename the reissue engine depended on shared fields between records. For example, a water.billing_invoice and a crm_v2.invoice_account shared the same fields; invoice_account_id and invoice_account_number.

So, you could pass an instance of both to a service like GenerateBillService and as far as it is concerned it is dealing with a 'billing account' instance because it has the invoice_account_id and invoice_account_number properties it expects.

const billingInvoice = {
  billingInvoiceId: 'e1b40699-3b57-422c-96c3-3732e86312fc',
  invoiceAccountId: '53c85d8c-d5fc-48db-9c59-aa36995c0e4b',
  invoiceAccountNumber: 'A00000002A'
}

const invoiceAccount = {
  invoiceAccountId: '53c85d8c-d5fc-48db-9c59-aa36995c0e4b',
  invoiceAccountNumber: 'A00000002A'
}

Post the rename this is no longer the case. Now we have the following

const billingInvoice = {
  id: 'e1b40699-3b57-422c-96c3-3732e86312fc',
  invoiceAccountId: '53c85d8c-d5fc-48db-9c59-aa36995c0e4b',
  invoiceAccountNumber: 'A00000002A'
}

const invoiceAccount = {
  id: '53c85d8c-d5fc-48db-9c59-aa36995c0e4b',
  invoiceAccountNumber: 'A00000002A'
}

We use field names before the great rename to help explain the issue. But this is not what they are in the code anymore.

It's invoiceAccountId on the billing invoice and just id on the invoice account. GenerateBillService can no longer be given both types of instances and expect to get the same result.

So, this fixes the issue by generating objects that represent what GenerateBillService and GenerateBillLicenceService expect.

https://eaflood.atlassian.net/browse/WATER-4336

Whilst working on updating our acceptance tests due to changes in the view bill run and view bill screens we found even after accounting for the changes, the SROC reissue test still failed.

After investigation we were able to identify changes made during the [The Great Rename](#416) had broken the reissue engine.

Prior to the rename the reissue engine was depending on shared fields between records. For example, a `water.billing_invoice` and a `crm_v2.invoice_account` shared the same fields; `invoice_account_id` and `invoice_account_number`.

So, you could pass an instance of both to a service like `GenerateBillService` and as far as it is concerned it is dealing with a 'billing account' instance because it has the `invoice_account_id` and `invoice_account_number` properties it expects.

```javascript
const billingInvoice = {
  billingInvoiceId: 'e1b40699-3b57-422c-96c3-3732e86312fc'
  invoiceAccountId: '53c85d8c-d5fc-48db-9c59-aa36995c0e4b',
  invoiceAccountNumber: 'A00000002A'
}

const invoiceAccount = {
  invoiceAccountId: '53c85d8c-d5fc-48db-9c59-aa36995c0e4b',
  invoiceAccountNumber: 'A00000002A'
}
```

Post the rename this is no longer the case. Now we have the following

```javascript
const billingInvoice = {
  id: 'e1b40699-3b57-422c-96c3-3732e86312fc'
  invoiceAccountId: '53c85d8c-d5fc-48db-9c59-aa36995c0e4b',
  invoiceAccountNumber: 'A00000002A'
}

const invoiceAccount = {
  id: '53c85d8c-d5fc-48db-9c59-aa36995c0e4b',
  invoiceAccountNumber: 'A00000002A'
}
```

> We use field names pre the great rename to help explain the issue. But this is not what they would actually be.

It's `invoiceAccountId` on the billing invoice and just `id` on the invoice account. `GenerateBillService` can no longer be given both types of instance and expect to give the same result.

So, this fixes the issue by generating objects that represent what `GenerateBillService` and `GenerateBillLicenceService` expect.
@Cruikshanks Cruikshanks added the bug Something isn't working label Jan 17, 2024
@Cruikshanks Cruikshanks self-assigned this Jan 17, 2024
@Cruikshanks Cruikshanks marked this pull request as ready for review January 17, 2024 14:54
@Cruikshanks Cruikshanks merged commit b492692 into main Jan 17, 2024
6 checks passed
@Cruikshanks Cruikshanks deleted the fix-reissue-great-rename-errors branch January 17, 2024 16:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants