added the 6 more uncomplicated methods to RestConnector_vMar2019

This commit is contained in:
hongwei 2019-03-27 11:19:15 +01:00
parent 1ed104d108
commit d65d1e1e1f
6 changed files with 82 additions and 55 deletions

View File

@ -276,7 +276,7 @@ object AkkaConnector_vDec2018 extends Connector with AkkaConnectorActorInit {
),
exampleInboundMessage = (
InboundGetCounterparties(
InboundCounterparty(
CounterpartyConnector(
createdByUserId = userIdExample.value,
name = "",
thisBankId = bankIdExample.value,

View File

@ -1,13 +1,12 @@
package code.bankconnectors.akka
import java.lang
import java.util.Date
import code.api.util.APIUtil
import code.model.dataAccess.MappedBankAccountData
import code.model.Transaction
import com.openbankproject.commons.dto.{InboundAccount, InboundBank, InboundCustomer, InboundTransaction}
import com.openbankproject.commons.model.{CreditLimit, _}
import com.openbankproject.commons.model._
import net.liftweb.mapper.By
import net.liftweb.util.Helpers.today
@ -16,34 +15,8 @@ import scala.math.BigDecimal
object InboundTransformerDec2018 {
/*
* Customer
*/
case class AkkaDec2018Customer(
customerId: String,
bankId: String,
number: String,
legalName: String,
mobileNumber: String,
email: String,
faceImage: CustomerFaceImage,
dateOfBirth: Date,
relationshipStatus: String,
dependents: Integer,
dobOfDependents: List[Date],
highestEducationAttained: String,
employmentStatus: String,
creditRating: CreditRating,
creditLimit: CreditLimit,
kycStatus: lang.Boolean,
lastOkDate: Date,
title: String = "", //These new fields for V310, not from Connector for now.
branchId: String = "", //These new fields for V310, not from Connector for now.
nameSuffix: String = "", //These new fields for V310, not from Connector for now.
) extends Customer
def toCustomer(customer: InboundCustomer): Customer = {
AkkaDec2018Customer(
CustomerConnector(
customerId = customer.customerId,
bankId = customer.bankId,
number = customer.number,
@ -61,6 +34,9 @@ object InboundTransformerDec2018 {
creditLimit = customer.creditLimit,
kycStatus = customer.kycStatus,
lastOkDate = customer.lastOkDate,
title = "",
branchId = "",
nameSuffix = "",
)
}

View File

@ -147,7 +147,7 @@ object Transformer {
}
def toInternalCounterparty(c: CounterpartyTrait) = {
InboundCounterparty(
CounterpartyConnector(
createdByUserId=c.createdByUserId,
name=c.name,
thisBankId=c.thisBankId,

View File

@ -25,21 +25,22 @@ Berlin 13359, Germany
import java.util.UUID.randomUUID
import akka.http.scaladsl.model.{HttpHeader, HttpMethod, HttpMethods, HttpRequest, HttpResponse, ResponseEntity, StatusCodes}
import akka.http.scaladsl.model._
import akka.util.ByteString
import akka.http.scaladsl.model.HttpProtocol
import code.api.{APIFailure, APIFailureNewStyle}
import code.util.AkkaHttpClient._
import code.api.cache.Caching
import code.api.util.APIUtil.{MessageDoc, saveConnectorMetric}
import code.api.util.{APIUtil, CallContext, NewStyle}
import code.api.util.APIUtil.{MessageDoc, OBPReturnType, saveConnectorMetric}
import code.api.util.{APIUtil, CallContext, NewStyle, OBPQueryParam}
import code.api.util.ErrorMessages._
import code.bankconnectors._
import code.bankconnectors.vJune2017.AuthInfo
import code.bankconnectors.vMar2017._
import code.kafka.KafkaHelper
import code.model.Transaction
import code.util.Helper.MdcLoggable
import com.openbankproject.commons.model.{Bank, BankConnector, BankId, InboundAdapterInfoInternal}
import com.openbankproject.commons.model._
import com.tesobe.CacheKeyFromArguments
import net.liftweb.common.{Box, _}
import net.liftweb.json._
@ -78,6 +79,27 @@ trait RestConnector_vMar2019 extends Connector with KafkaHelper with MdcLoggable
//TODO 3-- Need to be generated automatically
override def getBankFuture(bankId: BankId, callContext: Option[CallContext]): Future[Box[(BankConnector, Option[CallContext])]] = ???
//TODO 4-- Need to be generated automatically
override def checkBankAccountExistsFuture(bankId : BankId, accountId : AccountId, callContext: Option[CallContext] = None): Future[Box[(BankAccountInMemory, Option[CallContext])]] = ???
//TODO 5-- Need to be generated automatically
override def getBankAccountFuture(bankId : BankId, accountId : AccountId, callContext: Option[CallContext]): OBPReturnType[Box[BankAccountInMemory]] = ???
//TODO 6-- Need to be generated automatically
override def getCoreBankAccountsFuture(BankIdAccountIds: List[BankIdAccountId], callContext: Option[CallContext]) : Future[Box[(List[CoreAccount], Option[CallContext])]] = ???
//TODO 7-- Need to be generated automatically
override def getCustomersByUserIdFuture(userId: String , callContext: Option[CallContext]): Future[Box[(List[CustomerConnector], Option[CallContext])]] = ???
//TODO 8-- Need to be generated automatically
override def getCounterpartiesFuture(thisBankId: BankId, thisAccountId: AccountId, viewId: ViewId, callContext: Option[CallContext] = None): OBPReturnType[Box[List[CounterpartyConnector]]] = ???
//TODO 9-- Need to be generated automatically
override def getTransactionsFuture(bankId: BankId, accountId: AccountId, callContext: Option[CallContext], queryParams: OBPQueryParam*): OBPReturnType[Box[List[Transaction]]] = ???
//TODO 10-- Need to be generated automatically
override def getTransactionFuture(bankId: BankId, accountId: AccountId, transactionId: TransactionId, callContext: Option[CallContext]): OBPReturnType[Box[Transaction]] = ???
private[this] def sendGetRequest[T : TypeTag: Manifest](url: String, callContext: Option[CallContext]) =
sendRequest[T](url, callContext, HttpMethods.GET)

View File

@ -82,7 +82,7 @@ case class InboundGetCoreBankAccounts(payload: List[InboundCoreAccount],
case class InboundGetCustomersByUserId(payload: List[InboundCustomer],
callContext: Option[CallContextAkka])
case class InboundGetCounterparties(payload: List[InboundCounterparty],
case class InboundGetCounterparties(payload: List[CounterpartyConnector],
callContext: Option[CallContextAkka])
case class InboundGetTransactions(payload: List[InboundTransaction],
@ -166,21 +166,3 @@ case class InboundTransaction(
)
case class InboundCounterparty(
createdByUserId: String,
name: String,
thisBankId: String,
thisAccountId: String,
thisViewId: String,
counterpartyId: String,
otherAccountRoutingScheme: String,
otherAccountRoutingAddress: String,
otherBankRoutingScheme: String,
otherBankRoutingAddress: String,
otherBranchRoutingScheme: String,
otherBranchRoutingAddress: String,
isBeneficiary: Boolean,
description: String,
otherAccountSecondaryRoutingScheme: String,
otherAccountSecondaryRoutingAddress: String,
bespoke: List[CounterpartyBespoke]) extends CounterpartyTrait

View File

@ -1,5 +1,8 @@
package com.openbankproject.commons.model
import java.lang
import java.util.Date
import scala.collection.immutable.List
/**
@ -48,4 +51,48 @@ case class BankConnector(
bankRoutingAddress: String,
swiftBic: String,
nationalIdentifier: String
) extends Bank
) extends Bank
case class CustomerConnector(
customerId: String,
bankId: String,
number: String,
legalName: String,
mobileNumber: String,
email: String,
faceImage: CustomerFaceImage,
dateOfBirth: Date,
relationshipStatus: String,
dependents: Integer,
dobOfDependents: List[Date],
highestEducationAttained: String,
employmentStatus: String,
creditRating: CreditRating,
creditLimit: CreditLimit,
kycStatus: lang.Boolean,
lastOkDate: Date,
title: String,
branchId: String,
nameSuffix: String,
) extends Customer
case class CounterpartyConnector(
createdByUserId: String,
name: String,
thisBankId: String,
thisAccountId: String,
thisViewId: String,
counterpartyId: String,
otherAccountRoutingScheme: String,
otherAccountRoutingAddress: String,
otherBankRoutingScheme: String,
otherBankRoutingAddress: String,
otherBranchRoutingScheme: String,
otherBranchRoutingAddress: String,
isBeneficiary: Boolean,
description: String,
otherAccountSecondaryRoutingScheme: String,
otherAccountSecondaryRoutingAddress: String,
bespoke: List[CounterpartyBespoke]
) extends CounterpartyTrait