From b289c1563b3a52f1ceb61a83e1954f511a859a1e Mon Sep 17 00:00:00 2001 From: Martin Kankaanranta <55850510+norkator@users.noreply.github.com> Date: Wed, 25 Oct 2023 21:36:11 +0300 Subject: [PATCH] fix lint errors --- src/interfaces.ts | 11 +++++++---- src/utils/parsers.ts | 15 ++++++++++++--- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/src/interfaces.ts b/src/interfaces.ts index 1c4a55b..624e838 100644 --- a/src/interfaces.ts +++ b/src/interfaces.ts @@ -515,10 +515,7 @@ interface StatementDetailEntry { }; }; }; - relatedParties?: { - type: string | null; - name: string | null; - }; + relatedParties?: RelatedPartiesInterface; remittanceInformation: { unstructured: string; }; @@ -528,6 +525,11 @@ interface StatementDetailEntry { }; } +interface RelatedPartiesInterface { + type: string | null; + name: string | null; +} + export { ApplicationRequestSignatureInterface, AxiosAgentInterface, @@ -557,4 +559,5 @@ export { StatementEntry, StatementDetailEntry, BalanceEntry, + RelatedPartiesInterface, } diff --git a/src/utils/parsers.ts b/src/utils/parsers.ts index c5d12f6..8eb91ba 100644 --- a/src/utils/parsers.ts +++ b/src/utils/parsers.ts @@ -1,6 +1,13 @@ -import {CodeOrProprietary, CreditDebitIndicator, Domain, FamilyCode, SubFamilyCode} from './../constants'; +import {CodeOrProprietary, CreditDebitIndicator, Domain, FamilyCode, SubFamilyCode} from '../constants'; import {Base64DecodeStr, ParseXml, GetNested, GetExternalStatusCodeDescriptions} from './utils'; -import {BalanceEntry, BankStatement, PaymentStatusReport, StatementDetailEntry, StatementEntry} from '../interfaces'; +import { + BalanceEntry, + BankStatement, + PaymentStatusReport, + RelatedPartiesInterface, + StatementDetailEntry, + StatementEntry +} from '../interfaces'; /** * Parses content from payment status report @@ -203,11 +210,13 @@ function parseStatementDetailEntries(detailEntriesObject: any[]): StatementDetai } -function parseRelatedParties(rltdPties: any): { type: string | null; name: string | null; } { +function parseRelatedParties(rltdPties: any): RelatedPartiesInterface { try { const key = Object.keys(rltdPties[0])[0]; + return {type: key, name: rltdPties[0][key][0]['Nm'][0]}; } catch (e) { + return {type: null, name: null}; } }