Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
8039973
docfix/code clean
hongwei1 Apr 14, 2026
603b2f9
refactor/remove idempotency_key from trading endpoints - use auto-gen…
hongwei1 Apr 15, 2026
2e84cf9
feature/add trading domain models, JSON models, error messages and AP…
hongwei1 Apr 15, 2026
21a548c
feature/add GET trading offers list endpoint with filtering support
hongwei1 Apr 15, 2026
3432b6a
feature/add market domain models and connector methods for Phase 2
hongwei1 Apr 15, 2026
0a75e5d
feature/add market JSON models error messages and API tag for Phase 2
hongwei1 Apr 15, 2026
1a77230
feature/implement 8 market endpoints for OBP Trading v7.0.0
hongwei1 Apr 15, 2026
6271cc4
refactor/remove idempotency_key field and use order_id UUID pattern f…
hongwei1 Apr 16, 2026
7322b98
feature/implement update trading offer endpoint to complete P1
hongwei1 Apr 16, 2026
ab6a253
refactor/align Market Order endpoints with OBP convention using full …
hongwei1 Apr 16, 2026
a3fa43b
feature/add userId and consentId audit fields to all trading and mark…
hongwei1 Apr 16, 2026
f1f3383
fix/add audit fields to ResourceDoc examples in all 13 trading endpoints
hongwei1 Apr 16, 2026
dda8e2c
feature/add blockchain tracking fields to Deposit and Withdrawal mode…
hongwei1 Apr 16, 2026
947f630
feature/implement TCC payment authorization with PaymentAuth model an…
hongwei1 Apr 16, 2026
7942d8a
Merge branch 'obp-develop' into develop-Simon
hongwei1 Apr 21, 2026
ac0d6f5
Merge remote-tracking branch 'OBP/develop' into develop
hongwei1 Apr 22, 2026
ff92d4b
docfix/add work in progress warning to trading endpoints
hongwei1 Apr 24, 2026
6fe146f
refactor/commented the TCC endpoints
hongwei1 Apr 24, 2026
fc2a566
refactor/commented the notifyDeposit endpoint
hongwei1 Apr 24, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
446 changes: 0 additions & 446 deletions .postman.json

This file was deleted.

30 changes: 0 additions & 30 deletions .postman_environment.json

This file was deleted.

83 changes: 0 additions & 83 deletions .postman_simple.json

This file was deleted.

2 changes: 2 additions & 0 deletions obp-api/src/main/scala/code/api/util/ApiTag.scala
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ object ApiTag {
val apiTagSystem = ResourceDocTag("System")
val apiTagCache = ResourceDocTag("Cache")
val apiTagLogCache = ResourceDocTag("Log-Cache")
val apiTagTrading = ResourceDocTag("Trading")
val apiTagMarket = ResourceDocTag("Market")

val apiTagApiCollection = ResourceDocTag("Api-Collection")

Expand Down
21 changes: 21 additions & 0 deletions obp-api/src/main/scala/code/api/util/ErrorMessages.scala
Original file line number Diff line number Diff line change
Expand Up @@ -850,6 +850,27 @@ object ErrorMessages {
val MethodRoutingNotFoundByMethodRoutingId = "OBP-70002: MethodRouting not found. Please specify a valid value for method_routing_id."
val MethodRoutingAlreadyExistsError = "OBP-70003: Method Routing is already exists."

// Trading Exceptions (OBP-71XXX)
val OfferNotFound = "OBP-71001: Trading offer not found."
val InvalidOfferType = "OBP-71002: Invalid offer type. Must be 'BUY' or 'SELL'."
val InvalidTradingAmount = "OBP-71003: Invalid amount. Must be a positive number."
val CreateTradingOfferError = "OBP-71005: Could not create trading offer."

// Market Trading Exceptions (OBP-72XXX)
val OrderNotFound = "OBP-72001: Market order not found."
val InvalidOrderSide = "OBP-72002: Invalid order side. Must be 'BUY' or 'SELL'."
val TradeNotFound = "OBP-72003: Market trade not found."
val InvalidMatchParameters = "OBP-72004: Invalid match parameters."
val SettlementFailed = "OBP-72005: Settlement request failed."
val WithdrawalFailed = "OBP-72006: Withdrawal request failed."

// TCC Payment Authorization Exceptions (OBP-73XXX)
val PaymentAuthNotFound = "OBP-73001: Payment authorization not found."
val InvalidPaymentAuthState = "OBP-73002: Invalid payment authorization state transition."
val PaymentAuthAlreadyCaptured = "OBP-73003: Payment authorization has already been captured."
val PaymentAuthAlreadyReleased = "OBP-73004: Payment authorization has already been released."
val CreatePaymentAuthError = "OBP-73005: Could not create payment authorization."

// Cascade Deletion Exceptions (OBP-8XXXX)
val CouldNotDeleteCascade = "OBP-80001: Could not delete cascade."
val CannotDeleteCascadePersonalEntity = "OBP-80002: Cannot delete cascade for personal entities (hasPersonalEntity=true). Please delete the records and definition separately."
Expand Down
231 changes: 231 additions & 0 deletions obp-api/src/main/scala/code/api/util/NewStyle.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4563,6 +4563,237 @@
) map {
i => (unboxFullOrFail(i._1, callContext, s"$DeleteCounterpartyLimitError"), i._2)
}

// Trading Methods
def createTradingOffer(
bankId: BankId,
accountId: AccountId,
offerType: String,
assetCode: String,
assetAmount: BigDecimal,
priceCurrency: String,
priceAmount: BigDecimal,
settlementAccountId: String,
callContext: Option[CallContext]
): OBPReturnType[com.openbankproject.commons.model.TradingOffer] = {
Connector.connector.vend.createTradingOffer(
bankId, accountId, offerType, assetCode, assetAmount,
priceCurrency, priceAmount, settlementAccountId, callContext
) map {
i => (unboxFullOrFail(i._1, callContext, s"$OfferNotFound"), i._2)
}
}

def getTradingOffer(
offerId: String,
callContext: Option[CallContext]
): OBPReturnType[com.openbankproject.commons.model.TradingOffer] = {
Connector.connector.vend.getTradingOffer(offerId, callContext) map {
i => (unboxFullOrFail(i._1, callContext, s"$OfferNotFound"), i._2)
}
}

def cancelTradingOffer(
offerId: String,
callContext: Option[CallContext]
): OBPReturnType[com.openbankproject.commons.model.TradingOffer] = {
Connector.connector.vend.cancelTradingOffer(offerId, callContext) map {
i => (unboxFullOrFail(i._1, callContext, s"$OfferNotFound"), i._2)
}
}

def updateTradingOffer(
offerId: String,
priceAmount: Option[BigDecimal],
expiryDatetime: Option[Date],
minimumFill: Option[BigDecimal],
callContext: Option[CallContext]
): OBPReturnType[com.openbankproject.commons.model.TradingOffer] = {
Connector.connector.vend.updateTradingOffer(offerId, priceAmount, expiryDatetime, minimumFill, callContext) map {
i => (unboxFullOrFail(i._1, callContext, s"$OfferNotFound"), i._2)
}
}

def getTradingOffers(
bankId: BankId,
accountId: AccountId,
status: Option[String],
offerType: Option[String],
callContext: Option[CallContext]
): OBPReturnType[List[com.openbankproject.commons.model.TradingOffer]] = {
Connector.connector.vend.getTradingOffers(bankId, accountId, status, offerType, callContext) map {
i => (unboxFullOrFail(i._1, callContext, s"$BankAccountNotFound"), i._2)
}
}

// Market Methods
def createMarketOrder(
bankId: BankId,
accountId: AccountId,
side: String,
price: BigDecimal,
quantity: BigDecimal,
settlementAccountId: String,
callContext: Option[CallContext]
): OBPReturnType[com.openbankproject.commons.model.MarketOrder] = {
Connector.connector.vend.createMarketOrder(
bankId, accountId, side, price, quantity, settlementAccountId, callContext
) map {
i => (unboxFullOrFail(i._1, callContext, s"$OrderNotFound"), i._2)
}
}

def getMarketOrder(
bankId: BankId,
accountId: AccountId,
orderId: String,
callContext: Option[CallContext]
): OBPReturnType[com.openbankproject.commons.model.MarketOrder] = {
Connector.connector.vend.getMarketOrder(bankId, accountId, orderId, callContext) map {
i => (unboxFullOrFail(i._1, callContext, s"$OrderNotFound"), i._2)
}
}

def cancelMarketOrder(
bankId: BankId,
accountId: AccountId,
orderId: String,
callContext: Option[CallContext]
): OBPReturnType[com.openbankproject.commons.model.MarketOrder] = {
Connector.connector.vend.cancelMarketOrder(bankId, accountId, orderId, callContext) map {
i => (unboxFullOrFail(i._1, callContext, s"$OrderNotFound"), i._2)
}
}

def createMarketMatch(
bankId: BankId,
accountId: AccountId,
orderId: String,
counterOrderId: String,
amount: BigDecimal,
price: BigDecimal,
callContext: Option[CallContext]
): OBPReturnType[com.openbankproject.commons.model.MarketMatch] = {
Connector.connector.vend.createMarketMatch(
bankId, accountId, orderId, counterOrderId, amount, price, callContext
) map {
i => (unboxFullOrFail(i._1, callContext, s"$InvalidMatchParameters"), i._2)
}
}

def getMarketTrade(
bankId: BankId,
accountId: AccountId,
tradeId: String,
callContext: Option[CallContext]
): OBPReturnType[com.openbankproject.commons.model.MarketTrade] = {
Connector.connector.vend.getMarketTrade(bankId, accountId, tradeId, callContext) map {
i => (unboxFullOrFail(i._1, callContext, s"$TradeNotFound"), i._2)
}
}

def requestSettlement(
bankId: BankId,
accountId: AccountId,
tradeId: String,
step: Option[String],
callContext: Option[CallContext]
): OBPReturnType[com.openbankproject.commons.model.Settlement] = {
Connector.connector.vend.requestSettlement(bankId, accountId, tradeId, step, callContext) map {
i => (unboxFullOrFail(i._1, callContext, s"$SettlementFailed"), i._2)
}
}

def notifyDeposit(

Check warning on line 4707 in obp-api/src/main/scala/code/api/util/NewStyle.scala

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

This function has 9 parameters, which is greater than the 7 authorized.

See more on https://sonarcloud.io/project/issues?id=OpenBankProject_OBP-API&issues=AZ2-1w0HRuvhNyq5FgWi&open=AZ2-1w0HRuvhNyq5FgWi&pullRequest=2768
bankId: BankId,
accountId: AccountId,
txHash: String,
from: String,
to: String,
amount: BigDecimal,
confirmations: Int,
requiredConfirmations: Int,
callContext: Option[CallContext]
): OBPReturnType[com.openbankproject.commons.model.Deposit] = {
Connector.connector.vend.notifyDeposit(
bankId, accountId, txHash, from, to, amount, confirmations, requiredConfirmations, callContext
) map {
i => (unboxFullOrFail(i._1, callContext, s"$InvalidTradingAmount"), i._2)
}
}

def requestWithdrawal(
bankId: BankId,
accountId: AccountId,
settlementAccountId: String,
amount: BigDecimal,
address: String,
requiredConfirmations: Int,
callContext: Option[CallContext]
): OBPReturnType[com.openbankproject.commons.model.Withdrawal] = {
Connector.connector.vend.requestWithdrawal(
bankId, accountId, settlementAccountId, amount, address, requiredConfirmations, callContext
) map {
i => (unboxFullOrFail(i._1, callContext, s"$WithdrawalFailed"), i._2)
}
}

// TCC Payment Authorization NewStyle Wrappers
def createPaymentAuth(
bankId: BankId,
accountId: AccountId,
tradeId: String,
buyerAccountId: String,
sellerAccountId: String,
amountFiat: BigDecimal,
currency: String,
callContext: Option[CallContext]
): OBPReturnType[com.openbankproject.commons.model.PaymentAuth] = {
Connector.connector.vend.createPaymentAuth(
bankId, accountId, tradeId, buyerAccountId, sellerAccountId, amountFiat, currency, callContext
) map {
i => (unboxFullOrFail(i._1, callContext, s"$CreatePaymentAuthError"), i._2)
}
}

def capturePaymentAuth(
bankId: BankId,
accountId: AccountId,
authId: String,
callContext: Option[CallContext]
): OBPReturnType[com.openbankproject.commons.model.PaymentAuth] = {
Connector.connector.vend.capturePaymentAuth(
bankId, accountId, authId, callContext
) map {
i => (unboxFullOrFail(i._1, callContext, s"$InvalidPaymentAuthState"), i._2)
}
}

def releasePaymentAuth(
bankId: BankId,
accountId: AccountId,
authId: String,
callContext: Option[CallContext]
): OBPReturnType[com.openbankproject.commons.model.PaymentAuth] = {
Connector.connector.vend.releasePaymentAuth(
bankId, accountId, authId, callContext
) map {
i => (unboxFullOrFail(i._1, callContext, s"$InvalidPaymentAuthState"), i._2)
}
}

def getPaymentAuth(
bankId: BankId,
accountId: AccountId,
authId: String,
callContext: Option[CallContext]
): OBPReturnType[com.openbankproject.commons.model.PaymentAuth] = {
Connector.connector.vend.getPaymentAuth(
bankId, accountId, authId, callContext
) map {
i => (unboxFullOrFail(i._1, callContext, s"$PaymentAuthNotFound"), i._2)
}
}
}

}
Loading
Loading