Skip to content

Commit fc2a566

Browse files
committed
refactor/commented the notifyDeposit endpoint
1 parent 6fe146f commit fc2a566

1 file changed

Lines changed: 76 additions & 76 deletions

File tree

obp-api/src/main/scala/code/api/v7_0_0/Http4s700.scala

Lines changed: 76 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -1479,82 +1479,82 @@ object Http4s700 {
14791479
)
14801480

14811481
// Route: POST /obp/v7.0.0/banks/BANK_ID/accounts/ACCOUNT_ID/views/VIEW_ID/market/deposits
1482-
val notifyDeposit: HttpRoutes[IO] = HttpRoutes.of[IO] {
1483-
case req @ POST -> `prefixPath` / "banks" / bankId / "accounts" / accountId / "views" / viewId / "market" / "deposits" =>
1484-
EndpointHelpers.withUserAndBodyCreated[JSONFactory700.NotifyDepositJson, JSONFactory700.DepositJson](req) { (user, depositJson, cc) =>
1485-
for {
1486-
// Validate bank and account
1487-
(_, callContext) <- NewStyle.function.getBankAccount(BankId(bankId), AccountId(accountId), Some(cc))
1488-
1489-
// Validate amount
1490-
_ <- Helper.booleanToFuture(
1491-
failMsg = InvalidTradingAmount,
1492-
failCode = 400,
1493-
cc = callContext
1494-
)(depositJson.amount > 0)
1495-
1496-
// Validate confirmations
1497-
_ <- Helper.booleanToFuture(
1498-
failMsg = InvalidMatchParameters,
1499-
failCode = 400,
1500-
cc = callContext
1501-
)(depositJson.confirmations >= 0)
1502-
1503-
// Invoke connector
1504-
(deposit, callContext2) <- NewStyle.function.notifyDeposit(
1505-
BankId(bankId),
1506-
AccountId(accountId),
1507-
depositJson.tx_hash,
1508-
depositJson.from,
1509-
depositJson.to,
1510-
depositJson.amount,
1511-
depositJson.confirmations,
1512-
12, // Ethereum mainnet standard: 12 confirmations required
1513-
callContext
1514-
)
1515-
} yield JSONFactory700.createDepositJson(deposit)
1516-
}
1517-
}
1518-
1519-
resourceDocs += ResourceDoc(
1520-
null,
1521-
implementedInApiVersion,
1522-
nameOf(notifyDeposit),
1523-
"POST",
1524-
"/banks/BANK_ID/accounts/ACCOUNT_ID/views/VIEW_ID/market/deposits",
1525-
"Notify Deposit",
1526-
"""**WORK IN PROGRESS**
1527-
|
1528-
|Record a blockchain deposit notification.
1529-
|
1530-
|Authentication is required.""",
1531-
JSONFactory700.NotifyDepositJson(
1532-
tx_hash = "0x123abc",
1533-
from = "0xsender",
1534-
to = "0xreceiver",
1535-
amount = BigDecimal("100.0"),
1536-
confirmations = 6
1537-
),
1538-
JSONFactory700.DepositJson(
1539-
deposit_id = "deposit-202",
1540-
tx_hash = "0x123abc",
1541-
from = "0xsender",
1542-
to = "0xreceiver",
1543-
amount = BigDecimal("100.0"),
1544-
confirmations = 6,
1545-
required_confirmations = 12,
1546-
status = "pending",
1547-
nonce = Some(123456L),
1548-
gas_used = Some(21000L),
1549-
error_message = None,
1550-
user_id = "user-abc-123",
1551-
consent_id = None,
1552-
created_at = "2026-04-16T00:50:00Z"
1553-
),
1554-
List(InvalidJsonFormat, InvalidTradingAmount, InvalidMatchParameters, $AuthenticatedUserIsRequired, $BankNotFound, $BankAccountNotFound, UnknownError),
1555-
apiTagMarket :: Nil,
1556-
http4sPartialFunction = Some(notifyDeposit)
1557-
)
1482+
// val notifyDeposit: HttpRoutes[IO] = HttpRoutes.of[IO] {
1483+
// case req @ POST -> `prefixPath` / "banks" / bankId / "accounts" / accountId / "views" / viewId / "market" / "deposits" =>
1484+
// EndpointHelpers.withUserAndBodyCreated[JSONFactory700.NotifyDepositJson, JSONFactory700.DepositJson](req) { (user, depositJson, cc) =>
1485+
// for {
1486+
// // Validate bank and account
1487+
// (_, callContext) <- NewStyle.function.getBankAccount(BankId(bankId), AccountId(accountId), Some(cc))
1488+
//
1489+
// // Validate amount
1490+
// _ <- Helper.booleanToFuture(
1491+
// failMsg = InvalidTradingAmount,
1492+
// failCode = 400,
1493+
// cc = callContext
1494+
// )(depositJson.amount > 0)
1495+
//
1496+
// // Validate confirmations
1497+
// _ <- Helper.booleanToFuture(
1498+
// failMsg = InvalidMatchParameters,
1499+
// failCode = 400,
1500+
// cc = callContext
1501+
// )(depositJson.confirmations >= 0)
1502+
//
1503+
// // Invoke connector
1504+
// (deposit, callContext2) <- NewStyle.function.notifyDeposit(
1505+
// BankId(bankId),
1506+
// AccountId(accountId),
1507+
// depositJson.tx_hash,
1508+
// depositJson.from,
1509+
// depositJson.to,
1510+
// depositJson.amount,
1511+
// depositJson.confirmations,
1512+
// 12, // Ethereum mainnet standard: 12 confirmations required
1513+
// callContext
1514+
// )
1515+
// } yield JSONFactory700.createDepositJson(deposit)
1516+
// }
1517+
// }
1518+
//
1519+
// resourceDocs += ResourceDoc(
1520+
// null,
1521+
// implementedInApiVersion,
1522+
// nameOf(notifyDeposit),
1523+
// "POST",
1524+
// "/banks/BANK_ID/accounts/ACCOUNT_ID/views/VIEW_ID/market/deposits",
1525+
// "Notify Deposit",
1526+
// """**WORK IN PROGRESS**
1527+
// |
1528+
// |Record a blockchain deposit notification.
1529+
// |
1530+
// |Authentication is required.""",
1531+
// JSONFactory700.NotifyDepositJson(
1532+
// tx_hash = "0x123abc",
1533+
// from = "0xsender",
1534+
// to = "0xreceiver",
1535+
// amount = BigDecimal("100.0"),
1536+
// confirmations = 6
1537+
// ),
1538+
// JSONFactory700.DepositJson(
1539+
// deposit_id = "deposit-202",
1540+
// tx_hash = "0x123abc",
1541+
// from = "0xsender",
1542+
// to = "0xreceiver",
1543+
// amount = BigDecimal("100.0"),
1544+
// confirmations = 6,
1545+
// required_confirmations = 12,
1546+
// status = "pending",
1547+
// nonce = Some(123456L),
1548+
// gas_used = Some(21000L),
1549+
// error_message = None,
1550+
// user_id = "user-abc-123",
1551+
// consent_id = None,
1552+
// created_at = "2026-04-16T00:50:00Z"
1553+
// ),
1554+
// List(InvalidJsonFormat, InvalidTradingAmount, InvalidMatchParameters, $AuthenticatedUserIsRequired, $BankNotFound, $BankAccountNotFound, UnknownError),
1555+
// apiTagMarket :: Nil,
1556+
// http4sPartialFunction = Some(notifyDeposit)
1557+
// )
15581558

15591559
// Route: POST /obp/v7.0.0/banks/BANK_ID/accounts/ACCOUNT_ID/views/VIEW_ID/market/withdrawals
15601560
val requestWithdrawal: HttpRoutes[IO] = HttpRoutes.of[IO] {

0 commit comments

Comments
 (0)