-
Notifications
You must be signed in to change notification settings - Fork 7
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
[MODINVOICE-554]. Invoices app: Incorrect formula for calculating adjustments, that are included and pro-rated by amount #1563
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
136 changes: 136 additions & 0 deletions
136
...esources/thunderjet/mod-invoice/features/check-invoice-lines-with-vat-adjustments.feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,136 @@ | ||
# For MODINVOICE-554 | ||
Feature: Check invoice lines with VAT adjustments | ||
|
||
Background: | ||
* url baseUrl | ||
|
||
* call login testAdmin | ||
* def okapitokenAdmin = okapitoken | ||
|
||
* call login testUser | ||
* def okapitokenUser = okapitoken | ||
|
||
* def headersUser = { 'Content-Type': 'application/json', 'x-okapi-token': '#(okapitokenUser)', 'Accept': 'application/json' } | ||
* def headersAdmin = { 'Content-Type': 'application/json', 'x-okapi-token': '#(okapitokenAdmin)', 'Accept': 'application/json' } | ||
|
||
* configure headers = headersUser | ||
|
||
* callonce variables | ||
|
||
@Positive | ||
Scenario: Check invoice lines with VAT adjustments | ||
# Check that each invoice line VAT calculation is unaffected by other invoice lines | ||
# as other forms of adjustments typically involve every invoice line in its adjustment calculation | ||
* def fundId = call uuid | ||
* def budgetId = call uuid | ||
|
||
* def adjustmentId = call uuid | ||
* def invoiceId1 = call uuid | ||
* def invoiceId2 = call uuid | ||
* def invoiceLineId1 = call uuid | ||
* def invoiceLineId2 = call uuid | ||
* def invoiceLineId3 = call uuid | ||
* def invoiceLineId4 = call uuid | ||
|
||
### 1. Create fund and budgets | ||
* configure headers = headersAdmin | ||
* def v = call createFund { id: '#(fundId)', code: '#(fundId)' } | ||
* def v = call createBudget { id: '#(budgetId)', fundId: '#(fundId)', allocated: 1000 } | ||
* configure headers = headersUser | ||
|
||
### 4. Create invoices | ||
* def invoiceAdjustments = | ||
""" | ||
[{ | ||
"id": "#(adjustmentId)", | ||
"value": 7.0, | ||
"type": "Percentage", | ||
"prorate": "By amount", | ||
"description": "VAT", | ||
"relationToTotal": "Included in", | ||
"fundDistributions": [], | ||
"exportToAccounting": false | ||
}] | ||
""" | ||
* table invoices | ||
| id | invoiceId | currency | adjustments | | ||
| invoiceId1 | invoiceId1 | 'EUR' | invoiceAdjustments | | ||
| invoiceId2 | invoiceId2 | 'EUR' | invoiceAdjustments | | ||
* def v = call createInvoice invoices | ||
|
||
### 5. Add invoice lines | ||
* table invoiceLines | ||
| invoiceLineId | invoiceId | total | fundId | | ||
| invoiceLineId1 | invoiceId1 | 30.0 | fundId | | ||
| invoiceLineId2 | invoiceId2 | 30.0 | fundId | | ||
| invoiceLineId3 | invoiceId2 | 30.0 | fundId | | ||
| invoiceLineId4 | invoiceId2 | 30.0 | fundId | | ||
* def v = call createInvoiceLine invoiceLines | ||
|
||
### 6. Check invoices and invoice lines before approval | ||
* table invoicesExpected | ||
| id | invoiceTotal | invoiceLines | invoiceLineTotal | invoiceLineAdjustment | status | | ||
| invoiceId1 | 28.04 | 1 | 28.04 | 1.96 | 'Open' | | ||
| invoiceId2 | 84.12 | 3 | 28.04 | 1.96 | 'Open' | | ||
* def v = call read('@CheckInvoices') invoicesExpected | ||
* def v = call read('@CheckInvoiceLines') invoicesExpected | ||
|
||
### 7. Remove a single invoice line from the second invoice | ||
Given path 'invoice/invoice-lines', invoiceLineId4 | ||
When method DELETE | ||
Then status 204 | ||
|
||
### 8. Recheck invoices and invoice lines to verify that the adjustment calculation was unaffected | ||
* table invoicesExpected | ||
| id | invoiceTotal | invoiceLines | invoiceLineTotal | invoiceLineAdjustment | status | | ||
| invoiceId1 | 28.04 | 1 | 28.04 | 1.96 | 'Open' | | ||
| invoiceId2 | 56.08 | 2 | 28.04 | 1.96 | 'Open' | | ||
* def v = call read('@CheckInvoices') invoicesExpected | ||
* def v = call read('@CheckInvoiceLines') invoicesExpected | ||
|
||
### 9. Approve the invoices | ||
* def v = call approveInvoice invoices | ||
|
||
### 10. Check invoices and invoice lines after approval | ||
* table invoicesExpected | ||
| id | invoiceTotal | invoiceLines | invoiceLineTotal | invoiceLineAdjustment | status | | ||
| invoiceId1 | 28.04 | 1 | 28.04 | 1.96 | 'Approved' | | ||
| invoiceId2 | 56.08 | 2 | 28.04 | 1.96 | 'Approved' | | ||
* def v = call read('@CheckInvoices') invoicesExpected | ||
* def v = call read('@CheckInvoiceLines') invoicesExpected | ||
|
||
@ignore @CheckInvoices | ||
Scenario: Check invoices | ||
Given path 'invoice/invoices', id | ||
When method GET | ||
Then status 200 | ||
And match response.currency == 'EUR' | ||
And match response.status == status | ||
And match response.adjustmentsTotal == 0.0 | ||
And match response.subTotal == invoiceTotal | ||
And match response.total == invoiceTotal | ||
And match each response.adjustments[*].id == adjustmentId | ||
And match each response.adjustments[*].value == 7.0 | ||
And match each response.adjustments[*].type == 'Amount' | ||
And match each response.adjustments[*].prorate == 'By amount' | ||
And match each response.adjustments[*].description == 'VAT' | ||
And match each response.adjustments[*].relationToTotal == 'Included in' | ||
|
||
@ignore @CheckInvoiceLines | ||
Scenario: Check invoice line | ||
Given path 'invoice/invoice-lines' | ||
And param query = 'invoiceId==' + id | ||
When method GET | ||
Then status 200 | ||
And match response.totalRecords == invoiceLines | ||
And match each response.invoiceLines[*].quantity == 1 | ||
And match each response.invoiceLines[*].total == invoiceLineTotal | ||
And match each response.invoiceLines[*].subTotal == invoiceLineTotal | ||
And match each response.invoiceLines[*].adjustmentsTotal == 0.0 | ||
And match each response.invoiceLines[*].invoiceLineStatus == status | ||
And match each response.invoiceLines[*].adjustments[*].adjustmentId == adjustmentId | ||
And match each response.invoiceLines[*].adjustments[*].value == invoiceLineAdjustment | ||
And match each response.invoiceLines[*].adjustments[*].type == 'Amount' | ||
And match each response.invoiceLines[*].adjustments[*].prorate == 'Not prorated' | ||
And match each response.invoiceLines[*].adjustments[*].description == 'VAT' | ||
And match each response.invoiceLines[*].adjustments[*].relationToTotal == 'Included in' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Two invoices used, first invoice is used to verify the logic for a simple single-line case, while the second invoice for cases with multiple invoice lines being added and/or removed. Both cases should not affect other invoice line adjustments.