Skip to content

feat(import): support multi-vendor place imports#91

Draft
dadofsambonzuki wants to merge 4 commits into
masterfrom
import-enhancements
Draft

feat(import): support multi-vendor place imports#91
dadofsambonzuki wants to merge 4 commits into
masterfrom
import-enhancements

Conversation

@dadofsambonzuki
Copy link
Copy Markdown
Member

@dadofsambonzuki dadofsambonzuki commented May 15, 2026

Need

Currently, the /import endpoint only supports Square as an origin. Multiple other wallets have expressed interest in using this endpoint to leverage the verification and quality controls provided by taggers and avoid the pitfalls associated with direct OSM integration.

Summary

  • Add import origin scopes to access tokens, including * wildcard support for all origins.
  • Centralize import vendor metadata and use it for sync, pending-place filtering, payment provider mapping and Gitea labels.
  • Preserve existing places-source token behavior by migrating current places-source tokens to wildcard scope.

Validation

  • cargo fmt
  • cargo clippy -- -D warnings
  • cargo test

Out Of Scope

  • Public/admin RPC or UI for creating scoped import tokens; scoped token creation remains manual for now.
  • Dynamic vendor configuration from the database or admin UI; vendors are still registered in code.
  • Vendor-specific category mapping beyond the existing Square mapping; non-Square vendors currently fall back to the generic store icon unless configured later.
  • End-to-end Gitea issue creation tests for each vendor; sync behavior is covered through shared vendor metadata and existing tests.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 15, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: b9d6eca6-de1f-43cb-af47-fa957865d837

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 import-enhancements

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 and usage tips.

@dadofsambonzuki dadofsambonzuki changed the title Support multi-vendor place imports feat(import): support multi-vendor place imports May 15, 2026
@dadofsambonzuki
Copy link
Copy Markdown
Member Author

I think we can totally remove all the category -> icon mapping. That was intended when we were going to temporarily display imported places, which we don't do.

@r1ckstardev
Copy link
Copy Markdown

Reviewed + ran tests on the pinned 1.93.0 toolchain. One blocker.

get_submitted_place and revoke_submitted_place authorize on caller-supplied params.origin, then fetch by params.id without re-checking the loaded row's actual origin. A places_source token scoped to ["coinos"] can read or revoke any other vendor's submission with {"id": <n>, "origin": "coinos"}. Fix: load by id first, then ensure_can_access_origin(roles, token, &submission.origin) before returning or mutating. No existing test exercises id + mismatched-origin; a regression case should land with the fix.

Two worth a line in the PR:

  • Migration 101.sql sets import_origins=["*"] on every grandfathered places_source token. Pre-PR Square was the only vendor; ["square"] would be conservative, ["*"] auto-inherits every future one.
  • Commit 6b81284 collapses PlaceSubmission::icon() to "store", dropping the Square category mapping with no PR-description callout.

Vendor centralization, the v4/places.rs simplification, and 101.sql mechanics are otherwise clean.

Happy to write the regression test or draft the fix - ping @rockstardev to point me at it.

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