Skip to content

chore: Refactor models and other shareable packages into importable pkg#762

Open
laouji wants to merge 6 commits into
mainfrom
EN-1270-pt-1
Open

chore: Refactor models and other shareable packages into importable pkg#762
laouji wants to merge 6 commits into
mainfrom
EN-1270-pt-1

Conversation

@laouji

@laouji laouji commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Starts: EN-1270

This is part 1 of a project to libify connectors. All this does is move common code into pkg directory.
Libifying the connectors will come in a second PR.

@coderabbitai

coderabbitai Bot commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Too many files!

This PR contains 298 files, which is 148 over the limit of 150.

To get a review, narrow the scope:
• coderabbit review --type committed # exclude uncommitted changes
• coderabbit review --dir # limit to a subdirectory
• coderabbit review --base # compare against a closer base

Upgrade to a paid plan to raise the limit.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: b9499d1e-d3a9-4d12-a46b-2d8940f78a4f

📥 Commits

Reviewing files that changed from the base of the PR and between 1065b2c and 1af1647.

⛔ Files ignored due to path filters (2)
  • go.mod is excluded by !**/*.mod
  • go.sum is excluded by !**/*.sum, !**/*.sum
📒 Files selected for processing (298)
  • Justfile
  • cmd/common.go
  • cmd/recreate_schedules.go
  • cmd/recreate_schedules_test.go
  • dev.Dockerfile
  • ee/plugins/bankingbridge/accounts.go
  • ee/plugins/bankingbridge/accounts_test.go
  • ee/plugins/bankingbridge/balances.go
  • ee/plugins/bankingbridge/balances_test.go
  • ee/plugins/bankingbridge/capabilities.go
  • ee/plugins/bankingbridge/client/accounts.go
  • ee/plugins/bankingbridge/client/balances.go
  • ee/plugins/bankingbridge/client/client.go
  • ee/plugins/bankingbridge/client/transactions.go
  • ee/plugins/bankingbridge/config.go
  • ee/plugins/bankingbridge/payments.go
  • ee/plugins/bankingbridge/payments_test.go
  • ee/plugins/bankingbridge/plugin.go
  • ee/plugins/bankingbridge/schemes.go
  • ee/plugins/bankingbridge/schemes_test.go
  • ee/plugins/bankingbridge/workflow.go
  • ee/plugins/bitstamp/accounts.go
  • ee/plugins/bitstamp/accounts_test.go
  • ee/plugins/bitstamp/balances.go
  • ee/plugins/bitstamp/balances_test.go
  • ee/plugins/bitstamp/capabilities.go
  • ee/plugins/bitstamp/client/client.go
  • ee/plugins/bitstamp/config.go
  • ee/plugins/bitstamp/config_test.go
  • ee/plugins/bitstamp/conversions.go
  • ee/plugins/bitstamp/conversions_test.go
  • ee/plugins/bitstamp/mappers/account.go
  • ee/plugins/bitstamp/mappers/balance.go
  • ee/plugins/bitstamp/mappers/balance_test.go
  • ee/plugins/bitstamp/mappers/conversion.go
  • ee/plugins/bitstamp/mappers/conversion_test.go
  • ee/plugins/bitstamp/mappers/order.go
  • ee/plugins/bitstamp/mappers/order_test.go
  • ee/plugins/bitstamp/mappers/payment.go
  • ee/plugins/bitstamp/mappers/payment_test.go
  • ee/plugins/bitstamp/mappers/status.go
  • ee/plugins/bitstamp/mappers/status_test.go
  • ee/plugins/bitstamp/orders.go
  • ee/plugins/bitstamp/orders_test.go
  • ee/plugins/bitstamp/payments.go
  • ee/plugins/bitstamp/payments_test.go
  • ee/plugins/bitstamp/plugin.go
  • ee/plugins/bitstamp/plugin_test.go
  • ee/plugins/bitstamp/workflow.go
  • ee/plugins/coinbaseprime/accounts.go
  • ee/plugins/coinbaseprime/accounts_test.go
  • ee/plugins/coinbaseprime/balances.go
  • ee/plugins/coinbaseprime/balances_test.go
  • ee/plugins/coinbaseprime/capabilities.go
  • ee/plugins/coinbaseprime/client/client.go
  • ee/plugins/coinbaseprime/config.go
  • ee/plugins/coinbaseprime/config_test.go
  • ee/plugins/coinbaseprime/conversions.go
  • ee/plugins/coinbaseprime/conversions_test.go
  • ee/plugins/coinbaseprime/orders.go
  • ee/plugins/coinbaseprime/orders_test.go
  • ee/plugins/coinbaseprime/payments.go
  • ee/plugins/coinbaseprime/payments_test.go
  • ee/plugins/coinbaseprime/plugin.go
  • ee/plugins/coinbaseprime/plugin_test.go
  • ee/plugins/coinbaseprime/workflow.go
  • ee/plugins/fireblocks/accounts.go
  • ee/plugins/fireblocks/accounts_test.go
  • ee/plugins/fireblocks/balances.go
  • ee/plugins/fireblocks/balances_test.go
  • ee/plugins/fireblocks/capabilities.go
  • ee/plugins/fireblocks/client/blockchains_test.go
  • ee/plugins/fireblocks/client/client.go
  • ee/plugins/fireblocks/client/transactions_test.go
  • ee/plugins/fireblocks/config.go
  • ee/plugins/fireblocks/payments.go
  • ee/plugins/fireblocks/payments_test.go
  • ee/plugins/fireblocks/plugin.go
  • ee/plugins/fireblocks/plugin_test.go
  • ee/plugins/fireblocks/workflow.go
  • ee/plugins/routable/accounts.go
  • ee/plugins/routable/accounts_test.go
  • ee/plugins/routable/balances.go
  • ee/plugins/routable/balances_test.go
  • ee/plugins/routable/capabilities.go
  • ee/plugins/routable/client/client.go
  • ee/plugins/routable/config.go
  • ee/plugins/routable/external_accounts.go
  • ee/plugins/routable/external_accounts_test.go
  • ee/plugins/routable/mappers/account.go
  • ee/plugins/routable/mappers/balance.go
  • ee/plugins/routable/mappers/external_account.go
  • ee/plugins/routable/mappers/mappers_test.go
  • ee/plugins/routable/mappers/payable.go
  • ee/plugins/routable/mappers/receivable.go
  • ee/plugins/routable/mappers/scheme.go
  • ee/plugins/routable/mappers/scheme_test.go
  • ee/plugins/routable/mappers/status.go
  • ee/plugins/routable/mappers/status_test.go
  • ee/plugins/routable/payable_create.go
  • ee/plugins/routable/payments.go
  • ee/plugins/routable/payments_test.go
  • ee/plugins/routable/payouts.go
  • ee/plugins/routable/payouts_test.go
  • ee/plugins/routable/plugin.go
  • ee/plugins/routable/plugin_test.go
  • ee/plugins/routable/transfers.go
  • ee/plugins/routable/transfers_test.go
  • ee/plugins/routable/workflow.go
  • internal/api/backend/backend.go
  • internal/api/backend/backend_generated.go
  • internal/api/services/accounts_create.go
  • internal/api/services/accounts_create_test.go
  • internal/api/services/accounts_get.go
  • internal/api/services/accounts_get_test.go
  • internal/api/services/accounts_list.go
  • internal/api/services/balances_list.go
  • internal/api/services/bank_accounts_create.go
  • internal/api/services/bank_accounts_create_test.go
  • internal/api/services/bank_accounts_forward_to_connector.go
  • internal/api/services/bank_accounts_forward_to_connector_test.go
  • internal/api/services/bank_accounts_get.go
  • internal/api/services/bank_accounts_get_test.go
  • internal/api/services/bank_accounts_list.go
  • internal/api/services/connector_capabilities.go
  • internal/api/services/connector_capabilities_test.go
  • internal/api/services/connector_configs.go
  • internal/api/services/connector_configs_test.go
  • internal/api/services/connectors_config_update.go
  • internal/api/services/connectors_config_update_test.go
  • internal/api/services/connectors_handle_webhooks.go
  • internal/api/services/connectors_handle_webhooks_test.go
  • internal/api/services/connectors_install.go
  • internal/api/services/connectors_install_test.go
  • internal/api/services/connectors_list.go
  • internal/api/services/connectors_reset.go
  • internal/api/services/connectors_reset_test.go
  • internal/api/services/connectors_uninstall.go
  • internal/api/services/connectors_uninstall_test.go
  • internal/api/services/conversions_get.go
  • internal/api/services/conversions_list.go
  • internal/api/services/errors.go
  • internal/api/services/orders_get.go
  • internal/api/services/orders_list.go
  • internal/api/services/payment_initiation_adjustments_get_last.go
  • internal/api/services/payment_initiation_adjustments_get_last_test.go
  • internal/api/services/payment_initiation_adjustments_list.go
  • internal/api/services/payment_initiation_adjustments_list_test.go
  • internal/api/services/payment_initiation_related_payments_list.go
  • internal/api/services/payment_initiation_related_payments_list_test.go
  • internal/api/services/payment_initiations_approve.go
  • internal/api/services/payment_initiations_approve_test.go
  • internal/api/services/payment_initiations_create.go
  • internal/api/services/payment_initiations_create_test.go
  • internal/api/services/payment_initiations_delete.go
  • internal/api/services/payment_initiations_delete_test.go
  • internal/api/services/payment_initiations_get.go
  • internal/api/services/payment_initiations_get_test.go
  • internal/api/services/payment_initiations_list.go
  • internal/api/services/payment_initiations_reject.go
  • internal/api/services/payment_initiations_reject_test.go
  • internal/api/services/payment_initiations_retry.go
  • internal/api/services/payment_initiations_retry_test.go
  • internal/api/services/payment_initiations_reversal_create.go
  • internal/api/services/payment_initiations_reversal_create_test.go
  • internal/api/services/payment_service_users_complete_link_flow.go
  • internal/api/services/payment_service_users_complete_link_flow_test.go
  • internal/api/services/payment_service_users_connections_delete.go
  • internal/api/services/payment_service_users_connections_delete_test.go
  • internal/api/services/payment_service_users_connections_list.go
  • internal/api/services/payment_service_users_connections_list_test.go
  • internal/api/services/payment_service_users_connector_delete.go
  • internal/api/services/payment_service_users_connector_delete_test.go
  • internal/api/services/payment_service_users_create.go
  • internal/api/services/payment_service_users_create_link.go
  • internal/api/services/payment_service_users_create_link_test.go
  • internal/api/services/payment_service_users_create_test.go
  • internal/api/services/payment_service_users_delete.go
  • internal/api/services/payment_service_users_delete_test.go
  • internal/api/services/payment_service_users_forward.go
  • internal/api/services/payment_service_users_forward_bank_account.go
  • internal/api/services/payment_service_users_forward_bank_account_test.go
  • internal/api/services/payment_service_users_forward_test.go
  • internal/api/services/payment_service_users_get.go
  • internal/api/services/payment_service_users_get_test.go
  • internal/api/services/payment_service_users_link_attempts_get.go
  • internal/api/services/payment_service_users_link_attempts_get_test.go
  • internal/api/services/payment_service_users_link_attempts_list.go
  • internal/api/services/payment_service_users_link_attempts_list_test.go
  • internal/api/services/payment_service_users_list.go
  • internal/api/services/payment_service_users_update_link.go
  • internal/api/services/payment_service_users_update_link_test.go
  • internal/api/services/payments_create.go
  • internal/api/services/payments_create_test.go
  • internal/api/services/payments_get.go
  • internal/api/services/payments_get_test.go
  • internal/api/services/payments_list.go
  • internal/api/services/payments_update_metadata.go
  • internal/api/services/payments_update_metadata_test.go
  • internal/api/services/pools_add_account.go
  • internal/api/services/pools_add_account_test.go
  • internal/api/services/pools_balances.go
  • internal/api/services/pools_balances_at.go
  • internal/api/services/pools_balances_at_test.go
  • internal/api/services/pools_balances_test.go
  • internal/api/services/pools_create.go
  • internal/api/services/pools_create_test.go
  • internal/api/services/pools_get.go
  • internal/api/services/pools_get_test.go
  • internal/api/services/pools_list.go
  • internal/api/services/pools_list_test.go
  • internal/api/services/pools_remove_account.go
  • internal/api/services/pools_remove_account_test.go
  • internal/api/services/schedules_get.go
  • internal/api/services/schedules_get_test.go
  • internal/api/services/schedules_list.go
  • internal/api/services/tasks_get.go
  • internal/api/services/tasks_get_test.go
  • internal/api/services/workflows_instances_list.go
  • internal/api/v2/errors.go
  • internal/api/v2/handler_accounts_balances.go
  • internal/api/v2/handler_accounts_balances_test.go
  • internal/api/v2/handler_accounts_create.go
  • internal/api/v2/handler_accounts_create_test.go
  • internal/api/v2/handler_accounts_get.go
  • internal/api/v2/handler_accounts_get_test.go
  • internal/api/v2/handler_accounts_list_test.go
  • internal/api/v2/handler_bank_accounts_create.go
  • internal/api/v2/handler_bank_accounts_forward_to_connector.go
  • internal/api/v2/handler_bank_accounts_forward_to_connector_test.go
  • internal/api/v2/handler_bank_accounts_get_test.go
  • internal/api/v2/handler_bank_accounts_list_test.go
  • internal/api/v2/handler_connectors_config.go
  • internal/api/v2/handler_connectors_config_test.go
  • internal/api/v2/handler_connectors_install_test.go
  • internal/api/v2/handler_connectors_list_test.go
  • internal/api/v2/handler_connectors_reset.go
  • internal/api/v2/handler_connectors_reset_test.go
  • internal/api/v2/handler_connectors_uninstall.go
  • internal/api/v2/handler_connectors_uninstall_test.go
  • internal/api/v2/handler_connectors_update_config.go
  • internal/api/v2/handler_connectors_update_config_test.go
  • internal/api/v2/handler_connectors_webhooks.go
  • internal/api/v2/handler_connectors_webhooks_test.go
  • internal/api/v2/handler_payments_create.go
  • internal/api/v2/handler_payments_create_test.go
  • internal/api/v2/handler_payments_get.go
  • internal/api/v2/handler_payments_get_test.go
  • internal/api/v2/handler_payments_list_test.go
  • internal/api/v2/handler_payments_update_metadata.go
  • internal/api/v2/handler_payments_update_metadata_test.go
  • internal/api/v2/handler_pools_add_account.go
  • internal/api/v2/handler_pools_add_account_test.go
  • internal/api/v2/handler_pools_balances_at_test.go
  • internal/api/v2/handler_pools_balances_latest_test.go
  • internal/api/v2/handler_pools_create.go
  • internal/api/v2/handler_pools_create_test.go
  • internal/api/v2/handler_pools_get_test.go
  • internal/api/v2/handler_pools_list_test.go
  • internal/api/v2/handler_pools_remove_account.go
  • internal/api/v2/handler_pools_remove_account_test.go
  • internal/api/v2/handler_tasks_get.go
  • internal/api/v2/handler_tasks_get_test.go
  • internal/api/v2/handler_tasks_list_test.go
  • internal/api/v2/handler_transfer_initiations_create.go
  • internal/api/v2/handler_transfer_initiations_create_test.go
  • internal/api/v2/handler_transfer_initiations_delete.go
  • internal/api/v2/handler_transfer_initiations_delete_test.go
  • internal/api/v2/handler_transfer_initiations_get.go
  • internal/api/v2/handler_transfer_initiations_get_test.go
  • internal/api/v2/handler_transfer_initiations_list.go
  • internal/api/v2/handler_transfer_initiations_list_test.go
  • internal/api/v2/handler_transfer_initiations_retry.go
  • internal/api/v2/handler_transfer_initiations_retry_test.go
  • internal/api/v2/handler_transfer_initiations_reverse.go
  • internal/api/v2/handler_transfer_initiations_reverse_test.go
  • internal/api/v2/handler_transfer_initiations_update_status.go
  • internal/api/v2/handler_transfer_initiations_update_status_test.go
  • internal/api/v2/utils.go
  • internal/api/v3/handler_accounts_balances.go
  • internal/api/v3/handler_accounts_balances_test.go
  • internal/api/v3/handler_accounts_create.go
  • internal/api/v3/handler_accounts_create_test.go
  • internal/api/v3/handler_accounts_get.go
  • internal/api/v3/handler_accounts_get_test.go
  • internal/api/v3/handler_accounts_list_test.go
  • internal/api/v3/handler_bank_accounts_create.go
  • internal/api/v3/handler_bank_accounts_forward_to_connector.go
  • internal/api/v3/handler_bank_accounts_forward_to_connector_test.go
  • internal/api/v3/handler_bank_accounts_get_test.go
  • internal/api/v3/handler_bank_accounts_list_test.go
  • internal/api/v3/handler_connectors_capabilities.go
  • internal/api/v3/handler_connectors_capabilities_test.go
  • internal/api/v3/handler_connectors_config.go
  • internal/api/v3/handler_connectors_config_test.go
  • internal/api/v3/handler_connectors_config_update.go
  • internal/api/v3/handler_connectors_config_update_test.go
  • internal/api/v3/handler_connectors_install_test.go

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch EN-1270-pt-1

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Jun 22, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 65.58%. Comparing base (0df286b) to head (9cf6f7b).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #762      +/-   ##
==========================================
- Coverage   66.84%   65.58%   -1.26%     
==========================================
  Files         923      861      -62     
  Lines       43125    39530    -3595     
==========================================
- Hits        28827    25926    -2901     
+ Misses      12393    11843     -550     
+ Partials     1905     1761     -144     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@laouji laouji marked this pull request as ready for review June 22, 2026 12:41
@laouji laouji requested review from a team as code owners June 22, 2026 12:41

@NumaryBot NumaryBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🛑 Changes requested — automated review

The refactor leaves development Docker builds broken, drops CI execution for the moved domain tests, and leaves the connector scaffolding templates generating imports to removed packages. These are discrete follow-up changes needed for the move to be safe.

Comment thread go.mod
Comment thread pkg/domain/go.mod
Comment thread internal/connectors/plugins/public/adyen/accounts.go

@NumaryBot NumaryBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🛑 Changes requested — automated review

The refactor mostly preserves code behavior, but introducing pkg/domain as a nested module without release tagging breaks the intended ability for external consumers to pin it to normal repository releases.

Comment thread pkg/domain/go.mod
@@ -0,0 +1,50 @@
module github.com/formancehq/payments/pkg/domain

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟠 [major] Publish domain with submodule release tags

When an out-of-repo connector tries to pin github.com/formancehq/payments/pkg/domain to a payments release such as @vX.Y.Z, this nested go.mod makes Go look for tags prefixed with pkg/domain/, while the existing release workflow only creates root v*.*.* tags. That means the new shared domain module cannot be fetched at released versions unless consumers use pseudo-versions or add their own replace; either keep it in the root module or add matching submodule tagging.

@NumaryBot NumaryBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🛑 Changes requested — automated review

The patch introduces a call to a nonexistent method on the Storage interface, so the repository will not compile until that API is implemented or the call is changed.

}

func (l *scopedAccountLookup) ListAccountsByConnector(ctx context.Context) ([]models.PSPAccount, error) {
accounts, err := l.storage.AccountsListAllByConnectorID(ctx, l.connectorID)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔴 [blocker] Add the storage method before calling it

This new lookup implementation calls AccountsListAllByConnectorID, but storage.Storage, its concrete implementation, and the generated mock do not define that method. As a result, any build or test compiling internal/connectors/engine fails with l.storage.AccountsListAllByConnectorID undefined; either add the storage API/implementation/mock or use the existing AccountsList query path here.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants