feature/added the attributes to createTransactionRequest(counterparty)

This commit is contained in:
hongwei 2024-12-12 10:33:43 +01:00
parent 2112695a47
commit 5539f614ee
10 changed files with 46 additions and 28 deletions

View File

@ -2293,12 +2293,19 @@ object SwaggerDefinitionsJSON {
transaction_request_types = List(transactionRequestTypeJSONV210)
)
val transactionRequestAttributeJsonV400 = TransactionRequestAttributeJsonV400(
name = transactionRequestAttributeNameExample.value,
`type` = transactionRequestAttributeTypeExample.value,
value = transactionRequestAttributeValueExample.value
)
val transactionRequestBodyCounterpartyJSON = TransactionRequestBodyCounterpartyJSON(
counterpartyIdJson,
amountOfMoneyJsonV121,
"A description for the transaction to the counterparty",
description = "A description for the transaction to the counterparty",
chargePolicyExample.value,
Some(futureDateExample.value)
Some(futureDateExample.value),
Some(List(transactionRequestAttributeJsonV400))
)
val transactionRequestBodySEPAJSON = TransactionRequestBodySEPAJSON(
@ -4752,12 +4759,6 @@ object SwaggerDefinitionsJSON {
`type` = transactionRequestAttributeTypeExample.value,
value = transactionRequestAttributeValueExample.value
)
val transactionRequestAttributeJsonV400 = TransactionRequestAttributeJsonV400(
name = transactionRequestAttributeNameExample.value,
`type` = transactionRequestAttributeTypeExample.value,
value = transactionRequestAttributeValueExample.value
)
val transactionRequestAttributesResponseJson = TransactionRequestAttributesResponseJson(
transaction_request_attributes = List(transactionRequestAttributeResponseJson)

View File

@ -87,7 +87,8 @@ case class TransactionRequestBodyCounterpartyJSON(
value: AmountOfMoneyJsonV121,
description: String,
charge_policy: String,
future_date: Option[String] = None
future_date: Option[String] = None,
attributes: Option[List[TransactionRequestAttributeJsonV400]]= None,
) extends TransactionRequestCommonBodyJSON
// the data from endpoint, extract as valid JSON

View File

@ -549,12 +549,6 @@ case class TransactionAttributesResponseJson(
transaction_attributes: List[TransactionAttributeResponseJson]
)
case class TransactionRequestAttributeJsonV400(
name: String,
`type`: String,
value: String,
)
case class TransactionRequestAttributeResponseJson(
transaction_request_attribute_id: String,
name: String,

View File

@ -4778,7 +4778,8 @@ object LocalMappedConnector extends Connector with MdcLoggable {
value = AmountOfMoneyJsonV121(body.value.currency, body.value.amount),
description = body.description,
charge_policy = transactionRequest.charge_policy,
future_date = transactionRequest.future_date)
future_date = transactionRequest.future_date,
None)//this TransactionRequestAttributeJsonV400 is only in OBP side
(transactionId, callContext) <- NewStyle.function.makePaymentv210(
fromAccount,

View File

@ -22,6 +22,8 @@ class TransactionRequestAttribute extends TransactionRequestAttributeTrait with
override def attributeType: TransactionRequestAttributeType.Value = TransactionRequestAttributeType.withName(Type.get)
override def value: String = `Value`.get
override def isPersonal: Boolean = IsPersonal.get
object BankId extends UUIDString(this) // combination of this
@ -34,6 +36,8 @@ class TransactionRequestAttribute extends TransactionRequestAttributeTrait with
object Type extends MappedString(this, 50)
object `Value` extends MappedString(this, 255)
object IsPersonal extends MappedBoolean(this)
}

View File

@ -152,7 +152,7 @@ class TransactionRequestsTest extends V400ServerSetup with DefaultUsers {
var transactionRequestBodySEPA = TransactionRequestBodySEPAJSON(bodyValue, IbanJson(counterpartySEPA.otherAccountSecondaryRoutingAddress), description, sharedChargePolicy)
var transactionRequestBodyAgentCashWithdrawal = TransactionRequestBodyAgentJsonV400(AgentCashWithdrawalJson(agentCashWithdrawalAgent.bank_id,agentCashWithdrawalAgent.agent_number), bodyValue, description, sharedChargePolicy)
var transactionRequestBodyCounterparty = TransactionRequestBodyCounterpartyJSON(CounterpartyIdJson(counterpartyCounterparty.counterpartyId), bodyValue, description, sharedChargePolicy)
var transactionRequestBodyCounterparty = TransactionRequestBodyCounterpartyJSON(CounterpartyIdJson(counterpartyCounterparty.counterpartyId), bodyValue, description,sharedChargePolicy)
var transactionRequestBodySimple = TransactionRequestBodySimpleJsonV400(SwaggerDefinitionsJSON.postSimpleCounterpartyJson400.copy(
other_account_routing_address = counterpartyCounterparty.otherAccountRoutingAddress,
other_bank_routing_address= counterpartyCounterparty.otherBankRoutingAddress,

View File

@ -242,7 +242,8 @@ class CounterpartyLimitTest extends V510ServerSetup {
value = AmountOfMoneyJsonV121("EUR","11"),
description ="testing the limit",
charge_policy = "SHARED",
future_date = None
future_date = None,
None,
)
val response = makePostRequest(createTransReqRequest, write(transactionRequestBodyCounterparty))
@ -303,7 +304,8 @@ class CounterpartyLimitTest extends V510ServerSetup {
value = AmountOfMoneyJsonV121("EUR","11"),
description ="testing the limit",
charge_policy = "SHARED",
future_date = None
future_date = None,
None,
)
val response1 = makePostRequest(
@ -356,7 +358,8 @@ class CounterpartyLimitTest extends V510ServerSetup {
value = AmountOfMoneyJsonV121("EUR","11"),
description ="testing the limit",
charge_policy = "SHARED",
future_date = None
future_date = None,
None,
)
//("we try the max_monthly_amount limit (11 euros) . now we transfer 9 euro first. then 9 euros, we will get the error")

View File

@ -224,7 +224,8 @@ class VRPConsentRequestTest extends V510ServerSetup with PropsReset{
value = AmountOfMoneyJsonV121("EUR","1"),
description ="testing the limit",
charge_policy = "SHARED",
future_date =None
future_date = None,
None,
)
val response = makePostRequest(createTransReqRequest, write(transactionRequestBodyCounterparty), (s"Consent-JWT", consentJwt))
response.code shouldBe(201)
@ -334,7 +335,8 @@ class VRPConsentRequestTest extends V510ServerSetup with PropsReset{
value = AmountOfMoneyJsonV121("EUR","11"),
description ="testing the limit",
charge_policy = "SHARED",
future_date =None
future_date = None,
None,
)
setPropsValues("consumer_validation_method_for_consent"->"NONE")
val response = makePostRequest(createTransReqRequest, write(transactionRequestBodyCounterparty), (s"Consent-JWT", consentJwt))
@ -428,7 +430,8 @@ class VRPConsentRequestTest extends V510ServerSetup with PropsReset{
value = AmountOfMoneyJsonV121("EUR","11"),
description ="testing the limit",
charge_policy = "SHARED",
future_date =None
future_date = None,
None,
)
setPropsValues("consumer_validation_method_for_consent"->"NONE")
val response1 = makePostRequest(
@ -515,7 +518,8 @@ class VRPConsentRequestTest extends V510ServerSetup with PropsReset{
value = AmountOfMoneyJsonV121("EUR","11"),
description ="testing the limit",
charge_policy = "SHARED",
future_date =None
future_date = None,
None
)
setPropsValues("consumer_validation_method_for_consent"->"NONE")
//("we try the max_monthly_amount limit (11 euros) . now we transfer 9 euro first. then 9 euros, we will get the error")

View File

@ -381,8 +381,9 @@ case class ProductCommons(bankId: BankId,
object ProductCommons extends Converter[Product, ProductCommons]
case class TransactionRequestCommonBodyJSONCommons(
value : AmountOfMoneyJsonV121,
description: String) extends TransactionRequestCommonBodyJSON
value: AmountOfMoneyJsonV121,
description: String,
) extends TransactionRequestCommonBodyJSON
object TransactionRequestCommonBodyJSONCommons extends Converter[TransactionRequestCommonBodyJSON, TransactionRequestCommonBodyJSONCommons]
@ -699,7 +700,9 @@ case class TransactionRequestAttributeTraitCommons(
transactionRequestAttributeId: String,
attributeType: TransactionRequestAttributeType,
name: String,
value: String) extends TransactionRequestAttributeTrait
value: String,
isPersonal: Boolean
) extends TransactionRequestAttributeTrait
object TransactionRequestAttributeTraitCommons extends Converter[TransactionRequestAttributeTrait, TransactionRequestAttributeTraitCommons]
@ -814,7 +817,7 @@ case class TransactionRequestAccount (
account_id : String
)
//For SEPA, it need the iban to find the toCounterpaty--> toBankAccount
//For SEPA, it needs the iban to find the toCounterpaty--> toBankAccount
case class TransactionRequestIban (iban : String)
case class AmountOfMoneyJsonV121(
@ -832,6 +835,12 @@ case class FromAccountTransfer(
nickname: String
)
case class TransactionRequestAttributeJsonV400(
name: String,
`type`: String,
value: String,
)
case class ToAccountTransferToAtmKycDocument(
`type`: String,
number: String

View File

@ -595,6 +595,7 @@ trait TransactionRequestAttributeTrait {
def attributeType: TransactionRequestAttributeType.Value
def name: String
def value: String
def isPersonal: Boolean
}
trait DirectDebitTrait {