Skip to content

feat(buy/sell): explicit price provider (Aktionariat) message on outage#699

Open
TaprootFreak wants to merge 4 commits into
stagingfrom
feature/realunit-aktionariat-quote-message
Open

feat(buy/sell): explicit price provider (Aktionariat) message on outage#699
TaprootFreak wants to merge 4 commits into
stagingfrom
feature/realunit-aktionariat-quote-message

Conversation

@TaprootFreak
Copy link
Copy Markdown
Contributor

Problem

When buying/selling RealUnit while the external price provider (Aktionariat) is down, the app showed a generic "An error occurred … contact support" message. That wrongly implies the problem is with RealUnit or the app, when it is the external price provider.

Change

Pairs with API PR DFXswiss/api#3825, which now returns 503 / code: PRICE_SOURCE_UNAVAILABLE for the buy/sell quote during a price-source outage.

  • New PaymentInfoError.priceSourceUnavailable.
  • Buy (buy_payment_info_cubit.dart) and sell (sell_payment_info_cubit.dart): add an on ApiException clause — matched on statusCode == 503 or code == 'PRICE_SOURCE_UNAVAILABLE' — kept below the KYC/Registration clauses (those are ApiException subclasses). Matching on both makes it defensive even before the API ships.
  • Render an explicit message attributing the problem to Aktionariat: buy shows it inline (payment_information.dart), sell shows it as a snackbar (sell_button.dart).
  • New i18n keys priceProviderUnavailableTitle / priceProviderUnavailableDescription (de + en).

Dashboard intentionally unchanged (still --.--) — scope is buy/sell only.

Copy (de)

Problem beim Kursanbieter (Aktionariat)
Der externe Kursanbieter Aktionariat liefert aktuell keine Kurse. Das Problem liegt bei Aktionariat – nicht bei RealUnit oder der App. Sobald Aktionariat wieder Kurse liefert, funktioniert alles automatisch. Bitte später erneut versuchen.

Tests

  • Buy + sell payment-info cubit tests: 503 and codepriceSourceUnavailable; other ApiExceptionunknown.
  • New buy golden buy_price_source_unavailable (regenerated via golden-regenerate.yaml).
  • flutter analyze clean; buy/sell cubit suites green.

Test plan

  • Buy/sell while the price source is down (current real state) → explicit Aktionariat message, not the generic one.
  • Normal case (price available) → unchanged.

TaprootFreak and others added 3 commits June 5, 2026 12:10
… outage

When the buy/sell quote fails because the external price provider (Aktionariat)
is unavailable, the API now returns 503 / code PRICE_SOURCE_UNAVAILABLE. Map
that to a new PaymentInfoError.priceSourceUnavailable in both the buy and sell
payment-info cubits (matched on statusCode == 503 OR the code, kept below the
KYC/Registration clauses which are ApiException subclasses) and render an
explicit message that attributes the problem to Aktionariat — instead of the
generic "contact support" failure. Buy shows it inline; sell shows it as a
snackbar.

Adds priceProviderUnavailableTitle/Description strings (de + en), cubit tests
for the 503 mapping, and a buy golden for the new state.
The regenerate run also rewrote home_page_loaded.png with an unrelated
sub-pixel diff; revert it to the staging baseline so this PR adds only the
new buy_price_source_unavailable golden.
@TaprootFreak TaprootFreak marked this pull request as ready for review June 5, 2026 10:15
Adding priceSourceUnavailable makes the enum six variants; update the
contract test accordingly.
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.

1 participant