Skip to content

Commit

Permalink
Merge pull request #2280 from constantine2nd/develop
Browse files Browse the repository at this point in the history
A few tweaks
  • Loading branch information
simonredfern committed Oct 5, 2023
2 parents 391ccd8 + 01e3a28 commit 944ff61
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 69 deletions.
2 changes: 1 addition & 1 deletion obp-api/src/main/scala/bootstrap/liftweb/Boot.scala
Original file line number Diff line number Diff line change
Expand Up @@ -673,7 +673,7 @@ class Boot extends MdcLoggable {
})

LiftRules.exceptionHandler.prepend{
case(_, r, e) if DB.use(DefaultConnectionIdentifier){ conn => conn}.isClosed => {
case(_, r, e) if tryo(DB.use(DefaultConnectionIdentifier){ conn => conn}.isClosed).getOrElse(true) => {
logger.error("Exception being returned to browser when processing " + r.uri.toString, e)
JsonResponse(
Extraction.decompose(ErrorMessage(code = 500, message = s"${ErrorMessages.DatabaseConnectionClosedError}")),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,51 +22,11 @@ object MigrationOfAccountRoutings {
val startDate = System.currentTimeMillis()
val commitId: String = APIUtil.gitCommit

val accountsIban = MappedBankAccount.findAll(
NotNullRef(MappedBankAccount.accountIban)
)

val accountsOtherScheme = MappedBankAccount.findAll(
NotNullRef(MappedBankAccount.mAccountRoutingScheme),
NotNullRef(MappedBankAccount.mAccountRoutingAddress)
)

// Make back up
DbFunction.makeBackUpOfTable(MappedBankAccount)

// Add iban rows into table "BankAccountRouting"
val addIbanRows: List[Boolean] = {
val definedAccountsIban = accountsIban.filter(_.iban.getOrElse("").nonEmpty)
for {
accountIban <- definedAccountsIban
} yield {
createBankAccountRouting(accountIban.bankId.value, accountIban.accountId.value,
"IBAN", accountIban.iban.get)
}
}

// Add other routing scheme rows into table "BankAccountRouting"
val addOtherRoutingSchemeRows: List[Boolean] = {
val accountsOtherSchemeNonDuplicatedIban = accountsOtherScheme
.filterNot(a =>
(a.iban.getOrElse("").nonEmpty && a.accountRoutingScheme == "IBAN")
|| a.accountRoutingScheme.isEmpty || a.accountRoutingAddress.isEmpty
)
for {
accountOtherScheme <- accountsOtherSchemeNonDuplicatedIban
} yield {
createBankAccountRouting(accountOtherScheme.bankId.value, accountOtherScheme.accountId.value,
accountOtherScheme.accountRoutingScheme, accountOtherScheme.accountRoutingAddress)
}
}


val isSuccessful = addIbanRows.forall(_ == true) && addOtherRoutingSchemeRows.forall(_ == true)
val isSuccessful = true
val endDate = System.currentTimeMillis()
val comment: String =
s"""Number of iban rows inserted at table BankAccountRouting: ${addIbanRows.size}
|Number of other routing scheme rows inserted at table BankAccountRouting: ${addOtherRoutingSchemeRows.size}
|""".stripMargin
s""""Use BankAccountRouting model to store IBAN and other account routings
|The field MappedBankAccount.accountIban has been removed""".stripMargin
saveLog(name, commitId, isSuccessful, startDate, endDate, comment)
isSuccessful

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ class MappedBankAccount extends BankAccount with LongKeyedMapper[MappedBankAccou

object bank extends UUIDString(this)
object theAccountId extends AccountIdString(this)
@deprecated("Use BankAccountRouting model to store IBAN and other account routings", "22 Sept 2023" )
object accountIban extends MappedString(this, 50)
object accountCurrency extends MappedString(this, 10)
object accountNumber extends MappedAccountNumber(this)

Expand All @@ -36,12 +34,6 @@ class MappedBankAccount extends BankAccount with LongKeyedMapper[MappedBankAccou
//It means last transaction refresh date only used for HBCI now.
object accountLastUpdate extends MappedDateTime(this)


@deprecated("Use BankAccountRouting model to store IBAN and other account routings", "22 Sept 2023" )
object mAccountRoutingScheme extends MappedString(this, 32)
@deprecated("Use BankAccountRouting model to store IBAN and other account routings", "22 Sept 2023" )
object mAccountRoutingAddress extends MappedString(this, 128)

object mBranchId extends UUIDString(this)

object accountRuleScheme1 extends MappedString(this, 10)
Expand All @@ -50,10 +42,6 @@ class MappedBankAccount extends BankAccount with LongKeyedMapper[MappedBankAccou
object accountRuleValue2 extends MappedLong(this)

override def accountId: AccountId = AccountId(theAccountId.get)
def iban: Option[String] = {
val i = accountIban.get
if(i.isEmpty) None else Some(i)
}
override def bankId: BankId = BankId(bank.get)
override def currency: String = accountCurrency.get.toUpperCase
override def number: String = accountNumber.get
Expand All @@ -64,9 +52,7 @@ class MappedBankAccount extends BankAccount with LongKeyedMapper[MappedBankAccou
override def label: String = accountLabel.get
override def accountHolder: String = holder.get
override def lastUpdate : Date = accountLastUpdate.get

def accountRoutingScheme: String = mAccountRoutingScheme.get
def accountRoutingAddress: String = mAccountRoutingAddress.get

def branchId: String = mBranchId.get

def createAccountRule(scheme: String, value: Long) = {
Expand Down
7 changes: 3 additions & 4 deletions obp-api/src/main/webapp/media/js/bootstrap.min.js

Large diffs are not rendered by default.

6 changes: 2 additions & 4 deletions obp-api/src/main/webapp/media/js/jquery.min.js

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

0 comments on commit 944ff61

Please sign in to comment.