fio-api-handler
Version:
Unofficial handler for Fio Bank API
91 lines (67 loc) • 2.34 kB
JavaScript
import _defineProperty from '@babel/runtime/helpers/defineProperty';
import { DateTime } from 'luxon';
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
class Info {
constructor(source) {
_defineProperty(this, "data", void 0);
_defineProperty(this, "source", void 0);
const dateFormat = 'yyyy-MM-ddZZZ';
this.source = source; // $FlowFixMe
this.data = _objectSpread(_objectSpread({}, source), {}, {
accountId: Number(source.accountId),
bankId: Number(source.bankId),
dateStart: DateTime.fromFormat(source.dateStart, dateFormat),
dateEnd: DateTime.fromFormat(source.dateEnd, dateFormat)
});
}
getAccountId() {
return this.data.accountId;
}
getBankId() {
return this.data.bankId;
}
getCurrency() {
return this.data.currency;
}
getIban() {
return this.data.iban;
}
getBic() {
return this.data.bic;
}
getOpeningBalance() {
return this.data.openingBalance;
}
getClosingBalance() {
return this.data.closingBalance;
}
getStart() {
return this.data.dateStart;
}
getEnd() {
return this.data.dateEnd;
}
getYearList() {
return this.data.yearList;
}
getIdList() {
return this.data.idList;
}
getIdFrom() {
return this.data.idFrom;
}
getIdTo() {
return this.data.idTo;
}
getIdLastDownload() {
return this.data.idLastDownload;
}
getData() {
return this.data;
}
getSource() {
return this.source;
}
}
export default Info;