Class ValidationErrorUtils


  • public final class ValidationErrorUtils
    extends Object
    Util class handling error records.
    • Field Detail

      • XML_DATE_TIME_FORMATTER

        public static final DateTimeFormatter XML_DATE_TIME_FORMATTER
    • Method Detail

      • checkMhBr0070AndMhBr0080

        public static void checkMhBr0070AndMhBr0080​(List<ValidationError> validationErrors,
                                                    String messageRefId,
                                                    MessageTypeIndicEnum messageTypeIndic,
                                                    DocTypeEnum docType,
                                                    String docRefId)
        Checks if an initial Payment data message only contains new data and if a correction message only contains corrections/deletions (10070 and 10080).
        Parameters:
        validationErrors - the list of validation errors
        messageRefId - the reference of the message
        messageTypeIndic - the message type indic
        docType - the doc type
        docRefId - the doc ref id
      • checkCmBr0010

        public static void checkCmBr0010​(List<ValidationError> validationErrors,
                                         String messageRefId,
                                         Set<String> docRefIds,
                                         String docRefId)
        Checks if the DocRefId is not unique in the message (20010).
        Parameters:
        validationErrors - the list of validation errors
        messageRefId - the reference of the message
        docRefIds - the docref ids already checked
        docRefId - the docref id
      • checkCmBr0050

        public static void checkCmBr0050​(List<ValidationError> validationErrors,
                                         String messageRefId,
                                         DocTypeEnum docTypeEnum,
                                         String corrDocRefId,
                                         String docRefId)
        Checks if the CorrDocRefId is not specified for new data (20050).
        Parameters:
        validationErrors - the list of validation errors
        messageRefId - the reference of the message
        docTypeEnum - the doc type enum
        corrDocRefId - the corr doc ref id
        docRefId - the doc ref id
      • checkCmBr0060

        public static void checkCmBr0060​(List<ValidationError> validationErrors,
                                         String messageRefId,
                                         DocTypeEnum docTypeEnum,
                                         String corrDocRefId,
                                         String docRefId)
        Checks if the corrDocRefId is provided in case of correction (20060).
        Parameters:
        validationErrors - the list of validation errors
        messageRefId - the reference of the message
        docTypeEnum - the doc type enum
        corrDocRefId - the corrDocRefId
        docRefId - the doc ref id
      • checkRpBr0010

        public static void checkRpBr0010​(List<ValidationError> validationErrors,
                                         String messageRefId,
                                         String payeeCountry,
                                         String payerMsCountry,
                                         String transactionIdentifier)
        Checks if the country code of the 'Country' element within the 'ReportedPayee' element is not the same as the country code of the 'PayerMS' element (40010).
        Parameters:
        validationErrors - the list of validation errors
        messageRefId - the reference of the message
        payeeCountry - the payee country
        payerMsCountry - the payer MS country
        transactionIdentifier - the transaction identifier id
      • checkRpBr0020

        public static void checkRpBr0020​(List<ValidationError> validationErrors,
                                         String messageRefId,
                                         String accountIdentifierType,
                                         String iban,
                                         String docRefId)
        Checks the IBAN format (40020).
        Parameters:
        validationErrors - the list of validation errors
        messageRefId - the reference of the message
        accountIdentifierType - the account identifier type enum
        iban - the iban
        docRefId - the doc ref id
      • checkRpBr0030

        public static void checkRpBr0030​(List<ValidationError> validationErrors,
                                         String messageRefId,
                                         String accountIdentifierType,
                                         String countryCode,
                                         String iban,
                                         String docRefId)
        Validates the IBAN (40030) based on the countryCode IBAN length and the MOD97 algorithm.
        Parameters:
        validationErrors - the list of validation errors
        messageRefId - the reference of the message
        accountIdentifierType - the account identifier type enum
        countryCode - the country code
        iban - the iban
        docRefId - the doc ref id
      • checkRpBr0040

        public static void checkRpBr0040​(List<ValidationError> validationErrors,
                                         String messageRefId,
                                         boolean hasPaymentData,
                                         MessageTypeIndicEnum messageTypeIndic)
        Checks if no Reported payee is listed in no payment data for the requested period handler (40040).
        Parameters:
        validationErrors - the list of validation errors
        messageRefId - the reference of the message
        hasPaymentData - if the transaction has payment data
        messageTypeIndic - the message type indic
      • checkRpBr0050

        public static void checkRpBr0050​(List<ValidationError> validationErrors,
                                         String messageRefId,
                                         DocTypeEnum docType,
                                         boolean emptyTransactions)
        Checks if the 'ReportedTransaction' element is present, except in case of deletion of the related Reported Payee. (40050).
        Parameters:
        validationErrors - the list of validation errors
        messageRefId - the reference of the message
        docType - the doc type of the reported payee
        emptyTransactions - true if no reported transactions for this reported payee
      • checkRpBr0060

        public static void checkRpBr0060​(List<ValidationError> validationErrors,
                                         XmlCountryTypeAndValue account,
                                         String messageRefId)
        Checks if there is no discrepancy in the 'AccountIdentifier' attributes. (40060)
        Parameters:
        validationErrors - the validation errors
        account - the account
        messageRefId - the message ref id
      • checkMhBr0020

        public static void checkMhBr0020​(List<ValidationError> validationErrors,
                                         String messageRefId,
                                         String timestamp)
        Checks if the 'Timestamp' element does not refer to a wrong (future) value (10020).
        Parameters:
        validationErrors - the list of validation errors
        messageRefId - the reference of the message
        timestamp - the timestamp of the transaction
      • checkMhBr0030

        public static void checkMhBr0030​(List<ValidationError> validationErrors,
                                         String messageRefId,
                                         Integer period,
                                         Integer minPeriod)
        Checks if the period is not before 01/01/2024 (10030).
        Parameters:
        validationErrors - the list of validation errors
        messageRefId - the reference of the message
        period - the period
        minPeriod - the minimum period allowed
      • checkMhBr0090

        public static void checkMhBr0090​(List<ValidationError> validationErrors,
                                         String messageRefId,
                                         MessageTypeEnum messageType,
                                         boolean hasPaymentDataBody)
        A payment data message (MessageType = 'PMT') must contain the 'PaymentDataBody' element.
        Parameters:
        validationErrors - the list of validation errors
        messageRefId - the reference of the message
        messageType - the message type
        hasPaymentDataBody - true if the message contains a 'PaymentDataBody' element, false otherwise
      • checkMhBr0100

        public static void checkMhBr0100​(List<ValidationError> validationErrors,
                                         String messageRefId,
                                         MessageTypeIndicEnum messageTypeIndic,
                                         Integer period,
                                         Integer correlatedPeriod)
        In a correction message, the reporting period must be identical to the reporting period of the correlated message.
        Parameters:
        validationErrors - the list of validation errors
        messageRefId - the message ref id
        messageTypeIndic - the message type indic
        period - the message period
        correlatedPeriod - the period of the correlated message
      • checkMhBr0110

        public static void checkMhBr0110​(List<ValidationError> validationErrors,
                                         String messageRefId,
                                         String corrMessageRefId,
                                         MessageTypeIndicEnum messageTypeIndic)
        CorrMessageRefId in the 'MessageSpec' element must only be provided in correction messages (when 'MessageTypeIndic' = CESOP101). Otherwise, the element must not be provided.
        Parameters:
        validationErrors - the list of validation errors
        messageRefId - the message ref id
        corrMessageRefId - the CorrMessageRefId value
        messageTypeIndic - the message type indic
      • checkMhBr0120

        public static void checkMhBr0120​(List<ValidationError> validationErrors,
                                         String messageRefId,
                                         String transmittingCountry,
                                         String requiredCountry)
        TransmittingCountry in the 'MessageSpec' element must be the same as required country if that is passed. EU is a wildcard and should allow the upload for any MS.
        Parameters:
        validationErrors - the validation errors
        messageRefId - the message ref id
        transmittingCountry - the transmitting country
        requiredCountry - the required country
      • checkRtBr0010

        public static void checkRtBr0010​(List<ValidationError> validationErrors,
                                         String messageRefId,
                                         boolean isRefund,
                                         XmlTypeAndValue amount,
                                         String transactionIdentifier)
        Checks the amount value. The refund attribute refers to a wrong value declared in the AmountCurrency element. When the refund attribute is set to 'false', the value of the amount in AmountCurrency element must be positive. When the refund attribute is set to 'true', the value of the amount in the AmountCurrency element must be negative.
        Parameters:
        validationErrors - the validation errors
        messageRefId - the message ref id
        isRefund - the is refund
        amount - the amount
        transactionIdentifier - the transaction identifier
      • checkRtBr0030

        public static void checkRtBr0030​(List<ValidationError> validationErrors,
                                         String messageRefId,
                                         Integer period,
                                         EnumMap<TransactionDateEnum,​String> dates,
                                         String transactionIdentifier)
        Checks if at least one 'DateTime' element in the 'ReportedTransaction' element refers to a date within the period and year declared in the 'ReportingPeriod' element (45030).
        Parameters:
        validationErrors - the list of validation errors
        messageRefId - the reference of the message
        period - the period
        dates - the transaction dates
        transactionIdentifier - the transaction identifier id
      • checkRtBr0040

        public static void checkRtBr0040​(List<ValidationError> validationErrors,
                                         String messageRefId,
                                         Set<String> transactionIdentifiers,
                                         String transactionIdentifier)
        Checks if the transaction identifier is unique in message handler (45040).
        Parameters:
        validationErrors - the list of validation errors
        messageRefId - the reference of the message
        transactionIdentifiers - the transaction identifiers ids already checked
        transactionIdentifier - the transaction identifier id
      • checkRtBr0060

        public static void checkRtBr0060​(List<ValidationError> validationErrors,
                                         String messageRefId,
                                         String amount,
                                         String transactionIdentifier)
        Checks if the value of the 'Amount' element is not equal to zero (45060).
        Parameters:
        validationErrors - the list of validation errors
        messageRefId - the reference of the message
        amount - the amount
        transactionIdentifier - the transaction identifier id
      • checkRtBr0080

        public static void checkRtBr0080​(List<ValidationError> validationErrors,
                                         String messageRefId,
                                         boolean isInErrorRtBr0080,
                                         String transactionIdentifier)
        Checks if the same type of transaction date has not been provided more than once (45080). This rule is checked during the reported transactions parsing.
        Parameters:
        validationErrors - the list of validation errors
        messageRefId - the reference of the message
        isInErrorRtBr0080 - true if the rule is not respected
        transactionIdentifier - the transaction identifier id
      • checkCmTr0020

        public static void checkCmTr0020​(List<ValidationError> validationErrors,
                                         String messageRefId)
        Failed Decryption (50020).
        Parameters:
        validationErrors - the list of validation errors
        messageRefId - the reference of the message
      • checkCmTr0030

        public static void checkCmTr0030​(List<ValidationError> validationErrors,
                                         String messageRefId)
        Failed Decompression (50030).
        Parameters:
        validationErrors - the list of validation errors
        messageRefId - the reference of the message
      • checkCmTr0040

        public static void checkCmTr0040​(List<ValidationError> validationErrors,
                                         String messageRefId)
        Failed Signature Check (50040).
        Parameters:
        validationErrors - the list of validation errors
        messageRefId - the reference of the message
      • checkCmTr0050

        public static void checkCmTr0050​(List<ValidationError> validationErrors,
                                         String messageRefId)
        Failed Threat Scan (50050).
        Parameters:
        validationErrors - the list of validation errors
        messageRefId - the reference of the message
      • checkCmTr0060

        public static void checkCmTr0060​(List<ValidationError> validationErrors,
                                         String messageRefId)
        Failed Virus Scan (50060).
        Parameters:
        validationErrors - the list of validation errors
        messageRefId - the reference of the message
      • checkCmTr0070

        public static void checkCmTr0070​(List<ValidationError> validationErrors,
                                         String messageRefId,
                                         long size,
                                         long maxSize)
        Message size exceeded (50070).
        Parameters:
        validationErrors - the list of validation errors
        messageRefId - the reference of the message
        size - the size of message
        maxSize - the max size authorized
      • checkCmBr0110

        public static void checkCmBr0110​(List<ValidationError> validationErrors,
                                         String messageRefId,
                                         MessageTypeIndicEnum messageTypeIndic)
        Given there's no payees in the message, check if it is allowed for the specified type of message.
        Parameters:
        validationErrors - the list of validation errors
        messageRefId - the reference of the message
        messageTypeIndic - the type of message indic being validated
      • checkRpBr0070

        public static void checkRpBr0070​(List<ValidationError> validationErrors,
                                         String messageRefId,
                                         XmlTypeAndValue representativeId,
                                         String docRefId)
        Checks if the representative's BIC conforms ISO-9362.
        Parameters:
        validationErrors - the list of validation errors
        messageRefId - the reference of the message
        representativeId - the representative id
        docRefId - the doc ref id
      • checkCmBr0100

        public static void checkCmBr0100​(List<ValidationError> validationErrors,
                                         String messageRefId,
                                         XmlTypeAndValue pspId)
        Checks Psp BIC conforms ISO-9362.
        Parameters:
        validationErrors - the list of validation errors
        messageRefId - the reference of the message
        pspId - the psp id
      • checkDuplicateReportedPayees

        public static void checkDuplicateReportedPayees​(List<ValidationError> validationErrors,
                                                        String messageRefId,
                                                        HashMap<Set<XmlTypeAndValue>,​String> reportedPayees,
                                                        List<XmlTypeAndValue> names,
                                                        XmlCountryTypeAndValue account,
                                                        String docRefId)
        Checks if the current reported payee is not a duplicate of a previously reported payee. The check is done by comparing the set of names and account identifiers of the current reported payee with the previously seen reported payees.
        Parameters:
        validationErrors - the list of validation errors
        messageRefId - the message ref id
        reportedPayees - the map of seen reported payees, maps the set of names and account identifiers to the doc ref id
        names - the names of the payee
        account - the account identifier of the payee
        docRefId - the doc ref id
      • createCustomError

        public static ValidationError createCustomError​(String messageRefId,
                                                        String description)
        Custom error (99999).
        Parameters:
        messageRefId - the reference of the message
        description - the description of the error
        Returns:
        the validation error
      • convertGreece

        public static String convertGreece​(String code)