Files
sure/app/views/wise_items/select_profiles.html.erb
xBlaz3kx 237146a914 feat(wise): add Wise integration with JAR savings account and activity support
- Add WiseItem/WiseAccount models with full sync pipeline (importer, syncer, processor)
- Detect income vs expense using targetAccount == recipientId from borderless accounts API
- Support JAR (SAVINGS) accounts with totalWorth balance and savings subtype
- Fetch JAR activity via profile activities API (INTERBALANCE, BALANCE_CASHBACK, BALANCE_ASSET_FEE)
- Route INTERBALANCE activities to both JAR and STANDARD accounts and link as Transfer records
- Add provider connection status registration, routes, views, and i18n
- Add migration for wise_items and wise_accounts tables
- Add tests for WiseAccount, WiseEntry::Processor, WiseActivity::Processor, WiseItem::Importer, and WiseItem#link_jar_transfers!
2026-07-09 22:58:15 +02:00

65 lines
2.6 KiB
Plaintext

<% content_for :title, t(".title") %>
<%= render DS::Dialog.new do |dialog| %>
<% dialog.with_header(title: t(".title")) do %>
<div class="flex items-center gap-2">
<%= icon "globe", class: "text-primary" %>
<span class="text-primary"><%= t(".subtitle") %></span>
</div>
<% end %>
<% dialog.with_body do %>
<%= form_with url: link_profiles_wise_items_path,
method: :post,
local: true,
data: { turbo_frame: "_top" },
class: "space-y-6" do |form| %>
<p class="text-sm text-secondary"><%= t(".description") %></p>
<div class="space-y-3">
<% @pending_profiles.each do |profile| %>
<% profile_id = profile["id"].to_s %>
<% already_connected = @existing_profile_ids.include?(profile_id) %>
<% profile_type = profile["type"] == "business" ? "business" : "personal" %>
<% details = profile["details"] || {} %>
<% display_name = details["name"].presence || [ details["firstName"], details["lastName"] ].compact.join(" ") %>
<label class="flex items-start gap-3 p-3 border <%= already_connected ? "border-secondary opacity-60 cursor-not-allowed" : "border-primary hover:bg-subtle cursor-pointer" %> rounded-lg transition-colors">
<%= check_box_tag "profile_ids[]", profile_id, !already_connected, disabled: already_connected, class: "mt-1" %>
<div class="flex-1">
<div class="flex items-center gap-2">
<span class="font-medium text-sm text-primary"><%= display_name.presence || t(".unnamed_profile") %></span>
<span class="text-xs px-1.5 py-0.5 rounded bg-surface-inset text-secondary">
<%= t("wise_items.profile_types.#{profile_type}") %>
</span>
<% if already_connected %>
<span class="text-xs text-secondary"><%= t(".already_connected_label") %></span>
<% end %>
</div>
<% if details["email"].present? %>
<p class="text-xs text-secondary mt-0.5"><%= details["email"] %></p>
<% end %>
</div>
</label>
<% end %>
</div>
<div class="flex gap-3">
<%= render DS::Button.new(
text: t(".connect"),
variant: "primary",
icon: "link",
type: "submit",
class: "flex-1"
) %>
<%= render DS::Link.new(
text: t(".cancel"),
variant: "secondary",
href: settings_providers_path
) %>
</div>
<% end %>
<% end %>
<% end %>