Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add proper transaction formatting for Stadtsparkasse Düsseldorf (Germany) #531

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

DennaGherlyn
Copy link

@DennaGherlyn DennaGherlyn commented Jan 1, 2025

This adds a gocardless formatter for the bank Stadtsparkasse Düsseldorf (Germany).
Mainly it fixes the creditor name for cases where payments are managed by a third-party provider by using the ultimateCreditor in addition to the other possible fields and fills the notes property.

@actual-github-bot actual-github-bot bot changed the title Add proper transaction formatting for Stadtsparkasse Düsseldorf (Germany) [WIP] Add proper transaction formatting for Stadtsparkasse Düsseldorf (Germany) Jan 1, 2025
@DennaGherlyn DennaGherlyn changed the title [WIP] Add proper transaction formatting for Stadtsparkasse Düsseldorf (Germany) Add proper transaction formatting for Stadtsparkasse Düsseldorf (Germany) Jan 1, 2025
Copy link
Contributor

coderabbitai bot commented Jan 1, 2025

Warning

Rate limit exceeded

@DennaGherlyn has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 11 minutes and 7 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 7a20ed1 and 2d085f5.

📒 Files selected for processing (1)
  • src/app-gocardless/banks/ssk-dusseldorf-dussdeddxxx.js (1 hunks)

Walkthrough

The pull request introduces a new bank integration for SSK Düsseldorf (DUSSELDORF_DUSSDEDDXXX) into the existing bank factory system. This includes adding a new module ssk-dusseldorf-dussdeddxxx.js in the banks directory and updating the bank factory to include this new bank in its exported banks array.

The new bank module implements a method called normalizeTransaction, which processes transaction objects by constructing a remittance information string and determining a creditor name based on various fields in the transaction data. The integration adheres to the existing structure of bank-specific modules within the application, thereby enhancing the system's capability to manage transactions from this financial institution.

The changes are primarily additive, expanding the existing bank integration framework without altering the core functionality of the bank factory or the transaction processing system.


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>, please review it.
    • 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 gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @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 using 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 generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

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.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2005c1b and 222150c.

⛔ Files ignored due to path filters (1)
  • upcoming-release-notes/531.md is excluded by !**/*.md
📒 Files selected for processing (2)
  • src/app-gocardless/bank-factory.js (2 hunks)
  • src/app-gocardless/banks/ssk-dusseldorf-dussdeddxxx.js (1 hunks)
🔇 Additional comments (7)
src/app-gocardless/banks/ssk-dusseldorf-dussdeddxxx.js (5)

1-2: Looks good - fallback import is consistent.
No issues found here.


3-4: Great choice on reusing formatPayeeName.
This helps maintain a consistent payee display across all bank integrations.


22-25: Good practice returning null if no valid date.
This effectively filters out invalid or incomplete transactions.


38-41: Appropriately prioritizes ultimateCreditor over creditorName.
This addresses scenarios where a third-party provider processes the payment.


47-52: Efficient and concise transaction normalization.
The final object ensures relevant fields (payeeName and date) are exposed as expected.

src/app-gocardless/bank-factory.js (2)

34-34: New import properly references SSK Düsseldorf bank file.
No observations or issues here.


71-71: Bank appended correctly to the existing banks array.
The new entry ensures that SSK Düsseldorf is recognized among supported banks.

src/app-gocardless/banks/ssk-dusseldorf-dussdeddxxx.js Outdated Show resolved Hide resolved
Copy link
Contributor

@matt-fidd matt-fidd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for this! I've added a few comments on how to simplify the handler

src/app-gocardless/banks/ssk-dusseldorf-dussdeddxxx.js Outdated Show resolved Hide resolved
src/app-gocardless/banks/ssk-dusseldorf-dussdeddxxx.js Outdated Show resolved Hide resolved
src/app-gocardless/banks/ssk-dusseldorf-dussdeddxxx.js Outdated Show resolved Hide resolved
src/app-gocardless/banks/ssk-dusseldorf-dussdeddxxx.js Outdated Show resolved Hide resolved
upcoming-release-notes/531.md Outdated Show resolved Hide resolved
src/app-gocardless/banks/ssk-dusseldorf-dussdeddxxx.js Outdated Show resolved Hide resolved
src/app-gocardless/banks/ssk-dusseldorf-dussdeddxxx.js Outdated Show resolved Hide resolved
src/app-gocardless/banks/ssk-dusseldorf-dussdeddxxx.js Outdated Show resolved Hide resolved
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (2)
src/app-gocardless/banks/ssk-dusseldorf-dussdeddxxx.js (2)

11-19: Robust remittance information handling

Good implementation of the remittance information concatenation with proper null handling. The code safely combines information from multiple sources while avoiding the undefined concatenation issue.

Consider adding a brief comment explaining the remittance information priority order:

+    // Prioritize unstructured information, falling back to structured formats
     let remittanceInformationUnstructured =
       transaction.remittanceInformationUnstructured ??
       transaction.remittanceInformationStructured ??
       transaction.remittanceInformationStructuredArray?.join(' ');
🧰 Tools
🪛 eslint

[error] 17-17: Replace ·(remittanceInformationUnstructured·??·'')· with ⏎········(remittanceInformationUnstructured·??·'')·+

(prettier/prettier)


[error] 18-18: Replace +·'·'· with ··'·'·+

(prettier/prettier)


[error] 19-19: Replace + with ·

(prettier/prettier)

🪛 GitHub Check: lint

[failure] 17-17:
Replace ·(remittanceInformationUnstructured·??·'')· with ⏎········(remittanceInformationUnstructured·??·'')·+


[failure] 18-18:
Replace +·'·'· with ··'·'·+


[failure] 19-19:
Replace + with ·


9-31: Minor formatting issues detected

The static analysis tools indicate some formatting inconsistencies. These will be automatically fixed by the project's formatting tools, but for reference:

  • Extra newline after function declaration
  • Inconsistent concatenation operator spacing
🧰 Tools
🪛 eslint

[error] 10-11: Delete

(prettier/prettier)


[error] 17-17: Replace ·(remittanceInformationUnstructured·??·'')· with ⏎········(remittanceInformationUnstructured·??·'')·+

(prettier/prettier)


[error] 18-18: Replace +·'·'· with ··'·'·+

(prettier/prettier)


[error] 19-19: Replace + with ·

(prettier/prettier)

🪛 GitHub Check: lint

[failure] 10-10:
Delete


[failure] 17-17:
Replace ·(remittanceInformationUnstructured·??·'')· with ⏎········(remittanceInformationUnstructured·??·'')·+


[failure] 18-18:
Replace +·'·'· with ··'·'·+


[failure] 19-19:
Replace + with ·

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 222150c and 6014867.

⛔ Files ignored due to path filters (1)
  • upcoming-release-notes/531.md is excluded by !**/*.md
📒 Files selected for processing (1)
  • src/app-gocardless/banks/ssk-dusseldorf-dussdeddxxx.js (1 hunks)
🧰 Additional context used
🪛 eslint
src/app-gocardless/banks/ssk-dusseldorf-dussdeddxxx.js

[error] 10-11: Delete

(prettier/prettier)


[error] 17-17: Replace ·(remittanceInformationUnstructured·??·'')· with ⏎········(remittanceInformationUnstructured·??·'')·+

(prettier/prettier)


[error] 18-18: Replace +·'·'· with ··'·'·+

(prettier/prettier)


[error] 19-19: Replace + with ·

(prettier/prettier)

🪛 GitHub Check: lint
src/app-gocardless/banks/ssk-dusseldorf-dussdeddxxx.js

[failure] 10-10:
Delete


[failure] 17-17:
Replace ·(remittanceInformationUnstructured·??·'')· with ⏎········(remittanceInformationUnstructured·??·'')·+


[failure] 18-18:
Replace +·'·'· with ··'·'·+


[failure] 19-19:
Replace + with ·

🔇 Additional comments (3)
src/app-gocardless/banks/ssk-dusseldorf-dussdeddxxx.js (3)

1-6: Well-structured module setup!

Good use of inheritance pattern by extending the fallback implementation while maintaining type safety through JSDoc annotations.


7-8: Clear bank identification

The institution ID correctly identifies Stadtsparkasse Düsseldorf using the standard format.


21-30: Verify creditor name prioritization behavior

The implementation correctly prioritizes ultimateCreditor for third-party payments, which aligns with the PR objectives. However, let's verify this behavior with some test cases.

Run the following script to search for existing test coverage:

If no tests are found, would you like me to help create test cases for various creditor name scenarios?

✅ Verification successful

Let me gather more information about the test coverage and implementation patterns.


Let me analyze the test coverage for creditor name handling.


Creditor name prioritization behavior is consistent with other Sparkasse banks

Based on the previous search results, I found that the creditor name prioritization pattern (ultimateCreditor || creditorName || debtorName) is consistently implemented across multiple Sparkasse banks:

  • berliner_sparkasse_beladebexxx.js
  • spk-karlsruhe-karsde66.js
  • ssk-dusseldorf-dussdeddxxx.js

While there's no specific test file for SSK Dusseldorf, the implementation follows the established pattern used by other Sparkasse banks in the codebase. The prioritization of ultimateCreditor for third-party payments is a common pattern across these implementations.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for test files related to this bank integration
fd -e test.js -e spec.js ssk-dusseldorf

# Search for similar creditor name handling patterns in other bank implementations
ast-grep --pattern 'transaction.ultimateCreditor || transaction.creditorName'

Length of output: 685


Script:

#!/bin/bash
# Check test files in the app-gocardless directory
fd -e test.js -e spec.js . src/app-gocardless

# Look for test cases involving creditor name handling
rg -A 5 "ultimateCreditor|creditorName" $(fd -e test.js -e spec.js . src/app-gocardless)

# Check the implementation in other banks to understand the pattern
rg -A 5 "usefulCreditorName" src/app-gocardless/banks/

Length of output: 23135


Script:

#!/bin/bash
# Check for test file specific to SSK Dusseldorf
fd -e test.js -e spec.js ssk-dusseldorf

# Look for test cases involving ultimateCreditor
rg -A 5 "ultimateCreditor" $(fd -e test.js -e spec.js . src/app-gocardless)

# Check the implementation pattern in the Fallback class
rg -A 5 "class Fallback" src/app-gocardless/

Length of output: 1403

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
src/app-gocardless/banks/ssk-dusseldorf-dussdeddxxx.js (1)

17-20: Fix code formatting to match project style.

The concatenation logic has correct null handling but needs formatting adjustments.

Apply this formatting fix:

-      remittanceInformationUnstructured = 
-        (remittanceInformationUnstructured ?? '')
-        + ' ' 
-        + transaction.additionalInformation;
+      remittanceInformationUnstructured =
+        (remittanceInformationUnstructured ?? '') +
+        ' ' +
+        transaction.additionalInformation;
🧰 Tools
🪛 eslint

[error] 17-17: Delete ·

(prettier/prettier)


[error] 18-18: Insert ·+

(prettier/prettier)


[error] 19-19: Replace ·+·'·'· with ·'·'·+

(prettier/prettier)


[error] 20-20: Delete ·+

(prettier/prettier)

🪛 GitHub Check: lint

[failure] 17-17:
Delete ·


[failure] 18-18:
Insert ·+


[failure] 19-19:
Replace ·+·'·'· with ·'·'·+


[failure] 20-20:
Delete ·+

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6014867 and 7a20ed1.

📒 Files selected for processing (1)
  • src/app-gocardless/banks/ssk-dusseldorf-dussdeddxxx.js (1 hunks)
🧰 Additional context used
🪛 eslint
src/app-gocardless/banks/ssk-dusseldorf-dussdeddxxx.js

[error] 17-17: Delete ·

(prettier/prettier)


[error] 18-18: Insert ·+

(prettier/prettier)


[error] 19-19: Replace ·+·'·'· with ·'·'·+

(prettier/prettier)


[error] 20-20: Delete ·+

(prettier/prettier)

🪛 GitHub Check: lint
src/app-gocardless/banks/ssk-dusseldorf-dussdeddxxx.js

[failure] 17-17:
Delete ·


[failure] 18-18:
Insert ·+


[failure] 19-19:
Replace ·+·'·'· with ·'·'·+


[failure] 20-20:
Delete ·+

🔇 Additional comments (4)
src/app-gocardless/banks/ssk-dusseldorf-dussdeddxxx.js (4)

1-8: LGTM! Well-structured module setup.

The module correctly extends the base Fallback integration and properly identifies the institution.


11-14: LGTM! Robust remittance information handling.

Good use of nullish coalescing operators for fallback chain, ensuring graceful degradation through different information sources.


22-29: LGTM! Well-implemented creditor name handling.

The implementation correctly addresses the PR objective by prioritizing ultimateCreditor for third-party payments while maintaining fallbacks to other creditor sources.


9-32: Verify the implementation with real transaction data.

The implementation looks solid and meets all PR objectives. However, it would be valuable to verify the behavior with real transaction data from SSK Düsseldorf, particularly for third-party payment scenarios.

Would you like me to help create test cases covering various transaction scenarios, especially focusing on third-party payments where ultimateCreditor differs from creditorName?

🧰 Tools
🪛 eslint

[error] 17-17: Delete ·

(prettier/prettier)


[error] 18-18: Insert ·+

(prettier/prettier)


[error] 19-19: Replace ·+·'·'· with ·'·'·+

(prettier/prettier)


[error] 20-20: Delete ·+

(prettier/prettier)

🪛 GitHub Check: lint

[failure] 17-17:
Delete ·


[failure] 18-18:
Insert ·+


[failure] 19-19:
Replace ·+·'·'· with ·'·'·+


[failure] 20-20:
Delete ·+

@DennaGherlyn
Copy link
Author

@matt-fidd Okay, I think I fixed everything you asked. I hope I understood everything correctly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants