UNPKG

tecnospeed-nfe

Version:

Emit NFe through TecnoSpeed API

183 lines (156 loc) 2.88 kB
'use strict' const TX2 = require('./tx2') class Address extends TX2 { constructor(settings = {}) { super() this.settings = settings } /** * @returns {String} */ getStreetName() { return this.settings.streetName } /** * @returns {Address} */ setStreetName(streetName) { this.settings.streetName = streetName return this } /** * @returns {String} */ getStreetNumber() { return this.settings.streetNumber } /** * @returns {Address} */ setStreetNumber(streetNumber) { this.settings.streetNumber = streetNumber return this } /** * @returns {String} */ getNeighborhood() { return this.settings.neighborhood } /** * @returns {Address} */ setNeighborhood(neighborhood) { this.settings.neighborhood = neighborhood return this } /** * @returns {String} */ getCityCode() { return this.settings.cityCode } /** * @returns {Address} */ setCityCode(cityCode) { this.settings.cityCode = cityCode return this } /** * @returns {String} */ getCity() { return this.settings.city } /** * @returns {Address} */ setCity(city) { this.settings.city = city return this } /** * @returns {String} */ getState() { return this.settings.state } /** * @returns {Address} */ setState(state) { this.settings.state = state return this } /** * @returns {String} */ getStateCode() { return this.settings.stateCode } /** * @returns {Address} */ setStateCode(stateCode) { this.settings.stateCode = stateCode return this } /** * @returns {String} */ getCode() { return this.settings.code } /** * @returns {Address} */ setCode(code) { this.settings.code = code return this } /** * @returns {String} */ getCountryCode() { return this.settings.countryCode } /** * @returns {Address} */ setCountryCode(countryCode) { this.settings.countryCode = countryCode return this } /** * @returns {String} */ getCountryName() { return this.settings.countryName } /** * @returns {Address} */ setCountryName(countryName) { this.settings.countryName = countryName return this } /** * @returns {String} */ toTX2() { const tx2 = [] tx2.push('xLgr_C06=' + this.getStreetName()) tx2.push('nro_C07=' + this.getStreetNumber()) tx2.push('xBairro_C09=' + this.getNeighborhood()) tx2.push('cMun_C10=' + this.getCityCode()) tx2.push('xMun_C11=' + this.getCity()) tx2.push('UF_C12=' + this.getState()) tx2.push('cUF_B02=' + this.getStateCode()) tx2.push('CEP_C13=' + this.getCode()) tx2.push('cPais_C14=' + this.getCountryCode()) tx2.push('xPais_C15=' + this.getCountryName()) return tx2.join('\n') } } module.exports = Address