prowide-iso20022 icon indicating copy to clipboard operation
prowide-iso20022 copied to clipboard

SRU2024 v9.5

Open zubri opened this issue 10 months ago • 1 comments

Summary by CodeRabbit

  • New Features

    • Enhanced message handling to support SWIFT Standard 2024 and standard envelopes.
    • Introduced message categories for better organization.
    • Added support for Business Application Header version 4.
  • Improvements

    • Enhanced message identification with updates to the message handling components.
    • Added a business service field for message type differentiation.
    • Streamlined XML serialization with improved handling of envelope types.
    • Enhanced parsing logic for different versions of the Business Application Header.
  • Dependency Updates

    • Updated libraries for enhanced performance and security.
  • Bug Fixes

    • Addressed a Null Pointer Exception in metadata handling.
    • Corrected UTC offset conversion in date and time handling.

zubri avatar Apr 27 '24 02:04 zubri

Walkthrough

Walkthrough

The updates introduce significant enhancements to the Prowide ISO 20022 library, aligning it with the SWIFT Standard 2024. Key improvements include better handling of business services, the introduction of new message categories, and support for standard envelopes. Critical fixes, particularly addressing null pointer exceptions, bolster application robustness. Additionally, the library's dependencies have been updated to ensure improved performance and security.

Changes

File Change Summary
CHANGELOG.md Overview of updates from version 9.4.6 to 9.5.4, including fixes, enhancements, and dependency updates.
AppHdrFactory.java, MxParseUtils.java Enhanced to respect business services in message identification and header creation.
MxWriteConfiguration.java Added support for standard envelopes for SWIFT and ISO 20022, with improved configuration handling.
MxId.java Introduced optional businessService field for message type differentiation.
AbstractMX.java Deprecated methods and constants, refined XML serialization logic for better clarity and flexibility.
AppHdrParser.java Expanded parsing logic to support multiple versions of Business Application Header.
Dependencies Updated commons-lang3 to version 3.14.0 and gson to version 2.11.0 for enhanced performance and security.

Sequence Diagram(s)

sequenceDiagram
    actor User
    participant AppHdrFactory
    participant MxParseUtils
    participant MxId
    User->>AppHdrFactory: Create Header with Business Service
    AppHdrFactory->>MxId: Initialize with Business Service
    User->>MxParseUtils: Identify Message
    MxParseUtils->>MxId: Set Business Service

Recent review details

Configuration used: CodeRabbit UI Review profile: ASSERTIVE

Commits

Files that changed from the base of the PR and between 04b9e2a603c8bfa2d29cc18a6ea0c098d54db74c and fdf33461b3314925f07916e6617028b2493e9ebb.

Files selected for processing (8)
  • CHANGELOG.md (1 hunks)
  • iso20022-core/src/main/java/com/prowidesoftware/swift/model/mx/AppHdrFactory.java (5 hunks)
  • iso20022-core/src/main/java/com/prowidesoftware/swift/model/mx/AppHdrParser.java (2 hunks)
  • iso20022-core/src/main/java/com/prowidesoftware/swift/model/mx/AppHdrType.java (1 hunks)
  • iso20022-core/src/main/java/com/prowidesoftware/swift/model/mx/BusinessAppHdrV04.java (1 hunks)
  • iso20022-core/src/main/java/com/prowidesoftware/swift/model/mx/DefaultMxMetadataStrategy.java (4 hunks)
  • iso20022-core/src/test/java/com/prowidesoftware/issues/Issue1958.java (1 hunks)
  • iso20022-core/src/test/java/com/prowidesoftware/swift/model/mx/AppHdrParserTest.java (8 hunks)
Additional context used
Markdownlint
CHANGELOG.md

3-3: Expected: h2; Actual: h4 Heading levels should only increment by one level at a time

(MD001, heading-increment)


4-4: Expected: 0; Actual: 2 Unordered list indentation

(MD007, ul-indent)


7-7: Expected: 0; Actual: 2 Unordered list indentation

(MD007, ul-indent)


8-8: Expected: 0; Actual: 2 Unordered list indentation

(MD007, ul-indent)


11-11: Expected: 0; Actual: 2 Unordered list indentation

(MD007, ul-indent)


14-14: Expected: 0; Actual: 2 Unordered list indentation

(MD007, ul-indent)


15-15: Expected: 0; Actual: 2 Unordered list indentation

(MD007, ul-indent)


18-18: Expected: 0; Actual: 2 Unordered list indentation

(MD007, ul-indent)


19-19: Expected: 0; Actual: 2 Unordered list indentation

(MD007, ul-indent)


20-20: Expected: 0; Actual: 2 Unordered list indentation

(MD007, ul-indent)


21-21: Expected: 0; Actual: 2 Unordered list indentation

(MD007, ul-indent)


22-22: Expected: 0; Actual: 2 Unordered list indentation

(MD007, ul-indent)


23-23: Expected: 0; Actual: 2 Unordered list indentation

(MD007, ul-indent)


24-24: Expected: 0; Actual: 2 Unordered list indentation

(MD007, ul-indent)


25-25: Expected: 0; Actual: 2 Unordered list indentation

(MD007, ul-indent)


3-3: Expected: 1; Actual: 0; Below Headings should be surrounded by blank lines

(MD022, blanks-around-headings)


6-6: Expected: 1; Actual: 0; Below Headings should be surrounded by blank lines

(MD022, blanks-around-headings)


10-10: Expected: 1; Actual: 0; Below Headings should be surrounded by blank lines

(MD022, blanks-around-headings)


13-13: Expected: 1; Actual: 0; Below Headings should be surrounded by blank lines

(MD022, blanks-around-headings)


17-17: Expected: 1; Actual: 0; Below Headings should be surrounded by blank lines

(MD022, blanks-around-headings)


4-4: null Lists should be surrounded by blank lines

(MD032, blanks-around-lists)


7-7: null Lists should be surrounded by blank lines

(MD032, blanks-around-lists)


11-11: null Lists should be surrounded by blank lines

(MD032, blanks-around-lists)


14-14: null Lists should be surrounded by blank lines

(MD032, blanks-around-lists)


18-18: null Lists should be surrounded by blank lines

(MD032, blanks-around-lists)


19-19: null Bare URL used

(MD034, no-bare-urls)

Additional comments not posted (30)
iso20022-core/src/main/java/com/prowidesoftware/swift/model/mx/AppHdrType.java (1)

27-28: Addition of BAH_V4 is appropriate.

The addition of BAH_V4 to the AppHdrType enum is a necessary update to support the new version of business application headers. This change is well-aligned with the library's evolution to accommodate newer standards.

iso20022-core/src/main/java/com/prowidesoftware/swift/model/mx/AppHdrParser.java (3)

86-90: Support for BAH version 1 parsing is well-implemented.

The addition of parsing logic for BusinessAppHdrV01 is clear and integrates well with the existing structure.


101-105: Support for BAH version 4 parsing is well-implemented.

The addition of parsing logic for BusinessAppHdrV04 enhances the method's capability to handle newer BAH versions.


107-109: Default parsing to BAH version 2 is appropriate.

Changing the default parsing behavior to BusinessAppHdrV02 aligns with its common usage in CBPR+ and improves the method's robustness.

iso20022-core/src/main/java/com/prowidesoftware/swift/model/mx/BusinessAppHdrV04.java (5)

72-74: LGTM!

The parse(String xml) method correctly delegates to the overloaded method with default parameters.


84-87: LGTM!

The parse(String xml, MxReadParams params) method includes proper null checks and uses a utility for parsing.


125-142: LGTM!

The getBIC(Party51Choice p) method handles potential null pointers effectively while retrieving BIC codes.


236-264: LGTM!

The xml(MxWriteParams params) method correctly handles JAXB marshalling and logs errors appropriately.


274-296: LGTM!

The element(JAXBContext inputContext) method effectively creates a DOM element and handles exceptions.

iso20022-core/src/main/java/com/prowidesoftware/swift/model/mx/AppHdrFactory.java (4)

108-110: LGTM!

The createBusinessAppHdrV02 method correctly handles optional business service in the MxId.


155-157: LGTM!

The createBusinessAppHdrV03 method correctly handles optional business service in the MxId.


178-204: LGTM!

The createBusinessAppHdrV04 method is well-implemented, handling optional parameters and business service consistently.


274-275: LGTM!

The createAppHdr method correctly integrates the new BAH_V4 case.

iso20022-core/src/main/java/com/prowidesoftware/swift/model/mx/DefaultMxMetadataStrategy.java (8)

94-94: Improved null check for getCamt29Amount.

The addition of a null check for amount.getValue() enhances robustness by preventing potential null pointer exceptions.


102-102: Improved null check for getCamt52Amount.

The added null check for amount.getValue() ensures that only valid amounts are processed, reducing the risk of runtime exceptions.


110-110: Improved null check for getCamt53Amount.

The null check for amount.getValue() is a good addition to prevent errors when processing monetary amounts.


124-124: Improved null check for getCamt54Amount.

The null check for amount.getValue() ensures robustness by avoiding null pointer exceptions when creating Money objects.


132-132: Improved null check for getCamt56Amount.

Adding a null check for amount.getValue() is a good practice to ensure that only valid data is processed.


140-140: Improved null check for getCamt57Amount.

The null check for amount.getValue() enhances the method's robustness by preventing potential null pointer exceptions.


151-151: Improved null check for getPacs004Amount.

The null check for amount.getValue() is a valuable addition to ensure that only valid monetary amounts are processed.


184-184: Improved null check for getPacsAmount.

The null check for amount.getValue() in both the group header and credit transfer attempts enhances data integrity and prevents null pointer exceptions.

iso20022-core/src/test/java/com/prowidesoftware/swift/model/mx/AppHdrParserTest.java (9)

42-42: Added instance type assertion in assertSampleApplicationHeader.

The use of assertInstanceOf ensures that the parsed header is of the expected type, improving test robustness.


74-76: Instance type assertion for testParseApplicationHeader_sample_payload_mq.

The addition of assertInstanceOf confirms the correct subclass is instantiated, enhancing the test's reliability.


89-91: Instance type assertion for testParseApplicationHeader_sample_bah.

The assertInstanceOf assertion ensures the correct type is used, which is crucial for validating the parsing logic.


Line range hint 112-149: New test method testParseBAH1_sample.

The method tests parsing of a specific XML structure and includes assertions for instance type and expected values, expanding test coverage.


Line range hint 192-214: Renamed and modified test method testParseBAH1_sample2.

The method name change reflects the specific scenario tested, and the instance type assertion ensures the correct subclass is used.


224-278: New test method testParseBAH2_sample.

The method tests a different version of the application header, with assertions for instance type and expected values, enhancing test coverage.


280-312: New test method testParseBAH3_sample.

The method tests another version of the application header, ensuring the parser's functionality across different versions.


314-346: New test method testParseBAH4_sample.

The method adds coverage for yet another version of the application header, with appropriate assertions to verify parsing correctness.


395-395: Updated type in testNoNamespaceDefaultToBAH.

The change to BusinessAppHdrV02 reflects the expected default behavior when no namespace is present, ensuring the test aligns with the intended logic.


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

coderabbitai[bot] avatar Jun 28 '24 18:06 coderabbitai[bot]