File tree Expand file tree Collapse file tree 2 files changed +26
-1
lines changed Expand file tree Collapse file tree 2 files changed +26
-1
lines changed Original file line number Diff line number Diff line change @@ -79,6 +79,16 @@ EPersonNotFound = class(EAfipException)
79
79
public
80
80
constructor Create(const ARawJson: string); override;
81
81
end ;
82
+
83
+ // / <summary>
84
+ // / Esta excepcion se va a elevar cuando no se encuentra una constancia de
85
+ // / CUIT. Desciende de Exception porque no hay informacion JSON para
86
+ // / mostrar
87
+ // / </summary>
88
+ EConstanciaNotFound = class (Exception)
89
+ public
90
+ constructor Create; reintroduce;
91
+ end ;
82
92
{ $ENDREGION}
83
93
84
94
{ $REGION 'TDomicilioFiscal'}
@@ -567,7 +577,13 @@ procedure TDomicilioFiscal.SetRawJson(const Value: string);
567
577
568
578
function TDomicilioFiscal.ToString : string;
569
579
begin
570
- Result := Direccion + ' , ' + Localidad + ' , ' + CodPostal;
580
+ Result := Direccion;
581
+
582
+ if Localidad <> EmptyStr then
583
+ Result := Result + ' , ' + Localidad;
584
+
585
+ if CodPostal <> EmptyStr then
586
+ Result := Result + ' , ' + CodPostal;
571
587
end ;
572
588
573
589
{ $ENDREGION}
@@ -647,4 +663,11 @@ constructor EPersonNotFound.Create(const ARawJson: string);
647
663
end ;
648
664
{ $ENDREGION}
649
665
666
+ { EConstanciaNotFound }
667
+
668
+ constructor EConstanciaNotFound.Create;
669
+ begin
670
+ inherited Create(' No se encontraron resultados' );
671
+ end ;
672
+
650
673
end .
Original file line number Diff line number Diff line change @@ -123,6 +123,8 @@ function TAfipQuery.ObtenerConstancia(const Cuit: string): TStream;
123
123
begin
124
124
Result := TMemoryStream.Create;
125
125
AResponse := FHttpClient.Get(FServicesUrl[stConstancia] + Cuit, Result);
126
+ if Result.Size = 0 then
127
+ raise EConstanciaNotFound.Create;
126
128
end ;
127
129
{ $ENDREGION}
128
130
You can’t perform that action at this time.
0 commit comments