Skip to content

Commit 5a35560

Browse files
committed
Update RegisterInscriptionProof ws name
1 parent 566ba53 commit 5a35560

File tree

2 files changed

+99
-1
lines changed

2 files changed

+99
-1
lines changed

src/Afip.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ const AfipWebService = require('./Class/AfipWebService');
2323
const ElectronicBilling = require('./Class/ElectronicBilling');
2424
const RegisterScopeFour = require('./Class/RegisterScopeFour');
2525
const RegisterScopeFive = require('./Class/RegisterScopeFive');
26+
const RegisterInscriptionProof = require('./Class/RegisterInscriptionProof');
2627
const RegisterScopeTen = require('./Class/RegisterScopeTen');
2728
const RegisterScopeThirteen = require('./Class/RegisterScopeThirteen');
2829

@@ -131,7 +132,7 @@ function Afip(options = {}){
131132
this.ElectronicBilling = new ElectronicBilling(this);
132133
this.RegisterScopeFour = new RegisterScopeFour(this);
133134
this.RegisterScopeFive = new RegisterScopeFive(this);
134-
this.RegisterInscriptionProof = new RegisterScopeFive(this);
135+
this.RegisterInscriptionProof = new RegisterInscriptionProof(this);
135136
this.RegisterScopeTen = new RegisterScopeTen(this);
136137
this.RegisterScopeThirteen = new RegisterScopeThirteen(this);
137138
}
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
const AfipWebService = require('./AfipWebService');
2+
3+
/**
4+
* SDK for AFIP Register Inscription Proof (ws_sr_constancia_inscripcion)
5+
**/
6+
module.exports = class RegisterInscriptionProof extends AfipWebService {
7+
constructor(afip){
8+
const options = {
9+
soapV12: false,
10+
WSDL: 'ws_sr_padron_a5-production.wsdl',
11+
URL: 'https://aws.afip.gov.ar/sr-padron/webservices/personaServiceA5',
12+
WSDL_TEST: 'ws_sr_padron_a5.wsdl',
13+
URL_TEST: 'https://awshomo.afip.gov.ar/sr-padron/webservices/personaServiceA5',
14+
afip
15+
}
16+
17+
super(options, { service: 'ws_sr_constancia_inscripcion' });
18+
}
19+
/**
20+
* Asks to web service for servers status {@see WS
21+
* Specification item 3.1}
22+
*
23+
* @return object { appserver : Web Service status,
24+
* dbserver : Database status, authserver : Autentication
25+
* server status}
26+
**/
27+
async getServerStatus() {
28+
return this.executeRequest('dummy');
29+
}
30+
31+
/**
32+
* Asks to web service for taxpayer details {@see WS
33+
* Specification item 3.2}
34+
*
35+
* @throws Exception if exists an error in response
36+
*
37+
* @return object|null if taxpayer does not exists, return null,
38+
* if it exists, returns full response {@see
39+
* WS Specification item 3.2.2}
40+
**/
41+
async getTaxpayerDetails(identifier) {
42+
// Get token and sign
43+
let { token, sign } = await this.afip.GetServiceTA('ws_sr_constancia_inscripcion');
44+
45+
// Prepare SOAP params
46+
let params = {
47+
token, sign,
48+
cuitRepresentada: this.afip.CUIT,
49+
idPersona: identifier
50+
};
51+
52+
return this.executeRequest('getPersona_v2', params)
53+
.then(res => res)
54+
.catch(err => { if (err.message.indexOf('No existe') !== -1) { return null } else { throw err }});
55+
}
56+
57+
/**
58+
* Asks to web service for taxpayers details
59+
*
60+
* @throws Exception if exists an error in response
61+
*
62+
* @return [object] returns web service full response
63+
**/
64+
async getTaxpayersDetails(identifiers) {
65+
// Get token and sign
66+
let { token, sign } = await this.afip.GetServiceTA('ws_sr_constancia_inscripcion');
67+
68+
// Prepare SOAP params
69+
let params = {
70+
token, sign,
71+
cuitRepresentada: this.afip.CUIT,
72+
idPersona: identifiers
73+
};
74+
75+
return this.executeRequest('getPersonaList_v2', params)
76+
.then(res => res.persona);
77+
}
78+
79+
/**
80+
* Send request to AFIP servers
81+
*
82+
* @param operation SOAP operation to execute
83+
* @param params Parameters to send
84+
*
85+
* @return mixed Operation results
86+
**/
87+
async executeRequest(operation, params = {})
88+
{
89+
let results = await super.executeRequest(operation, params);
90+
91+
return results[
92+
operation === 'getPersona_v2' ? 'personaReturn' :
93+
(operation === 'getPersonaList_v2' ? 'personaListReturn': 'return')
94+
];
95+
}
96+
}
97+

0 commit comments

Comments
 (0)