lib-cl-sii-python
lib-cl-sii-python copied to clipboard
rtc: Update AEC XML document validations
Add new validators to rtc.data_models
described in the document "Instructivo Técnico Registro Público Electrónico de Transferencia de Crédito" (retrieved on 2021-03-03)
Source: Instructivo Técnico Registro Público Electrónico de Transferencia de Crédito
-
rtc.data_models_aec
: Thecedente_rut
should be the DTE'semisor_rut
or the lastcesionario_rut
when the sequence is greater than 1 -
rtc.data_models
: Thefecha_cesion_dt
should be before or equal to the current day -
rtc.data_models
: Thefecha_ultimo_vencimiento
should be after or equal to thefecha_emision
of the DTE
@yaselc please update PR regarding the referenced documentation
Also, please update the PR description and all the commits messages so we have stable references (SII's hosted static files can not be trusted)
Also, since this PR involves a critical part of validation, please run it against many many many real cases (you will need to code something for that I suppose).
I'd also like to know the difference (timedelta) between fecha_firma_dt
and fecha_cesion_dt
for all those cases. I've got a feeling that difference must be very little (for valid "cesiones" I mean).
What if we add a warning (for more than X seconds of difference) instead of the "validation" that we are removing?
@jtrh your thoughts on this please
I'd also like to know the difference (timedelta) between
fecha_firma_dt
andfecha_cesion_dt
for all those cases. I've got a feeling that difference must be very little (for valid "cesiones" I mean).What if we add a warning (for more than X seconds of difference) instead of the "validation" that we are removing?
@jtrh your thoughts on this please
I would keep the validation of fecha_firma_dt
and fecha_cesion_dt
, but change it from an equality comparison to the following condition: the absolute value of the difference between the two datetimes
must be ≤ 60 seconds.
I would keep the validation of
fecha_firma_dt
andfecha_cesion_dt
, but change it from an equality comparison to the following condition: the absolute value of the difference between the twodatetimes
must be ≤ 60 seconds.
Also, I would do the above change in a separate pull request. The other validations are nice-to-haves, but I think we should prioritize this one so we can speed up the fix of https://github.com/fyntex/fd-cl-data/issues/671.
LGTM. @jtrh your call.
I would keep the validation of
fecha_firma_dt
andfecha_cesion_dt
, but change it from an equality comparison to the following condition: the absolute value of the difference between the twodatetimes
must be ≤ 60 seconds.Also, I would do the above change in a separate pull request. The other validations are nice-to-haves, but I think we should prioritize this one so we can speed up the fix of fyntex/fd-cl-data#671.
@jtrh I moved this specific validation to PR #208, with an analysis of a representative set of AEC, because I still have doubts about it.
CC: @jtrobles-cdd
Is this PR ready for a new review?
Codecov Report
Merging #199 (b1ca3c7) into develop (b97bb11) will increase coverage by
0.13%
. The diff coverage is91.48%
.
@@ Coverage Diff @@
## develop #199 +/- ##
===========================================
+ Coverage 81.02% 81.16% +0.13%
===========================================
Files 32 32
Lines 2525 2565 +40
Branches 375 384 +9
===========================================
+ Hits 2046 2082 +36
+ Misses 306 305 -1
- Partials 173 178 +5
Impacted Files | Coverage Δ | |
---|---|---|
cl_sii/rtc/data_models.py | 91.03% <90.62%> (-0.32%) |
:arrow_down: |
cl_sii/rtc/data_models_aec.py | 90.09% <93.33%> (-0.36%) |
:arrow_down: |
cl_sii/libs/tz_utils.py | 67.64% <0.00%> (+2.94%) |
:arrow_up: |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact)
,ø = not affected
,? = missing data
Powered by Codecov. Last update b97bb11...b1ca3c7. Read the comment docs.
Is this PR ready for a new review?
It's now... thanks
Taking into account what @ycouce-cdd and me discussed yesterday (2021-05-24), are there any validations that should be removed because they conflict with the SII's de facto rules?
It took me a long time to answer, sorry for that, but practice showed us that one thing is what the rules say and another is how they are applied. Obviously, it is not wise to implement validations that probably the SII's own system doesn't apply, it would only make sense if we wanted to generate our own AECs, but I would not use it to restrict the ones we accept. The smartest thing to do for now is to keep this PR on hold.