Validate before approval
Read the findings, understand the rules, and rebuild the form that is behind until the errors are gone.
On this page
The checks look at one return and at the other returns of the same company and period. An error blocks signing, approving and filing. A warning is for you to read and does not block.
The rules
| Rule | Severity | Forms | Requires |
|---|---|---|---|
X-01 | error | D300, D394 | The supplies and acquisitions of D394 must equal the rows of D300, by rate. |
X-02 | error | D300, D390 | The acquisitions of D390 must equal the acquisitions from other member states in D300. |
S-01 | error | D406 | The total debit of the ledger must equal its total credit. |
P-01 | error | D394 | Every partner row must carry a tax code. |
W-01 | warning | D300 | The return shows VAT to recover. |
The catalogue is also an operation: listRules.
Read the findings
The sample is the VAT return of October. It was signed from snapshot 1, when it agreed with the recapitulative statement D390. Then a purchase from another member state was posted late and D390 was rebuilt from snapshot 2; the VAT return was not. The finding names the rule X-02, the row and the two amounts that differ, so canApprove is false.
curl
curl "$RDC_BASE_URL/declarations/v1/returns/3b559a77-5de4-4b9a-9e2e-ca6625d123f2/findings" \
-H "Authorization: Bearer $RDC_TOKEN" JavaScript
const response = await fetch(`${process.env.RDC_BASE_URL}/declarations/v1/returns/3b559a77-5de4-4b9a-9e2e-ca6625d123f2/findings`, {
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"]}/declarations/v1/returns/3b559a77-5de4-4b9a-9e2e-ca6625d123f2/findings',
headers={
'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
},
)
result = response.json() PHP
<?php
$curl = curl_init(getenv('RDC_BASE_URL') . '/declarations/v1/returns/3b559a77-5de4-4b9a-9e2e-ca6625d123f2/findings');
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")}/declarations/v1/returns/3b559a77-5de4-4b9a-9e2e-ca6625d123f2/findings");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync(); {
"returnId": "3b559a77-5de4-4b9a-9e2e-ca6625d123f2",
"revision": 4,
"canApprove": false,
"errors": 1,
"warnings": 0,
"findings": [
{
"rule": "X-02",
"severity": "error",
"row": "ic-acquisitions",
"message": "The acquisitions of D390 must equal the acquisitions from other member states in D300. This return has 5252.00; D390 has 8534.50."
}
]
} Fix the form that is behind
Find the older build
Read the
snapshotof both returns. The one with the smaller number was built from the older ledger.Rebuild it
regenerateReturn builds it from the newest snapshot and puts it back to
generated. Its validation and its signature are replaced; the history keeps them.Validate it
validateReturn records the validation. When both returns agree, the error is gone from both.
Sign it again
signReturn records a new signature on the new build.
Read the findings again
canApproveis true. Now the return can be approved.
curl
curl -X POST "$RDC_BASE_URL/declarations/v1/returns/3b559a77-5de4-4b9a-9e2e-ca6625d123f2/validate" \
-H "Authorization: Bearer $RDC_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"operationId": "87fbb260-7b9b-436b-bfd0-8ee38a87676e",
"expectedRevision": 5
}' JavaScript
const response = await fetch(`${process.env.RDC_BASE_URL}/declarations/v1/returns/3b559a77-5de4-4b9a-9e2e-ca6625d123f2/validate`, {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.RDC_TOKEN}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"operationId": "87fbb260-7b9b-436b-bfd0-8ee38a87676e",
"expectedRevision": 5
}),
});
const result = await response.json(); Python
import os
import requests
response = requests.request(
'POST',
f'{os.environ["RDC_BASE_URL"]}/declarations/v1/returns/3b559a77-5de4-4b9a-9e2e-ca6625d123f2/validate',
headers={
'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
},
json={
'operationId': '87fbb260-7b9b-436b-bfd0-8ee38a87676e',
'expectedRevision': 5,
},
)
result = response.json() PHP
<?php
$body = <<<'JSON'
{
"operationId": "87fbb260-7b9b-436b-bfd0-8ee38a87676e",
"expectedRevision": 5
}
JSON;
$curl = curl_init(getenv('RDC_BASE_URL') . '/declarations/v1/returns/3b559a77-5de4-4b9a-9e2e-ca6625d123f2/validate');
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")}/declarations/v1/returns/3b559a77-5de4-4b9a-9e2e-ca6625d123f2/validate");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
request.Content = new StringContent("""
{
"operationId": "87fbb260-7b9b-436b-bfd0-8ee38a87676e",
"expectedRevision": 5
}
""", System.Text.Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync(); {
"operationId": "87fbb260-7b9b-436b-bfd0-8ee38a87676e",
"status": "accepted",
"aggregateId": "3b559a77-5de4-4b9a-9e2e-ca6625d123f2",
"aggregateRevision": 6
}