UNPKG

sdk-node-apis-efi

Version:

Module for integration with Efi Bank API

714 lines (713 loc) 31.5 kB
import axios from 'axios'; import { randomInt } from 'node:crypto'; import { endpoints } from './constants/endpoints.js'; import { buildHttpsAgent, httpRequest, SDK_IDENTIFIER } from './httpClient.js'; import { createStaticPix } from './pixStatic.js'; const ALPHANUMERIC = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; const TOKEN_EXPIRATION_MARGIN_SECONDS = 30; const WEBHOOK_CONFIGURATION_ENDPOINTS = new Set([ 'pixConfigWebhook', 'pixConfigWebhookRecurrenceAutomatic', 'pixConfigWebhookAutomaticCharge', 'payConfigWebhook', 'accountConfigWebhook', ]); function generateIdempotencyKey(length = 72) { let key = ''; for (let i = 0; i < length; i += 1) { key += ALPHANUMERIC[randomInt(0, ALPHANUMERIC.length)]; } return key; } function getBaseUrl(apiKey, sandbox) { const api = endpoints.APIS[apiKey]; return sandbox ? api.URL.SANDBOX : api.URL.PRODUCTION; } function normalizeParams(params) { return (params ?? {}); } function isEmptyParams(value) { return value !== null && typeof value === 'object' && !Array.isArray(value) && Object.keys(value).length === 0; } function hasHeader(headers, name) { const normalizedName = name.toLowerCase(); return Object.keys(headers ?? {}).some((headerName) => headerName.toLowerCase() === normalizedName); } function handleAuthError(authError) { const error = authError?.response?.data || authError?.cause || authError; switch (error?.message) { case 'socket hang up': throw new Error('Verifique sandbox e certificate para o ambiente desejado.'); case 'header too long': throw new Error('Verifique se o certificado foi enviado no formato correto.'); case 'wrong tag': case 'error:0909006C:PEM routines:get_name:no start line': throw new Error('Foi enviado um certificado .pem sem pemKey correspondente.'); default: throw error; } } export class EfiPay { constructor(options) { this.authCache = new Map(); this.authInFlight = new Map(); if (!options.client_id || !options.client_secret) { throw new Error('client_id e client_secret sao obrigatorios'); } this.options = { ...options, cache: options.cache ?? true }; } resolveRequestContext(name) { const apiKeys = Object.keys(endpoints.APIS); const defaultEndpoint = endpoints.APIS.DEFAULT.ENDPOINTS[name]; if (defaultEndpoint) { return { apiKey: 'DEFAULT', endpoint: defaultEndpoint, baseUrl: getBaseUrl('DEFAULT', this.options.sandbox), authRoute: endpoints.APIS.DEFAULT.ENDPOINTS.authorize, }; } for (const apiKey of apiKeys) { const endpoint = endpoints.APIS[apiKey].ENDPOINTS[name]; if (endpoint) { return { apiKey, endpoint, baseUrl: getBaseUrl(apiKey, this.options.sandbox), authRoute: endpoints.APIS[apiKey].ENDPOINTS.authorize, }; } } throw new Error(`Endpoint "${name}" nao encontrado`); } isExpired(auth) { if (!this.options.cache) return true; const now = Date.now() / 1000; return now > auth.authDate + auth.expires_in - TOKEN_EXPIRATION_MARGIN_SECONDS; } async authenticate(context) { const cachedAuth = this.authCache.get(context.baseUrl); if (cachedAuth && !this.isExpired(cachedAuth)) { return cachedAuth; } const inFlight = this.authInFlight.get(context.baseUrl); if (inFlight) return inFlight; const authentication = this.requestAuthentication(context); this.authInFlight.set(context.baseUrl, authentication); try { return await authentication; } finally { if (this.authInFlight.get(context.baseUrl) === authentication) { this.authInFlight.delete(context.baseUrl); } } } async requestAuthentication(context) { const authParams = { method: 'POST', url: context.baseUrl + context.authRoute.route, headers: { 'api-sdk': SDK_IDENTIFIER, }, data: { grant_type: 'client_credentials', }, }; if (context.apiKey === 'DEFAULT') { authParams.auth = { username: this.options.client_id, password: this.options.client_secret, }; } else { const token = Buffer.from(`${this.options.client_id}:${this.options.client_secret}`).toString('base64'); authParams.headers.Authorization = `Basic ${token}`; authParams.headers['Content-Type'] = 'application/json'; authParams.httpsAgent = buildHttpsAgent(this.options); } try { const res = await axios(authParams); const auth = { ...res.data, authDate: Date.now() / 1000, }; this.authCache.set(context.baseUrl, auth); return auth; } catch (error) { handleAuthError(error); } } async call(endpointName, params, body, headers) { const context = this.resolveRequestContext(endpointName); if (context.apiKey !== 'DEFAULT' && !this.options.certificate) { throw new Error(`certificate e obrigatorio para consumir a API ${context.apiKey}`); } const auth = await this.authenticate(context); const certificateOptions = context.apiKey === 'DEFAULT' ? {} : { certificate: this.options.certificate, pemKey: this.options.pemKey, cert_base64: this.options.cert_base64, }; return httpRequest({ baseUrl: context.baseUrl, endpoint: context.endpoint, params: normalizeParams(params), body, headers, authorization: `Bearer ${auth.access_token}`, partner_token: this.options.partner_token, skipMtlsChecking: WEBHOOK_CONFIGURATION_ENDPOINTS.has(endpointName) && this.options.validateMtls === false, idempotencyKey: context.apiKey === 'OPENFINANCE' && !hasHeader(headers, 'x-idempotency-key') ? this.options.idempotencyKey ?? generateIdempotencyKey() : undefined, ...certificateOptions, }); } callBodyEndpoint(endpointName, bodyOrParams, bodyOrHeaders, legacyHeaders) { if (isEmptyParams(bodyOrParams)) { return this.call(endpointName, {}, bodyOrHeaders, legacyHeaders); } return this.call(endpointName, {}, bodyOrParams, bodyOrHeaders); } callWithoutParams(endpointName, paramsOrHeaders, legacyHeaders) { const headers = isEmptyParams(paramsOrHeaders) ? legacyHeaders : paramsOrHeaders; return this.call(endpointName, {}, undefined, headers); } createOneStepCharge(bodyOrParams, bodyOrHeaders, headers) { return this.callBodyEndpoint('createOneStepCharge', bodyOrParams, bodyOrHeaders, headers); } createCharge(bodyOrParams, bodyOrHeaders, headers) { return this.callBodyEndpoint('createCharge', bodyOrParams, bodyOrHeaders, headers); } definePayMethod(params, body, headers) { return this.call('definePayMethod', params, body, headers); } detailCharge(params, headers) { return this.call('detailCharge', params, undefined, headers); } listCharges(params, headers) { return this.call('listCharges', params, undefined, headers); } updateChargeMetadata(params, body, headers) { return this.call('updateChargeMetadata', params, body, headers); } updateBillet(params, body, headers) { return this.call('updateBillet', params, body, headers); } cancelCharge(params, headers) { return this.call('cancelCharge', params, undefined, headers); } sendBilletEmail(params, body, headers) { return this.call('sendBilletEmail', params, body, headers); } createChargeHistory(params, body, headers) { return this.call('createChargeHistory', params, body, headers); } defineBalanceSheetBillet(params, body, headers) { return this.call('defineBalanceSheetBillet', params, body, headers); } settleCharge(params, headers) { return this.call('settleCharge', params, undefined, headers); } cardPaymentRetry(params, body, headers) { return this.call('cardPaymentRetry', params, body, headers); } refundCard(params, body, headers) { return this.call('refundCard', params, body, headers); } getInstallments(params, headers) { return this.call('getInstallments', params, undefined, headers); } createCarnet(bodyOrParams, bodyOrHeaders, headers) { return this.callBodyEndpoint('createCarnet', bodyOrParams, bodyOrHeaders, headers); } detailCarnet(params, headers) { return this.call('detailCarnet', params, undefined, headers); } updateCarnetMetadata(params, body, headers) { return this.call('updateCarnetMetadata', params, body, headers); } updateCarnetParcel(params, body, headers) { return this.call('updateCarnetParcel', params, body, headers); } updateCarnetParcels(params, body, headers) { return this.call('updateCarnetParcels', params, body, headers); } cancelCarnet(params, headers) { return this.call('cancelCarnet', params, undefined, headers); } cancelCarnetParcel(params, headers) { return this.call('cancelCarnetParcel', params, undefined, headers); } sendCarnetEmail(params, body, headers) { return this.call('sendCarnetEmail', params, body, headers); } sendCarnetParcelEmail(params, body, headers) { return this.call('sendCarnetParcelEmail', params, body, headers); } createCarnetHistory(params, body, headers) { return this.call('createCarnetHistory', params, body, headers); } settleCarnet(params, headers) { return this.call('settleCarnet', params, undefined, headers); } settleCarnetParcel(params, headers) { return this.call('settleCarnetParcel', params, undefined, headers); } createPlan(bodyOrParams, bodyOrHeaders, headers) { return this.callBodyEndpoint('createPlan', bodyOrParams, bodyOrHeaders, headers); } listPlans(params, headers) { return this.call('listPlans', params, undefined, headers); } updatePlan(params, body, headers) { return this.call('updatePlan', params, body, headers); } deletePlan(params, headers) { return this.call('deletePlan', params, undefined, headers); } createOneStepSubscription(params, body, headers) { return this.call('createOneStepSubscription', params, body, headers); } createSubscription(params, body, headers) { return this.call('createSubscription', params, body, headers); } defineSubscriptionPayMethod(params, body, headers) { return this.call('defineSubscriptionPayMethod', params, body, headers); } detailSubscription(params, headers) { return this.call('detailSubscription', params, undefined, headers); } createOneStepSubscriptionLink(params, body, headers) { return this.call('createOneStepSubscriptionLink', params, body, headers); } updateSubscriptionMetadata(params, body, headers) { return this.call('updateSubscriptionMetadata', params, body, headers); } updateSubscription(params, body, headers) { return this.call('updateSubscription', params, body, headers); } cancelSubscription(params, headers) { return this.call('cancelSubscription', params, undefined, headers); } createSubscriptionHistory(params, body, headers) { return this.call('createSubscriptionHistory', params, body, headers); } sendSubscriptionLinkEmail(params, body, headers) { return this.call('sendSubscriptionLinkEmail', params, body, headers); } createOneStepLink(bodyOrParams, bodyOrHeaders, headers) { return this.callBodyEndpoint('createOneStepLink', bodyOrParams, bodyOrHeaders, headers); } defineLinkPayMethod(params, body, headers) { return this.call('defineLinkPayMethod', params, body, headers); } updateChargeLink(params, body, headers) { return this.call('updateChargeLink', params, body, headers); } sendLinkEmail(params, body, headers) { return this.call('sendLinkEmail', params, body, headers); } getNotification(params, headers) { return this.call('getNotification', params, undefined, headers); } createChargeCard(bodyOrParams, bodyOrHeaders, headers) { return this.callBodyEndpoint('createChargeCard', bodyOrParams, bodyOrHeaders, headers); } pixCreateImmediateCharge(bodyOrParams, bodyOrHeaders, headers) { return this.callBodyEndpoint('pixCreateImmediateCharge', bodyOrParams, bodyOrHeaders, headers); } pixCreateCharge(params, body, headers) { return this.call('pixCreateCharge', params, body, headers); } pixUpdateCharge(params, body, headers) { return this.call('pixUpdateCharge', params, body, headers); } pixDetailCharge(params, headers) { return this.call('pixDetailCharge', params, undefined, headers); } pixListCharges(params, headers) { return this.call('pixListCharges', params, undefined, headers); } pixCreateDueCharge(params, body, headers) { return this.call('pixCreateDueCharge', params, body, headers); } pixUpdateDueCharge(params, body, headers) { return this.call('pixUpdateDueCharge', params, body, headers); } pixDetailDueCharge(params, headers) { return this.call('pixDetailDueCharge', params, undefined, headers); } pixListDueCharges(params, headers) { return this.call('pixListDueCharges', params, undefined, headers); } pixSend(params, body, headers) { return this.call('pixSend', params, body, headers); } pixSendDetail(params, headers) { return this.call('pixSendDetail', params, undefined, headers); } pixSendDetailId(params, headers) { return this.call('pixSendDetailId', params, undefined, headers); } pixSendList(params, headers) { return this.call('pixSendList', params, undefined, headers); } async pixQrCodeDetail(bodyOrParams, legacyBody) { const payload = legacyBody ?? bodyOrParams; if (!payload || typeof payload.pixCopiaECola !== 'string' || payload.pixCopiaECola.trim() === '') { throw new Error('O campo "pixCopiaECola" e obrigatorio e deve ser uma string.'); } const { getDecodedPixJwt } = await import('pix-qr-code-detail'); const decoded = await getDecodedPixJwt(payload.pixCopiaECola); const tipoCob = payload.pixCopiaECola.includes('/cobv/') ? 'cobv' : 'cob'; if (decoded.payload && typeof decoded.payload === 'object') { return { tipoCob, ...decoded.payload }; } return decoded.payload; } pixQrCodePay(params, body, headers) { return this.call('pixQrCodePay', params, body, headers); } pixDetailReceived(params, headers) { return this.call('pixDetailReceived', params, undefined, headers); } pixReceivedList(params, headers) { return this.call('pixReceivedList', params, undefined, headers); } pixDevolution(params, body, headers) { return this.call('pixDevolution', params, body, headers); } pixDetailDevolution(params, headers) { return this.call('pixDetailDevolution', params, undefined, headers); } pixCreateLocation(bodyOrParams, bodyOrHeaders, headers) { return this.callBodyEndpoint('pixCreateLocation', bodyOrParams, bodyOrHeaders, headers); } pixLocationList(params, headers) { return this.call('pixLocationList', params, undefined, headers); } pixDetailLocation(params, headers) { return this.call('pixDetailLocation', params, undefined, headers); } pixGenerateQRCode(params, headers) { return this.call('pixGenerateQRCode', params, undefined, headers); } pixUnlinkTxidLocation(params, headers) { return this.call('pixUnlinkTxidLocation', params, undefined, headers); } pixCreateDueChargeBatch(params, body, headers) { return this.call('pixCreateDueChargeBatch', params, body, headers); } pixUpdateDueChargeBatch(params, body, headers) { return this.call('pixUpdateDueChargeBatch', params, body, headers); } pixDetailDueChargeBatch(params, headers) { return this.call('pixDetailDueChargeBatch', params, undefined, headers); } pixListDueChargeBatch(params, headers) { return this.call('pixListDueChargeBatch', params, undefined, headers); } pixSplitConfig(bodyOrParams, bodyOrHeaders, headers) { return this.callBodyEndpoint('pixSplitConfig', bodyOrParams, bodyOrHeaders, headers); } pixSplitConfigId(params, body, headers) { return this.call('pixSplitConfigId', params, body, headers); } pixSplitDetailConfig(params, headers) { return this.call('pixSplitDetailConfig', params, undefined, headers); } pixSplitLinkCharge(params, headers) { return this.call('pixSplitLinkCharge', params, undefined, headers); } pixSplitLinkDueCharge(params, headers) { return this.call('pixSplitLinkDueCharge', params, undefined, headers); } pixSplitUnlinkCharge(params, headers) { return this.call('pixSplitUnlinkCharge', params, undefined, headers); } pixSplitUnlinkDueCharge(params, headers) { return this.call('pixSplitUnlinkDueCharge', params, undefined, headers); } pixSplitDetailCharge(params, headers) { return this.call('pixSplitDetailCharge', params, undefined, headers); } pixSplitDetailDueCharge(params, headers) { return this.call('pixSplitDetailDueCharge', params, undefined, headers); } pixConfigWebhook(params, body, headers) { return this.call('pixConfigWebhook', params, body, headers); } pixDetailWebhook(params, headers) { return this.call('pixDetailWebhook', params, undefined, headers); } pixListWebhook(params, headers) { return this.call('pixListWebhook', params, undefined, headers); } pixDeleteWebhook(params, headers) { return this.call('pixDeleteWebhook', params, undefined, headers); } pixCreateEvp(paramsOrHeaders, headers) { return this.callWithoutParams('pixCreateEvp', paramsOrHeaders, headers); } pixListEvp(paramsOrHeaders, headers) { return this.callWithoutParams('pixListEvp', paramsOrHeaders, headers); } pixDeleteEvp(params, headers) { return this.call('pixDeleteEvp', params, undefined, headers); } getAccountBalance(params, headers) { return this.call('getAccountBalance', params, undefined, headers); } updateAccountConfig(bodyOrParams, bodyOrHeaders, headers) { return this.callBodyEndpoint('updateAccountConfig', bodyOrParams, bodyOrHeaders, headers); } listAccountConfig(paramsOrHeaders, headers) { return this.callWithoutParams('listAccountConfig', paramsOrHeaders, headers); } medList(params, headers) { return this.call('medList', params, undefined, headers); } medDefense(params, body, headers) { return this.call('medDefense', params, body, headers); } createReport(bodyOrParams, bodyOrHeaders, headers) { return this.callBodyEndpoint('createReport', bodyOrParams, bodyOrHeaders, headers); } detailReport(params, headers) { return this.call('detailReport', params, undefined, headers); } pixResendWebhook(bodyOrParams, bodyOrHeaders, headers) { return this.callBodyEndpoint('pixResendWebhook', bodyOrParams, bodyOrHeaders, headers); } pixGetReceipt(params, headers) { return this.call('pixGetReceipt', params, undefined, headers); } pixDetailRecurrenceAutomatic(params, headers) { return this.call('pixDetailRecurrenceAutomatic', params, undefined, headers); } pixUpdateRecurrenceAutomatic(params, body, headers) { return this.call('pixUpdateRecurrenceAutomatic', params, body, headers); } pixListRecurrenceAutomatic(params, headers) { return this.call('pixListRecurrenceAutomatic', params, undefined, headers); } pixCreateRecurrenceAutomatic(bodyOrParams, bodyOrHeaders, headers) { return this.callBodyEndpoint('pixCreateRecurrenceAutomatic', bodyOrParams, bodyOrHeaders, headers); } pixCreateRequestRecurrenceAutomatic(bodyOrParams, bodyOrHeaders, headers) { return this.callBodyEndpoint('pixCreateRequestRecurrenceAutomatic', bodyOrParams, bodyOrHeaders, headers); } pixDetailRequestRecurrenceAutomatic(params, headers) { return this.call('pixDetailRequestRecurrenceAutomatic', params, undefined, headers); } pixUpdateRequestRecurrenceAutomatic(params, body, headers) { return this.call('pixUpdateRequestRecurrenceAutomatic', params, body, headers); } pixCreateAutomaticChargeTxid(params, body, headers) { return this.call('pixCreateAutomaticChargeTxid', params, body, headers); } pixUpdateAutomaticCharge(params, body, headers) { return this.call('pixUpdateAutomaticCharge', params, body, headers); } pixDetailAutomaticCharge(params, headers) { return this.call('pixDetailAutomaticCharge', params, undefined, headers); } pixCreateAutomaticCharge(bodyOrParams, bodyOrHeaders, headers) { return this.callBodyEndpoint('pixCreateAutomaticCharge', bodyOrParams, bodyOrHeaders, headers); } pixListAutomaticCharge(params, headers) { return this.call('pixListAutomaticCharge', params, undefined, headers); } pixRetryRequestAutomatic(params, headers) { return this.call('pixRetryRequestAutomatic', params, undefined, headers); } pixCreateLocationRecurrenceAutomatic(paramsOrHeaders, headers) { return this.callWithoutParams('pixCreateLocationRecurrenceAutomatic', paramsOrHeaders, headers); } pixListLocationRecurrenceAutomatic(params, headers) { return this.call('pixListLocationRecurrenceAutomatic', params, undefined, headers); } pixDetailLocationRecurrenceAutomatic(params, headers) { return this.call('pixDetailLocationRecurrenceAutomatic', params, undefined, headers); } pixUnlinkLocationRecurrenceAutomatic(params, headers) { return this.call('pixUnlinkLocationRecurrenceAutomatic', params, undefined, headers); } pixConfigWebhookRecurrenceAutomatic(bodyOrParams, bodyOrHeaders, headers) { return this.callBodyEndpoint('pixConfigWebhookRecurrenceAutomatic', bodyOrParams, bodyOrHeaders, headers); } pixListWebhookRecurrenceAutomatic(paramsOrHeaders, headers) { return this.callWithoutParams('pixListWebhookRecurrenceAutomatic', paramsOrHeaders, headers); } pixDeleteWebhookRecurrenceAutomatic(paramsOrHeaders, headers) { return this.callWithoutParams('pixDeleteWebhookRecurrenceAutomatic', paramsOrHeaders, headers); } pixConfigWebhookAutomaticCharge(bodyOrParams, bodyOrHeaders, headers) { return this.callBodyEndpoint('pixConfigWebhookAutomaticCharge', bodyOrParams, bodyOrHeaders, headers); } pixListWebhookAutomaticCharge(paramsOrHeaders, headers) { return this.callWithoutParams('pixListWebhookAutomaticCharge', paramsOrHeaders, headers); } pixDeleteWebhookAutomaticCharge(paramsOrHeaders, headers) { return this.callWithoutParams('pixDeleteWebhookAutomaticCharge', paramsOrHeaders, headers); } pixSplitDevolution(params, body, headers) { return this.call('pixSplitDevolution', params, body, headers); } pixSendSameOwnership(params, body, headers) { return this.call('pixSendSameOwnership', params, body, headers); } pixKeysBucket(paramsOrHeaders, headers) { return this.callWithoutParams('pixKeysBucket', paramsOrHeaders, headers); } pixGenerateStaticQRCode(pixData) { return createStaticPix(pixData); } ofConfigDetail(paramsOrHeaders, headers) { return this.callWithoutParams('ofConfigDetail', paramsOrHeaders, headers); } ofConfigUpdate(bodyOrParams, bodyOrHeaders, headers) { return this.callBodyEndpoint('ofConfigUpdate', bodyOrParams, bodyOrHeaders, headers); } ofListParticipants(params, headers) { return this.call('ofListParticipants', params, undefined, headers); } ofListPixPayment(params, headers) { return this.call('ofListPixPayment', params, undefined, headers); } ofStartPixPayment(bodyOrParams, bodyOrHeaders, headers) { return this.callBodyEndpoint('ofStartPixPayment', bodyOrParams, bodyOrHeaders, headers); } ofDevolutionPix(params, body, headers) { return this.call('ofDevolutionPix', params, body, headers); } ofStartSchedulePixPayment(bodyOrParams, bodyOrHeaders, headers) { return this.callBodyEndpoint('ofStartSchedulePixPayment', bodyOrParams, bodyOrHeaders, headers); } ofListSchedulePixPayment(params, headers) { return this.call('ofListSchedulePixPayment', params, undefined, headers); } ofCancelSchedulePix(params, headers) { return this.call('ofCancelSchedulePix', params, undefined, headers); } ofDevolutionSchedulePix(params, body, headers) { return this.call('ofDevolutionSchedulePix', params, body, headers); } ofStartRecurrencyPixPayment(bodyOrParams, bodyOrHeaders, headers) { return this.callBodyEndpoint('ofStartRecurrencyPixPayment', bodyOrParams, bodyOrHeaders, headers); } ofListRecurrencyPixPayment(params, headers) { return this.call('ofListRecurrencyPixPayment', params, undefined, headers); } ofCancelRecurrencyPix(params, headers) { return this.call('ofCancelRecurrencyPix', params, undefined, headers); } ofDevolutionRecurrencyPix(params, body, headers) { return this.call('ofDevolutionRecurrencyPix', params, body, headers); } ofReplaceRecurrencyPixParcel(params, body, headers) { return this.call('ofReplaceRecurrencyPixParcel', params, body, headers); } ofCreateBiometricEnrollment(bodyOrParams, bodyOrHeaders, headers) { return this.callBodyEndpoint('ofCreateBiometricEnrollment', bodyOrParams, bodyOrHeaders, headers); } ofListBiometricEnrollment(params, headers) { return this.call('ofListBiometricEnrollment', params, undefined, headers); } ofCreateBiometricPixPayment(bodyOrParams, bodyOrHeaders, headers) { return this.callBodyEndpoint('ofCreateBiometricPixPayment', bodyOrParams, bodyOrHeaders, headers); } ofListBiometricPixPayment(params, headers) { return this.call('ofListBiometricPixPayment', params, undefined, headers); } ofRevokeBiometricEnrollment(bodyOrParams, bodyOrHeaders, headers) { return this.callBodyEndpoint('ofRevokeBiometricEnrollment', bodyOrParams, bodyOrHeaders, headers); } ofCreateAutomaticEnrollment(bodyOrParams, bodyOrHeaders, headers) { return this.callBodyEndpoint('ofCreateAutomaticEnrollment', bodyOrParams, bodyOrHeaders, headers); } ofListAutomaticEnrollment(params, headers) { return this.call('ofListAutomaticEnrollment', params, undefined, headers); } ofUpdateAutomaticEnrollment(bodyOrParams, bodyOrHeaders, headers) { return this.callBodyEndpoint('ofUpdateAutomaticEnrollment', bodyOrParams, bodyOrHeaders, headers); } ofCreateAutomaticPixPayment(bodyOrParams, bodyOrHeaders, headers) { return this.callBodyEndpoint('ofCreateAutomaticPixPayment', bodyOrParams, bodyOrHeaders, headers); } ofListAutomaticPixPayment(params, headers) { return this.call('ofListAutomaticPixPayment', params, undefined, headers); } ofCancelAutomaticPixPayment(bodyOrParams, bodyOrHeaders, headers) { return this.callBodyEndpoint('ofCancelAutomaticPixPayment', bodyOrParams, bodyOrHeaders, headers); } // Pagamento de Contas payDetailBarCode(params, headers) { return this.call('payDetailBarCode', params, undefined, headers); } payRequestBarCode(params, body, headers) { return this.call('payRequestBarCode', params, body, headers); } payDetailPayment(params, headers) { return this.call('payDetailPayment', params, undefined, headers); } payListPayments(params, headers) { return this.call('payListPayments', params, undefined, headers); } payConfigWebhook(bodyOrParams, bodyOrHeaders, headers) { return this.callBodyEndpoint('payConfigWebhook', bodyOrParams, bodyOrHeaders, headers); } payListWebhook(params, headers) { return this.call('payListWebhook', params, undefined, headers); } payDeleteWebhook(bodyOrParams, bodyOrHeaders, headers) { return this.callBodyEndpoint('payDeleteWebhook', bodyOrParams, bodyOrHeaders, headers); } createAccount(bodyOrParams, bodyOrHeaders, headers) { return this.callBodyEndpoint('createAccount', bodyOrParams, bodyOrHeaders, headers); } getAccountCredentials(params, headers) { return this.call('getAccountCredentials', params, undefined, headers); } createAccountCertificate(params, headers) { return this.call('createAccountCertificate', params, undefined, headers); } accountConfigWebhook(bodyOrParams, bodyOrHeaders, headers) { return this.callBodyEndpoint('accountConfigWebhook', bodyOrParams, bodyOrHeaders, headers); } accountDetailWebhook(params, headers) { return this.call('accountDetailWebhook', params, undefined, headers); } accountListWebhook(params, headers) { return this.call('accountListWebhook', params, undefined, headers); } accountDeleteWebhook(params, headers) { return this.call('accountDeleteWebhook', params, undefined, headers); } listStatementFiles(paramsOrHeaders, headers) { return this.callWithoutParams('listStatementFiles', paramsOrHeaders, headers); } getStatementFile(params, headers) { return this.call('getStatementFile', params, undefined, headers); } listStatementRecurrences(paramsOrHeaders, headers) { return this.callWithoutParams('listStatementRecurrences', paramsOrHeaders, headers); } createStatementRecurrency(bodyOrParams, bodyOrHeaders, headers) { return this.callBodyEndpoint('createStatementRecurrency', bodyOrParams, bodyOrHeaders, headers); } updateStatementRecurrency(params, body, headers) { return this.call('updateStatementRecurrency', params, body, headers); } createSftpKey(paramsOrHeaders, headers) { return this.callWithoutParams('createSftpKey', paramsOrHeaders, headers); } } export default EfiPay;