UNPKG

asaas

Version:

Unofficial Asaas Payment Gateway SDK

65 lines (64 loc) 2.02 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.InvoicesAPI = void 0; const BaseAPI_1 = require("./BaseAPI"); class InvoicesAPI extends BaseAPI_1.BaseAPI { constructor(apiClient, options = {}) { super(apiClient, options); } async create(params) { try { const response = await this.apiClient.post('/invoices', params); return response.data; } catch (error) { return this.handleError(error, 'Erro ao agendar uma nota fiscal:'); } } async list(params) { try { const response = await this.apiClient.get('/invoices', { params }); return response.data; } catch (error) { return this.handleError(error, 'Erro ao obter a lista de notas fiscal:'); } } async getById(id) { try { const response = await this.apiClient.get(`/invoices/${id}`); return response.data; } catch (error) { return this.handleError(error, 'Erro ao obter a nota fiscal:'); } } async updateById(id, params) { try { const response = await this.apiClient.post(`/invoices/${id}`, params); return response.data; } catch (error) { return this.handleError(error, 'Erro ao atualizar a nota fiscal:'); } } async authorize(id) { try { const response = await this.apiClient.post(`/invoices/${id}/authorize`); return response.data; } catch (error) { return this.handleError(error, 'Erro ao emitir nota fiscal:'); } } async cancel(id) { try { const response = await this.apiClient.post(`/invoices/${id}/cancel`); return response.data; } catch (error) { return this.handleError(error, 'Erro ao cancelar nota fiscal:'); } } } exports.InvoicesAPI = InvoicesAPI;