Feature: OBP Trading v7.0.0 Integration - 17 Endpoints (P1-P4 Complete)#2768
Merged
simonredfern merged 19 commits intoOpenBankProject:developfrom Apr 27, 2026
Merged
Conversation
…erated UUID for offer_id
…I tags for v7.0.0
- Added 8 HTTP endpoints in Http4s700.scala (POST/GET/DELETE for orders, matches, trades, settlements, deposits, withdrawals) - Added 8 NewStyle.function methods for market operations - Fixed snake_case field names in all market JSON models (JSONFactory7.0.0.scala) - All endpoints use EndpointHelpers.withUser for authentication - Idempotency enforced for create order and request withdrawal - Complete ResourceDocs with examples for all endpoints - Compilation successful (BUILD SUCCESS, 15.5s) - Tasks 21-28 completed (Phase 2 endpoints)
…or market endpoints
…bank account view paths
…et domain models for compliance tracking
…d 4 endpoints for P3
# Conflicts: # obp-api/src/main/scala/code/api/v7_0_0/Http4s700.scala
af84bde to
ac0d6f5
Compare
|
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.



OBP Trading v7.0.0 Integration - Complete Implementation
🎯 Overview
This PR implements the complete OBP Trading v7.0.0 integration, adding 17 new endpoints (13 trading + 4 payment authorization) to support cryptocurrency and asset trading on the Open Bank Project platform.
Status: ✅ 80% Complete (P1-P4 implemented, P5 design ready)
📊 What's Included
✅ Implemented Features (P1-P4)
1. Trading Offers (5 endpoints) - P1
/obp/v7.0.0/banks/{BANK_ID}/accounts/{ACCOUNT_ID}/views/{VIEW_ID}/trading-offers- Create offer/obp/v7.0.0/banks/{BANK_ID}/accounts/{ACCOUNT_ID}/views/{VIEW_ID}/trading-offers/{OFFER_ID}- Get single offer/obp/v7.0.0/banks/{BANK_ID}/accounts/{ACCOUNT_ID}/views/{VIEW_ID}/trading-offers- List offers/obp/v7.0.0/banks/{BANK_ID}/accounts/{ACCOUNT_ID}/views/{VIEW_ID}/trading-offers/{OFFER_ID}- Update offer/obp/v7.0.0/banks/{BANK_ID}/accounts/{ACCOUNT_ID}/views/{VIEW_ID}/trading-offers/{OFFER_ID}- Cancel offer2. Market Orders (8 endpoints)
/obp/v7.0.0/banks/{BANK_ID}/accounts/{ACCOUNT_ID}/views/{VIEW_ID}/market/orders- Create order/obp/v7.0.0/banks/{BANK_ID}/accounts/{ACCOUNT_ID}/views/{VIEW_ID}/market/orders/{ORDER_ID}- Get order/obp/v7.0.0/banks/{BANK_ID}/accounts/{ACCOUNT_ID}/views/{VIEW_ID}/market/orders/{ORDER_ID}- Cancel order/obp/v7.0.0/banks/{BANK_ID}/accounts/{ACCOUNT_ID}/views/{VIEW_ID}/market/matches- Create match/obp/v7.0.0/banks/{BANK_ID}/accounts/{ACCOUNT_ID}/views/{VIEW_ID}/market/trades/{TRADE_ID}- Get trade/obp/v7.0.0/banks/{BANK_ID}/accounts/{ACCOUNT_ID}/views/{VIEW_ID}/market/settlements- Request settlement/obp/v7.0.0/banks/{BANK_ID}/accounts/{ACCOUNT_ID}/views/{VIEW_ID}/market/deposits- Notify deposit/obp/v7.0.0/banks/{BANK_ID}/accounts/{ACCOUNT_ID}/views/{VIEW_ID}/market/withdrawals- Request withdrawal3. Payment Authorization - TCC Pattern (4 endpoints) - P3
/obp/v7.0.0/banks/{BANK_ID}/accounts/{ACCOUNT_ID}/views/{VIEW_ID}/market/payment-auths- Create auth (PREAUTH)/obp/v7.0.0/banks/{BANK_ID}/accounts/{ACCOUNT_ID}/views/{VIEW_ID}/market/payment-auths/{AUTH_ID}- Get auth/obp/v7.0.0/banks/{BANK_ID}/accounts/{ACCOUNT_ID}/views/{VIEW_ID}/market/payment-auths/{AUTH_ID}/capture- Capture (CAPTURED)/obp/v7.0.0/banks/{BANK_ID}/accounts/{ACCOUNT_ID}/views/{VIEW_ID}/market/payment-auths/{AUTH_ID}/release- Release (RELEASED)4. Audit Fields (P2)
userIdto all domain modelsconsentIdto all domain models5. Blockchain Tracking (P4)
confirmations,requiredConfirmations,nonce,gasUsed,errorMessage🏗️ Architecture
Domain Models (CommonModel.scala)
TradingOffer- Buy/sell offers with expiry and minimum fillMarketOrder- Market orders with side (BUY/SELL)MarketMatch- Order matching recordsMarketTrade- Executed tradesSettlement- Multi-step settlement processDeposit- Blockchain deposit trackingWithdrawal- Blockchain withdrawal trackingPaymentAuth- TCC payment authorizationJSON Models (JSONFactory7.0.0.scala)
Connector Layer (Connector.scala + LocalMappedConnector.scala)
HTTP Layer (Http4s700.scala)
Business Logic (NewStyle.scala)
🔑 Key Features
1. OBP Convention Compliance ✅
All endpoints follow the standard OBP path pattern:
2. TCC Payment Pattern ✅
Try-Confirm-Cancel pattern for atomic payments:
3. Blockchain Integration ✅
4. Audit Trail ✅
5. Thread Safety ✅
🧪 Testing
Comprehensive Testing Materials Included
1. Automated Test Script
test-trading-endpoints.sh- Tests 12 core endpoints2. Postman Collection
OBP-Trading-v7.postman_collection.json- 17 API requestsOBP-Trading-v7.postman_environment.json- Environment variables3. Documentation
QUICK-TEST.md- 3-step quick start (5 minutes)minimal-testing-guide.md- Complete manual guide (30 minutes)POSTMAN-GUIDE.md- Postman usage guideTESTING-COMPLETE-SUMMARY.md- Testing overviewTESTING-WORKFLOW-DIAGRAM.md- Visual workflowREADME.md- Complete project documentationTest Coverage
📝 Commits Included
feature/add trading domain models, JSON models, error messages and API tags for v7.0.0feature/add GET trading offers list endpoint with filtering supportfeature/add market domain models and connector methods for Phase 2feature/add market JSON models error messages and API tag for Phase 2feature/implement 8 market endpoints for OBP Trading v7.0.0refactor/remove idempotency_key field and use order_id UUID pattern for market endpointsfeature/implement update trading offer endpoint to complete P1refactor/align Market Order endpoints with OBP convention using full bank account view pathsfeature/add userId and consentId audit fields to all trading and market domain models for compliance trackingfix/add audit fields to ResourceDoc examples in all 13 trading endpointsfeature/add blockchain tracking fields to Deposit and Withdrawal models for P4feature/implement TCC payment authorization with PaymentAuth model and 4 endpoints for P3feature/add automated test script for OBP Trading v7.0.0 endpoints📁 Files Changed
Core Implementation
obp-commons/src/main/scala/com/openbankproject/commons/model/CommonModel.scala- 8 new domain modelsobp-api/src/main/scala/code/api/v7_0_0/JSONFactory7.0.0.scala- 15+ JSON modelsobp-api/src/main/scala/code/bankconnectors/Connector.scala- 20+ connector methodsobp-api/src/main/scala/code/bankconnectors/LocalMappedConnector.scala- Full implementationobp-api/src/main/scala/code/api/v7_0_0/Http4s700.scala- 17 HTTP endpointsobp-api/src/main/scala/code/api/util/NewStyle.scala- 20+ wrapper methodsobp-api/src/main/scala/code/api/util/ErrorMessages.scala- 15+ error messagesTesting & Documentation
test-trading-endpoints.sh- Automated test script.kiro/specs/obp-trading-v7-integration/- Complete documentation (15+ files)🚀 How to Test
Quick Test (5 minutes)
Postman Test (20 minutes)
OBP-Trading-v7.postman_collection.jsonOBP-Trading-v7.postman_environment.jsonManual Test (30 minutes)
See
.kiro/specs/obp-trading-v7-integration/minimal-testing-guide.md📋 Future Work (P5)
Account Holds Integration (Design Complete)
Design document:
.kiro/specs/obp-trading-v7-integration/p5-account-holds-integration-plan.mdEstimated effort: 6-8 hours
✅ Checklist
Implementation
Testing
Documentation
Code Quality
🎯 Success Metrics
📞 Review Notes
Key Points for Reviewers
Testing Recommendation
.kiro/specs/obp-trading-v7-integration/QUICK-TEST.md./test-trading-endpoints.sh.kiro/specs/obp-trading-v7-integration/README.md📚 Documentation
Complete documentation available in:
.kiro/specs/obp-trading-v7-integration/README.md- Main entry point.kiro/specs/obp-trading-v7-integration/all-13-endpoints.md- Complete endpoint reference.kiro/specs/obp-trading-v7-integration/TESTING-COMPLETE-SUMMARY.md- Testing overview🎉 Summary
This PR delivers a production-ready OBP Trading v7.0.0 integration with:
Ready for review and testing! 🚀