-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #55 from josegiufrida/main
Add: inscription proof service
- Loading branch information
Showing
12 changed files
with
1,383 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# Padrón de AFIP constancia inscripción | ||
|
||
Los métodos de este Web Service se encuentran disponibles en `afip.registerInscriptionProofService` | ||
|
||
La especificación de este Web Service se encuentra disponible [aquí](https://www.afip.gob.ar/ws/WSCI/manual-ws-sr-ws-constancia-inscripcion.pdf) | ||
|
||
<h2> Índice </h2> | ||
|
||
[[toc]] | ||
|
||
|
||
## Obtener datos del contribuyente | ||
|
||
Debemos utilizar el metodo `getTaxpayerDetails` pasando como parámetro el documento identificador del contribuyente, por ej. el CUIT. Nos devolvera un objeto con los detalles o `null` en caso de no existir en el padrón | ||
|
||
```js | ||
const taxpayerDetails = await afip.registerInscriptionProofService.getTaxpayerDetails( | ||
20111111111 | ||
); //Devuelve los datos del contribuyente correspondiente al identificador 20111111111 | ||
``` | ||
|
||
Para mas información acerca de este método ver el item 3.2 de la [especificación del Web service](https://www.afip.gob.ar/ws/WSCI/manual-ws-sr-ws-constancia-inscripcion.pdf) | ||
|
||
## Obtener datos de múltiples contribuyentes | ||
|
||
Debemos utilizar el método `getTaxpayersDetails` pasando como parámetro un array con los documentos identificadores de los contribuyentes. Nos devolverá un array con los detalles de cada contribuyente. | ||
|
||
```js | ||
const taxpayersDetails = | ||
await afip.registerInscriptionProofService.getTaxpayersDetails([ | ||
20111111111, 20111111112, | ||
]); //Devuelve los datos de los contribuyentes correspondientes a los identificadores 20111111111y 20111111112 | ||
``` | ||
|
||
## Obtener estado del servidor | ||
|
||
Para esto utilizaremos el método `getServerStatus` | ||
|
||
```js | ||
const serverStatus = await afip.registerInscriptionProofService.getServerStatus(); | ||
|
||
console.log("Este es el estado del servidor:"); | ||
console.log(serverStatus); | ||
``` | ||
|
||
Para mas información acerca de este método ver el item 3.1 de la [especificación del Web service](https://www.afip.gob.ar/ws/WSCI/manual-ws-sr-ws-constancia-inscripcion.pdf) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
import { AfipService } from "./afip.service"; | ||
import { WsdlPathEnum } from "../soap/wsdl-path.enum"; | ||
import { ServiceNamesEnum } from "../soap/service-names.enum"; | ||
import { | ||
IPersonaServiceInscriptionProofPortSoap, | ||
PersonaServiceInscriptionProofPortTypes | ||
} from "../soap/interfaces/PersonaServiceInscriptionProof/PersonaServiceInscriptionProofPort"; | ||
import { Context } from "../types"; | ||
import { EndpointsEnum } from "../enums"; | ||
|
||
export class RegisterInscriptionProofService extends AfipService<IPersonaServiceInscriptionProofPortSoap> { | ||
constructor(context: Context) { | ||
super(context, { | ||
url: EndpointsEnum.WSSR_INSCRIPTION_PROOF, | ||
url_test: EndpointsEnum.WSSR_INSCRIPTION_PROOF_TEST, | ||
wsdl: WsdlPathEnum.WSSR_INSCRIPTION_PROOF, | ||
wsdl_test: WsdlPathEnum.WSSR_INSCRIPTION_PROOF_TEST, | ||
serviceName: ServiceNamesEnum.WSSR_INSCRIPTION_PROOF, | ||
v12: false, | ||
}); | ||
} | ||
|
||
/** | ||
* Asks to web service for servers status | ||
* | ||
* @return object { appserver : Web Service status, | ||
* dbserver : Database status, authserver : Autentication | ||
* server status} | ||
**/ | ||
async getServerStatus() { | ||
const client = await this.getClient(); | ||
const [output] = await client.dummyAsync({}); | ||
return output; | ||
} | ||
|
||
/** | ||
* Asks to web service for taxpayer details | ||
* | ||
* @return object|null if taxpayer does not exists, return null, | ||
* if it exists, returns full response | ||
**/ | ||
async getTaxpayerDetails( | ||
identifier: number | ||
): Promise<PersonaServiceInscriptionProofPortTypes.IpersonaReturn> { | ||
const client = await this.getClient(); | ||
const { Auth } = await this.getWsAuth(); | ||
const [output] = await client.getPersona_v2Async({ | ||
cuitRepresentada: Auth.Cuit, | ||
sign: Auth.Sign, | ||
token: Auth.Token, | ||
idPersona: identifier, | ||
}); | ||
return output.personaReturn; | ||
} | ||
|
||
/** | ||
* Asks to web service for taxpayers details | ||
* | ||
* @return [object] returns web service full response | ||
**/ | ||
async getTaxpayersDetails( | ||
identifiers: number[] | ||
): Promise<PersonaServiceInscriptionProofPortTypes.IpersonaListReturn> { | ||
const client = await this.getClient(); | ||
const { Auth } = await this.getWsAuth(); | ||
const [output] = await client.getPersonaList_v2Async({ | ||
cuitRepresentada: Auth.Cuit, | ||
sign: Auth.Sign, | ||
token: Auth.Token, | ||
idPersona: identifiers, | ||
}); | ||
return output.personaListReturn; | ||
} | ||
} |
Oops, something went wrong.