Skip to content

Commit

Permalink
Merge pull request #8 from dliocode/fix-web-service-url-with-Usar
Browse files Browse the repository at this point in the history
fix: web service url with Usar in urls
  • Loading branch information
Maurelima authored Sep 1, 2024
2 parents 178deb7 + 2873d1b commit 794cc79
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/utils/Utility.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,12 @@ class Utility {
* Retorna a url correta do webservice
*/
getWebServiceUrl(metodo: string, ambienteNacional = false, versao = ""): string {
const { chaveMae, chaveFilha } = this.setAmbiente(metodo, ambienteNacional, versao);
let { chaveMae, chaveFilha } = this.setAmbiente(metodo, ambienteNacional, versao);
const urls = NFeServicosUrl as NFeServicosUrlType;

if ('Usar' in urls[chaveMae])
chaveMae = urls[chaveMae].Usar

const url = urls[chaveMae] && urls[chaveMae][chaveFilha];
if (!url) {
throw new Error(`Não foi possível recuperar a url para o webservice: ${chaveFilha}`);
Expand Down

0 comments on commit 794cc79

Please # to comment.