Skip to content

Commit

Permalink
Merge pull request #55 from josegiufrida/main
Browse files Browse the repository at this point in the history
Add: inscription proof service
  • Loading branch information
ralcorta authored Feb 14, 2024
2 parents a19ca05 + 30e0ddc commit 91ea61f
Show file tree
Hide file tree
Showing 12 changed files with 1,383 additions and 0 deletions.
4 changes: 4 additions & 0 deletions docs/.vitepress/config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ export default defineConfig({
text: "1️⃣ 3️⃣ Alcance 13",
link: "/consulta_padron_alcance_13",
},
{
text: "📃 Constancia inscripción",
link: "/consulta_padron_constancia_inscripcion",
},
],
},
],
Expand Down
1 change: 1 addition & 0 deletions docs/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ La SDK actualmente ofrece soporte para una variedad de servicios de AFIP:
- **Padrón Alcance 5** - [Documentación](https://www.afip.gob.ar/ws/ws_sr_padron_a5/manual_ws_sr_padron_a5_v1.0.pdf)
- **Padrón Alcance 10** - [Documentación](https://www.afip.gob.ar/ws/ws_sr_padron_a10/manual_ws_sr_padron_a10_v1.1.pdf)
- **Padrón Alcance 13** - [Documentación](https://www.afip.gob.ar/ws/ws-padron-a13/manual-ws-sr-padron-a13-v1.2.pdf)
- **Padrón Constancia Inscripción** - [Documentación](https://www.afip.gob.ar/ws/WSCI/manual-ws-sr-ws-constancia-inscripcion.pdf)

Si deseas contribuir y añadir soporte para un nuevo servicio, puedes hacer un fork del repositorio y enviar un PR con los cambios. ¡Los evaluaremos y los incorporaremos!

Expand Down
46 changes: 46 additions & 0 deletions docs/services/consulta_padron_constancia_inscripcion.md
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)
7 changes: 7 additions & 0 deletions src/afip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { resolve } from "path";
import { Client } from "soap";
import { AfipService } from "./services/afip.service";
import { ElectronicBillingService } from "./services/electronic-billing.service";
import { RegisterInscriptionProofService } from "./services/register-inscription-proof.service";
import { RegisterScopeFiveService } from "./services/register-scope-five.service";
import { RegisterScopeFourService } from "./services/register-scope-four.service";
import { RegisterScopeTenService } from "./services/register-scope-ten.service";
Expand All @@ -10,6 +11,7 @@ import { Context, AfipServiceSoapParam } from "./types";

export class Afip {
private readonly _electronicBillingService: ElectronicBillingService;
private readonly _registerInscriptionProofService: RegisterInscriptionProofService;
private readonly _registerScopeFourService: RegisterScopeFourService;
private readonly _registerScopeFiveService: RegisterScopeFiveService;
private readonly _registerScopeTenService: RegisterScopeTenService;
Expand All @@ -23,6 +25,7 @@ export class Afip {
};

this._electronicBillingService = new ElectronicBillingService(this.context);
this._registerInscriptionProofService = new RegisterInscriptionProofService(this.context);
this._registerScopeFourService = new RegisterScopeFourService(this.context);
this._registerScopeFiveService = new RegisterScopeFiveService(this.context);
this._registerScopeTenService = new RegisterScopeTenService(this.context);
Expand All @@ -35,6 +38,10 @@ export class Afip {
return this._electronicBillingService;
}

get registerInscriptionProofService(): RegisterInscriptionProofService {
return this._registerInscriptionProofService;
}

get registerScopeFourService(): RegisterScopeFourService {
return this._registerScopeFourService;
}
Expand Down
6 changes: 6 additions & 0 deletions src/enums.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ export enum EndpointsEnum {
WSFEV1 = "https://servicios1.afip.gov.ar/wsfev1/service.asmx",
WSFEV1_TEST = "https://wswhomo.afip.gov.ar/wsfev1/service.asmx",

/**
* WS Constancia inscripción
**/
WSSR_INSCRIPTION_PROOF = "https://aws.afip.gov.ar/sr-padron/webservices/personaServiceA5",
WSSR_INSCRIPTION_PROOF_TEST = "https://awshomo.afip.gov.ar/sr-padron/webservices/personaServiceA5",

/**
* WS Padron 4
**/
Expand Down
74 changes: 74 additions & 0 deletions src/services/register-inscription-proof.service.ts
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;
}
}
Loading

0 comments on commit 91ea61f

Please sign in to comment.