Reasons and explanations
The reasons that fit each kind of difference, the rules of the note, how to reopen an explanation and the three states of the explanation file.
On this page
An explanation is one reason from a fixed list and a note in your own words, given by a person for one difference. The explained differences make up the explanation file of the period, which a second person approves.
Reasons for each kind
Each difference lists the reasons that fit its kind in reasons. Any other reason is refused with reason_not_allowed.
| Kind | Reasons |
|---|---|
not-posted | not_yet_posted, different_period |
other-period | different_period |
missing-at-authority | missing_in_efactura, different_period |
duplicate | duplicate_at_authority |
rate | different_rate |
amount | different_amount |
| Reason | It says |
|---|---|
not_yet_posted | The document is real and your ledger has not posted it yet. |
different_period | The document belongs to another month. |
missing_in_efactura | Your posting is real and the authority does not list it. |
duplicate_at_authority | The authority lists the document twice; it exists once. |
different_rate | The document and the posting carry other rates. |
different_amount | The document and the posting carry other figures at the same rates. |
The note
The note says what you checked and what you found. It has 8 to 500 characters. A shorter note is refused with note_required and a longer one with note_too_long. explainedBy names the person, as your system names them. A difference that already has an explanation is refused with already_explained.
The invoice AC-004563 reached accounting on 2 October, so the reason is not_yet_posted. Explaining it takes the revision you read, 1, and moves the period to revision 2.
curl
curl -X POST "$RDC_BASE_URL/etva/v1/periods/79509f60-565a-40eb-a4c3-709e5d49e517/differences/46735209-a528-4647-ba66-da4a8e7373ee/explain" \
-H "Authorization: Bearer $RDC_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"operationId": "3b01ddcf-38da-4d6e-93cd-ccabd05f8018",
"expectedRevision": 1,
"reason": "not_yet_posted",
"note": "The invoice reached accounting on 2 October. It is posted with the October journal.",
"explainedBy": "ana-rusu"
}' JavaScript
const response = await fetch(`${process.env.RDC_BASE_URL}/etva/v1/periods/79509f60-565a-40eb-a4c3-709e5d49e517/differences/46735209-a528-4647-ba66-da4a8e7373ee/explain`, {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.RDC_TOKEN}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"operationId": "3b01ddcf-38da-4d6e-93cd-ccabd05f8018",
"expectedRevision": 1,
"reason": "not_yet_posted",
"note": "The invoice reached accounting on 2 October. It is posted with the October journal.",
"explainedBy": "ana-rusu"
}),
});
const result = await response.json(); Python
import os
import requests
response = requests.request(
'POST',
f'{os.environ["RDC_BASE_URL"]}/etva/v1/periods/79509f60-565a-40eb-a4c3-709e5d49e517/differences/46735209-a528-4647-ba66-da4a8e7373ee/explain',
headers={
'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
},
json={
'operationId': '3b01ddcf-38da-4d6e-93cd-ccabd05f8018',
'expectedRevision': 1,
'reason': 'not_yet_posted',
'note': 'The invoice reached accounting on 2 October. It is posted with the October journal.',
'explainedBy': 'ana-rusu',
},
)
result = response.json() PHP
<?php
$body = <<<'JSON'
{
"operationId": "3b01ddcf-38da-4d6e-93cd-ccabd05f8018",
"expectedRevision": 1,
"reason": "not_yet_posted",
"note": "The invoice reached accounting on 2 October. It is posted with the October journal.",
"explainedBy": "ana-rusu"
}
JSON;
$curl = curl_init(getenv('RDC_BASE_URL') . '/etva/v1/periods/79509f60-565a-40eb-a4c3-709e5d49e517/differences/46735209-a528-4647-ba66-da4a8e7373ee/explain');
curl_setopt_array($curl, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('RDC_TOKEN'),
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => $body,
]);
$result = json_decode(curl_exec($curl), true);
curl_close($curl); C#
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, $"{Environment.GetEnvironmentVariable("RDC_BASE_URL")}/etva/v1/periods/79509f60-565a-40eb-a4c3-709e5d49e517/differences/46735209-a528-4647-ba66-da4a8e7373ee/explain");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
request.Content = new StringContent("""
{
"operationId": "3b01ddcf-38da-4d6e-93cd-ccabd05f8018",
"expectedRevision": 1,
"reason": "not_yet_posted",
"note": "The invoice reached accounting on 2 October. It is posted with the October journal.",
"explainedBy": "ana-rusu"
}
""", System.Text.Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync(); {
"operationId": "3b01ddcf-38da-4d6e-93cd-ccabd05f8018",
"status": "accepted",
"aggregateId": "79509f60-565a-40eb-a4c3-709e5d49e517",
"aggregateRevision": 2
} Reopen
reopenDifference removes the explanation and returns the difference to open. A row that was explained can go back to to_review. A difference without an explanation is refused with not_explained. Explain it again to give a new reason.
curl
curl -X POST "$RDC_BASE_URL/etva/v1/periods/79509f60-565a-40eb-a4c3-709e5d49e517/differences/50ad54ee-d206-4a82-a336-193ccffdc407/reopen" \
-H "Authorization: Bearer $RDC_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"operationId": "ef9b7a23-6ac3-4e46-a94c-38f914d98b26",
"expectedRevision": 1
}' JavaScript
const response = await fetch(`${process.env.RDC_BASE_URL}/etva/v1/periods/79509f60-565a-40eb-a4c3-709e5d49e517/differences/50ad54ee-d206-4a82-a336-193ccffdc407/reopen`, {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.RDC_TOKEN}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"operationId": "ef9b7a23-6ac3-4e46-a94c-38f914d98b26",
"expectedRevision": 1
}),
});
const result = await response.json(); Python
import os
import requests
response = requests.request(
'POST',
f'{os.environ["RDC_BASE_URL"]}/etva/v1/periods/79509f60-565a-40eb-a4c3-709e5d49e517/differences/50ad54ee-d206-4a82-a336-193ccffdc407/reopen',
headers={
'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
},
json={
'operationId': 'ef9b7a23-6ac3-4e46-a94c-38f914d98b26',
'expectedRevision': 1,
},
)
result = response.json() PHP
<?php
$body = <<<'JSON'
{
"operationId": "ef9b7a23-6ac3-4e46-a94c-38f914d98b26",
"expectedRevision": 1
}
JSON;
$curl = curl_init(getenv('RDC_BASE_URL') . '/etva/v1/periods/79509f60-565a-40eb-a4c3-709e5d49e517/differences/50ad54ee-d206-4a82-a336-193ccffdc407/reopen');
curl_setopt_array($curl, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('RDC_TOKEN'),
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => $body,
]);
$result = json_decode(curl_exec($curl), true);
curl_close($curl); C#
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, $"{Environment.GetEnvironmentVariable("RDC_BASE_URL")}/etva/v1/periods/79509f60-565a-40eb-a4c3-709e5d49e517/differences/50ad54ee-d206-4a82-a336-193ccffdc407/reopen");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
request.Content = new StringContent("""
{
"operationId": "ef9b7a23-6ac3-4e46-a94c-38f914d98b26",
"expectedRevision": 1
}
""", System.Text.Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync(); {
"operationId": "ef9b7a23-6ac3-4e46-a94c-38f914d98b26",
"status": "accepted",
"aggregateId": "79509f60-565a-40eb-a4c3-709e5d49e517",
"aggregateRevision": 2
} The explanation file
Each period has one explanation file with three states. explained counts the differences that have an explanation and toReview counts the rows still to_review. canApprove is true when the file is a draft and no row is to_review.
| Status | Meaning |
|---|---|
draft | Open for work: explanations, links, imports and limits are accepted. |
approved | A second person approved it. The period takes no change. |
filed | Final. It never changes. |
Three operations move the file: approveFile from draft to approved, withdrawApproval from approved back to draft, and markFiled from approved to filed. An operation that does not fit the state is refused with wrong_file_state. While the file is not a draft, every change to the period is refused with file_locked.
Who may approve
The approver must be another person than the one who prepared the file. preparedBy names the preparer, and an approvedBy that names the same person is refused with same_person. While a row is to_review, the approval is refused with rows_to_review. In the September period preparedBy is ioana-marin; with the two open differences explained, 5 differences are explained and no row is to_review, so another person may approve. The approval below reads revision 3, after the two explanations (1 to 2 and 2 to 3), and moves the period to revision 4.
curl
curl -X POST "$RDC_BASE_URL/etva/v1/periods/79509f60-565a-40eb-a4c3-709e5d49e517/explanation-file/approve" \
-H "Authorization: Bearer $RDC_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"operationId": "384bfa16-2916-43da-a678-c6dcb3d17365",
"expectedRevision": 3,
"approvedBy": "ana-rusu"
}' JavaScript
const response = await fetch(`${process.env.RDC_BASE_URL}/etva/v1/periods/79509f60-565a-40eb-a4c3-709e5d49e517/explanation-file/approve`, {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.RDC_TOKEN}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"operationId": "384bfa16-2916-43da-a678-c6dcb3d17365",
"expectedRevision": 3,
"approvedBy": "ana-rusu"
}),
});
const result = await response.json(); Python
import os
import requests
response = requests.request(
'POST',
f'{os.environ["RDC_BASE_URL"]}/etva/v1/periods/79509f60-565a-40eb-a4c3-709e5d49e517/explanation-file/approve',
headers={
'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
},
json={
'operationId': '384bfa16-2916-43da-a678-c6dcb3d17365',
'expectedRevision': 3,
'approvedBy': 'ana-rusu',
},
)
result = response.json() PHP
<?php
$body = <<<'JSON'
{
"operationId": "384bfa16-2916-43da-a678-c6dcb3d17365",
"expectedRevision": 3,
"approvedBy": "ana-rusu"
}
JSON;
$curl = curl_init(getenv('RDC_BASE_URL') . '/etva/v1/periods/79509f60-565a-40eb-a4c3-709e5d49e517/explanation-file/approve');
curl_setopt_array($curl, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('RDC_TOKEN'),
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => $body,
]);
$result = json_decode(curl_exec($curl), true);
curl_close($curl); C#
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, $"{Environment.GetEnvironmentVariable("RDC_BASE_URL")}/etva/v1/periods/79509f60-565a-40eb-a4c3-709e5d49e517/explanation-file/approve");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
request.Content = new StringContent("""
{
"operationId": "384bfa16-2916-43da-a678-c6dcb3d17365",
"expectedRevision": 3,
"approvedBy": "ana-rusu"
}
""", System.Text.Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync(); {
"operationId": "384bfa16-2916-43da-a678-c6dcb3d17365",
"status": "accepted",
"aggregateId": "79509f60-565a-40eb-a4c3-709e5d49e517",
"aggregateRevision": 4
} Read the file with getExplanationFile, the explained differences with listExplanations and the file as CSV with getExport and kind=explanation-file. The events file.approved and file.filed announce the two steps.
curl
curl "$RDC_BASE_URL/etva/v1/periods/79509f60-565a-40eb-a4c3-709e5d49e517/explanation-file" \
-H "Authorization: Bearer $RDC_TOKEN" JavaScript
const response = await fetch(`${process.env.RDC_BASE_URL}/etva/v1/periods/79509f60-565a-40eb-a4c3-709e5d49e517/explanation-file`, {
method: 'GET',
headers: {
Authorization: `Bearer ${process.env.RDC_TOKEN}`,
},
});
const result = await response.json(); Python
import os
import requests
response = requests.request(
'GET',
f'{os.environ["RDC_BASE_URL"]}/etva/v1/periods/79509f60-565a-40eb-a4c3-709e5d49e517/explanation-file',
headers={
'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
},
)
result = response.json() PHP
<?php
$curl = curl_init(getenv('RDC_BASE_URL') . '/etva/v1/periods/79509f60-565a-40eb-a4c3-709e5d49e517/explanation-file');
curl_setopt_array($curl, [
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('RDC_TOKEN'),
],
]);
$result = json_decode(curl_exec($curl), true);
curl_close($curl); C#
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Get, $"{Environment.GetEnvironmentVariable("RDC_BASE_URL")}/etva/v1/periods/79509f60-565a-40eb-a4c3-709e5d49e517/explanation-file");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync(); {
"periodId": "79509f60-565a-40eb-a4c3-709e5d49e517",
"state": "draft",
"preparedBy": "ioana-marin",
"approvedBy": null,
"approvedAt": null,
"filedAt": null,
"explained": 3,
"toReview": 2,
"canApprove": false,
"revision": 1
}