Bike orders and contracts
Period 2026 · Major API integration in June / business portal in July
- Role
- I built the frontend for staff Admin and the business portal, aligning API contracts with the backend team, which handled legacy data migration.
- Result
- Built staff flows for first orders and sending contracts, plus business-customer lookup for contracts and payments.
Context
Bike orders, contracts, and handovers involved both staff and business customers. Legacy tools and manual work remained in use while the new system was built.
Key decisions
Separate staff work from customer lookup
Staff could create first orders and send contracts in Admin. Business customers could use the portal to view contracts, subscription plans, and unpaid and paid amounts.
Check workflows before APIs were finalized
I checked return, handover, and insurance-change screens with nonproduction fixtures first. After the API contracts were available, I connected the vehicle, store, and insurance screens and adjusted legacy field representations.
Handle user types and response shapes
Business customers shared a user model with regular users, so I kept ordinary SWAP use available while separating business-only menus, pages, and APIs. When a B2C response lacked the business-information object, I coordinated a backend response fix and updated the frontend conditions.
Implementation details
View implementation flow
In Admin, I developed screens separately from APIs that were still undefined. Later, in the business portal, I sequenced data lookups after authentication, access checks, and store selection. I handled changes in user type and response shape explicitly.
Authentication ready
Restore saved auth state and complete initialization
Read every stage
- 01Authentication ready
Restore saved auth state and complete initialization
- 02Access check
Fetch store access summary and list
- 03Store selection
Fetch details and subscriptions with an ID from the list
- 04Refresh after change
Apply payment results and refetch billing
Fixtures and response contracts
Before the APIs were defined, I checked return, handover, and insurance-change screens with nonproduction fixtures. In the real integration, I incorporated the discriminator in the shared user model. In particular, I found B2C responses where the business-information object itself was absent, and worked with the backend to correct the response contract while updating UI conditions and test cases.
Requests after access checks
After restoring auth state from Zustand and completing initialization, the portal checked the access summary, then fetched the store list and selected store details in sequence. Null SWR keys deferred requests until their conditions were met. Sign-in required, access denied, and lookup error appeared as separate entry states.
Selection state and payment results
The store was chosen from the URL, saved selection, then single-store default, in that order; only IDs present in the list were used for detail lookups. After payment, only successful items were applied to the SWR cache and the billing list was refetched. Partial failure, complete failure, and request exceptions each received separate guidance.
One-time authentication return
When payment-method registration began, the portal saved the return location in sessionStorage and opened authentication through the app bridge. The result screen read and deleted the saved value, then navigated only if it was a same-origin portal path. Without a valid return location, the flow continued to the existing payment-method screen.
Verification
- B2B and B2C screen checks
- I checked both user types with Playwright E2E and direct screen inspection, then repeated both after the response and UI fixes.
- Portal flow
- By July 2026, I had connected the flow for business customers to view subscription and payment status and return after payment-method handling.