Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
.settings
.metals
.vscode
*.code-workspace
.zed
.cursor
.classpath
.project
.cache
Expand All @@ -35,5 +37,4 @@ marketing_diagram_generation/outputs/*
.bsp
.specstory
project/project
coursier
*.code-workspace
coursier
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ object JSONFactory_BERLIN_GROUP_1_3 extends CustomJsonFormats with MdcLoggable{
Some(balances.filter(_.accountId.equals(x.accountId)).flatMap(balance => (List(CoreAccountBalanceJson(
balanceAmount = AmountOfMoneyV13(x.currency, balance.balanceAmount.toString()),
balanceType = balance.balanceType,
lastChangeDateTime = balance.lastChangeDateTime.map(APIUtil.DateWithMsAndTimeZoneOffset.format(_))
lastChangeDateTime = balance.lastChangeDateTime.map(APIUtil.DateWithMsFormat.format(_))
)))))
}else{
None
Expand Down Expand Up @@ -432,7 +432,7 @@ object JSONFactory_BERLIN_GROUP_1_3 extends CustomJsonFormats with MdcLoggable{
Some(balances.filter(_.accountId.equals(bankAccount.accountId)).flatMap(balance => (List(CoreAccountBalanceJson(
balanceAmount = AmountOfMoneyV13(bankAccount.currency, balance.balanceAmount.toString()),
balanceType = balance.balanceType,
lastChangeDateTime = balance.lastChangeDateTime.map(APIUtil.DateWithMsAndTimeZoneOffset.format(_))
lastChangeDateTime = balance.lastChangeDateTime.map(APIUtil.DateWithMsFormat.format(_))
)))))
} else {
None
Expand Down Expand Up @@ -477,7 +477,7 @@ object JSONFactory_BERLIN_GROUP_1_3 extends CustomJsonFormats with MdcLoggable{
`balances` = accountBalances.map(accountBalance => AccountBalance(
balanceAmount = AmountOfMoneyV13(bankAccount.currency, accountBalance.balanceAmount.toString()),
balanceType = accountBalance.balanceType,
lastChangeDateTime = accountBalance.lastChangeDateTime.map(APIUtil.DateWithMsAndTimeZoneOffset.format(_)),
lastChangeDateTime = accountBalance.lastChangeDateTime.map(APIUtil.DateWithMsFormat.format(_)),
referenceDate = accountBalance.referenceDate,
)
))
Expand Down Expand Up @@ -614,8 +614,8 @@ object JSONFactory_BERLIN_GROUP_1_3 extends CustomJsonFormats with MdcLoggable{
else
transaction.amount.get.toString()
),
bookingDate = transaction.startDate.map(APIUtil.DateWithMsAndTimeZoneOffset.format(_)).getOrElse(""),
valueDate = transaction.finishDate.map(APIUtil.DateWithMsAndTimeZoneOffset.format(_)).getOrElse(""),
bookingDate = transaction.startDate.map(APIUtil.DateWithMsFormat.format(_)).getOrElse(""),
valueDate = transaction.finishDate.map(APIUtil.DateWithMsFormat.format(_)).getOrElse(""),
remittanceInformationUnstructured = transaction.description.getOrElse(""),
bankTransactionCode ="",
)
Expand Down
7 changes: 5 additions & 2 deletions obp-api/src/main/scala/code/api/util/APIUtil.scala
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,11 @@ object APIUtil extends MdcLoggable with CustomJsonFormats{
val DateWithMonthFormat = new SimpleDateFormat(DateWithMonth)
val DateWithDayFormat = new SimpleDateFormat(DateWithDay)
val DateWithSecondsFormat = new SimpleDateFormat(DateWithSeconds)
val DateWithMsFormat = new SimpleDateFormat(DateWithMs)
// If you need UTC Z format, please continue to use DateWithMsFormat. eg: 2025-01-01T01:01:01.000Z
val DateWithMsFormat = new SimpleDateFormat(DateWithMs)
// If you need a format with timezone offset (+0000), please use DateWithMsRollbackFormat, eg: 2025-01-01T01:01:01.000+0000
val DateWithMsRollbackFormat = new SimpleDateFormat(DateWithMsAndTimeZoneOffset)

val rfc7231Date = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss z", Locale.ENGLISH)

val DateWithYearExampleString: String = "1100"
Expand Down Expand Up @@ -967,7 +970,7 @@ object APIUtil extends MdcLoggable with CustomJsonFormats{
if(date == null)
None
else
Some(APIUtil.DateWithMsAndTimeZoneOffset.format(date))
Some(APIUtil.DateWithMsRollbackFormat.format(date))

def stringOrNull(text : String) =
if(text == null || text.isEmpty)
Expand Down
9 changes: 9 additions & 0 deletions obp-api/src/test/scala/code/util/APIUtilTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,15 @@ class APIUtilTest extends FeatureSpec with Matchers with GivenWhenThen with Prop
val inputStringDateFormat = DateWithMsFormat
val startDateObject: Date = DateWithMsFormat.parse(DefaultFromDateString)
val endDateObject: Date = DateWithMsFormat.parse(DefaultToDateString)

feature("Test the value of dateString formatted by DateWithMsFormat") {
scenario("Check the formatted dateString value") {
val dateString = inputStringDateFormat.format(new Date())
// println(s"dateString value: $dateString")
dateString should not be "yyyy-MM-dd'T'HH:mm:ss.SSSZ"
}
}

ZonedDateTime.now(ZoneId.of("UTC"))

feature("test APIUtil.dateRangesOverlap method") {
Expand Down