mirror of
https://github.com/OpenBankProject/OBP-API.git
synced 2026-02-06 16:16:47 +00:00
feature/OBPV500 added addCardForBank updateCardForBank and getCardForBank
This commit is contained in:
parent
890d7ca501
commit
303801804c
@ -4726,7 +4726,102 @@ object SwaggerDefinitionsJSON {
|
||||
valid_from = Some(new Date()),
|
||||
time_to_live = Some(3600)
|
||||
)
|
||||
|
||||
|
||||
val createPhysicalCardJsonV500 = CreatePhysicalCardJsonV500(
|
||||
card_number = bankCardNumberExample.value,
|
||||
card_type = cardTypeExample.value,
|
||||
name_on_card = nameOnCardExample.value,
|
||||
issue_number = issueNumberExample.value,
|
||||
serial_number = serialNumberExample.value,
|
||||
valid_from_date = DateWithDayExampleObject,
|
||||
expires_date = DateWithDayExampleObject,
|
||||
enabled = true,
|
||||
technology = "technology1",
|
||||
networks = List("network1", "network2"),
|
||||
allows = List(CardAction.CREDIT.toString.toLowerCase, CardAction.DEBIT.toString.toLowerCase),
|
||||
account_id =accountIdExample.value,
|
||||
replacement = Some(replacementJSON),
|
||||
pin_reset = List(pinResetJSON, pinResetJSON1),
|
||||
collected = Some(DateWithDayExampleObject),
|
||||
posted = Some(DateWithDayExampleObject),
|
||||
customer_id = customerIdExample.value,
|
||||
cvv = cvvExample.value,
|
||||
brand = brandExample.value
|
||||
)
|
||||
|
||||
val physicalCardJsonV500 = PhysicalCardJsonV500(
|
||||
card_id = cardIdExample.value,
|
||||
bank_id = bankIdExample.value,
|
||||
card_number = bankCardNumberExample.value,
|
||||
card_type = cardTypeExample.value,
|
||||
name_on_card = nameOnCardExample.value,
|
||||
issue_number = issueNumberExample.value,
|
||||
serial_number = serialNumberExample.value,
|
||||
valid_from_date = DateWithDayExampleObject,
|
||||
expires_date = DateWithDayExampleObject,
|
||||
enabled = true,
|
||||
cancelled = true,
|
||||
on_hot_list = true,
|
||||
technology = technologyExample.value,
|
||||
networks = networksExample.value.split("[,;]").toList,
|
||||
allows = List(CardAction.CREDIT.toString.toLowerCase, CardAction.DEBIT.toString.toLowerCase),
|
||||
account = accountJSON,
|
||||
replacement = replacementJSON,
|
||||
pin_reset = List(pinResetJSON),
|
||||
collected = DateWithDayExampleObject,
|
||||
posted = DateWithDayExampleObject,
|
||||
customer_id = customerIdExample.value,
|
||||
cvv = cvvExample.value,
|
||||
brand = brandExample.value
|
||||
)
|
||||
|
||||
val physicalCardWithAttributesJsonV500 = PhysicalCardWithAttributesJsonV500(
|
||||
card_id = cardIdExample.value,
|
||||
bank_id = bankIdExample.value,
|
||||
card_number = bankCardNumberExample.value,
|
||||
card_type = cardTypeExample.value,
|
||||
name_on_card = nameOnCardExample.value,
|
||||
issue_number = issueNumberExample.value,
|
||||
serial_number = serialNumberExample.value,
|
||||
valid_from_date = DateWithDayExampleObject,
|
||||
expires_date = DateWithDayExampleObject,
|
||||
enabled = true,
|
||||
cancelled = true,
|
||||
on_hot_list = true,
|
||||
technology = technologyExample.value,
|
||||
networks = networksExample.value.split("[,;]").toList,
|
||||
allows = List(CardAction.CREDIT.toString.toLowerCase, CardAction.DEBIT.toString.toLowerCase),
|
||||
account = accountBasicV310,
|
||||
replacement = replacementJSON,
|
||||
pin_reset = List(pinResetJSON),
|
||||
collected = DateWithDayExampleObject,
|
||||
posted = DateWithDayExampleObject,
|
||||
customer_id = customerIdExample.value,
|
||||
card_attributes = List(cardAttributeCommons),
|
||||
cvv = cvvExample.value,
|
||||
brand = brandExample.value
|
||||
)
|
||||
|
||||
val updatePhysicalCardJsonV500 = UpdatePhysicalCardJsonV500(
|
||||
card_type = cardTypeExample.value,
|
||||
name_on_card = nameOnCardExample.value,
|
||||
issue_number = issueNumberExample.value,
|
||||
serial_number = serialNumberExample.value,
|
||||
valid_from_date = DateWithDayExampleObject,
|
||||
expires_date = DateWithDayExampleObject,
|
||||
enabled = true,
|
||||
technology = technologyExample.value,
|
||||
networks = networksExample.value.split("[,;]").toList,
|
||||
allows = List(CardAction.CREDIT.toString.toLowerCase, CardAction.DEBIT.toString.toLowerCase),
|
||||
account_id = accountIdExample.value,
|
||||
replacement = replacementJSON,
|
||||
pin_reset = List(pinResetJSON, pinResetJSON1),
|
||||
collected = DateWithDayExampleObject,
|
||||
posted = DateWithDayExampleObject,
|
||||
customer_id = customerIdExample.value,
|
||||
cvv = cvvExample.value,
|
||||
brand = brandExample.value
|
||||
)
|
||||
//The common error or success format.
|
||||
//Just some helper format to use in Json
|
||||
case class NotSupportedYet()
|
||||
|
||||
@ -372,7 +372,13 @@ object ExampleValue {
|
||||
glossaryItems += makeGlossaryItem("Adapter.card_id", cardIdExample)
|
||||
|
||||
lazy val nameOnCardExample = ConnectorField(owner1Example.value, s"The name on the physical card")
|
||||
glossaryItems += makeGlossaryItem("Adapter.name_on_card", nameOnCardExample)
|
||||
glossaryItems += makeGlossaryItem("Adapter.name_on_card", nameOnCardExample)
|
||||
|
||||
lazy val cvvExample = ConnectorField("123", s"Card Verification Value")
|
||||
glossaryItems += makeGlossaryItem("Adapter.cvv", nameOnCardExample)
|
||||
|
||||
lazy val brandExample = ConnectorField("Visa", s"The brand of the card, eg: Visa, Mastercard")
|
||||
glossaryItems += makeGlossaryItem("Adapter.brand", nameOnCardExample)
|
||||
|
||||
lazy val issueNumberExample = ConnectorField("1", s"The issue number of the physical card, eg 1,2,3,4 ....")
|
||||
glossaryItems += makeGlossaryItem("Adapter.issue_number", issueNumberExample)
|
||||
|
||||
@ -2591,6 +2591,8 @@ object NewStyle extends MdcLoggable{
|
||||
collected: Option[CardCollectionInfo],
|
||||
posted: Option[CardPostedInfo],
|
||||
customerId: String,
|
||||
cvv: String,
|
||||
brand: String,
|
||||
callContext: Option[CallContext]
|
||||
): OBPReturnType[PhysicalCard] = {
|
||||
validateBankId(bankId, callContext)
|
||||
@ -2616,6 +2618,8 @@ object NewStyle extends MdcLoggable{
|
||||
collected: Option[CardCollectionInfo],
|
||||
posted: Option[CardPostedInfo],
|
||||
customerId: String,
|
||||
cvv: String,
|
||||
brand: String,
|
||||
callContext: Option[CallContext]
|
||||
) map {
|
||||
i => (unboxFullOrFail(i._1, callContext, s"$CreateCardError"), i._2)
|
||||
@ -2644,6 +2648,8 @@ object NewStyle extends MdcLoggable{
|
||||
collected: Option[CardCollectionInfo],
|
||||
posted: Option[CardPostedInfo],
|
||||
customerId: String,
|
||||
cvv: String,
|
||||
brand: String,
|
||||
callContext: Option[CallContext]
|
||||
): OBPReturnType[PhysicalCardTrait] = {
|
||||
validateBankId(bankId, callContext)
|
||||
@ -2670,6 +2676,8 @@ object NewStyle extends MdcLoggable{
|
||||
collected: Option[CardCollectionInfo],
|
||||
posted: Option[CardPostedInfo],
|
||||
customerId: String,
|
||||
cvv: String,
|
||||
brand: String,
|
||||
callContext: Option[CallContext]
|
||||
) map {
|
||||
i => (unboxFullOrFail(i._1, callContext, s"$UpdateCardError"), i._2)
|
||||
|
||||
@ -1001,6 +1001,8 @@ trait APIMethods210 {
|
||||
collected= Option(CardCollectionInfo(postJson.collected)),
|
||||
posted= Option(CardPostedInfo(postJson.posted)),
|
||||
customerId = "",// this field is introduced from V310
|
||||
cvv = "",// this field is introduced from V500
|
||||
brand = "",// this field is introduced from V500
|
||||
callContext
|
||||
)
|
||||
|
||||
|
||||
@ -4814,6 +4814,8 @@ trait APIMethods310 {
|
||||
collected = collected,
|
||||
posted = posted,
|
||||
customerId = postJson.customer_id,
|
||||
cvv = "",//added from v500
|
||||
brand = "",//added from v500
|
||||
callContext
|
||||
)
|
||||
} yield {
|
||||
@ -4841,7 +4843,7 @@ trait APIMethods310 {
|
||||
UnknownError
|
||||
),
|
||||
List(apiTagCard, apiTagNewStyle),
|
||||
Some(List(canCreateCardsForBank)))
|
||||
Some(List(canUpdateCardsForBank)))
|
||||
lazy val updatedCardForBank: OBPEndpoint = {
|
||||
case "management" :: "banks" :: BankId(bankId) :: "cards" :: cardId :: Nil JsonPut json -> _ => {
|
||||
cc =>
|
||||
@ -4893,6 +4895,8 @@ trait APIMethods310 {
|
||||
collected= Option(CardCollectionInfo(postJson.collected)),
|
||||
posted = Option(CardPostedInfo(postJson.posted)),
|
||||
customerId = postJson.customer_id,
|
||||
cvv = "", //added from v500
|
||||
brand = "",//added from v500
|
||||
callContext = callContext
|
||||
)
|
||||
} yield {
|
||||
@ -4957,7 +4961,8 @@ trait APIMethods310 {
|
||||
emptyObjectJson,
|
||||
physicalCardWithAttributesJsonV310,
|
||||
List(UserNotLoggedIn,BankNotFound, UnknownError),
|
||||
List(apiTagCard, apiTagNewStyle))
|
||||
List(apiTagCard, apiTagNewStyle),
|
||||
Some(List(canGetCardsForBank)))
|
||||
lazy val getCardForBank : OBPEndpoint = {
|
||||
case "management" :: "banks" :: BankId(bankId) :: "cards" :: cardId :: Nil JsonGet _ => {
|
||||
cc => {
|
||||
|
||||
@ -942,14 +942,13 @@ trait APIMethods400 {
|
||||
(card,callContext) <- NewStyle.function.getPhysicalCardByCardNumber(transactionRequestBodyCard.card.card_number, callContext)
|
||||
|
||||
// 1.2 check card name/expire month. year.
|
||||
|
||||
calendar = Calendar.getInstance
|
||||
_ = calendar.setTime(card.expires)
|
||||
year = calendar.get(Calendar.YEAR)
|
||||
month = calendar.get(Calendar.MONTH)
|
||||
nameOnCard= card.nameOnCard
|
||||
// 1.3 not sure the brand and card_type
|
||||
|
||||
cvv= card.cvv
|
||||
brand= card.brand
|
||||
} yield{
|
||||
(card.account, callContext)
|
||||
}
|
||||
|
||||
@ -10,6 +10,7 @@ import code.api.util.NewStyle.function.extractQueryParams
|
||||
import code.api.util._
|
||||
import code.api.v2_1_0.JSONFactory210
|
||||
import code.api.v3_0_0.JSONFactory300
|
||||
import code.api.v3_1_0.JSONFactory310.createPhysicalCardJson
|
||||
import code.api.v3_1_0._
|
||||
import code.api.v4_0_0.JSONFactory400.createCustomersMinimalJson
|
||||
import code.bankconnectors.Connector
|
||||
@ -21,7 +22,7 @@ import code.views.Views
|
||||
import com.github.dwickern.macros.NameOf.nameOf
|
||||
import com.openbankproject.commons.ExecutionContext.Implicits.global
|
||||
import com.openbankproject.commons.model.enums.StrongCustomerAuthentication
|
||||
import com.openbankproject.commons.model.{AccountId, BankId, CreditLimit, CreditRating, CustomerFaceImage, TransactionRequestType, UserAuthContextUpdateStatus, ViewId}
|
||||
import com.openbankproject.commons.model.{AccountId, BankId, BankIdAccountId, CardAction, CardAttributeCommons, CardCollectionInfo, CardPostedInfo, CardReplacementInfo, CardReplacementReason, CreditLimit, CreditRating, CustomerFaceImage, PinResetInfo, PinResetReason, TransactionRequestType, UserAuthContextUpdateStatus, View, ViewId}
|
||||
import com.openbankproject.commons.util.ApiVersion
|
||||
import net.liftweb.common.Full
|
||||
import net.liftweb.http.Req
|
||||
@ -1019,6 +1020,217 @@ trait APIMethods500 {
|
||||
}
|
||||
}
|
||||
|
||||
staticResourceDocs += ResourceDoc(
|
||||
addCardForBank,
|
||||
implementedInApiVersion,
|
||||
nameOf(addCardForBank),
|
||||
"POST",
|
||||
"/management/banks/BANK_ID/cards",
|
||||
"Create Card",
|
||||
s"""Create Card at bank specified by BANK_ID .
|
||||
|
|
||||
|${authenticationRequiredMessage(true)}
|
||||
|""",
|
||||
createPhysicalCardJsonV500,
|
||||
physicalCardJsonV500,
|
||||
List(
|
||||
$UserNotLoggedIn,
|
||||
$BankNotFound,
|
||||
UserHasMissingRoles,
|
||||
AllowedValuesAre,
|
||||
UnknownError
|
||||
),
|
||||
List(apiTagCard, apiTagNewStyle),
|
||||
Some(List(canCreateCardsForBank)))
|
||||
lazy val addCardForBank: OBPEndpoint = {
|
||||
case "management" :: "banks" :: BankId(bankId) :: "cards" :: Nil JsonPost json -> _ => {
|
||||
cc =>
|
||||
for {
|
||||
(Full(u), _,callContext) <- SS.userBank
|
||||
|
||||
failMsg = s"$InvalidJsonFormat The Json body should be the $CreatePhysicalCardJsonV500 "
|
||||
postJson <- NewStyle.function.tryons(failMsg, 400, callContext) {json.extract[CreatePhysicalCardJsonV500]}
|
||||
|
||||
_ <- postJson.allows match {
|
||||
case List() => Future {true}
|
||||
case _ => Helper.booleanToFuture(AllowedValuesAre + CardAction.availableValues.mkString(", "), cc=callContext)(postJson.allows.forall(a => CardAction.availableValues.contains(a)))
|
||||
}
|
||||
|
||||
failMsg = AllowedValuesAre + CardReplacementReason.availableValues.mkString(", ")
|
||||
cardReplacementReason <- NewStyle.function.tryons(failMsg, 400, callContext) {
|
||||
postJson.replacement match {
|
||||
case Some(value) => CardReplacementReason.valueOf(value.reason_requested)
|
||||
case None => CardReplacementReason.valueOf(CardReplacementReason.FIRST.toString)
|
||||
}
|
||||
}
|
||||
|
||||
_<-Helper.booleanToFuture(s"${maximumLimitExceeded.replace("10000", "10")} Current issue_number is ${postJson.issue_number}", cc=callContext)(postJson.issue_number.length<= 10)
|
||||
|
||||
(_, callContext)<- NewStyle.function.getBankAccount(bankId, AccountId(postJson.account_id), callContext)
|
||||
|
||||
(_, callContext)<- NewStyle.function.getCustomerByCustomerId(postJson.customer_id, callContext)
|
||||
|
||||
replacement = postJson.replacement match {
|
||||
case Some(replacement) =>
|
||||
Some(CardReplacementInfo(requestedDate = replacement.requested_date, cardReplacementReason))
|
||||
case None => None
|
||||
}
|
||||
collected = postJson.collected match {
|
||||
case Some(collected) => Some(CardCollectionInfo(collected))
|
||||
case None => None
|
||||
}
|
||||
posted = postJson.posted match {
|
||||
case Some(posted) => Option(CardPostedInfo(posted))
|
||||
case None => None
|
||||
}
|
||||
|
||||
(card, callContext) <- NewStyle.function.createPhysicalCard(
|
||||
bankCardNumber=postJson.card_number,
|
||||
nameOnCard=postJson.name_on_card,
|
||||
cardType = postJson.card_type,
|
||||
issueNumber=postJson.issue_number,
|
||||
serialNumber=postJson.serial_number,
|
||||
validFrom=postJson.valid_from_date,
|
||||
expires=postJson.expires_date,
|
||||
enabled=postJson.enabled,
|
||||
cancelled=false,
|
||||
onHotList=false,
|
||||
technology=postJson.technology,
|
||||
networks= postJson.networks,
|
||||
allows= postJson.allows,
|
||||
accountId= postJson.account_id,
|
||||
bankId=bankId.value,
|
||||
replacement = replacement,
|
||||
pinResets= postJson.pin_reset.map(e => PinResetInfo(e.requested_date, PinResetReason.valueOf(e.reason_requested.toUpperCase))),
|
||||
collected = collected,
|
||||
posted = posted,
|
||||
customerId = postJson.customer_id,
|
||||
cvv = postJson.cvv,
|
||||
brand = postJson.brand,
|
||||
callContext
|
||||
)
|
||||
} yield {
|
||||
(createPhysicalCardJson(card, u), HttpCode.`201`(callContext))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
staticResourceDocs += ResourceDoc(
|
||||
getCardForBank,
|
||||
implementedInApiVersion,
|
||||
nameOf(getCardForBank),
|
||||
"GET",
|
||||
"/management/banks/BANK_ID/cards/CARD_ID",
|
||||
"Get Card By Id",
|
||||
s"""
|
||||
|This will the details of the card.
|
||||
|It shows the account information which linked the the card.
|
||||
|Also shows the card attributes of the card.
|
||||
|
|
||||
""".stripMargin,
|
||||
emptyObjectJson,
|
||||
physicalCardWithAttributesJsonV500,
|
||||
List($UserNotLoggedIn,$BankNotFound, UnknownError),
|
||||
List(apiTagCard, apiTagNewStyle),
|
||||
Some(List(canGetCardsForBank))
|
||||
)
|
||||
lazy val getCardForBank : OBPEndpoint = {
|
||||
case "management" :: "banks" :: BankId(bankId) :: "cards" :: cardId :: Nil JsonGet _ => {
|
||||
cc => {
|
||||
for {
|
||||
(Full(u), _,callContext) <- SS.userBank
|
||||
(card, callContext) <- NewStyle.function.getPhysicalCardForBank(bankId, cardId, callContext)
|
||||
(cardAttributes, callContext) <- NewStyle.function.getCardAttributesFromProvider(cardId, callContext)
|
||||
} yield {
|
||||
val views: List[View] = Views.views.vend.assignedViewsForAccount(BankIdAccountId(card.account.bankId, card.account.accountId))
|
||||
val commonsData: List[CardAttributeCommons]= cardAttributes
|
||||
(JSONFactory500.createPhysicalCardWithAttributesJson(card, commonsData, u, views), HttpCode.`200`(callContext))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
staticResourceDocs += ResourceDoc(
|
||||
updatedCardForBank,
|
||||
implementedInApiVersion,
|
||||
nameOf(updatedCardForBank),
|
||||
"PUT",
|
||||
"/management/banks/BANK_ID/cards/CARD_ID",
|
||||
"Update Card",
|
||||
s"""Update Card at bank specified by CARD_ID .
|
||||
|${authenticationRequiredMessage(true)}
|
||||
|""",
|
||||
updatePhysicalCardJsonV500,
|
||||
physicalCardJsonV500,
|
||||
List(
|
||||
$UserNotLoggedIn,
|
||||
$BankNotFound,
|
||||
UserHasMissingRoles,
|
||||
AllowedValuesAre,
|
||||
UnknownError
|
||||
),
|
||||
List(apiTagCard, apiTagNewStyle),
|
||||
Some(List(canUpdateCardsForBank)))
|
||||
lazy val updatedCardForBank: OBPEndpoint = {
|
||||
case "management" :: "banks" :: BankId(bankId) :: "cards" :: cardId :: Nil JsonPut json -> _ => {
|
||||
cc =>
|
||||
for {
|
||||
(Full(u), _,callContext) <- SS.userBank
|
||||
failMsg = s"$InvalidJsonFormat The Json body should be the $UpdatePhysicalCardJsonV310 "
|
||||
postJson <- NewStyle.function.tryons(failMsg, 400, callContext) {
|
||||
json.extract[UpdatePhysicalCardJsonV500]
|
||||
}
|
||||
_ <- postJson.allows match {
|
||||
case List() => Future {1}
|
||||
case _ => Helper.booleanToFuture(AllowedValuesAre + CardAction.availableValues.mkString(", "), cc=callContext)(postJson.allows.forall(a => CardAction.availableValues.contains(a)))
|
||||
}
|
||||
|
||||
failMsg = AllowedValuesAre + CardReplacementReason.availableValues.mkString(", ")
|
||||
_ <- NewStyle.function.tryons(failMsg, 400, callContext) {
|
||||
CardReplacementReason.valueOf(postJson.replacement.reason_requested)
|
||||
}
|
||||
|
||||
_<-Helper.booleanToFuture(s"${maximumLimitExceeded.replace("10000", "10")} Current issue_number is ${postJson.issue_number}", cc=callContext)(postJson.issue_number.length<= 10)
|
||||
|
||||
(_, callContext)<- NewStyle.function.getBankAccount(bankId, AccountId(postJson.account_id), callContext)
|
||||
|
||||
(card, callContext) <- NewStyle.function.getPhysicalCardForBank(bankId, cardId, callContext)
|
||||
|
||||
(_, callContext)<- NewStyle.function.getCustomerByCustomerId(postJson.customer_id, callContext)
|
||||
|
||||
(card, callContext) <- NewStyle.function.updatePhysicalCard(
|
||||
cardId = cardId,
|
||||
bankCardNumber=card.bankCardNumber,
|
||||
cardType = postJson.card_type,
|
||||
nameOnCard=postJson.name_on_card,
|
||||
issueNumber=postJson.issue_number,
|
||||
serialNumber=postJson.serial_number,
|
||||
validFrom=postJson.valid_from_date,
|
||||
expires=postJson.expires_date,
|
||||
enabled=postJson.enabled,
|
||||
cancelled=false,
|
||||
onHotList=false,
|
||||
technology=postJson.technology,
|
||||
networks= postJson.networks,
|
||||
allows= postJson.allows,
|
||||
accountId= postJson.account_id,
|
||||
bankId=bankId.value,
|
||||
replacement= Some(CardReplacementInfo(requestedDate = postJson.replacement.requested_date, CardReplacementReason.valueOf(postJson.replacement.reason_requested))),
|
||||
pinResets= postJson.pin_reset.map(e => PinResetInfo(e.requested_date, PinResetReason.valueOf(e.reason_requested.toUpperCase))),
|
||||
collected= Option(CardCollectionInfo(postJson.collected)),
|
||||
posted = Option(CardPostedInfo(postJson.posted)),
|
||||
customerId = postJson.customer_id,
|
||||
cvv = postJson.cvv,
|
||||
brand = postJson.brand,
|
||||
callContext = callContext
|
||||
)
|
||||
} yield {
|
||||
(createPhysicalCardJson(card, u), HttpCode.`200`(callContext))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -27,15 +27,16 @@
|
||||
package code.api.v5_0_0
|
||||
|
||||
import java.util.Date
|
||||
|
||||
import code.api.util.APIUtil.stringOrNull
|
||||
import code.api.v1_2_1.BankRoutingJsonV121
|
||||
import code.api.v1_3_0.JSONFactory1_3_0.{cardActionsToString, createAccountJson, createPinResetJson, createReplacementJson}
|
||||
import code.api.v1_3_0.{PinResetJSON, ReplacementJSON}
|
||||
import code.api.v1_4_0.JSONFactory1_4_0.CustomerFaceImageJson
|
||||
import code.api.v2_1_0.CustomerCreditRatingJSON
|
||||
import code.api.v3_1_0.PostConsentEntitlementJsonV310
|
||||
import code.api.v3_1_0.{AccountBasicV310, PhysicalCardWithAttributesJsonV310, PostConsentEntitlementJsonV310}
|
||||
import code.api.v4_0_0.BankAttributeBankResponseJsonV400
|
||||
import code.bankattribute.BankAttribute
|
||||
import com.openbankproject.commons.model.{AccountRoutingJsonV121, AmountOfMoneyJsonV121, Bank, UserAuthContext, UserAuthContextUpdate}
|
||||
import com.openbankproject.commons.model.{AccountRoutingJsonV121, AmountOfMoneyJsonV121, Bank, CardAttribute, PhysicalCardTrait, User, UserAuthContext, UserAuthContextUpdate, View, ViewBasic}
|
||||
import net.liftweb.json.JsonAST.JValue
|
||||
|
||||
import scala.collection.immutable.List
|
||||
@ -129,6 +130,103 @@ case class PostConsentRequestJsonV500(
|
||||
)
|
||||
|
||||
case class ConsentJsonV500(consent_id: String, jwt: String, status: String, consent_request_id: Option[String])
|
||||
|
||||
case class CreatePhysicalCardJsonV500(
|
||||
card_number: String,
|
||||
card_type: String,
|
||||
name_on_card: String,
|
||||
issue_number: String,
|
||||
serial_number: String,
|
||||
valid_from_date: Date,
|
||||
expires_date: Date,
|
||||
enabled: Boolean,
|
||||
technology: String,
|
||||
networks: List[String],
|
||||
allows: List[String],
|
||||
account_id: String,
|
||||
replacement: Option[ReplacementJSON],
|
||||
pin_reset: List[PinResetJSON],
|
||||
collected: Option[Date],
|
||||
posted: Option[Date],
|
||||
customer_id: String,
|
||||
cvv: String,
|
||||
brand: String
|
||||
)
|
||||
|
||||
case class PhysicalCardJsonV500(
|
||||
card_id: String,
|
||||
bank_id: String,
|
||||
card_number: String,
|
||||
card_type: String,
|
||||
name_on_card: String,
|
||||
issue_number: String,
|
||||
serial_number: String,
|
||||
valid_from_date: Date,
|
||||
expires_date: Date,
|
||||
enabled: Boolean,
|
||||
cancelled: Boolean,
|
||||
on_hot_list: Boolean,
|
||||
technology: String,
|
||||
networks: List[String],
|
||||
allows: List[String],
|
||||
account: code.api.v1_2_1.AccountJSON,
|
||||
replacement: ReplacementJSON,
|
||||
pin_reset: List[PinResetJSON],
|
||||
collected: Date,
|
||||
posted: Date,
|
||||
customer_id: String,
|
||||
cvv: String,
|
||||
brand: String
|
||||
)
|
||||
|
||||
case class PhysicalCardWithAttributesJsonV500(
|
||||
card_id: String,
|
||||
bank_id: String,
|
||||
card_number: String,
|
||||
card_type: String,
|
||||
name_on_card: String,
|
||||
issue_number: String,
|
||||
serial_number: String,
|
||||
valid_from_date: Date,
|
||||
expires_date: Date,
|
||||
enabled: Boolean,
|
||||
cancelled: Boolean,
|
||||
on_hot_list: Boolean,
|
||||
technology: String,
|
||||
networks: List[String],
|
||||
allows: List[String],
|
||||
account: AccountBasicV310,
|
||||
replacement: ReplacementJSON,
|
||||
pin_reset: List[PinResetJSON],
|
||||
collected: Date,
|
||||
posted: Date,
|
||||
customer_id: String,
|
||||
card_attributes: List[CardAttribute],
|
||||
cvv: String,
|
||||
brand: String
|
||||
)
|
||||
|
||||
case class UpdatePhysicalCardJsonV500(
|
||||
card_type: String,
|
||||
name_on_card: String,
|
||||
issue_number: String,
|
||||
serial_number: String,
|
||||
valid_from_date: Date,
|
||||
expires_date: Date,
|
||||
enabled: Boolean,
|
||||
technology: String,
|
||||
networks: List[String],
|
||||
allows: List[String],
|
||||
account_id: String,
|
||||
replacement: ReplacementJSON,
|
||||
pin_reset: List[PinResetJSON],
|
||||
collected: Date,
|
||||
posted: Date,
|
||||
customer_id: String,
|
||||
cvv: String,
|
||||
brand: String
|
||||
)
|
||||
|
||||
object JSONFactory500 {
|
||||
|
||||
def createUserAuthContextJson(userAuthContext: UserAuthContext): UserAuthContextJsonV500 = {
|
||||
@ -180,6 +278,66 @@ object JSONFactory500 {
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
def createPhysicalCardWithAttributesJson(card: PhysicalCardTrait, cardAttributes: List[CardAttribute],user : User, views: List[View]): PhysicalCardWithAttributesJsonV500 = {
|
||||
PhysicalCardWithAttributesJsonV500(
|
||||
card_id = stringOrNull(card.cardId),
|
||||
bank_id = stringOrNull(card.bankId),
|
||||
card_number = stringOrNull(card.bankCardNumber),
|
||||
card_type = stringOrNull(card.cardType),
|
||||
name_on_card = stringOrNull(card.nameOnCard),
|
||||
issue_number = stringOrNull(card.issueNumber),
|
||||
serial_number = stringOrNull(card.serialNumber),
|
||||
valid_from_date = card.validFrom,
|
||||
expires_date = card.expires,
|
||||
enabled = card.enabled,
|
||||
cancelled = card.cancelled,
|
||||
on_hot_list = card.onHotList,
|
||||
technology = stringOrNull(card.technology),
|
||||
networks = card.networks,
|
||||
allows = card.allows.map(cardActionsToString).toList,
|
||||
account = AccountBasicV310(
|
||||
card.account.accountId.value,
|
||||
card.account.label,
|
||||
views.map(view => ViewBasic(view.viewId.value, view.name, view.description)),
|
||||
card.account.bankId.value),
|
||||
replacement = card.replacement.map(createReplacementJson).getOrElse(null),
|
||||
pin_reset = card.pinResets.map(createPinResetJson),
|
||||
collected = card.collected.map(_.date).getOrElse(null),
|
||||
posted = card.posted.map(_.date).getOrElse(null),
|
||||
customer_id = stringOrNull(card.customerId),
|
||||
card_attributes = cardAttributes,
|
||||
cvv = stringOrNull(card.cvv),
|
||||
brand = stringOrNull(card.brand),
|
||||
)
|
||||
}
|
||||
def createPhysicalCardJson(card: PhysicalCardTrait, user : User): PhysicalCardJsonV500 = {
|
||||
PhysicalCardJsonV500(
|
||||
card_id = stringOrNull(card.cardId),
|
||||
bank_id = stringOrNull(card.bankId),
|
||||
card_number = stringOrNull(card.bankCardNumber),
|
||||
card_type = stringOrNull(card.cardType),
|
||||
name_on_card = stringOrNull(card.nameOnCard),
|
||||
issue_number = stringOrNull(card.issueNumber),
|
||||
serial_number = stringOrNull(card.serialNumber),
|
||||
valid_from_date = card.validFrom,
|
||||
expires_date = card.expires,
|
||||
enabled = card.enabled,
|
||||
cancelled = card.cancelled,
|
||||
on_hot_list = card.onHotList,
|
||||
technology = stringOrNull(card.technology),
|
||||
networks = card.networks,
|
||||
allows = card.allows.map(cardActionsToString).toList,
|
||||
account = createAccountJson(card.account, user),
|
||||
replacement = card.replacement.map(createReplacementJson).getOrElse(null),
|
||||
pin_reset = card.pinResets.map(createPinResetJson),
|
||||
collected = card.collected.map(_.date).getOrElse(null),
|
||||
posted = card.posted.map(_.date).getOrElse(null),
|
||||
customer_id = stringOrNull(card.customerId),
|
||||
cvv = stringOrNull(card.cvv),
|
||||
brand = stringOrNull(card.brand)
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -657,6 +657,8 @@ trait Connector extends MdcLoggable {
|
||||
collected: Option[CardCollectionInfo],
|
||||
posted: Option[CardPostedInfo],
|
||||
customerId: String,
|
||||
cvv: String,
|
||||
brand: String,
|
||||
callContext: Option[CallContext]
|
||||
): Box[PhysicalCard] = Failure(setUnimplementedError)
|
||||
|
||||
@ -681,6 +683,8 @@ trait Connector extends MdcLoggable {
|
||||
collected: Option[CardCollectionInfo],
|
||||
posted: Option[CardPostedInfo],
|
||||
customerId: String,
|
||||
cvv: String,
|
||||
brand: String,
|
||||
callContext: Option[CallContext]
|
||||
): OBPReturnType[Box[PhysicalCard]] = Future{(Failure{setUnimplementedError}, callContext)}
|
||||
|
||||
@ -706,6 +710,8 @@ trait Connector extends MdcLoggable {
|
||||
collected: Option[CardCollectionInfo],
|
||||
posted: Option[CardPostedInfo],
|
||||
customerId: String,
|
||||
cvv: String,
|
||||
brand: String,
|
||||
callContext: Option[CallContext]
|
||||
): OBPReturnType[Box[PhysicalCardTrait]] = Future{(Failure{setUnimplementedError}, callContext)}
|
||||
|
||||
|
||||
@ -1204,7 +1204,9 @@ object LocalMappedConnector extends Connector with MdcLoggable {
|
||||
pinResets = l.pinResets,
|
||||
collected = l.collected,
|
||||
posted = l.posted,
|
||||
customerId = l.customerId
|
||||
customerId = l.customerId,
|
||||
cvv = l.cvv,
|
||||
brand = l.brand
|
||||
)
|
||||
(Full(cardList), callContext)
|
||||
}
|
||||
@ -1247,7 +1249,9 @@ object LocalMappedConnector extends Connector with MdcLoggable {
|
||||
pinResets = l.pinResets,
|
||||
collected = l.collected,
|
||||
posted = l.posted,
|
||||
customerId = l.customerId
|
||||
customerId = l.customerId,
|
||||
cvv = l.cvv,
|
||||
brand = l.brand
|
||||
)
|
||||
Full(cardList)
|
||||
}
|
||||
@ -1283,6 +1287,8 @@ object LocalMappedConnector extends Connector with MdcLoggable {
|
||||
collected: Option[CardCollectionInfo],
|
||||
posted: Option[CardPostedInfo],
|
||||
customerId: String,
|
||||
cvv: String,
|
||||
brand: String,
|
||||
callContext: Option[CallContext]): OBPReturnType[Box[PhysicalCard]] = Future {
|
||||
(createPhysicalCardLegacy(
|
||||
bankCardNumber: String,
|
||||
@ -1305,6 +1311,8 @@ object LocalMappedConnector extends Connector with MdcLoggable {
|
||||
collected: Option[CardCollectionInfo],
|
||||
posted: Option[CardPostedInfo],
|
||||
customerId: String,
|
||||
cvv: String,
|
||||
brand: String,
|
||||
callContext: Option[CallContext]),
|
||||
callContext)
|
||||
}
|
||||
@ -1331,6 +1339,8 @@ object LocalMappedConnector extends Connector with MdcLoggable {
|
||||
collected: Option[CardCollectionInfo],
|
||||
posted: Option[CardPostedInfo],
|
||||
customerId: String,
|
||||
cvv: String,
|
||||
brand: String,
|
||||
callContext: Option[CallContext]): Box[PhysicalCard] = {
|
||||
val physicalCardBox: Box[MappedPhysicalCard] = code.cards.PhysicalCard.physicalCardProvider.vend.createPhysicalCard(
|
||||
bankCardNumber: String,
|
||||
@ -1353,6 +1363,8 @@ object LocalMappedConnector extends Connector with MdcLoggable {
|
||||
collected: Option[CardCollectionInfo],
|
||||
posted: Option[CardPostedInfo],
|
||||
customerId: String,
|
||||
cvv: String,
|
||||
brand: String,
|
||||
callContext: Option[CallContext])
|
||||
|
||||
for (l <- physicalCardBox) yield
|
||||
@ -1377,7 +1389,9 @@ object LocalMappedConnector extends Connector with MdcLoggable {
|
||||
pinResets = l.pinResets,
|
||||
collected = l.collected,
|
||||
posted = l.posted,
|
||||
customerId = l.customerId
|
||||
customerId = l.customerId,
|
||||
cvv = l.cvv,
|
||||
brand = l.brand,
|
||||
)
|
||||
}
|
||||
|
||||
@ -1403,6 +1417,8 @@ object LocalMappedConnector extends Connector with MdcLoggable {
|
||||
collected: Option[CardCollectionInfo],
|
||||
posted: Option[CardPostedInfo],
|
||||
customerId: String,
|
||||
cvv: String,
|
||||
brand: String,
|
||||
callContext: Option[CallContext]
|
||||
): OBPReturnType[Box[PhysicalCardTrait]] = Future {
|
||||
(
|
||||
@ -1428,6 +1444,8 @@ object LocalMappedConnector extends Connector with MdcLoggable {
|
||||
collected: Option[CardCollectionInfo],
|
||||
posted: Option[CardPostedInfo],
|
||||
customerId: String,
|
||||
cvv: String,
|
||||
brand: String,
|
||||
callContext: Option[CallContext]),
|
||||
callContext)
|
||||
}
|
||||
|
||||
@ -1430,7 +1430,10 @@ object AkkaConnector_vDec2018 extends Connector with AkkaConnectorActorInit {
|
||||
reasonRequested=com.openbankproject.commons.model.PinResetReason.FORGOT)),
|
||||
collected=Some(CardCollectionInfo(toDate(collectedExample))),
|
||||
posted=Some(CardPostedInfo(toDate(postedExample))),
|
||||
customerId=customerIdExample.value)))
|
||||
customerId=customerIdExample.value,
|
||||
cvv = cvvExample.value,
|
||||
brand = brandExample.value
|
||||
)))
|
||||
),
|
||||
adapterImplementation = Some(AdapterImplementation("- Core", 1))
|
||||
)
|
||||
@ -1496,7 +1499,10 @@ object AkkaConnector_vDec2018 extends Connector with AkkaConnectorActorInit {
|
||||
reasonRequested=com.openbankproject.commons.model.PinResetReason.FORGOT)),
|
||||
collected=Some(CardCollectionInfo(toDate(collectedExample))),
|
||||
posted=Some(CardPostedInfo(toDate(postedExample))),
|
||||
customerId=customerIdExample.value))
|
||||
customerId=customerIdExample.value,
|
||||
cvv = cvvExample.value,
|
||||
brand = brandExample.value
|
||||
))
|
||||
),
|
||||
adapterImplementation = Some(AdapterImplementation("- Core", 1))
|
||||
)
|
||||
@ -1610,7 +1616,9 @@ object AkkaConnector_vDec2018 extends Connector with AkkaConnectorActorInit {
|
||||
reasonRequested=com.openbankproject.commons.model.PinResetReason.FORGOT)),
|
||||
collected=Some(CardCollectionInfo(toDate(collectedExample))),
|
||||
posted=Some(CardPostedInfo(toDate(postedExample))),
|
||||
customerId=customerIdExample.value)))
|
||||
customerId=customerIdExample.value,
|
||||
cvv = cvvExample.value,
|
||||
brand = brandExample.value)))
|
||||
),
|
||||
adapterImplementation = Some(AdapterImplementation("- Core", 1))
|
||||
)
|
||||
@ -1652,7 +1660,10 @@ object AkkaConnector_vDec2018 extends Connector with AkkaConnectorActorInit {
|
||||
reasonRequested=com.openbankproject.commons.model.PinResetReason.FORGOT)),
|
||||
collected=Some(CardCollectionInfo(toDate(collectedExample))),
|
||||
posted=Some(CardPostedInfo(toDate(postedExample))),
|
||||
customerId=customerIdExample.value)
|
||||
customerId=customerIdExample.value,
|
||||
cvv = cvvExample.value,
|
||||
brand = brandExample.value
|
||||
)
|
||||
),
|
||||
exampleInboundMessage = (
|
||||
InBoundCreatePhysicalCard(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext,
|
||||
@ -1696,14 +1707,21 @@ object AkkaConnector_vDec2018 extends Connector with AkkaConnectorActorInit {
|
||||
reasonRequested=com.openbankproject.commons.model.PinResetReason.FORGOT)),
|
||||
collected=Some(CardCollectionInfo(toDate(collectedExample))),
|
||||
posted=Some(CardPostedInfo(toDate(postedExample))),
|
||||
customerId=customerIdExample.value))
|
||||
customerId=customerIdExample.value,
|
||||
cvv = cvvExample.value,
|
||||
brand = brandExample.value))
|
||||
),
|
||||
adapterImplementation = Some(AdapterImplementation("- Core", 1))
|
||||
)
|
||||
|
||||
override def createPhysicalCard(bankCardNumber: String, nameOnCard: String, cardType: String, issueNumber: String, serialNumber: String, validFrom: Date, expires: Date, enabled: Boolean, cancelled: Boolean, onHotList: Boolean, technology: String, networks: List[String], allows: List[String], accountId: String, bankId: String, replacement: Option[CardReplacementInfo], pinResets: List[PinResetInfo], collected: Option[CardCollectionInfo], posted: Option[CardPostedInfo], customerId: String, callContext: Option[CallContext]): OBPReturnType[Box[PhysicalCard]] = {
|
||||
override def createPhysicalCard(bankCardNumber: String, nameOnCard: String, cardType: String, issueNumber: String,
|
||||
serialNumber: String, validFrom: Date, expires: Date, enabled: Boolean, cancelled: Boolean, onHotList: Boolean,
|
||||
technology: String, networks: List[String], allows: List[String], accountId: String, bankId: String,
|
||||
replacement: Option[CardReplacementInfo], pinResets: List[PinResetInfo], collected: Option[CardCollectionInfo],
|
||||
posted: Option[CardPostedInfo], customerId: String, cvv: String, brand: String,
|
||||
callContext: Option[CallContext]): OBPReturnType[Box[PhysicalCard]] = {
|
||||
import com.openbankproject.commons.dto.{InBoundCreatePhysicalCard => InBound, OutBoundCreatePhysicalCard => OutBound}
|
||||
val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, bankCardNumber, nameOnCard, cardType, issueNumber, serialNumber, validFrom, expires, enabled, cancelled, onHotList, technology, networks, allows, accountId, bankId, replacement, pinResets, collected, posted, customerId)
|
||||
val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, bankCardNumber, nameOnCard, cardType, issueNumber, serialNumber, validFrom, expires, enabled, cancelled, onHotList, technology, networks, allows, accountId, bankId, replacement, pinResets, collected, posted, customerId,cvv,brand)
|
||||
val response: Future[Box[InBound]] = (southSideActor ? req).mapTo[InBound].recoverWith(recoverFunction).map(Box !! _)
|
||||
response.map(convertToTuple[PhysicalCard](callContext))
|
||||
}
|
||||
@ -1739,7 +1757,9 @@ object AkkaConnector_vDec2018 extends Connector with AkkaConnectorActorInit {
|
||||
reasonRequested=com.openbankproject.commons.model.PinResetReason.FORGOT)),
|
||||
collected=Some(CardCollectionInfo(toDate(collectedExample))),
|
||||
posted=Some(CardPostedInfo(toDate(postedExample))),
|
||||
customerId=customerIdExample.value)
|
||||
customerId=customerIdExample.value,
|
||||
cvv = cvvExample.value,
|
||||
brand = brandExample.value)
|
||||
),
|
||||
exampleInboundMessage = (
|
||||
InBoundUpdatePhysicalCard(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext,
|
||||
@ -1783,14 +1803,17 @@ object AkkaConnector_vDec2018 extends Connector with AkkaConnectorActorInit {
|
||||
reasonRequested=com.openbankproject.commons.model.PinResetReason.FORGOT)),
|
||||
collected=Some(CardCollectionInfo(toDate(collectedExample))),
|
||||
posted=Some(CardPostedInfo(toDate(postedExample))),
|
||||
customerId=customerIdExample.value))
|
||||
customerId=customerIdExample.value,
|
||||
cvv = cvvExample.value,
|
||||
brand = brandExample.value))
|
||||
),
|
||||
adapterImplementation = Some(AdapterImplementation("- Core", 1))
|
||||
)
|
||||
|
||||
override def updatePhysicalCard(cardId: String, bankCardNumber: String, nameOnCard: String, cardType: String, issueNumber: String, serialNumber: String, validFrom: Date, expires: Date, enabled: Boolean, cancelled: Boolean, onHotList: Boolean, technology: String, networks: List[String], allows: List[String], accountId: String, bankId: String, replacement: Option[CardReplacementInfo], pinResets: List[PinResetInfo], collected: Option[CardCollectionInfo], posted: Option[CardPostedInfo], customerId: String, callContext: Option[CallContext]): OBPReturnType[Box[PhysicalCardTrait]] = {
|
||||
override def updatePhysicalCard(cardId: String, bankCardNumber: String, nameOnCard: String, cardType: String, issueNumber: String, serialNumber: String, validFrom: Date, expires: Date, enabled: Boolean, cancelled: Boolean, onHotList: Boolean, technology: String, networks: List[String], allows: List[String], accountId: String, bankId: String, replacement: Option[CardReplacementInfo], pinResets: List[PinResetInfo], collected: Option[CardCollectionInfo], posted: Option[CardPostedInfo], customerId: String,
|
||||
cvv: String, brand: String, callContext: Option[CallContext]): OBPReturnType[Box[PhysicalCardTrait]] = {
|
||||
import com.openbankproject.commons.dto.{InBoundUpdatePhysicalCard => InBound, OutBoundUpdatePhysicalCard => OutBound}
|
||||
val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, cardId, bankCardNumber, nameOnCard, cardType, issueNumber, serialNumber, validFrom, expires, enabled, cancelled, onHotList, technology, networks, allows, accountId, bankId, replacement, pinResets, collected, posted, customerId)
|
||||
val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, cardId, bankCardNumber, nameOnCard, cardType, issueNumber, serialNumber, validFrom, expires, enabled, cancelled, onHotList, technology, networks, allows, accountId, bankId, replacement, pinResets, collected, posted, customerId, cvv, brand)
|
||||
val response: Future[Box[InBound]] = (southSideActor ? req).mapTo[InBound].recoverWith(recoverFunction).map(Box !! _)
|
||||
response.map(convertToTuple[PhysicalCard](callContext))
|
||||
}
|
||||
|
||||
@ -1570,7 +1570,10 @@ trait RestConnector_vMar2019 extends Connector with KafkaHelper with MdcLoggable
|
||||
reasonRequested=com.openbankproject.commons.model.PinResetReason.FORGOT)),
|
||||
collected=Some(CardCollectionInfo(toDate(collectedExample))),
|
||||
posted=Some(CardPostedInfo(toDate(postedExample))),
|
||||
customerId=customerIdExample.value)))
|
||||
customerId=customerIdExample.value,
|
||||
cvv = cvvExample.value,
|
||||
brand = brandExample.value
|
||||
)))
|
||||
),
|
||||
adapterImplementation = Some(AdapterImplementation("- Core", 1))
|
||||
)
|
||||
@ -1636,7 +1639,9 @@ trait RestConnector_vMar2019 extends Connector with KafkaHelper with MdcLoggable
|
||||
reasonRequested=com.openbankproject.commons.model.PinResetReason.FORGOT)),
|
||||
collected=Some(CardCollectionInfo(toDate(collectedExample))),
|
||||
posted=Some(CardPostedInfo(toDate(postedExample))),
|
||||
customerId=customerIdExample.value))
|
||||
customerId=customerIdExample.value,
|
||||
cvv = cvvExample.value,
|
||||
brand = brandExample.value))
|
||||
),
|
||||
adapterImplementation = Some(AdapterImplementation("- Core", 1))
|
||||
)
|
||||
@ -1750,7 +1755,10 @@ trait RestConnector_vMar2019 extends Connector with KafkaHelper with MdcLoggable
|
||||
reasonRequested=com.openbankproject.commons.model.PinResetReason.FORGOT)),
|
||||
collected=Some(CardCollectionInfo(toDate(collectedExample))),
|
||||
posted=Some(CardPostedInfo(toDate(postedExample))),
|
||||
customerId=customerIdExample.value)))
|
||||
customerId=customerIdExample.value,
|
||||
cvv = cvvExample.value,
|
||||
brand = brandExample.value
|
||||
)))
|
||||
),
|
||||
adapterImplementation = Some(AdapterImplementation("- Core", 1))
|
||||
)
|
||||
@ -1792,7 +1800,9 @@ trait RestConnector_vMar2019 extends Connector with KafkaHelper with MdcLoggable
|
||||
reasonRequested=com.openbankproject.commons.model.PinResetReason.FORGOT)),
|
||||
collected=Some(CardCollectionInfo(toDate(collectedExample))),
|
||||
posted=Some(CardPostedInfo(toDate(postedExample))),
|
||||
customerId=customerIdExample.value)
|
||||
customerId=customerIdExample.value,
|
||||
cvv = cvvExample.value,
|
||||
brand = brandExample.value)
|
||||
),
|
||||
exampleInboundMessage = (
|
||||
InBoundCreatePhysicalCard(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext,
|
||||
@ -1836,14 +1846,20 @@ trait RestConnector_vMar2019 extends Connector with KafkaHelper with MdcLoggable
|
||||
reasonRequested=com.openbankproject.commons.model.PinResetReason.FORGOT)),
|
||||
collected=Some(CardCollectionInfo(toDate(collectedExample))),
|
||||
posted=Some(CardPostedInfo(toDate(postedExample))),
|
||||
customerId=customerIdExample.value))
|
||||
customerId=customerIdExample.value,
|
||||
cvv = cvvExample.value,
|
||||
brand = brandExample.value))
|
||||
),
|
||||
adapterImplementation = Some(AdapterImplementation("- Core", 1))
|
||||
)
|
||||
|
||||
override def createPhysicalCard(bankCardNumber: String, nameOnCard: String, cardType: String, issueNumber: String, serialNumber: String, validFrom: Date, expires: Date, enabled: Boolean, cancelled: Boolean, onHotList: Boolean, technology: String, networks: List[String], allows: List[String], accountId: String, bankId: String, replacement: Option[CardReplacementInfo], pinResets: List[PinResetInfo], collected: Option[CardCollectionInfo], posted: Option[CardPostedInfo], customerId: String, callContext: Option[CallContext]): OBPReturnType[Box[PhysicalCard]] = {
|
||||
override def createPhysicalCard(bankCardNumber: String, nameOnCard: String, cardType: String, issueNumber: String,
|
||||
serialNumber: String, validFrom: Date, expires: Date, enabled: Boolean, cancelled: Boolean, onHotList: Boolean,
|
||||
technology: String, networks: List[String], allows: List[String], accountId: String, bankId: String,
|
||||
replacement: Option[CardReplacementInfo], pinResets: List[PinResetInfo], collected: Option[CardCollectionInfo],
|
||||
posted: Option[CardPostedInfo], customerId: String, cvv: String, brand: String, callContext: Option[CallContext]): OBPReturnType[Box[PhysicalCard]] = {
|
||||
import com.openbankproject.commons.dto.{InBoundCreatePhysicalCard => InBound, OutBoundCreatePhysicalCard => OutBound}
|
||||
val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, bankCardNumber, nameOnCard, cardType, issueNumber, serialNumber, validFrom, expires, enabled, cancelled, onHotList, technology, networks, allows, accountId, bankId, replacement, pinResets, collected, posted, customerId)
|
||||
val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, bankCardNumber, nameOnCard, cardType, issueNumber, serialNumber, validFrom, expires, enabled, cancelled, onHotList, technology, networks, allows, accountId, bankId, replacement, pinResets, collected, posted, customerId, cvv, brand)
|
||||
val response: Future[Box[InBound]] = sendRequest[InBound](getUrl(callContext, "createPhysicalCard"), HttpMethods.POST, req, callContext)
|
||||
response.map(convertToTuple[PhysicalCard](callContext))
|
||||
}
|
||||
@ -1879,7 +1895,9 @@ trait RestConnector_vMar2019 extends Connector with KafkaHelper with MdcLoggable
|
||||
reasonRequested=com.openbankproject.commons.model.PinResetReason.FORGOT)),
|
||||
collected=Some(CardCollectionInfo(toDate(collectedExample))),
|
||||
posted=Some(CardPostedInfo(toDate(postedExample))),
|
||||
customerId=customerIdExample.value)
|
||||
customerId=customerIdExample.value,
|
||||
cvv = cvvExample.value,
|
||||
brand = brandExample.value)
|
||||
),
|
||||
exampleInboundMessage = (
|
||||
InBoundUpdatePhysicalCard(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext,
|
||||
@ -1923,14 +1941,16 @@ trait RestConnector_vMar2019 extends Connector with KafkaHelper with MdcLoggable
|
||||
reasonRequested=com.openbankproject.commons.model.PinResetReason.FORGOT)),
|
||||
collected=Some(CardCollectionInfo(toDate(collectedExample))),
|
||||
posted=Some(CardPostedInfo(toDate(postedExample))),
|
||||
customerId=customerIdExample.value))
|
||||
customerId=customerIdExample.value,
|
||||
cvv = cvvExample.value,
|
||||
brand = brandExample.value))
|
||||
),
|
||||
adapterImplementation = Some(AdapterImplementation("- Core", 1))
|
||||
)
|
||||
|
||||
override def updatePhysicalCard(cardId: String, bankCardNumber: String, nameOnCard: String, cardType: String, issueNumber: String, serialNumber: String, validFrom: Date, expires: Date, enabled: Boolean, cancelled: Boolean, onHotList: Boolean, technology: String, networks: List[String], allows: List[String], accountId: String, bankId: String, replacement: Option[CardReplacementInfo], pinResets: List[PinResetInfo], collected: Option[CardCollectionInfo], posted: Option[CardPostedInfo], customerId: String, callContext: Option[CallContext]): OBPReturnType[Box[PhysicalCardTrait]] = {
|
||||
override def updatePhysicalCard(cardId: String, bankCardNumber: String, nameOnCard: String, cardType: String, issueNumber: String, serialNumber: String, validFrom: Date, expires: Date, enabled: Boolean, cancelled: Boolean, onHotList: Boolean, technology: String, networks: List[String], allows: List[String], accountId: String, bankId: String, replacement: Option[CardReplacementInfo], pinResets: List[PinResetInfo], collected: Option[CardCollectionInfo], posted: Option[CardPostedInfo], customerId: String, cvv: String, brand: String, callContext: Option[CallContext]): OBPReturnType[Box[PhysicalCardTrait]] = {
|
||||
import com.openbankproject.commons.dto.{InBoundUpdatePhysicalCard => InBound, OutBoundUpdatePhysicalCard => OutBound}
|
||||
val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, cardId, bankCardNumber, nameOnCard, cardType, issueNumber, serialNumber, validFrom, expires, enabled, cancelled, onHotList, technology, networks, allows, accountId, bankId, replacement, pinResets, collected, posted, customerId)
|
||||
val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, cardId, bankCardNumber, nameOnCard, cardType, issueNumber, serialNumber, validFrom, expires, enabled, cancelled, onHotList, technology, networks, allows, accountId, bankId, replacement, pinResets, collected, posted, customerId, cvv, brand)
|
||||
val response: Future[Box[InBound]] = sendRequest[InBound](getUrl(callContext, "updatePhysicalCard"), HttpMethods.POST, req, callContext)
|
||||
response.map(convertToTuple[PhysicalCard](callContext))
|
||||
}
|
||||
|
||||
@ -1549,7 +1549,9 @@ trait StoredProcedureConnector_vDec2019 extends Connector with MdcLoggable {
|
||||
reasonRequested=com.openbankproject.commons.model.PinResetReason.FORGOT)),
|
||||
collected=Some(CardCollectionInfo(toDate(collectedExample))),
|
||||
posted=Some(CardPostedInfo(toDate(postedExample))),
|
||||
customerId=customerIdExample.value)))
|
||||
customerId=customerIdExample.value,
|
||||
cvv = cvvExample.value,
|
||||
brand = brandExample.value)))
|
||||
),
|
||||
adapterImplementation = Some(AdapterImplementation("- Core", 1))
|
||||
)
|
||||
@ -1615,7 +1617,10 @@ trait StoredProcedureConnector_vDec2019 extends Connector with MdcLoggable {
|
||||
reasonRequested=com.openbankproject.commons.model.PinResetReason.FORGOT)),
|
||||
collected=Some(CardCollectionInfo(toDate(collectedExample))),
|
||||
posted=Some(CardPostedInfo(toDate(postedExample))),
|
||||
customerId=customerIdExample.value))
|
||||
customerId=customerIdExample.value,
|
||||
cvv = cvvExample.value,
|
||||
brand = brandExample.value
|
||||
))
|
||||
),
|
||||
adapterImplementation = Some(AdapterImplementation("- Core", 1))
|
||||
)
|
||||
@ -1729,7 +1734,10 @@ trait StoredProcedureConnector_vDec2019 extends Connector with MdcLoggable {
|
||||
reasonRequested=com.openbankproject.commons.model.PinResetReason.FORGOT)),
|
||||
collected=Some(CardCollectionInfo(toDate(collectedExample))),
|
||||
posted=Some(CardPostedInfo(toDate(postedExample))),
|
||||
customerId=customerIdExample.value)))
|
||||
customerId=customerIdExample.value,
|
||||
cvv = cvvExample.value,
|
||||
brand = brandExample.value
|
||||
)))
|
||||
),
|
||||
adapterImplementation = Some(AdapterImplementation("- Core", 1))
|
||||
)
|
||||
@ -1771,7 +1779,9 @@ trait StoredProcedureConnector_vDec2019 extends Connector with MdcLoggable {
|
||||
reasonRequested=com.openbankproject.commons.model.PinResetReason.FORGOT)),
|
||||
collected=Some(CardCollectionInfo(toDate(collectedExample))),
|
||||
posted=Some(CardPostedInfo(toDate(postedExample))),
|
||||
customerId=customerIdExample.value)
|
||||
customerId=customerIdExample.value,
|
||||
cvv = cvvExample.value,
|
||||
brand = brandExample.value)
|
||||
),
|
||||
exampleInboundMessage = (
|
||||
InBoundCreatePhysicalCard(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext,
|
||||
@ -1815,14 +1825,21 @@ trait StoredProcedureConnector_vDec2019 extends Connector with MdcLoggable {
|
||||
reasonRequested=com.openbankproject.commons.model.PinResetReason.FORGOT)),
|
||||
collected=Some(CardCollectionInfo(toDate(collectedExample))),
|
||||
posted=Some(CardPostedInfo(toDate(postedExample))),
|
||||
customerId=customerIdExample.value))
|
||||
customerId=customerIdExample.value,
|
||||
cvv = cvvExample.value,
|
||||
brand = brandExample.value
|
||||
))
|
||||
),
|
||||
adapterImplementation = Some(AdapterImplementation("- Core", 1))
|
||||
)
|
||||
|
||||
override def createPhysicalCard(bankCardNumber: String, nameOnCard: String, cardType: String, issueNumber: String, serialNumber: String, validFrom: Date, expires: Date, enabled: Boolean, cancelled: Boolean, onHotList: Boolean, technology: String, networks: List[String], allows: List[String], accountId: String, bankId: String, replacement: Option[CardReplacementInfo], pinResets: List[PinResetInfo], collected: Option[CardCollectionInfo], posted: Option[CardPostedInfo], customerId: String, callContext: Option[CallContext]): OBPReturnType[Box[PhysicalCard]] = {
|
||||
override def createPhysicalCard(bankCardNumber: String, nameOnCard: String, cardType: String, issueNumber: String,
|
||||
serialNumber: String, validFrom: Date, expires: Date, enabled: Boolean, cancelled: Boolean, onHotList: Boolean,
|
||||
technology: String, networks: List[String], allows: List[String], accountId: String, bankId: String,
|
||||
replacement: Option[CardReplacementInfo], pinResets: List[PinResetInfo], collected: Option[CardCollectionInfo],
|
||||
posted: Option[CardPostedInfo], customerId: String, cvv: String, brand: String,callContext: Option[CallContext]): OBPReturnType[Box[PhysicalCard]] = {
|
||||
import com.openbankproject.commons.dto.{InBoundCreatePhysicalCard => InBound, OutBoundCreatePhysicalCard => OutBound}
|
||||
val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, bankCardNumber, nameOnCard, cardType, issueNumber, serialNumber, validFrom, expires, enabled, cancelled, onHotList, technology, networks, allows, accountId, bankId, replacement, pinResets, collected, posted, customerId)
|
||||
val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, bankCardNumber, nameOnCard, cardType, issueNumber, serialNumber, validFrom, expires, enabled, cancelled, onHotList, technology, networks, allows, accountId, bankId, replacement, pinResets, collected, posted, customerId, cvv, brand)
|
||||
val response: Future[Box[InBound]] = sendRequest[InBound]("obp_create_physical_card", req, callContext)
|
||||
response.map(convertToTuple[PhysicalCard](callContext))
|
||||
}
|
||||
@ -1858,7 +1875,10 @@ trait StoredProcedureConnector_vDec2019 extends Connector with MdcLoggable {
|
||||
reasonRequested=com.openbankproject.commons.model.PinResetReason.FORGOT)),
|
||||
collected=Some(CardCollectionInfo(toDate(collectedExample))),
|
||||
posted=Some(CardPostedInfo(toDate(postedExample))),
|
||||
customerId=customerIdExample.value)
|
||||
customerId=customerIdExample.value,
|
||||
cvv = cvvExample.value,
|
||||
brand = brandExample.value
|
||||
)
|
||||
),
|
||||
exampleInboundMessage = (
|
||||
InBoundUpdatePhysicalCard(inboundAdapterCallContext=MessageDocsSwaggerDefinitions.inboundAdapterCallContext,
|
||||
@ -1902,14 +1922,16 @@ trait StoredProcedureConnector_vDec2019 extends Connector with MdcLoggable {
|
||||
reasonRequested=com.openbankproject.commons.model.PinResetReason.FORGOT)),
|
||||
collected=Some(CardCollectionInfo(toDate(collectedExample))),
|
||||
posted=Some(CardPostedInfo(toDate(postedExample))),
|
||||
customerId=customerIdExample.value))
|
||||
customerId=customerIdExample.value,
|
||||
cvv = cvvExample.value,
|
||||
brand = brandExample.value))
|
||||
),
|
||||
adapterImplementation = Some(AdapterImplementation("- Core", 1))
|
||||
)
|
||||
|
||||
override def updatePhysicalCard(cardId: String, bankCardNumber: String, nameOnCard: String, cardType: String, issueNumber: String, serialNumber: String, validFrom: Date, expires: Date, enabled: Boolean, cancelled: Boolean, onHotList: Boolean, technology: String, networks: List[String], allows: List[String], accountId: String, bankId: String, replacement: Option[CardReplacementInfo], pinResets: List[PinResetInfo], collected: Option[CardCollectionInfo], posted: Option[CardPostedInfo], customerId: String, callContext: Option[CallContext]): OBPReturnType[Box[PhysicalCardTrait]] = {
|
||||
override def updatePhysicalCard(cardId: String, bankCardNumber: String, nameOnCard: String, cardType: String, issueNumber: String, serialNumber: String, validFrom: Date, expires: Date, enabled: Boolean, cancelled: Boolean, onHotList: Boolean, technology: String, networks: List[String], allows: List[String], accountId: String, bankId: String, replacement: Option[CardReplacementInfo], pinResets: List[PinResetInfo], collected: Option[CardCollectionInfo], posted: Option[CardPostedInfo], customerId: String, cvv: String, brand: String, callContext: Option[CallContext]): OBPReturnType[Box[PhysicalCardTrait]] = {
|
||||
import com.openbankproject.commons.dto.{InBoundUpdatePhysicalCard => InBound, OutBoundUpdatePhysicalCard => OutBound}
|
||||
val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, cardId, bankCardNumber, nameOnCard, cardType, issueNumber, serialNumber, validFrom, expires, enabled, cancelled, onHotList, technology, networks, allows, accountId, bankId, replacement, pinResets, collected, posted, customerId)
|
||||
val req = OutBound(callContext.map(_.toOutboundAdapterCallContext).orNull, cardId, bankCardNumber, nameOnCard, cardType, issueNumber, serialNumber, validFrom, expires, enabled, cancelled, onHotList, technology, networks, allows, accountId, bankId, replacement, pinResets, collected, posted, customerId, cvv, brand)
|
||||
val response: Future[Box[InBound]] = sendRequest[InBound]("obp_update_physical_card", req, callContext)
|
||||
response.map(convertToTuple[PhysicalCard](callContext))
|
||||
}
|
||||
|
||||
@ -38,6 +38,8 @@ object MappedPhysicalCardProvider extends PhysicalCardProvider {
|
||||
collected: Option[CardCollectionInfo],
|
||||
posted: Option[CardPostedInfo],
|
||||
customerId: String,
|
||||
cvv: String,
|
||||
brand: String,
|
||||
callContext: Option[CallContext]
|
||||
): Box[MappedPhysicalCard] = {
|
||||
|
||||
@ -139,6 +141,8 @@ object MappedPhysicalCardProvider extends PhysicalCardProvider {
|
||||
collected: Option[CardCollectionInfo],
|
||||
posted: Option[CardPostedInfo],
|
||||
customerId: String,
|
||||
cvv: String,
|
||||
brand: String,
|
||||
callContext: Option[CallContext]
|
||||
): Box[MappedPhysicalCard] = {
|
||||
|
||||
@ -196,6 +200,8 @@ object MappedPhysicalCardProvider extends PhysicalCardProvider {
|
||||
.mPosted(p.date)
|
||||
.mAccount(mappedBankAccountPrimaryKey) // Card <-MappedLongForeignKey-> BankAccount, so need the primary key here.
|
||||
.mCustomerId(customerId)
|
||||
.mBrand(brand)
|
||||
.mCVV(cvv)
|
||||
.saveMe()
|
||||
} ?~! ErrorMessages.CreateCardError
|
||||
}
|
||||
@ -318,6 +324,9 @@ class MappedPhysicalCard extends PhysicalCardTrait with LongKeyedMapper[MappedPh
|
||||
//Maybe this will be first uesd for the initialization. and then we can add more `allows` for this card.
|
||||
object mCardType extends MappedString(this, 255)
|
||||
object mCustomerId extends MappedString(this, 255)
|
||||
|
||||
object mBrand extends MappedString(this, 255)
|
||||
object mCVV extends MappedString(this, 255)
|
||||
|
||||
def bankId: String = mBankId.get
|
||||
def bankCardNumber: String = mBankCardNumber.get
|
||||
@ -359,6 +368,8 @@ class MappedPhysicalCard extends PhysicalCardTrait with LongKeyedMapper[MappedPh
|
||||
def cardType: String = mCardType.get
|
||||
def cardId: String = mCardId.get
|
||||
def customerId: String = mCustomerId.get
|
||||
def cvv: String = mCVV.get
|
||||
def brand: String = mBrand.get
|
||||
}
|
||||
|
||||
object MappedPhysicalCard extends MappedPhysicalCard with LongKeyedMetaMapper[MappedPhysicalCard] {
|
||||
|
||||
@ -41,6 +41,8 @@ trait PhysicalCardProvider {
|
||||
collected: Option[CardCollectionInfo],
|
||||
posted: Option[CardPostedInfo],
|
||||
customerId: String,
|
||||
cvv: String,
|
||||
brand: String,
|
||||
callContext: Option[CallContext]
|
||||
): Box[MappedPhysicalCard]
|
||||
|
||||
@ -66,6 +68,8 @@ trait PhysicalCardProvider {
|
||||
collected: Option[CardCollectionInfo],
|
||||
posted: Option[CardPostedInfo],
|
||||
customerId: String,
|
||||
cvv: String,
|
||||
brand: String,
|
||||
callContext: Option[CallContext]
|
||||
): Box[PhysicalCardTrait]
|
||||
|
||||
|
||||
@ -43,7 +43,9 @@ class PhysicalCardsTest extends ServerSetup with DefaultUsers with DefaultConne
|
||||
pinResets = Nil,
|
||||
collected = None,
|
||||
posted = None,
|
||||
customerId = ""
|
||||
customerId = "",
|
||||
cvv = "",
|
||||
brand = ""
|
||||
)
|
||||
|
||||
val user1CardAtBank1 = createCard("1")
|
||||
|
||||
@ -691,7 +691,10 @@ case class OutBoundUpdatePhysicalCard(outboundAdapterCallContext: OutboundAdapte
|
||||
pinResets: List[PinResetInfo],
|
||||
collected: Option[CardCollectionInfo],
|
||||
posted: Option[CardPostedInfo],
|
||||
customerId: String) extends TopicTrait
|
||||
customerId: String,
|
||||
cvv: String,
|
||||
brand: String
|
||||
) extends TopicTrait
|
||||
case class InBoundUpdatePhysicalCard(inboundAdapterCallContext: InboundAdapterCallContext, status: Status, data: PhysicalCard) extends InBoundTrait[PhysicalCard]
|
||||
|
||||
case class OutBoundDeletePhysicalCardForBank(outboundAdapterCallContext: OutboundAdapterCallContext,
|
||||
@ -734,7 +737,9 @@ case class OutBoundCreatePhysicalCard(outboundAdapterCallContext: OutboundAdapte
|
||||
pinResets: List[PinResetInfo],
|
||||
collected: Option[CardCollectionInfo],
|
||||
posted: Option[CardPostedInfo],
|
||||
customerId: String
|
||||
customerId: String,
|
||||
cvv: String,
|
||||
brand: String
|
||||
) extends TopicTrait
|
||||
case class InBoundCreatePhysicalCard(inboundAdapterCallContext: InboundAdapterCallContext, status: Status, data: PhysicalCard) extends InBoundTrait[PhysicalCard]
|
||||
|
||||
|
||||
@ -61,6 +61,8 @@ trait PhysicalCardTrait {
|
||||
def collected: Option[CardCollectionInfo]
|
||||
def posted: Option[CardPostedInfo]
|
||||
def customerId: String
|
||||
def cvv: String
|
||||
def brand: String
|
||||
}
|
||||
|
||||
case class PhysicalCard (
|
||||
@ -84,7 +86,9 @@ case class PhysicalCard (
|
||||
val pinResets : List[PinResetInfo],
|
||||
val collected : Option[CardCollectionInfo],
|
||||
val posted : Option[CardPostedInfo],
|
||||
val customerId: String
|
||||
val customerId: String,
|
||||
val cvv: String,
|
||||
val brand: String
|
||||
) extends PhysicalCardTrait
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user