camtts
Version:
CAMT parser for Typescript
231 lines (230 loc) • 10.4 kB
JavaScript
;
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var Base_1 = require("./Base");
var Entry = /** @class */ (function (_super) {
__extends(Entry, _super);
function Entry() {
return _super !== null && _super.apply(this, arguments) || this;
}
Object.defineProperty(Entry.prototype, "reference", {
get: function () {
var _a, _b;
return (_b = (_a = this.element) === null || _a === void 0 ? void 0 : _a.getElementsByTagName('NtryRef')[0]) === null || _b === void 0 ? void 0 : _b.textContent;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Entry.prototype, "amount", {
get: function () {
var _a, _b, _c, _d;
var value = (_b = (_a = this.element) === null || _a === void 0 ? void 0 : _a.getElementsByTagName('Amt')[0]) === null || _b === void 0 ? void 0 : _b.textContent;
var currency = (_d = (_c = this.element) === null || _c === void 0 ? void 0 : _c.getElementsByTagName('Amt')[0]) === null || _d === void 0 ? void 0 : _d.getAttribute('Ccy');
return { value: value, currency: currency };
},
enumerable: true,
configurable: true
});
Object.defineProperty(Entry.prototype, "creditdebitIndicator", {
get: function () {
var _a, _b;
return (_b = (_a = this.element) === null || _a === void 0 ? void 0 : _a.getElementsByTagName('CdtDbtInd')[0]) === null || _b === void 0 ? void 0 : _b.textContent;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Entry.prototype, "bookindDate", {
get: function () {
var _a, _b, _c;
var bookingDate = (_a = this.element) === null || _a === void 0 ? void 0 : _a.getElementsByTagName('BookgDt')[0];
return { date: (_c = (_b = bookingDate) === null || _b === void 0 ? void 0 : _b.getElementsByTagName('Dt')[0]) === null || _c === void 0 ? void 0 : _c.textContent };
},
enumerable: true,
configurable: true
});
Object.defineProperty(Entry.prototype, "accountServiceRef", {
get: function () {
var _a, _b;
return (_b = (_a = this.element) === null || _a === void 0 ? void 0 : _a.getElementsByTagName('AcctSvcrRef')[0]) === null || _b === void 0 ? void 0 : _b.textContent;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Entry.prototype, "additionalEntryInfo", {
get: function () {
var _a, _b;
return (_b = (_a = this.element) === null || _a === void 0 ? void 0 : _a.getElementsByTagName('AddtlNtryInf')[0]) === null || _b === void 0 ? void 0 : _b.textContent;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Entry.prototype, "entryDetails", {
get: function () {
var _a;
return new EntryDetails((_a = this.element) === null || _a === void 0 ? void 0 : _a.getElementsByTagName('NtryDtls')[0]);
},
enumerable: true,
configurable: true
});
return Entry;
}(Base_1.CAMTElement));
exports.Entry = Entry;
var EntryDetails = /** @class */ (function (_super) {
__extends(EntryDetails, _super);
function EntryDetails() {
return _super !== null && _super.apply(this, arguments) || this;
}
Object.defineProperty(EntryDetails.prototype, "transactionDetails", {
get: function () {
var _a;
return new TransactionDetails((_a = this.element) === null || _a === void 0 ? void 0 : _a.getElementsByTagName('TxDtls')[0]);
},
enumerable: true,
configurable: true
});
Object.defineProperty(EntryDetails.prototype, "remittanceInformation", {
/**
* Subject / Verwendungszweck
*/
get: function () {
var _a;
return new RemittanceInformation((_a = this.element) === null || _a === void 0 ? void 0 : _a.getElementsByTagName('RmtInf')[0]);
},
enumerable: true,
configurable: true
});
return EntryDetails;
}(Base_1.CAMTElement));
exports.EntryDetails = EntryDetails;
var TransactionDetails = /** @class */ (function (_super) {
__extends(TransactionDetails, _super);
function TransactionDetails() {
return _super !== null && _super.apply(this, arguments) || this;
}
Object.defineProperty(TransactionDetails.prototype, "relatedParties", {
get: function () {
var _a;
return new RelatedParties((_a = this.element) === null || _a === void 0 ? void 0 : _a.getElementsByTagName('RltdPties')[0]);
},
enumerable: true,
configurable: true
});
return TransactionDetails;
}(Base_1.CAMTElement));
exports.TransactionDetails = TransactionDetails;
var RelatedParties = /** @class */ (function (_super) {
__extends(RelatedParties, _super);
function RelatedParties() {
return _super !== null && _super.apply(this, arguments) || this;
}
Object.defineProperty(RelatedParties.prototype, "debtorAccount", {
/**
* Financial institution for the creditor/ Zahlungsdienstleister des Debtors
*/
get: function () {
var _a, _b, _c, _d;
var acc = (_a = this.element) === null || _a === void 0 ? void 0 : _a.getElementsByTagName('DbtrAcct')[0];
var iban = (_d = (_c = (_b = acc) === null || _b === void 0 ? void 0 : _b.getElementsByTagName('Id')[0]) === null || _c === void 0 ? void 0 : _c.getElementsByTagName('IBAN')[0]) === null || _d === void 0 ? void 0 : _d.textContent;
return { id: { iban: iban } };
},
enumerable: true,
configurable: true
});
Object.defineProperty(RelatedParties.prototype, "debtor", {
/**
* Debtor / Zahler
*/
get: function () {
var _a, _b, _c;
var acc = (_a = this.element) === null || _a === void 0 ? void 0 : _a.getElementsByTagName('Dbtr')[0];
var name = (_c = (_b = acc) === null || _b === void 0 ? void 0 : _b.getElementsByTagName('Nm')[0]) === null || _c === void 0 ? void 0 : _c.textContent;
return { name: name };
},
enumerable: true,
configurable: true
});
Object.defineProperty(RelatedParties.prototype, "ultimateDebtor", {
/**
* Ultimate debtor different from creditor / Abweichender Zahler
*/
get: function () {
var _a, _b, _c;
var acc = (_a = this.element) === null || _a === void 0 ? void 0 : _a.getElementsByTagName('UltmtDbtr')[0];
var name = (_c = (_b = acc) === null || _b === void 0 ? void 0 : _b.getElementsByTagName('Nm')[0]) === null || _c === void 0 ? void 0 : _c.textContent;
return { name: name };
},
enumerable: true,
configurable: true
});
Object.defineProperty(RelatedParties.prototype, "creditorAccount", {
/**
* ID of creditor account / Zahlungsdienstleister des Creditors
*/
get: function () {
var _a, _b, _c, _d;
var acc = (_a = this.element) === null || _a === void 0 ? void 0 : _a.getElementsByTagName('CdtrAcct')[0];
var iban = (_d = (_c = (_b = acc) === null || _b === void 0 ? void 0 : _b.getElementsByTagName('Id')[0]) === null || _c === void 0 ? void 0 : _c.getElementsByTagName('IBAN')[0]) === null || _d === void 0 ? void 0 : _d.textContent;
return { id: { iban: iban } };
},
enumerable: true,
configurable: true
});
Object.defineProperty(RelatedParties.prototype, "creditor", {
/**
* Party to which amount of money is due / Einreicher der Lastschrift
*/
get: function () {
var _a, _b, _c;
var acc = (_a = this.element) === null || _a === void 0 ? void 0 : _a.getElementsByTagName('Cdtr')[0];
var name = (_c = (_b = acc) === null || _b === void 0 ? void 0 : _b.getElementsByTagName('Nm')[0]) === null || _c === void 0 ? void 0 : _c.textContent;
return { name: name };
},
enumerable: true,
configurable: true
});
Object.defineProperty(RelatedParties.prototype, "ultimateCreditor", {
/**
* Ultimate party to which an amount of money is due. / Konto des Lastschrifteinreichers
*/
get: function () {
var _a, _b, _c;
var acc = (_a = this.element) === null || _a === void 0 ? void 0 : _a.getElementsByTagName('UltmtCdtr')[0];
var name = (_c = (_b = acc) === null || _b === void 0 ? void 0 : _b.getElementsByTagName('Nm')[0]) === null || _c === void 0 ? void 0 : _c.textContent;
return { name: name };
},
enumerable: true,
configurable: true
});
return RelatedParties;
}(Base_1.CAMTElement));
exports.RelatedParties = RelatedParties;
var RemittanceInformation = /** @class */ (function (_super) {
__extends(RemittanceInformation, _super);
function RemittanceInformation() {
return _super !== null && _super.apply(this, arguments) || this;
}
Object.defineProperty(RemittanceInformation.prototype, "unstructured", {
get: function () {
var _a;
return Array.prototype.map.call((_a = this.element) === null || _a === void 0 ? void 0 : _a.getElementsByTagName('Ustrd'), function (elem) {
return elem.textContent;
});
},
enumerable: true,
configurable: true
});
return RemittanceInformation;
}(Base_1.CAMTElement));
exports.RemittanceInformation = RemittanceInformation;