mirror of
https://github.com/OpenBankProject/OBP-API.git
synced 2026-02-06 15:27:01 +00:00
refactor/Add CAN_SEE_TRANSACTION_STATUS constant to permissions list and enhance transaction status handling in tests
This commit is contained in:
parent
1f0ba6c50d
commit
1c159413d9
@ -331,6 +331,7 @@ object Constant extends MdcLoggable {
|
||||
CAN_SEE_BANK_ACCOUNT_ROUTING_ADDRESS,
|
||||
CAN_SEE_BANK_ACCOUNT_CURRENCY,
|
||||
CAN_SEE_TRANSACTION_METADATA,
|
||||
CAN_SEE_TRANSACTION_STATUS
|
||||
)
|
||||
|
||||
final val SYSTEM_VIEW_PERMISSION_COMMON = List(
|
||||
|
||||
@ -192,10 +192,8 @@ class AccountInformationServiceAISApiTest extends BerlinGroupServerSetupV1_3 wit
|
||||
Then("We should get a 200 ")
|
||||
response.code should equal(200)
|
||||
response.body.extract[TransactionsJsonV13].account.iban should not be ("")
|
||||
// response.body.extract[TransactionsJsonV13].transactions.booked.head.length >0 should be (true)
|
||||
response.body.extract[TransactionsJsonV13].transactions.pending.head.nonEmpty should be (true)
|
||||
response.body.extract[TransactionsJsonV13].transactions.booked.nonEmpty should be (true)
|
||||
|
||||
response.body.extract[TransactionsJsonV13].transactions.booked.head.length >0 should be (true)
|
||||
response.body.extract[TransactionsJsonV13].transactions.pending.head.length >0 should be (true)
|
||||
|
||||
val requestGet2 = (V1_3_BG / "accounts" / testAccountId1.value / "transactions").GET <@ (user1) <<? List(("bookingStatus", "booked"))
|
||||
val response2: APIResponse = makeGetRequest(requestGet2)
|
||||
@ -391,8 +389,7 @@ class AccountInformationServiceAISApiTest extends BerlinGroupServerSetupV1_3 wit
|
||||
Then("We should get a 200 ")
|
||||
response.code should equal(200)
|
||||
response.body.extract[TransactionsJsonV13].account.iban should not be ("")
|
||||
response.body.extract[TransactionsJsonV13].transactions.pending.head.nonEmpty should be (true)
|
||||
// response.body.extract[TransactionsJsonV13].transactions.pending.length > 0 should be (true)
|
||||
response.body.extract[TransactionsJsonV13].transactions.pending.head.length > 0 should be (true)
|
||||
val transactionId = response.body.extract[TransactionsJsonV13].transactions.pending.head.head.transactionId
|
||||
|
||||
val requestGet2 = (V1_3_BG / "accounts" / testAccountId.value / "transactions" / transactionId).GET <@ (user1)
|
||||
|
||||
@ -14,6 +14,7 @@ import code.transactionrequests.MappedTransactionRequest
|
||||
import code.util.Helper.MdcLoggable
|
||||
import com.openbankproject.commons.model._
|
||||
import com.openbankproject.commons.model.enums.AccountRoutingScheme
|
||||
import com.openbankproject.commons.model.enums._
|
||||
import net.liftweb.common.Box
|
||||
import net.liftweb.mapper.{By, MetaMapper}
|
||||
import net.liftweb.util.Helpers._
|
||||
@ -131,8 +132,43 @@ trait LocalMappedConnectorTestSetup extends TestConnectorSetupWithStandardPermis
|
||||
.CPOtherAccountSecondaryRoutingAddress(randomString(5))
|
||||
.CPOtherBankRoutingScheme(randomString(5))
|
||||
.CPOtherBankRoutingAddress(randomString(5))
|
||||
.status(TransactionRequestStatus.COMPLETED.toString) // 🆕 Add transaction status field
|
||||
.saveMe
|
||||
.toTransaction.orNull
|
||||
|
||||
{
|
||||
val accountBalanceBefore = mappedBankAccount.accountBalance.get
|
||||
val transactionAmount = Random.nextInt(1000).toLong
|
||||
val accountBalanceAfter = accountBalanceBefore + transactionAmount
|
||||
|
||||
mappedBankAccount.accountBalance(accountBalanceAfter).save
|
||||
|
||||
MappedTransaction.create
|
||||
.bank(account.bankId.value)
|
||||
.account(account.accountId.value)
|
||||
.transactionType(randomString(5))
|
||||
.tStartDate(startDate)
|
||||
.tFinishDate(finishDate)
|
||||
.currency(account.currency)
|
||||
.amount(transactionAmount)
|
||||
.newAccountBalance(accountBalanceAfter)
|
||||
.description(randomString(5))
|
||||
.counterpartyAccountHolder(randomString(5))
|
||||
.counterpartyAccountKind(randomString(5))
|
||||
.counterpartyAccountNumber(randomString(5))
|
||||
.counterpartyBankName(randomString(5))
|
||||
.counterpartyIban(randomString(5))
|
||||
.counterpartyNationalId(randomString(5))
|
||||
.CPOtherAccountRoutingScheme(randomString(5))
|
||||
.CPOtherAccountRoutingAddress(randomString(5))
|
||||
.CPOtherAccountSecondaryRoutingScheme(randomString(5))
|
||||
.CPOtherAccountSecondaryRoutingAddress(randomString(5))
|
||||
.CPOtherBankRoutingScheme(randomString(5))
|
||||
.CPOtherBankRoutingAddress(randomString(5))
|
||||
.status(TransactionRequestStatus.INITIATED.toString) // 🆕 Add transaction status field
|
||||
.saveMe
|
||||
.toTransaction.orNull
|
||||
}
|
||||
}
|
||||
|
||||
override protected def createTransactionRequest(account: BankAccount): List[MappedTransactionRequest] = {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user