Skip to content

Refactor/migrate ukstandard#2817

Merged
simonredfern merged 15 commits into
OpenBankProject:developfrom
hongwei1:refactor/migrateUKstandard
May 29, 2026
Merged

Refactor/migrate ukstandard#2817
simonredfern merged 15 commits into
OpenBankProject:developfrom
hongwei1:refactor/migrateUKstandard

Conversation

@hongwei1
Copy link
Copy Markdown
Contributor

No description provided.

hongwei1 added 15 commits May 28, 2026 12:10
- Add Http4sUKOBv200AIS: migrate getAccountList, getAccount, getBalances
  from Lift to http4s using withUser + getBankAccounts + JSONFactory_UKOpenBanking_200.
  Complex endpoints (getAccountBalances, getAccountTransactions) retain Lift
  fall-through pending further migration.

- Add Http4sUKOBv200 aggregator and wire ukV20Routes into Http4sApp.baseServices
  (after Berlin Group, before Lift bridge).

- Add 16 Http4sUKOBv310* stub files covering all PIS/PIIS/AIS payment categories:
  Products, Beneficiaries, DirectDebits, Offers, Partys, ScheduledPayments,
  StandingOrders, Statements, DomesticPayments, DomesticScheduledPayments,
  DomesticStandingOrders, FilePayments, FundsConfirmations, InternationalPayments,
  InternationalScheduledPayments, InternationalStandingOrders.
  Each stub uses withUser (→ 401 when unauthenticated, 200 with NotImplemented
  marker when authenticated). DELETE /funds-confirmation-consents uses withUserDelete
  (→ 204) to match Lift's HttpCode.`204` baseline.

- Add Http4sUKOBv310 aggregator and wire ukV31Routes into Http4sApp.baseServices.

- Each endpoint's resourceDocs += is placed immediately after its lazy val
  definition (no initDocs() grouping method).

- Add UKOpenBankingV310ServerSetup, UKOpenBankingV310AisTests,
  UKOpenBankingV310PisTests covering all 67 endpoints × (authed + unauthed).
  Expand UKOpenBankingV200Tests with getAccount and 401 scenarios.

- Routes use depth-first ordering within each file to prevent shallow wildcard
  patterns from swallowing deeper paths (e.g. statements/{id}/file before
  statements/{id}).
…ggregators

- Comment out all 16 stub-category *Api.scala files in v3.1.0 (Products,
  Beneficiaries, DirectDebits, Offers, Partys, ScheduledPayments,
  StandingOrders, Statements, DomesticPayments, DomesticScheduledPayments,
  DomesticStandingOrders, FilePayments, FundsConfirmations,
  InternationalPayments, InternationalScheduledPayments,
  InternationalStandingOrders) — their routes are now served by the
  corresponding Http4sUKOBv310* objects wired in Http4sApp.
- Comment out APIMethods_UKOpenBanking_200.scala — migrated to Http4sUKOBv200AIS.
- Slim OBP_UKOpenBanking_200: allResourceDocs → Http4sUKOBv200.resourceDocs,
  routes = Nil.
- Slim OBP_UKOpenBanking_310: retains only the 4 genuine Lift categories
  (AccountAccess, Accounts, Balances, Transactions) until their http4s
  counterparts are ready; allResourceDocs = Http4sUKOBv310.resourceDocs ++
  genuineResourceDocs.
…ss, Accounts, Balances, Transactions) to http4s

- Add Http4sUKOBv310AccountAccess (3 endpoints: POST/DELETE/GET consent)
- Add Http4sUKOBv310Accounts (2 endpoints: GET /accounts, GET /accounts/{id})
- Add Http4sUKOBv310Balances (2 endpoints: GET /accounts/{id}/balances, GET /balances)
- Add Http4sUKOBv310Transactions (3 endpoints: stub + real GET transactions + bulk GET)
- Update Http4sUKOBv310 aggregator to wire in all 4 new objects
- Comment out Lift source files (AccountAccessApi, AccountsApi, BalancesApi, TransactionsApi)
- Simplify OBP_UKOpenBanking_310 to routes=Nil, allResourceDocs from Http4sUKOBv310 only

All UK Open Banking v3.1 endpoints now served by http4s ahead of the Lift bridge.
…xample bodies from Lift source

All Http4sUKOBv310* stub and genuine endpoint files now carry the original
JSON example bodies that were present in the Lift *Api.scala source files.
Previously every ResourceDoc used EmptyBody for both request and response;
now the response bodies are restored verbatim from the commented-out Lift
definitions, keeping Swagger/resource-docs output consistent with the
original Lift API surface.
…ankingV20/V31

UK Open Banking versions are ScannedApiVersion instances. Without explicit
cases in the activeResourceDocs match, they fall through to case _ which
filters by versionRoutesClasses — but since OBP_UKOpenBanking_*00.routes
is now Nil (all endpoints served by http4s), versionRoutesClasses is empty
and all resource docs are filtered out. Add explicit pass-through cases
mirroring the Berlin Group pattern.
- Add parseBody helper (String -> JObject) to each file: ResourceDoc body
  args require scala.Product; json.parse returns abstract JValue which does
  not satisfy Product; JObject (a case class) does
- Replace json.parse(""" with parseBody(""" in all ResourceDoc and stub
  handler usages across all 20 Http4sUKOBv310* files
- Fix attemptedToOpenAnEmptyBox import in Accounts (ErrorMessages, not APIUtil)
- Remove deprecated val keyword from for-comprehension in AccountAccess
…y refactor

- Fix net.liftweb.parseBody -> parseBody in AccountAccess and Accounts
  (Python regex was replacing json.parse inside net.liftweb.json.parse,
   producing net.liftweb.parseBody — fixed by running fully-qualified
   replacement first)
- Transactions: fix HTTPParam import (provider.HTTPParam, not http.HTTPParam)
- Transactions: add BankAccountExtended import; wrap account and bankAccount
  with BankAccountExtended to call getModeratedTransactionsFuture /
  getModeratedTransactions (methods defined on code.model, not commons.model)
- Transactions: cast u to MappedUser for checkOwnerViewAccessAndReturnOwnerView
- Transactions: fix HTTPParam constructor (values: List[String])
- Fix missing commas in JSON example bodies (Accounts, Transactions)
- Replace non-existent code.model.User alias with code.model.UserExtended
- Remove erroneous trailing .map{unboxFull(_)} calls after fullBoxOrException
  (fullBoxOrException already extracts T from Box[T], leaving no Box to unbox)
- Rewrite getTransactions inner for-comp: wrap Box for-comp in Future{} block
  and drop getTransactionRequests210 Future call to eliminate Box/Future mixing;
  pass Nil for transactionRequests (mirrors Lift mock behaviour for bulk endpoint)
- Remove unused imports: Connector, unboxFull
…tions

fullBoxOrException returns Box[T] (it throws on non-Full, but the return
type remains Box[T]). unboxFull is needed to extract T for use as
List[OBPQueryParam] and (List[ModeratedTransaction], Option[CallContext]).
ScannedApis trait declares apiVersion as ScannedApiVersion; override must
use the same type (not the wider ApiVersion) to satisfy Scala type-checking.
…s docs

APIMethods_AccountAccessApi (Lift) has been commented out as part of the
Lift -> http4s migration. Replace usage with Http4sUKOBv310AccountAccess
and apply the same direct-prop-filter pattern already used for Http4s400.
v2.0.0:
- Add getAccountBalances (GET /accounts/ACCOUNT_ID/balances) using
  BankAccountExtended.moderatedBankAccount + ViewNewStyle owner view check
- Add getAccountTransactions (GET /accounts/ACCOUNT_ID/transactions) using
  BankAccountExtended.getModeratedTransactions; passes Nil for transactionRequests

v3.1.0:
- Change createAccountAccessConsents from executeFutureWithBodyCreated to
  withUserAndBodyCreated so that unauthenticated requests return 401 before
  body parsing — mirrors Lift's wrappedWithAuthCheck enforcing
  AuthenticatedUserIsRequired
…rn 401 for unauthenticated requests

withUserAndBodyCreated parses body before checking auth, causing unauthenticated
requests with an empty/invalid body to return 400 instead of 401. Switch to
executeFutureCreated with an explicit user check first (matching Lift's
wrappedWithAuthCheck order: auth → body parse → business logic).
All UK Open Banking endpoints (v2.0: 5, v3.1: ~67 across 20 categories) are fully
migrated to http4s and the Lift ScannedApis aggregators register routes = Nil, so
Lift serves no UK path. Several file/class header comments still claimed endpoints
fall through to the Lift bridge (v2.0 account-scoped balances/transactions, v3.1
unmatched routes) and mislabelled the v3.1 coverage as '16 stub categories'. These
comments are now corrected to reflect the actual state. Comment-only change; no
runtime behaviour is affected.
@sonarqubecloud
Copy link
Copy Markdown

constantine2nd added a commit to constantine2nd/OBP-API that referenced this pull request May 29, 2026
…oints to native http4s

# Conflicts:
#	obp-api/src/main/scala/code/api/util/http4s/Http4sApp.scala
constantine2nd added a commit to constantine2nd/OBP-API that referenced this pull request May 29, 2026
@hongwei1 hongwei1 changed the title Refactor/migrate u kstandard Refactor/migrate ukstandard May 29, 2026
@simonredfern simonredfern merged commit 58e42da into OpenBankProject:develop May 29, 2026
7 checks passed
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.

2 participants