mirror of
https://github.com/we-promise/sure.git
synced 2026-04-08 14:54:49 +00:00
* **Add Coinbase integration with item and account management** - Creates migrations for `coinbase_items` and `coinbase_accounts`. - Adds models, controllers, views, and background tasks to support account linking, syncing, and transaction handling. - Implements Coinbase API client and adapter for seamless integration. - Supports ActiveRecord encryption for secure credential storage. - Adds UI components for provider setup, account management, and synchronization. * Localize Coinbase-related UI strings, refine account linking for security, and add timeouts to Coinbase API requests. * Localize Coinbase account handling to support native currencies (USD, EUR, GBP, etc.) across balances, trades, holdings, and transactions. * Improve Coinbase processing with timezone-safe parsing, native currency support, and immediate holdings updates. * Improve trend percentage formatting and enhance race condition handling for Coinbase account linking. * Fix log message wording for orphan cleanup * Ensure `selected_accounts` parameter is sanitized by rejecting blank entries. * Add tests for Coinbase integration: account, item, and controller coverage - Adds unit tests for `CoinbaseAccount` and `CoinbaseItem` models. - Adds integration tests for `CoinbaseItemsController`. - Introduces Stimulus `select-all` controller for UI checkbox handling. - Localizes UI strings and logging for Coinbase integration. * Update test fixtures to use consistent placeholder API keys and secrets * Refine `coinbase_item` tests to ensure deterministic ordering and improve scope assertions. * Integrate `SyncStats::Collector` into Coinbase syncer to streamline statistics collection and enhance consistency. * Localize Coinbase sync status messages and improve sync summary test coverage. * Update `CoinbaseItem` encryption: use deterministic encryption for `api_key` and standard for `api_secret`. * fix schema drift * Beta labels to lower expectations --------- Co-authored-by: luckyPipewrench <luckypipewrench@proton.me> Co-authored-by: Juan José Mata <juanjo.mata@gmail.com>
44 lines
2.1 KiB
Plaintext
44 lines
2.1 KiB
Plaintext
<%# Modal: Link an existing manual account to a Coinbase account %>
|
|
<%= turbo_frame_tag "modal" do %>
|
|
<%= render DS::Dialog.new do |dialog| %>
|
|
<% dialog.with_header(title: t(".title")) %>
|
|
|
|
<% dialog.with_body do %>
|
|
<% if @available_coinbase_accounts.blank? %>
|
|
<div class="p-4 text-sm text-secondary">
|
|
<p class="mb-2"><%= t(".no_accounts_found") %></p>
|
|
<ul class="list-disc list-inside space-y-1">
|
|
<li><%= t(".wait_for_sync") %></li>
|
|
<li><%= t(".check_provider_health") %></li>
|
|
</ul>
|
|
</div>
|
|
<% else %>
|
|
<%= form_with url: link_existing_account_coinbase_items_path, method: :post, class: "space-y-4" do %>
|
|
<%= hidden_field_tag :account_id, @account.id %>
|
|
<div class="space-y-2 max-h-64 overflow-auto">
|
|
<% @available_coinbase_accounts.each do |ca| %>
|
|
<label class="flex items-center gap-3 p-2 rounded border border-surface-inset/50 hover:border-primary cursor-pointer">
|
|
<%= radio_button_tag :coinbase_account_id, ca.id, false %>
|
|
<div class="flex flex-col">
|
|
<span class="text-sm text-primary font-medium"><%= ca.name.presence || ca.account_id %></span>
|
|
<span class="text-xs text-secondary">
|
|
<%= ca.currency %> • <%= t(".balance") %>: <%= number_with_delimiter(ca.current_balance || 0, delimiter: ",") %>
|
|
</span>
|
|
<% if ca.current_account.present? %>
|
|
<span class="text-xs text-secondary"><%= t(".currently_linked_to", account_name: ca.current_account.name) %></span>
|
|
<% end %>
|
|
</div>
|
|
</label>
|
|
<% end %>
|
|
</div>
|
|
|
|
<div class="flex items-center justify-end gap-2">
|
|
<%= render DS::Button.new(text: t(".link"), variant: :primary, icon: "link-2", type: :submit) %>
|
|
<%= render DS::Link.new(text: t(".cancel"), variant: :secondary, href: accounts_path, data: { turbo_frame: "_top" }) %>
|
|
</div>
|
|
<% end %>
|
|
<% end %>
|
|
<% end %>
|
|
<% end %>
|
|
<% end %>
|