Release: develop -> main#3831
Merged
Merged
Conversation
…uy/sell quote (#3825) * feat(realunit): surface price-source (Aktionariat) outage as 503 on buy/sell quote When the external RealUnit price provider (Aktionariat) is down, the buy and sell payment-info endpoints used to leak a generic 500, so clients could not tell the failure apart from any other error. Wrap the price-dependent quote calls in getPaymentInfo/getSellPaymentInfo: on failure, if the live price is currently unavailable, throw a 503 PriceSourceUnavailableException with code PRICE_SOURCE_UNAVAILABLE so the apps can show an explicit "price provider unavailable" message; otherwise the original error is rethrown unchanged. The /v1/realunit/price endpoints are unchanged (still 200 + null) so the price chart keeps rendering history during the outage. * fix(realunit): detect price-source outage via PriceInvalidException instead of re-querying price The previous guard called getRealUnitPrice() after a failure and checked chf == null to detect an Aktionariat outage. This was unreliable: the secondary call uses PriceValidity.ANY and may return a stale cached price with chf != null even when the source is down, causing the guard to miss the outage window and fall back to a generic 500. PricingService.getAssetPrice always throws PriceInvalidException on any pricing failure, so checking instanceof PriceInvalidException is a direct, synchronous signal with no second network call and no cache timing issue. Non-price errors (KYC, validation, IBAN) are unaffected. * style: fix prettier formatting in realunit.service.spec.ts --------- Co-authored-by: David May <david.leo.may@gmail.com>
…down (#3829) * fix(realunit): use last known price when Aktionariat price source is down The buy/sell quote depends on the live RealUnit price provider (Aktionariat). When that source is unavailable, the price lookup throws, so the quote and the payment-info endpoints fail and the app becomes unusable. Let the RealUnit pricing provider fall back to the last persisted price (Asset.approxPriceChf/Eur, refreshed hourly and surviving restarts) when the live fetch fails. The fallback price is flagged invalid so strict consumers (exact quotes, the price snapshot job) keep rejecting the stale value, while estimates (non-exact quotes, min volume, fees) keep working during an outage. * fix(pricing): do not persist an invalid price as a rule's current price Guard doUpdatePriceFor so a price flagged invalid is never written to PriceRule.currentPrice. This keeps the RealUnit last-known-price fallback from leaking into VALID_ONLY consumers: estimates (ANY) still use the last price, while the snapshot job and exact lookups keep skipping the stale value instead of recording it as current.
…mpty (#3830) The price fetch crashed with a cryptic "Cannot read properties of undefined (reading 'priceInCHF')" when the Aktionariat getPrice endpoint returned an empty/invalid body. Validate the response after the cache (AsyncCache swallows callback errors with fallbackToCache) and throw an explicit, source-attributing error instead.
…p crash (#3832) PricingRealUnitService read Config.environment in a class field initializer. Because of a circular import, Config is undefined at construction time, so NestJS DI threw "Cannot read properties of undefined (reading 'environment')" and the whole API failed to bootstrap (crash loop, all health checks down). Convert the field into a lazy getter so Config is read at runtime, after the module graph is fully initialized.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Automatic Release PR
This PR was automatically created after changes were pushed to develop.
Commits: 1 new commit(s)
Checklist