-
Notifications
You must be signed in to change notification settings - Fork 430
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2341 from constantine2nd/develop
Regulated Entities
- Loading branch information
Showing
13 changed files
with
599 additions
and
17 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
80 changes: 80 additions & 0 deletions
80
obp-api/src/main/scala/code/api/util/newstyle/RegulatedEntity.scala
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
package code.api.util.newstyle | ||
|
||
import code.api.util.APIUtil.{OBPReturnType, unboxFull, unboxFullOrFail} | ||
import code.api.util.ErrorMessages.{RegulatedEntityNotDeleted, RegulatedEntityNotFound} | ||
import code.api.util.{APIUtil, CallContext} | ||
import code.consumer.Consumers | ||
import code.model.{AppType, Consumer} | ||
import code.regulatedentities.MappedRegulatedEntityProvider | ||
import com.openbankproject.commons.model.RegulatedEntityTrait | ||
import net.liftweb.common.Box | ||
|
||
import scala.concurrent.Future | ||
|
||
object RegulatedEntityNewStyle { | ||
|
||
import com.openbankproject.commons.ExecutionContext.Implicits.global | ||
|
||
def createRegulatedEntityNewStyle(certificateAuthorityCaOwnerId: Option[String], | ||
entityCertificatePublicKey: Option[String], | ||
entityCode: Option[String], | ||
entityType: Option[String], | ||
entityAddress: Option[String], | ||
entityTownCity: Option[String], | ||
entityPostCode: Option[String], | ||
entityCountry: Option[String], | ||
entityWebSite: Option[String], | ||
services: Option[String], | ||
callContext: Option[CallContext]): OBPReturnType[RegulatedEntityTrait] = { | ||
Future { | ||
MappedRegulatedEntityProvider.createRegulatedEntity( | ||
certificateAuthorityCaOwnerId: Option[String], | ||
entityCertificatePublicKey: Option[String], | ||
entityCode: Option[String], | ||
entityType: Option[String], | ||
entityAddress: Option[String], | ||
entityTownCity: Option[String], | ||
entityPostCode: Option[String], | ||
entityCountry: Option[String], | ||
entityWebSite: Option[String], | ||
services: Option[String] | ||
) map { | ||
(_, callContext) | ||
} | ||
} map { | ||
unboxFull(_) | ||
} | ||
} | ||
|
||
def getRegulatedEntitiesNewStyle(callContext: Option[CallContext]): OBPReturnType[List[RegulatedEntityTrait]] = { | ||
Future { | ||
MappedRegulatedEntityProvider.getRegulatedEntities() | ||
} map { | ||
(_, callContext) | ||
} | ||
} | ||
def getRegulatedEntityByEntityIdNewStyle(id: String, | ||
callContext: Option[CallContext] | ||
): OBPReturnType[RegulatedEntityTrait] = { | ||
Future { | ||
MappedRegulatedEntityProvider.getRegulatedEntityByEntityId(id) | ||
} map { | ||
(_, callContext) | ||
} map { | ||
x => (unboxFullOrFail(x._1, callContext, RegulatedEntityNotFound, 404), x._2) | ||
} | ||
} | ||
def deleteRegulatedEntityNewStyle(id: String, | ||
callContext: Option[CallContext] | ||
): OBPReturnType[Boolean] = { | ||
Future { | ||
MappedRegulatedEntityProvider.deleteRegulatedEntity(id) | ||
} map { | ||
(_, callContext) | ||
} map { | ||
x => (unboxFullOrFail(x._1, callContext, RegulatedEntityNotDeleted, 400), x._2) | ||
} | ||
} | ||
|
||
|
||
} |
This file contains 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
Oops, something went wrong.