mirror of
https://github.com/OpenBankProject/OBP-API.git
synced 2026-02-06 16:16:47 +00:00
feature/Create Customer with Customer Number
This commit is contained in:
parent
78c373f4b1
commit
de125760b5
@ -2420,6 +2420,7 @@ object SwaggerDefinitionsJSON {
|
||||
val postCustomerJsonV500 =
|
||||
PostCustomerJsonV500(
|
||||
legal_name = ExampleValue.legalNameExample.value,
|
||||
customer_number = Some(ExampleValue.customerNumberExample.value),
|
||||
mobile_phone_number = ExampleValue.mobilePhoneNumberExample.value,
|
||||
email = Some(ExampleValue.emailExample.value),
|
||||
face_image = Some(customerFaceImageJson),
|
||||
|
||||
@ -2525,6 +2525,53 @@ object NewStyle extends MdcLoggable{
|
||||
) map {
|
||||
i => (unboxFullOrFail(i._1, callContext, CreateCustomerError), i._2)
|
||||
}
|
||||
def createCustomerC2(
|
||||
bankId: BankId,
|
||||
legalName: String,
|
||||
customerNumber: String,
|
||||
mobileNumber: String,
|
||||
email: String,
|
||||
faceImage:
|
||||
CustomerFaceImageTrait,
|
||||
dateOfBirth: Date,
|
||||
relationshipStatus: String,
|
||||
dependents: Int,
|
||||
dobOfDependents: List[Date],
|
||||
highestEducationAttained: String,
|
||||
employmentStatus: String,
|
||||
kycStatus: Boolean,
|
||||
lastOkDate: Date,
|
||||
creditRating: Option[CreditRatingTrait],
|
||||
creditLimit: Option[AmountOfMoneyTrait],
|
||||
title: String,
|
||||
branchId: String,
|
||||
nameSuffix: String,
|
||||
callContext: Option[CallContext]): OBPReturnType[Customer] =
|
||||
Connector.connector.vend.createCustomerC2(
|
||||
bankId: BankId,
|
||||
legalName: String,
|
||||
customerNumber: String,
|
||||
mobileNumber: String,
|
||||
email: String,
|
||||
faceImage:
|
||||
CustomerFaceImageTrait,
|
||||
dateOfBirth: Date,
|
||||
relationshipStatus: String,
|
||||
dependents: Int,
|
||||
dobOfDependents: List[Date],
|
||||
highestEducationAttained: String,
|
||||
employmentStatus: String,
|
||||
kycStatus: Boolean,
|
||||
lastOkDate: Date,
|
||||
creditRating: Option[CreditRatingTrait],
|
||||
creditLimit: Option[AmountOfMoneyTrait],
|
||||
title: String,
|
||||
branchId: String,
|
||||
nameSuffix: String,
|
||||
callContext: Option[CallContext]
|
||||
) map {
|
||||
i => (unboxFullOrFail(i._1, callContext, CreateCustomerError), i._2)
|
||||
}
|
||||
|
||||
def updateCustomerScaData(customerId: String,
|
||||
mobileNumber: Option[String],
|
||||
|
||||
@ -990,9 +990,12 @@ trait APIMethods500 {
|
||||
_ <- Helper.booleanToFuture(failMsg = InvalidJsonContent + s" The field dependants(${postedData.dependants.getOrElse(0)}) not equal the length(${postedData.dob_of_dependants.getOrElse(Nil).length }) of dob_of_dependants array", 400, cc.callContext) {
|
||||
postedData.dependants.getOrElse(0) == postedData.dob_of_dependants.getOrElse(Nil).length
|
||||
}
|
||||
(customer, callContext) <- NewStyle.function.createCustomer(
|
||||
customerNumber = postedData.customer_number.getOrElse(Random.nextInt(Integer.MAX_VALUE).toString)
|
||||
(_, callContext) <- NewStyle.function.checkCustomerNumberAvailable(bankId, customerNumber, cc.callContext)
|
||||
(customer, callContext) <- NewStyle.function.createCustomerC2(
|
||||
bankId,
|
||||
postedData.legal_name,
|
||||
customerNumber,
|
||||
postedData.mobile_phone_number,
|
||||
postedData.email.getOrElse(""),
|
||||
CustomerFaceImage(
|
||||
@ -1012,7 +1015,7 @@ trait APIMethods500 {
|
||||
postedData.title.getOrElse(""),
|
||||
postedData.branch_id.getOrElse(""),
|
||||
postedData.name_suffix.getOrElse(""),
|
||||
cc.callContext,
|
||||
callContext,
|
||||
)
|
||||
} yield {
|
||||
(JSONFactory310.createCustomerJson(customer), HttpCode.`201`(callContext))
|
||||
|
||||
@ -75,6 +75,7 @@ case class CreateAccountRequestJsonV500(
|
||||
|
||||
case class PostCustomerJsonV500(
|
||||
legal_name: String,
|
||||
customer_number: Option[String] = None,
|
||||
mobile_phone_number: String,
|
||||
email: Option[String] = None,
|
||||
face_image: Option[CustomerFaceImageJson] = None,
|
||||
|
||||
@ -1945,7 +1945,31 @@ trait Connector extends MdcLoggable {
|
||||
nameSuffix: String,
|
||||
callContext: Option[CallContext],
|
||||
): OBPReturnType[Box[Customer]] = Future{(Failure(setUnimplementedError), callContext)}
|
||||
|
||||
|
||||
def createCustomerC2(
|
||||
bankId: BankId,
|
||||
legalName: String,
|
||||
customerNumber: String,
|
||||
mobileNumber: String,
|
||||
email: String,
|
||||
faceImage:
|
||||
CustomerFaceImageTrait,
|
||||
dateOfBirth: Date,
|
||||
relationshipStatus: String,
|
||||
dependents: Int,
|
||||
dobOfDependents: List[Date],
|
||||
highestEducationAttained: String,
|
||||
employmentStatus: String,
|
||||
kycStatus: Boolean,
|
||||
lastOkDate: Date,
|
||||
creditRating: Option[CreditRatingTrait],
|
||||
creditLimit: Option[AmountOfMoneyTrait],
|
||||
title: String,
|
||||
branchId: String,
|
||||
nameSuffix: String,
|
||||
callContext: Option[CallContext],
|
||||
): OBPReturnType[Box[Customer]] = Future{(Failure(setUnimplementedError), callContext)}
|
||||
|
||||
def updateCustomerScaData(customerId: String,
|
||||
mobileNumber: Option[String],
|
||||
email: Option[String],
|
||||
|
||||
@ -3481,6 +3481,52 @@ object LocalMappedConnector extends Connector with MdcLoggable {
|
||||
), callContext)
|
||||
}
|
||||
|
||||
override def createCustomerC2(
|
||||
bankId: BankId,
|
||||
legalName: String,
|
||||
customerNumber: String,
|
||||
mobileNumber: String,
|
||||
email: String,
|
||||
faceImage:
|
||||
CustomerFaceImageTrait,
|
||||
dateOfBirth: Date,
|
||||
relationshipStatus: String,
|
||||
dependents: Int,
|
||||
dobOfDependents: List[Date],
|
||||
highestEducationAttained: String,
|
||||
employmentStatus: String,
|
||||
kycStatus: Boolean,
|
||||
lastOkDate: Date,
|
||||
creditRating: Option[CreditRatingTrait],
|
||||
creditLimit: Option[AmountOfMoneyTrait],
|
||||
title: String,
|
||||
branchId: String,
|
||||
nameSuffix: String,
|
||||
callContext: Option[CallContext]
|
||||
): OBPReturnType[Box[Customer]] = Future {
|
||||
(CustomerX.customerProvider.vend.addCustomer(
|
||||
bankId,
|
||||
customerNumber,
|
||||
legalName,
|
||||
mobileNumber,
|
||||
email,
|
||||
faceImage,
|
||||
dateOfBirth,
|
||||
relationshipStatus,
|
||||
dependents,
|
||||
dobOfDependents,
|
||||
highestEducationAttained,
|
||||
employmentStatus,
|
||||
kycStatus,
|
||||
lastOkDate,
|
||||
creditRating,
|
||||
creditLimit,
|
||||
title,
|
||||
branchId,
|
||||
nameSuffix
|
||||
), callContext)
|
||||
}
|
||||
|
||||
override def updateCustomerScaData(customerId: String,
|
||||
mobileNumber: Option[String],
|
||||
email: Option[String],
|
||||
|
||||
Loading…
Reference in New Issue
Block a user