UNPKG

asaaas

Version:

Unofficial Asaas Payment Gateway SDK

61 lines (60 loc) 1.81 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.InstallmentsAPI = void 0; class InstallmentsAPI { apiClient; constructor(apiClient) { this.apiClient = apiClient; } async list(params) { try { const response = await this.apiClient.get('/installments', { params }); return response.data; } catch (error) { console.error('Erro ao obter a lista de cobranças:', error); throw error; } } async getById(id) { try { const response = await this.apiClient.get(`/installments/${id}`); return response.data; } catch (error) { console.error('Erro ao obter a cobrança:', error); throw error; } } async paymentBook(id, params) { try { const response = await this.apiClient.get(`/installments/${id}/paymentBook`, { params }); return response.data; } catch (error) { console.error('Erro ao obter a linha digiável do boleto da cobrança:', error); throw error; } } async delete(id) { try { const response = await this.apiClient.delete(`/installments/${id}`); return response.data; } catch (error) { console.error('Erro ao deletar o parcelamento:', error); throw error; } } async refund(id) { try { const response = await this.apiClient.post(`/installments/${id}/refund`); return response.data; } catch (error) { console.error('Erro ao estornar o parcelamento:', error); throw error; } } } exports.InstallmentsAPI = InstallmentsAPI;