mirror of
https://github.com/we-promise/sure.git
synced 2026-08-05 00:22:17 +00:00
* 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!
* chore(lint): add ignore to security scan (false positive)
* fix(wise): address PR review feedback on activity routing, HTML stripping, rate limiting, and scope extraction
- Replace title string matching in activity_for_account? with resource.id vs balance_id comparison to avoid breakage when users rename JAR accounts on Wise
- Replace gsub(/<[^>]+>/, "") with ActionController::Base.helpers.strip_tags to safely handle user-controlled HTML-like content
- Wrap paginated API calls in with_rate_limit_retry (up to 3 attempts, exponential backoff) to handle 429 responses during fetch_jar_activities and fetch_transfers
- Extract WiseAccount.unlinked scope and remove duplicated left_joins query from controller
* fix(wise): address PR #2433 review feedback
- Wire @wise_items into AccountsController#index so linked accounts appear on /accounts
- Fix find_wise_account_for_linking to preserve .active scope via .merge instead of .then
- Fix cross-currency incoming transfer amount to use targetValue instead of sourceValue
- Add missing select_profiles.session_expired locale key
- Add missing account_name interpolation to link_existing_account success notice
- Use i18n for profile type labels in profile_display_name
- Trigger wise_item.sync_later after account linking in all three linking actions
- Isolate fee transaction failure so it no longer aborts the main transfer import
- Use bare raise in WiseActivity/WiseEntry processors to preserve original backtrace
- Re-raise in WiseItem::Unlinking to prevent silently orphaned Holdings
- Fix avatar badge to use design system tokens (bg-container-inset, text-primary)
* fix(wise): fix INTERBALANCE routing and encrypt pending token in session
* fix(wise): replace hand-rolled buttons/links with DS::Button and DS::Link
Address repeated sure-design DS drift findings: migrate all manual
Tailwind button_to and link_to calls in Wise views to DS::Button
(outline/outline_destructive variants) and DS::Link (secondary variant).
Add missing provider_panel.disconnect locale key for the disconnect button text.
* fix(wise): use render_provider_panel_error in create instead of missing new template
* fix(wise): add missing comma in PROVIDERS array
CI failed with a SyntaxError because the questrade entry wasn't
comma-terminated before the wise entry.
* chore(wise): re-add pipelock:ignore for pending token param
Lost when the token source moved from session to an encrypted params
field in 0b5dc886, causing the CI secret scanner to flag a false positive.
* fix(test): widen random ticker suffix to avoid rare collision flake
hex(2) only yields 65536 possible tickers, so create_trade's 4 calls per
test run had a small but nonzero chance of colliding on the unique
ticker+exchange index. hex(8) makes collisions practically impossible.
92 lines
4.0 KiB
Plaintext
92 lines
4.0 KiB
Plaintext
<%# locals: (form:, amount_method:, currency_method:, **options) %>
|
|
|
|
<% currency_value = if options[:currency_value_override].present?
|
|
options[:currency_value_override]
|
|
elsif form.object && form.object.respond_to?(currency_method)
|
|
form.object.public_send(currency_method)
|
|
end
|
|
currency = Money::Currency.new(currency_value || options[:default_currency] || "USD") %>
|
|
|
|
<div class="form-field <%= options[:container_class] %>"
|
|
data-controller="money-field"
|
|
<% if options[:precision].present? %> data-money-field-precision-value="<%= options[:precision] %>"<% end %>
|
|
<% if options[:step].present? %> data-money-field-step-value="<%= options[:step] %>"<% end %>>
|
|
<% if options[:label_tooltip] %>
|
|
<div class="form-field__header">
|
|
<%= form.label options[:label] || t(".label"), class: "form-field__label" do %>
|
|
<%= options[:label] || t(".label") %>
|
|
<% if options[:required] %>
|
|
<span class="text-red-500 ml-0.5">*</span>
|
|
<% end %>
|
|
<% end %>
|
|
<div class="form-field__actions">
|
|
<div data-controller="tooltip">
|
|
<%= icon "help-circle", size: "sm", color: "default", class: "cursor-help" %>
|
|
<div role="tooltip" data-tooltip-target="tooltip" class="tooltip bg-inverse text-inverse text-sm p-2 rounded-md w-64">
|
|
<%= options[:label_tooltip] %>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<% end %>
|
|
|
|
<div class="form-field__body">
|
|
<% unless options[:label_tooltip] %>
|
|
<%= form.label options[:label] || t(".label"), class: "form-field__label" do %>
|
|
<%= options[:label] || t(".label") %>
|
|
<% if options[:required] %>
|
|
<span class="text-red-500 ml-0.5">*</span>
|
|
<% end %>
|
|
<% end %>
|
|
<% end %>
|
|
|
|
<div class="flex items-center gap-1">
|
|
<div class="flex items-center grow gap-1">
|
|
<span class="text-subdued text-sm" data-money-field-target="symbol">
|
|
<%= currency.symbol %>
|
|
</span>
|
|
|
|
<%= form.number_field amount_method,
|
|
class: "form-field__input",
|
|
inline: true,
|
|
placeholder: "100",
|
|
value: if options[:value]
|
|
sprintf("%.#{options[:precision].presence || currency.default_precision}f", options[:value])
|
|
elsif form.object && form.object.respond_to?(amount_method)
|
|
val = form.object.public_send(amount_method)
|
|
sprintf("%.#{options[:precision].presence || currency.default_precision}f", val) if val.present?
|
|
end,
|
|
min: options[:min] || -99999999999999,
|
|
max: options[:max] || 99999999999999,
|
|
step: options[:step] || currency.step,
|
|
disabled: options[:disabled],
|
|
data: (options[:amount_data] || {}).merge({
|
|
"money-field-target": "amount",
|
|
"auto-submit-form-target": ("auto" if options[:auto_submit])
|
|
}.compact),
|
|
required: options[:required] %>
|
|
</div>
|
|
|
|
<% unless options[:hide_currency] %>
|
|
<div>
|
|
<% currency_data = (options[:currency_data] || {}).merge({
|
|
"money-field-target": "currency",
|
|
"auto-submit-form-target": ("auto" if options[:auto_submit])
|
|
}.compact)
|
|
# Preserve any existing action and append money-field handler
|
|
existing_action = currency_data.delete("action")
|
|
currency_data["action"] = ["change->money-field#handleCurrencyChange", existing_action].compact.join(" ") %>
|
|
<%= form.select currency_method,
|
|
currency_picker_options_for_family(extra: currency.iso_code),
|
|
{ inline: true, selected: currency.iso_code },
|
|
{
|
|
class: "w-fit pr-5 disabled:text-subdued form-field__input",
|
|
disabled: options[:disable_currency],
|
|
data: currency_data
|
|
} %>
|
|
</div>
|
|
<% end %>
|
|
</div>
|
|
</div>
|
|
</div>
|