mirror of
https://github.com/OpenBankProject/OBP-API.git
synced 2026-02-06 15:56:57 +00:00
code clean
This commit is contained in:
parent
dd892b5a6e
commit
870cb8b325
@ -6,7 +6,7 @@ import code.api.v1_4_0.{APIMethods140, JSONFactory1_4_0, OBPAPI1_4_0}
|
||||
import code.api.v2_2_0.{APIMethods220, OBPAPI2_2_0}
|
||||
import code.api.v3_0_0.{APIMethods300, OBPAPI3_0_0}
|
||||
import code.api.v3_0_0.OBPAPI3_0_0._
|
||||
import code.bankconnectors.KafkaMappedConnector_vMar2017
|
||||
import code.bankconnectors.vMar2017.KafkaMappedConnector_vMar2017
|
||||
import net.liftweb.common.{Box, Empty, Full}
|
||||
import code.util.Helper.MdcLoggable
|
||||
import net.liftweb.http.rest.RestHelper
|
||||
|
||||
@ -8,8 +8,9 @@ import code.api.util.ApiRole._
|
||||
import code.api.util.ErrorMessages
|
||||
import code.api.v2_1_0._
|
||||
import code.atms.Atms
|
||||
import code.atms.Atms.{Atm, AtmId, AtmT}
|
||||
import code.bankconnectors.vJune.InboundAccountJune2017
|
||||
import code.atms.Atms.{AtmId, AtmT}
|
||||
import code.bankconnectors.vJune2017.{InboundAccountJune2017, KafkaMappedConnector_vJune2017}
|
||||
import code.bankconnectors.vMar2017.KafkaMappedConnector_vMar2017
|
||||
import code.branches.Branches.{Branch, BranchId, BranchT}
|
||||
import code.branches.{InboundAdapterInfo, MappedBranch}
|
||||
import code.fx.FXRate
|
||||
@ -63,10 +64,12 @@ object Connector extends SimpleInjector {
|
||||
|
||||
connectorProps match {
|
||||
case "mapped" => LocalMappedConnector
|
||||
case "mongodb" => LocalConnector
|
||||
case "mongodb" => LocalRecordConnector
|
||||
case "obpjvm" => ObpJvmMappedConnector
|
||||
case "kafka" => KafkaMappedConnector
|
||||
case "kafka_JVMcompatible" => KafkaMappedConnector_JVMcompatible
|
||||
case "kafka_vJune2017" => KafkaMappedConnector_vJune2017
|
||||
case "kafka_vMar2017" => KafkaMappedConnector_vMar2017
|
||||
case matchKafkaVersion(version) => getObjectInstance(s"""code.bankconnectors.KafkaMappedConnector_v${version}""")
|
||||
}
|
||||
}
|
||||
|
||||
@ -31,6 +31,7 @@ import code.api.util.ErrorMessages
|
||||
import code.api.v2_1_0.{BranchJsonPostV210, TransactionRequestCommonBodyJSON}
|
||||
import code.atms.Atms.AtmId
|
||||
import code.atms.MappedAtm
|
||||
import code.bankconnectors.vMar2017.KafkaMappedConnector_vMar2017
|
||||
import code.branches.Branches.{Branch, BranchId, BranchT}
|
||||
import code.branches.{InboundAdapterInfo, MappedBranch}
|
||||
import code.fx.{FXRate, fx}
|
||||
|
||||
@ -80,6 +80,7 @@ import net.liftweb.json.MappingException
|
||||
|
||||
import scala.concurrent.TimeoutException
|
||||
import code.api.util.ErrorMessages._
|
||||
import code.bankconnectors.vMar2017.KafkaMappedConnector_vMar2017
|
||||
|
||||
object KafkaMappedConnector_JVMcompatible extends Connector with KafkaHelper with MdcLoggable {
|
||||
|
||||
|
||||
@ -31,11 +31,11 @@ import org.bson.types.ObjectId
|
||||
import scala.concurrent.ExecutionContext.Implicits.global
|
||||
import scala.concurrent._
|
||||
|
||||
private object LocalConnector extends Connector with MdcLoggable {
|
||||
private object LocalRecordConnector extends Connector with MdcLoggable {
|
||||
|
||||
type AccountType = Account
|
||||
|
||||
implicit override val nameOfConnector = LocalConnector.getClass.getSimpleName
|
||||
implicit override val nameOfConnector = LocalRecordConnector.getClass.getSimpleName
|
||||
|
||||
override def getAdapterInfo: Box[InboundAdapterInfo] = Empty
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
package code.bankconnectors.vJune
|
||||
package code.bankconnectors.vJune2017
|
||||
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.{Date, Locale}
|
||||
@ -26,7 +26,7 @@ case class GetAdapterInfo(date: String) extends GetAdapterInfoTopic
|
||||
case class GetBanks(authInfo: AuthInfo, criteria: String) extends GetBanksTopic
|
||||
case class GetBank(authInfo: AuthInfo, bankId: String) extends GetBankTopic
|
||||
case class GetUserByUsernamePassword(authInfo: AuthInfo, password: String) extends GetUserByUsernamePasswordTopic
|
||||
case class OutboundGetAccounts(authInfo: AuthInfo, customers:InternalCustomers ) extends GetAccountsTopic
|
||||
case class OutboundGetAccounts(authInfo: AuthInfo, customers:InternalBasicCustomers ) extends GetAccountsTopic
|
||||
case class GetAccountbyAccountID(authInfo: AuthInfo, bankId: String, accountId: String)extends GetAccountbyAccountIDTopic
|
||||
case class GetAccountbyAccountNumber(authInfo: AuthInfo, bankId: String, accountNumber: String)extends GetAccountbyAccountNumberTopic
|
||||
case class GetTransactions(authInfo: AuthInfo,bankId: String, accountId: String, limit: Int, fromDate: String, toDate: String) extends GetTransactionsTopic
|
||||
@ -94,52 +94,29 @@ case class BankAccountJune2017(r: InboundAccountJune2017) extends BankAccount {
|
||||
|
||||
}
|
||||
|
||||
case class InternalCustomer(
|
||||
customer_id: String,
|
||||
customer_number: String,
|
||||
legal_name: String,
|
||||
mobile_phone_number: String,
|
||||
email: String,
|
||||
face_image: CustomerFaceImageJson,
|
||||
date_of_birth: Date,
|
||||
relationship_status: String,
|
||||
dependants: Int,
|
||||
dob_of_dependants: List[Date],
|
||||
credit_rating: Option[CustomerCreditRatingJSON],
|
||||
credit_limit: Option[AmountOfMoneyJsonV121],
|
||||
highest_education_attained: String,
|
||||
employment_status: String,
|
||||
kyc_status: Boolean,
|
||||
last_ok_date: Date
|
||||
case class InternalBasicCustomer(
|
||||
bankId:String,
|
||||
customerId: String,
|
||||
customerNumber: String,
|
||||
legalName: String,
|
||||
dateOfBirth: Date
|
||||
)
|
||||
|
||||
case class InternalCustomers(customers: List[InternalCustomer])
|
||||
case class InternalBasicCustomers(customers: List[InternalBasicCustomer])
|
||||
|
||||
object JsonFactory_vJune2017 {
|
||||
def createCustomerJson(cInfo : Customer) : InternalCustomer = {
|
||||
InternalCustomer(
|
||||
customer_id = cInfo.customerId,
|
||||
customer_number = cInfo.number,
|
||||
legal_name = cInfo.legalName,
|
||||
mobile_phone_number = cInfo.mobileNumber,
|
||||
email = cInfo.email,
|
||||
face_image = CustomerFaceImageJson(url = cInfo.faceImage.url,
|
||||
date = cInfo.faceImage.date),
|
||||
date_of_birth = cInfo.dateOfBirth,
|
||||
relationship_status = cInfo.relationshipStatus,
|
||||
dependants = cInfo.dependents,
|
||||
dob_of_dependants = cInfo.dobOfDependents,
|
||||
credit_rating = Option(CustomerCreditRatingJSON(rating = cInfo.creditRating.rating, source = cInfo.creditRating.source)),
|
||||
credit_limit = Option(AmountOfMoneyJsonV121(currency = cInfo.creditLimit.currency, amount = cInfo.creditLimit.amount)),
|
||||
highest_education_attained = cInfo.highestEducationAttained,
|
||||
employment_status = cInfo.employmentStatus,
|
||||
kyc_status = cInfo.kycStatus,
|
||||
last_ok_date = cInfo.lastOkDate
|
||||
def createCustomerJson(customer : Customer) : InternalBasicCustomer = {
|
||||
InternalBasicCustomer(
|
||||
bankId=customer.bank,
|
||||
customerId = customer.customerId,
|
||||
customerNumber = customer.number,
|
||||
legalName = customer.legalName,
|
||||
dateOfBirth = customer.dateOfBirth
|
||||
)
|
||||
}
|
||||
|
||||
def createCustomersJson(customers : List[Customer]) : InternalCustomers = {
|
||||
InternalCustomers(customers.map(createCustomerJson))
|
||||
def createCustomersJson(customers : List[Customer]) : InternalBasicCustomers = {
|
||||
InternalBasicCustomers(customers.map(createCustomerJson))
|
||||
}
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
package code.bankconnectors
|
||||
package code.bankconnectors.vJune2017
|
||||
|
||||
/*
|
||||
Open Bank Project - API
|
||||
@ -27,12 +27,12 @@ import java.text.SimpleDateFormat
|
||||
import java.util.{Date, Locale, UUID}
|
||||
|
||||
import code.accountholder.AccountHolders
|
||||
import code.api.util.APIUtil.{MessageDoc, exampleDate, saveConnectorMetric}
|
||||
import code.api.util.APIUtil.{MessageDoc, saveConnectorMetric}
|
||||
import code.api.util.{APIUtil, ErrorMessages}
|
||||
import code.api.v1_4_0.JSONFactory1_4_0
|
||||
import code.api.v2_1_0._
|
||||
import code.atms.Atms.AtmId
|
||||
import code.atms.MappedAtm
|
||||
import code.bankconnectors._
|
||||
import code.branches.Branches.{Branch, BranchId}
|
||||
import code.branches._
|
||||
import code.customer.Customer
|
||||
@ -51,27 +51,24 @@ import code.transaction.MappedTransaction
|
||||
import code.transactionrequests.TransactionRequests._
|
||||
import code.transactionrequests.{TransactionRequestTypeCharge, TransactionRequests}
|
||||
import code.usercustomerlinks.UserCustomerLink
|
||||
import code.util.{Helper, TTLCache}
|
||||
import code.util.Helper
|
||||
import code.util.Helper.MdcLoggable
|
||||
import code.views.Views
|
||||
import com.google.common.cache.CacheBuilder
|
||||
import net.liftweb.common._
|
||||
import net.liftweb.json.Extraction
|
||||
import net.liftweb.json.Extraction._
|
||||
import net.liftweb.json.JsonAST.JValue
|
||||
import net.liftweb.mapper._
|
||||
import net.liftweb.util.Helpers._
|
||||
import net.liftweb.util.Helpers.{tryo, _}
|
||||
import net.liftweb.util.Props
|
||||
|
||||
import scala.collection.immutable.{Nil, Seq}
|
||||
import scala.collection.mutable.ArrayBuffer
|
||||
import scalacache.memoization.memoizeSync
|
||||
import scala.concurrent.duration._
|
||||
import scala.language.postfixOps
|
||||
import scalacache.ScalaCache
|
||||
import scalacache.guava.GuavaCache
|
||||
import concurrent.duration._
|
||||
import language.postfixOps
|
||||
import com.google.common.cache.CacheBuilder
|
||||
import code.util.Helper.MdcLoggable
|
||||
import net.liftweb.json.JsonAST.JValue
|
||||
import net.liftweb.json.Extraction._
|
||||
import code.api.ResourceDocs1_4_0.SwaggerDefinitionsJSON._
|
||||
import code.bankconnectors.vJune._
|
||||
import scalacache.memoization.memoizeSync
|
||||
|
||||
|
||||
object KafkaMappedConnector_vJune2017 extends Connector with KafkaHelper with MdcLoggable {
|
||||
@ -241,25 +238,14 @@ object KafkaMappedConnector_vJune2017 extends Connector with KafkaHelper with Md
|
||||
exampleOutboundMessage = decompose(
|
||||
OutboundGetAccounts(
|
||||
AuthInfo("userId", "username","cbsToken"),
|
||||
InternalCustomers(customers =List(InternalCustomer(
|
||||
customer_id = "123",
|
||||
customer_number = "123",
|
||||
legal_name = "legal_name",
|
||||
mobile_phone_number = "123",
|
||||
email = "contact@tesobe.com",
|
||||
face_image = customerFaceImageJson,
|
||||
date_of_birth = exampleDate,
|
||||
relationship_status = "123",
|
||||
dependants = 123,
|
||||
dob_of_dependants = List(exampleDate),
|
||||
credit_rating = Option(customerCreditRatingJSON),
|
||||
credit_limit = Option(amountOfMoneyJsonV121),
|
||||
highest_education_attained = "123",
|
||||
employment_status = "123",
|
||||
kyc_status = true,
|
||||
last_ok_date = exampleDate
|
||||
)))
|
||||
)
|
||||
InternalBasicCustomers(customers =List(
|
||||
InternalBasicCustomer(
|
||||
bankId="bankId",
|
||||
customerId = "customerId",
|
||||
customerNumber = "customerNumber",
|
||||
legalName = "legalName",
|
||||
dateOfBirth = exampleDate
|
||||
))))
|
||||
),
|
||||
exampleInboundMessage = decompose(
|
||||
InboundBankAccounts(
|
||||
@ -1,4 +1,4 @@
|
||||
package code.bankconnectors
|
||||
package code.bankconnectors.vMar2017
|
||||
|
||||
/*
|
||||
Open Bank Project - API
|
||||
@ -24,7 +24,6 @@ Berlin 13359, Germany
|
||||
*/
|
||||
|
||||
import java.text.SimpleDateFormat
|
||||
import java.time.ZonedDateTime
|
||||
import java.util.{Date, Locale, UUID}
|
||||
|
||||
import code.accountholder.AccountHolders
|
||||
@ -33,6 +32,7 @@ import code.api.util.ErrorMessages
|
||||
import code.api.v2_1_0._
|
||||
import code.atms.Atms.AtmId
|
||||
import code.atms.MappedAtm
|
||||
import code.bankconnectors._
|
||||
import code.branches.Branches.{Branch, BranchId, BranchT}
|
||||
import code.branches._
|
||||
import code.fx.{FXRate, fx}
|
||||
@ -52,7 +52,6 @@ import code.transactionrequests.{TransactionRequestTypeCharge, TransactionReques
|
||||
import code.util.{Helper, TTLCache}
|
||||
import code.views.Views
|
||||
import net.liftweb.common._
|
||||
import net.liftweb.json
|
||||
import net.liftweb.json.Extraction
|
||||
import net.liftweb.json.JsonAST.JValue
|
||||
import net.liftweb.mapper._
|
||||
@ -2,7 +2,7 @@ package code.examplething
|
||||
|
||||
|
||||
// Need to import these one by one because in same package!
|
||||
import code.bankconnectors.{KafkaMappedConnector, LocalConnector, LocalMappedConnector}
|
||||
import code.bankconnectors.{KafkaMappedConnector, LocalRecordConnector, LocalMappedConnector}
|
||||
|
||||
|
||||
import code.model.{BankId}
|
||||
|
||||
@ -16,7 +16,7 @@ case class SaveableMongoObj[T <: MongoRecord[_]](value : T) extends Saveable[T]
|
||||
}
|
||||
|
||||
/**
|
||||
* Imports data into the format used by LocalConnector (e.g. HostedBank)
|
||||
* Imports data into the format used by LocalRecordConnector (e.g. HostedBank)
|
||||
*/
|
||||
|
||||
|
||||
@ -24,7 +24,7 @@ case class SaveableMongoObj[T <: MongoRecord[_]](value : T) extends Saveable[T]
|
||||
|
||||
Not currently using this connector so not updating it at the moment.
|
||||
|
||||
object LocalConnectorDataImport extends OBPDataImport with CreateAuthUsers {
|
||||
object LocalRecordConnectorDataImport extends OBPDataImport with CreateAuthUsers {
|
||||
|
||||
type BankType = HostedBank
|
||||
type AccountType = Account
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
package code.yearlycustomercharges
|
||||
|
||||
import code.bankconnectors.{KafkaMappedConnector, LocalConnector, LocalMappedConnector}
|
||||
import code.bankconnectors.{KafkaMappedConnector, LocalRecordConnector, LocalMappedConnector}
|
||||
|
||||
|
||||
import code.model.{CustomerId, BankId}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
package code.api
|
||||
|
||||
import code.bankconnectors.vJune.InboundAccountJune2017
|
||||
import code.bankconnectors.vJune2017.InboundAccountJune2017
|
||||
import net.liftweb.json.{Extraction, compact, render}
|
||||
import code.util.Helper.MdcLoggable
|
||||
import net.liftweb.common.Full
|
||||
|
||||
@ -6,7 +6,7 @@ import code.api.v2_1_0.{BranchJsonPostV210, TransactionRequestCommonBodyJSON}
|
||||
import code.atms.Atms.AtmId
|
||||
import code.atms.MappedAtm
|
||||
import code.bankconnectors._
|
||||
import code.bankconnectors.vJune.InboundAccountJune2017
|
||||
import code.bankconnectors.vJune2017.InboundAccountJune2017
|
||||
import code.branches.Branches.{Branch, BranchId, BranchT}
|
||||
import code.branches.{InboundAdapterInfo, MappedBranch}
|
||||
import code.fx.FXRate
|
||||
|
||||
@ -21,7 +21,7 @@ import scala.util.Random
|
||||
trait LocalMappedConnectorTestSetup extends TestConnectorSetupWithStandardPermissions {
|
||||
//TODO: replace all these helpers with connector agnostic methods like createRandomBank
|
||||
// that call Connector.createBank etc.
|
||||
// (same in LocalConnectorTestSetup)
|
||||
// (same in LocalRecordConnectorTestSetup)
|
||||
// Tests should simply use the currently selected connector
|
||||
override protected def createBank(id : String) : Bank = {
|
||||
MappedBank.create
|
||||
|
||||
Loading…
Reference in New Issue
Block a user