@@ -4569,6 +4569,237 @@ object NewStyle extends MdcLoggable{
45694569 ) map {
45704570 i => (unboxFullOrFail(i._1, callContext, s " $DeleteCounterpartyLimitError" ), i._2)
45714571 }
4572+
4573+ // Trading Methods
4574+ def createTradingOffer (
4575+ bankId : BankId ,
4576+ accountId : AccountId ,
4577+ offerType : String ,
4578+ assetCode : String ,
4579+ assetAmount : BigDecimal ,
4580+ priceCurrency : String ,
4581+ priceAmount : BigDecimal ,
4582+ settlementAccountId : String ,
4583+ callContext : Option [CallContext ]
4584+ ): OBPReturnType [com.openbankproject.commons.model.TradingOffer ] = {
4585+ Connector .connector.vend.createTradingOffer(
4586+ bankId, accountId, offerType, assetCode, assetAmount,
4587+ priceCurrency, priceAmount, settlementAccountId, callContext
4588+ ) map {
4589+ i => (unboxFullOrFail(i._1, callContext, s " $OfferNotFound" ), i._2)
4590+ }
4591+ }
4592+
4593+ def getTradingOffer (
4594+ offerId : String ,
4595+ callContext : Option [CallContext ]
4596+ ): OBPReturnType [com.openbankproject.commons.model.TradingOffer ] = {
4597+ Connector .connector.vend.getTradingOffer(offerId, callContext) map {
4598+ i => (unboxFullOrFail(i._1, callContext, s " $OfferNotFound" ), i._2)
4599+ }
4600+ }
4601+
4602+ def cancelTradingOffer (
4603+ offerId : String ,
4604+ callContext : Option [CallContext ]
4605+ ): OBPReturnType [com.openbankproject.commons.model.TradingOffer ] = {
4606+ Connector .connector.vend.cancelTradingOffer(offerId, callContext) map {
4607+ i => (unboxFullOrFail(i._1, callContext, s " $OfferNotFound" ), i._2)
4608+ }
4609+ }
4610+
4611+ def updateTradingOffer (
4612+ offerId : String ,
4613+ priceAmount : Option [BigDecimal ],
4614+ expiryDatetime : Option [Date ],
4615+ minimumFill : Option [BigDecimal ],
4616+ callContext : Option [CallContext ]
4617+ ): OBPReturnType [com.openbankproject.commons.model.TradingOffer ] = {
4618+ Connector .connector.vend.updateTradingOffer(offerId, priceAmount, expiryDatetime, minimumFill, callContext) map {
4619+ i => (unboxFullOrFail(i._1, callContext, s " $OfferNotFound" ), i._2)
4620+ }
4621+ }
4622+
4623+ def getTradingOffers (
4624+ bankId : BankId ,
4625+ accountId : AccountId ,
4626+ status : Option [String ],
4627+ offerType : Option [String ],
4628+ callContext : Option [CallContext ]
4629+ ): OBPReturnType [List [com.openbankproject.commons.model.TradingOffer ]] = {
4630+ Connector .connector.vend.getTradingOffers(bankId, accountId, status, offerType, callContext) map {
4631+ i => (unboxFullOrFail(i._1, callContext, s " $BankAccountNotFound" ), i._2)
4632+ }
4633+ }
4634+
4635+ // Market Methods
4636+ def createMarketOrder (
4637+ bankId : BankId ,
4638+ accountId : AccountId ,
4639+ side : String ,
4640+ price : BigDecimal ,
4641+ quantity : BigDecimal ,
4642+ settlementAccountId : String ,
4643+ callContext : Option [CallContext ]
4644+ ): OBPReturnType [com.openbankproject.commons.model.MarketOrder ] = {
4645+ Connector .connector.vend.createMarketOrder(
4646+ bankId, accountId, side, price, quantity, settlementAccountId, callContext
4647+ ) map {
4648+ i => (unboxFullOrFail(i._1, callContext, s " $OrderNotFound" ), i._2)
4649+ }
4650+ }
4651+
4652+ def getMarketOrder (
4653+ bankId : BankId ,
4654+ accountId : AccountId ,
4655+ orderId : String ,
4656+ callContext : Option [CallContext ]
4657+ ): OBPReturnType [com.openbankproject.commons.model.MarketOrder ] = {
4658+ Connector .connector.vend.getMarketOrder(bankId, accountId, orderId, callContext) map {
4659+ i => (unboxFullOrFail(i._1, callContext, s " $OrderNotFound" ), i._2)
4660+ }
4661+ }
4662+
4663+ def cancelMarketOrder (
4664+ bankId : BankId ,
4665+ accountId : AccountId ,
4666+ orderId : String ,
4667+ callContext : Option [CallContext ]
4668+ ): OBPReturnType [com.openbankproject.commons.model.MarketOrder ] = {
4669+ Connector .connector.vend.cancelMarketOrder(bankId, accountId, orderId, callContext) map {
4670+ i => (unboxFullOrFail(i._1, callContext, s " $OrderNotFound" ), i._2)
4671+ }
4672+ }
4673+
4674+ def createMarketMatch (
4675+ bankId : BankId ,
4676+ accountId : AccountId ,
4677+ orderId : String ,
4678+ counterOrderId : String ,
4679+ amount : BigDecimal ,
4680+ price : BigDecimal ,
4681+ callContext : Option [CallContext ]
4682+ ): OBPReturnType [com.openbankproject.commons.model.MarketMatch ] = {
4683+ Connector .connector.vend.createMarketMatch(
4684+ bankId, accountId, orderId, counterOrderId, amount, price, callContext
4685+ ) map {
4686+ i => (unboxFullOrFail(i._1, callContext, s " $InvalidMatchParameters" ), i._2)
4687+ }
4688+ }
4689+
4690+ def getMarketTrade (
4691+ bankId : BankId ,
4692+ accountId : AccountId ,
4693+ tradeId : String ,
4694+ callContext : Option [CallContext ]
4695+ ): OBPReturnType [com.openbankproject.commons.model.MarketTrade ] = {
4696+ Connector .connector.vend.getMarketTrade(bankId, accountId, tradeId, callContext) map {
4697+ i => (unboxFullOrFail(i._1, callContext, s " $TradeNotFound" ), i._2)
4698+ }
4699+ }
4700+
4701+ def requestSettlement (
4702+ bankId : BankId ,
4703+ accountId : AccountId ,
4704+ tradeId : String ,
4705+ step : Option [String ],
4706+ callContext : Option [CallContext ]
4707+ ): OBPReturnType [com.openbankproject.commons.model.Settlement ] = {
4708+ Connector .connector.vend.requestSettlement(bankId, accountId, tradeId, step, callContext) map {
4709+ i => (unboxFullOrFail(i._1, callContext, s " $SettlementFailed" ), i._2)
4710+ }
4711+ }
4712+
4713+ def notifyDeposit (
4714+ bankId : BankId ,
4715+ accountId : AccountId ,
4716+ txHash : String ,
4717+ from : String ,
4718+ to : String ,
4719+ amount : BigDecimal ,
4720+ confirmations : Int ,
4721+ requiredConfirmations : Int ,
4722+ callContext : Option [CallContext ]
4723+ ): OBPReturnType [com.openbankproject.commons.model.Deposit ] = {
4724+ Connector .connector.vend.notifyDeposit(
4725+ bankId, accountId, txHash, from, to, amount, confirmations, requiredConfirmations, callContext
4726+ ) map {
4727+ i => (unboxFullOrFail(i._1, callContext, s " $InvalidTradingAmount" ), i._2)
4728+ }
4729+ }
4730+
4731+ def requestWithdrawal (
4732+ bankId : BankId ,
4733+ accountId : AccountId ,
4734+ settlementAccountId : String ,
4735+ amount : BigDecimal ,
4736+ address : String ,
4737+ requiredConfirmations : Int ,
4738+ callContext : Option [CallContext ]
4739+ ): OBPReturnType [com.openbankproject.commons.model.Withdrawal ] = {
4740+ Connector .connector.vend.requestWithdrawal(
4741+ bankId, accountId, settlementAccountId, amount, address, requiredConfirmations, callContext
4742+ ) map {
4743+ i => (unboxFullOrFail(i._1, callContext, s " $WithdrawalFailed" ), i._2)
4744+ }
4745+ }
4746+
4747+ // TCC Payment Authorization NewStyle Wrappers
4748+ def createPaymentAuth (
4749+ bankId : BankId ,
4750+ accountId : AccountId ,
4751+ tradeId : String ,
4752+ buyerAccountId : String ,
4753+ sellerAccountId : String ,
4754+ amountFiat : BigDecimal ,
4755+ currency : String ,
4756+ callContext : Option [CallContext ]
4757+ ): OBPReturnType [com.openbankproject.commons.model.PaymentAuth ] = {
4758+ Connector .connector.vend.createPaymentAuth(
4759+ bankId, accountId, tradeId, buyerAccountId, sellerAccountId, amountFiat, currency, callContext
4760+ ) map {
4761+ i => (unboxFullOrFail(i._1, callContext, s " $CreatePaymentAuthError" ), i._2)
4762+ }
4763+ }
4764+
4765+ def capturePaymentAuth (
4766+ bankId : BankId ,
4767+ accountId : AccountId ,
4768+ authId : String ,
4769+ callContext : Option [CallContext ]
4770+ ): OBPReturnType [com.openbankproject.commons.model.PaymentAuth ] = {
4771+ Connector .connector.vend.capturePaymentAuth(
4772+ bankId, accountId, authId, callContext
4773+ ) map {
4774+ i => (unboxFullOrFail(i._1, callContext, s " $InvalidPaymentAuthState" ), i._2)
4775+ }
4776+ }
4777+
4778+ def releasePaymentAuth (
4779+ bankId : BankId ,
4780+ accountId : AccountId ,
4781+ authId : String ,
4782+ callContext : Option [CallContext ]
4783+ ): OBPReturnType [com.openbankproject.commons.model.PaymentAuth ] = {
4784+ Connector .connector.vend.releasePaymentAuth(
4785+ bankId, accountId, authId, callContext
4786+ ) map {
4787+ i => (unboxFullOrFail(i._1, callContext, s " $InvalidPaymentAuthState" ), i._2)
4788+ }
4789+ }
4790+
4791+ def getPaymentAuth (
4792+ bankId : BankId ,
4793+ accountId : AccountId ,
4794+ authId : String ,
4795+ callContext : Option [CallContext ]
4796+ ): OBPReturnType [com.openbankproject.commons.model.PaymentAuth ] = {
4797+ Connector .connector.vend.getPaymentAuth(
4798+ bankId, accountId, authId, callContext
4799+ ) map {
4800+ i => (unboxFullOrFail(i._1, callContext, s " $PaymentAuthNotFound" ), i._2)
4801+ }
4802+ }
45724803 }
45734804
45744805}
0 commit comments